瀏覽代碼

变更流程信息错误问题处理

yzc 1 年之前
父節點
當前提交
20adeddf25

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/po/Contract.java

@@ -380,4 +380,9 @@ public class Contract extends BasePo {
     @TableField(exist = false)
     private Long upId;
 
+    /**
+     * 流程id
+     */
+    private Long flowId;
+
 }

+ 0 - 5
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -126,11 +126,6 @@ public class ContractVo extends Contract {
 
     private BigDecimal refundMoney;
 
-    /**
-     * 流程id
-     */
-    private Long flowId;
-
     public BigDecimal getRefundMoney() {
         return sumClaimMoney;
     }

+ 3 - 0
hx-sale/src/main/java/com/fjhx/sale/flow/ContractFlow.java

@@ -79,6 +79,9 @@ public class ContractFlow extends FlowDelegate {
     @Override
     public Long start(Long flowId, JSONObject submitData) {
         ContractDto contract = submitData.toJavaObject(ContractDto.class);
+
+        contract.setFlowId(flowId);
+
         if(StringUtils.isEmpty(contract.getCurrency())){
             throw new ServiceException("币种不能为空");
         }

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

@@ -79,6 +79,9 @@ public class ContractUpdateFlow extends FlowDelegate {
 
         ContractDto contract = submitData.toJavaObject(ContractDto.class);
 
+        //赋值流程id
+        contract.setFlowId(flowId);
+
         //判断合同是否在变更中,防止用户缓存导致重复变更
         Contract byId = contractService.getById(contract.getOldContractId());
         Assert.notEmpty(byId, "查询不到合同信息");

+ 12 - 9
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -38,6 +38,7 @@ import com.fjhx.customer.entity.customer.po.Customer;
 import com.fjhx.customer.service.customer.CustomerService;
 import com.fjhx.file.entity.FileInfoVo;
 import com.fjhx.file.utils.ObsFileUtil;
+import com.fjhx.flow.entity.flow.po.FlowExample;
 import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
 import com.fjhx.item.entity.product.po.ProductInfo;
@@ -243,9 +244,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     public Page<ContractVo> getPage(ContractSelectDto dto) {
         IWrapper<Contract> wrapper = getWrapper();
         SysUser sysUser = UserUtil.getUserInfo();
-        if(StringUtils.isEmpty(sysUser.getUserCode())){//不是业务员看所有
+        if (StringUtils.isEmpty(sysUser.getUserCode())) {//不是业务员看所有
             return pageCommon(dto, wrapper);
-        }else{//是业务员
+        } else {//是业务员
             List<Long> authIdList = customerService.getAuthIdList();
             if (authIdList.size() == 0) {
                 return new Page<>();
@@ -270,7 +271,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     private Page<ContractVo> pageCommon(ContractSelectDto dto, IWrapper<Contract> wrapper) {
         wrapper.orderByDesc("t1", Contract::getCreateTime);
         wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
-        wrapper.ne("t1",Contract::getIsShow,1);
+        wrapper.ne("t1", Contract::getIsShow, 1);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.DRAFT.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getStatus())) {
             wrapper.eq("t1", Contract::getStatus, dto.getStatus());
@@ -290,7 +291,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             List<Long> customerIds = customerService.listObject(Customer::getId, q -> q.like(Customer::getName, dto.getKeyword()));
             wrapper.and(q -> q
                     .like("t1", Contract::getCode, dto.getKeyword())
-                    .or().like("t1",Contract::getUserName,dto.getUserName())
+                    .or().like("t1", Contract::getUserName, dto.getUserName())
                     .or().in("t1", Contract::getSellCorporationId, corporationIds)
                     .or().in("t1", Contract::getBuyCorporationId, customerIds)
             );
@@ -348,7 +349,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             }
 
             // 赋值流程id
-            flowExampleService.setFlowId(list, ContractVo::setFlowId);
+            List<ContractVo> collect = list.stream().filter(item -> Objects.isNull(item.getFlowId())).collect(Collectors.toList());
+            flowExampleService.setFlowId(collect, ContractVo::setFlowId);
             //赋值原卖方公司名称 多公司
             corporationService.attributeAssign(list, ContractVo::getSellCorporationId, (item, corporation) -> {
                 item.setSellCorporationName(corporation.getName());
@@ -625,7 +627,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         List<EhsdPurchaseProduct> purchaseProducts = ehsdPurchaseProductService.getPurchaseProductByContractProductIds(contractProductIds);
         if (ObjectUtil.isNotEmpty(purchaseProducts)) {
             Map<Long, List<EhsdPurchaseProduct>> collect = purchaseProducts.stream()
-                    .filter(item->ObjectUtil.isNotEmpty(item.getDataResourceId()))
+                    .filter(item -> ObjectUtil.isNotEmpty(item.getDataResourceId()))
                     .collect(Collectors.groupingBy(EhsdPurchaseProduct::getDataResourceId));
             for (ContractProduct contractProduct : contractProductList) {
                 List<EhsdPurchaseProduct> ehsdPurchaseProductList = collect.get(contractProduct.getId());
@@ -1287,12 +1289,12 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         IWrapper<Contract> wrapper = IWrapper.getWrapper();
         SysUser sysUser = UserUtil.getUserInfo();
-        if(StringUtils.isNotEmpty(sysUser.getUserCode())){//是业务员
+        if (StringUtils.isNotEmpty(sysUser.getUserCode())) {//是业务员
             List<Long> authIdList = customerService.getAuthIdList();
             if (authIdList.size() == 0) {
                 return new Page<>();
             }
-            wrapper.in( Contract::getBuyCorporationId, authIdList);
+            wrapper.in(Contract::getBuyCorporationId, authIdList);
         }
 //        //销售跟单权限过滤
 //        List<Long> authUserIdList = UserUtil.getAuthUserIdList();
@@ -1792,7 +1794,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         }
         List<ContractVo> contractVos = BeanUtil.copyToList(contractList, ContractVo.class);
         // 赋值流程id
-        flowExampleService.setFlowId(contractVos, ContractVo::setFlowId);
+        List<ContractVo> collect = contractVos.stream().filter(item -> Objects.isNull(item.getFlowId())).collect(Collectors.toList());
+        flowExampleService.setFlowId(collect, ContractVo::setFlowId);
         return contractVos;
     }