Browse Source

解决利润结算表是否到账搜索有误BUG

caozj 1 year ago
parent
commit
744a09aaa7

+ 11 - 11
hx-sale/src/main/java/com/fjhx/sale/flow/ContractUpdateFlow.java

@@ -124,22 +124,22 @@ public class ContractUpdateFlow extends FlowDelegate {
             newCp.setExpendQuantity(newCp.getQuantity());
             newCp.setExpendQuantity(newCp.getQuantity());
             if (ObjectUtil.isNotEmpty(newCp.getId())) {//如果新合同产品ID不为空
             if (ObjectUtil.isNotEmpty(newCp.getId())) {//如果新合同产品ID不为空
                 //取出旧合同
                 //取出旧合同
-                ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(), null).get(0);
-                //取出旧合同包装方式
-                JSONObject oldJson = JSONObject.parseObject(oldContractProduct.getEhsdJson());
-                String oldPackMethod = oldJson.getOrDefault("packMethod", null) == null ? null : oldJson.getOrDefault("packMethod", null).toString();
-                //取出新合同包装方式
-                JSONObject newJson = JSONObject.parseObject(newCp.getEhsdJson());
-                String newPackMethod = newJson.getOrDefault("packMethod", null) == null ? null : oldJson.getOrDefault("packMethod", null).toString();
+                ContractProduct oldContractProduct = oldContractProductMap.getOrDefault(newCp.getId(),null).get(0);
+//                //取出旧合同包装方式
+//                JSONObject oldJson = JSONObject.parseObject(oldContractProduct.getEhsdJson());
+//                String oldPackMethod = oldJson.getOrDefault("packMethod",null)==null?null:oldJson.getOrDefault("packMethod",null).toString();
+//                //取出新合同包装方式
+//                JSONObject newJson = JSONObject.parseObject(newCp.getEhsdJson());
+//                String newPackMethod = newJson.getOrDefault("packMethod",null)==null?null:oldJson.getOrDefault("packMethod",null).toString();
                 /**
                 /**
                  * 商品英文名、尺寸、包装方式、数量 没有变更---取原本的剩余数量
                  * 商品英文名、尺寸、包装方式、数量 没有变更---取原本的剩余数量
                  */
                  */
-                if (oldContractProduct.getQuantity().compareTo(newCp.getQuantity()) == 0
-                        && StringUtils.equals(oldContractProduct.getProductName(), newCp.getProductName())
-                        && StringUtils.equals(oldContractProduct.getProductModel(), newCp.getProductModel())
-                        && StringUtils.equals(oldPackMethod, newPackMethod)) {
+                if(oldContractProduct.getQuantity().compareTo(newCp.getQuantity())==0){//如果数量没有变动
                     //取出旧的剩余数量
                     //取出旧的剩余数量
                     newCp.setExpendQuantity(oldContractProduct.getExpendQuantity());
                     newCp.setExpendQuantity(oldContractProduct.getExpendQuantity());
+                }else{//变动了
+                    BigDecimal quantity = newCp.getQuantity().subtract(oldContractProduct.getQuantity()).subtract(oldContractProduct.getExpendQuantity());//剩余数量
+                    newCp.setExpendQuantity(quantity);
                 }
                 }
             }
             }
         }
         }

+ 8 - 2
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -114,6 +114,7 @@ import java.util.stream.Collectors;
 public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         implements ContractService, GetDocumentaryBusinessTemplate {
         implements ContractService, GetDocumentaryBusinessTemplate {
 
 
+    public static final int VALUE = 20;
     private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy", Locale.ENGLISH);
     private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy", Locale.ENGLISH);
 
 
     @Qualifier(ThreadPoolConfig.threadPoolTaskExecutor)
     @Qualifier(ThreadPoolConfig.threadPoolTaskExecutor)
@@ -220,9 +221,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         }
         }
         if(StringUtils.isNotEmpty(dto.getIsArrival())){
         if(StringUtils.isNotEmpty(dto.getIsArrival())){
             if(StringUtils.equals(dto.getIsArrival(),"1")){//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
             if(StringUtils.equals(dto.getIsArrival(),"1")){//已到账----//预付比例等于0||到账认领金额 >= 合同金额 * 预付比例%
-                wrapper.eq("t1",Contract::getAdvanceRatio,"0").or().eq("t1.refundStatusNew",20);
+                wrapper.and(c -> {
+                    c.eq(Contract::getAdvanceRatio, "0").or();
+                    c.eq("t1.refundStatusNew", 20);
+                });
+
             }else{
             }else{
-                wrapper.ne("t1",Contract::getAdvanceRatio,"0").ne("t1.refundStatusNew",20);
+                wrapper.ne("t1",Contract::getAdvanceRatio,"0");
+                wrapper.ne("t1.refundStatusNew",20);
             }
             }
         }
         }
         Page<ContractVo> page = baseMapper.getProfitSettlement(dto.getPage(),wrapper);
         Page<ContractVo> page = baseMapper.getProfitSettlement(dto.getPage(),wrapper);