|
@@ -6,18 +6,16 @@ import com.baomidou.mybatisplus.plugins.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.winsea.svc.base.security.util.AuthSecurityUtils;
|
|
|
import com.yh.saas.common.support.util.IdGenerator;
|
|
|
+import com.yh.saas.common.support.util.StringUtils;
|
|
|
import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.entity.*;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.exception.*;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.mapper.CommonCompanyIdentityMapper;
|
|
|
-import com.yh.saas.plugin.yiliangyiyun.mapper.CommonUserMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper;
|
|
|
import com.yh.saas.plugin.yiliangyiyun.service.*;
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -48,6 +46,8 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
|
private IPurchasePriceService purchasePriceService;
|
|
|
@Autowired
|
|
|
private IPaymentManagementService paymentManagementService;
|
|
|
+ @Autowired
|
|
|
+ private IShippingInformationService shippingInformationService;
|
|
|
|
|
|
/**
|
|
|
* 粮商认证列表
|
|
@@ -474,16 +474,73 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
|
|
|
*/
|
|
|
@Override
|
|
|
public List<IdentityAuthenticationInfo> identityAuthenticationInfoCustomer(IdentityAuthenticationInfo identityAuthenticationInfo) {
|
|
|
- Map<String, Object> pageView = new HashMap<>();
|
|
|
+// Map<String, Object> pageView = new HashMap<>();
|
|
|
+// if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
|
|
|
+// identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
|
|
|
+// }
|
|
|
+// //公司id
|
|
|
+// pageView.put("compId", identityAuthenticationInfo.getCompId());
|
|
|
+// pageView.put("authenticationStatusKey", identityAuthenticationInfo.getAuthenticationStatusKey());
|
|
|
+// pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
|
|
|
+// List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoByCondition(pageView);
|
|
|
+// return dataList;
|
|
|
if(identityAuthenticationInfo.getCompId() == null || identityAuthenticationInfo.getCompId().isEmpty()){
|
|
|
identityAuthenticationInfo.setCompId(AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId());
|
|
|
}
|
|
|
- //公司id
|
|
|
- pageView.put("compId", identityAuthenticationInfo.getCompId());
|
|
|
- pageView.put("authenticationStatusKey", identityAuthenticationInfo.getAuthenticationStatusKey());
|
|
|
- pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
|
|
|
- List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoByCondition(pageView);
|
|
|
- return dataList;
|
|
|
+ Wrapper<IdentityAuthenticationInfo> identityAuthenticationInfoWrapper = new EntityWrapper<>();
|
|
|
+ identityAuthenticationInfoWrapper.eq("comp_id",identityAuthenticationInfo.getCompId())
|
|
|
+ .eq("cover","0")
|
|
|
+ .eq("authentication_status_key","7");
|
|
|
+ if (!StringUtils.isEmpty(identityAuthenticationInfo.getSearchKeyWord())) {
|
|
|
+ identityAuthenticationInfoWrapper.andNew("replace(" + "customer_name" + ",' ','')like {0} or "
|
|
|
+ + "customer_phone" + " like {0} or "
|
|
|
+ + "supplier" + " like {0}", "%" + identityAuthenticationInfo.getSearchKeyWord() + "%");
|
|
|
+ }
|
|
|
+ List<IdentityAuthenticationInfo> identityAuthenticationInfoList = this.selectList(identityAuthenticationInfoWrapper);
|
|
|
+ PurchasePrice purchasePrice=purchasePriceService.selectOne(new EntityWrapper<PurchasePrice>()
|
|
|
+ .eq("warehouse_id",identityAuthenticationInfo.getWarehouseId())
|
|
|
+ .eq("goods_name",identityAuthenticationInfo.getGoodsName())
|
|
|
+ .eq("status","已通过"));
|
|
|
+ List<IdentityAuthenticationInfo> identityAuthenticationInfoListNew=new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(identityAuthenticationInfoList)){
|
|
|
+ for (IdentityAuthenticationInfo identityAuthenticationInfo1:identityAuthenticationInfoList) {
|
|
|
+ Float cumulant = 0.0f;
|
|
|
+ //本年第一天零点
|
|
|
+ SimpleDateFormat now = new SimpleDateFormat("yyyy-01-01 00:00:00");
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ c.setTime(new java.util.Date());
|
|
|
+ c.add(Calendar.YEAR, 0);
|
|
|
+ Date y = c.getTime();
|
|
|
+ String year = now.format(y);
|
|
|
+ if (identityAuthenticationInfo.getGoodsName().contains("玉米")) {
|
|
|
+ identityAuthenticationInfo.setGoodsName("玉米");
|
|
|
+ }
|
|
|
+ List<PaymentManagement> paymentManagementList = paymentManagementService.selectList(new EntityWrapper<PaymentManagement>()
|
|
|
+ .like("goods_name", "%" + identityAuthenticationInfo.getGoodsName() + "%")
|
|
|
+ .eq("customer_number_card", identityAuthenticationInfo1.getCustomerNumberCard())
|
|
|
+ .eq("comp_id", purchasePrice.getCompId())
|
|
|
+ .ge("create_date", year));
|
|
|
+ if (!CollectionUtils.isEmpty(paymentManagementList)) {
|
|
|
+ Float netWeight = 0f;
|
|
|
+ for (PaymentManagement paymentManagement1 : paymentManagementList) {
|
|
|
+ //干粮净重
|
|
|
+ if ("干粮".equals(paymentManagement1.getType())) {
|
|
|
+ netWeight = netWeight + (paymentManagement1.getNetWeight() != null ? paymentManagement1.getNetWeight() : 0f);
|
|
|
+ }
|
|
|
+ //潮粮纯重
|
|
|
+ else if ("潮粮".equals(paymentManagement1.getType())) {
|
|
|
+ netWeight = netWeight + (paymentManagement1.getPureWeight() != null ? paymentManagement1.getPureWeight() : 0f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cumulant = cumulant + netWeight;
|
|
|
+ }
|
|
|
+ if (cumulant > (purchasePrice.getSaleLimit() - 50)*1000) {
|
|
|
+ identityAuthenticationInfoListNew.add(identityAuthenticationInfo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ identityAuthenticationInfoList.removeAll(identityAuthenticationInfoListNew);
|
|
|
+ }
|
|
|
+ return identityAuthenticationInfoList;
|
|
|
}
|
|
|
|
|
|
/**
|