Parcourir la source

发起变更逻辑修改

caozj il y a 1 an
Parent
commit
87c18b3e94

+ 1 - 6
hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java

@@ -306,7 +306,7 @@ public class Contract extends BasePo {
     /**
      * 是否显示
      */
-    private String isShow;
+    private Integer isShow;
 
     /**
      * 原合同id
@@ -323,11 +323,6 @@ public class Contract extends BasePo {
      */
     private Integer versions;
 
-    /**
-     * 是否显示
-     */
-    private Integer isShow;
-
 
     @TableField(exist = false)
     private Long upId;

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

@@ -120,21 +120,21 @@ public class ContractUpdateFlow extends FlowDelegate {
             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();
+//                //取出旧合同包装方式
+//                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());
+                }else{//变动了
+                    BigDecimal quantity = newCp.getQuantity().subtract(oldContractProduct.getQuantity()).subtract(oldContractProduct.getExpendQuantity());//剩余数量
+                    newCp.setExpendQuantity(quantity);
                 }
             }
         }