浏览代码

流程在保存时更新流程描述

yewc 1 年之前
父节点
当前提交
5c1a1bf879

+ 26 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/Asset/service/AssetProcureServiceImpl.java

@@ -3,6 +3,7 @@ package com.zjugis.business.flow.Asset.service;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson2.JSON;
+import com.google.common.base.Strings;
 import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.constants.DictConstants;
 import com.zjugis.business.constants.FlowStatusConstants;
@@ -24,6 +25,7 @@ import com.zjugis.business.flow.commoncost.entity.CommonCostDO;
 import com.zjugis.business.flow.commoncost.entity.CommonCostDetailDO;
 import com.zjugis.business.flow.commoncost.service.CommonCostServiceImpl;
 import com.zjugis.business.flow.usemoney.controller.vo.UseMoneyRespVO;
+import com.zjugis.business.flow.usemoney.controller.vo.UseMoneyUpdateReqVO;
 import com.zjugis.business.flow.usemoney.dao.UseMoneyDao;
 import com.zjugis.business.flow.usemoney.entity.UseMoneyDO;
 import com.zjugis.business.service.ProjectService;
@@ -182,8 +184,31 @@ public class AssetProcureServiceImpl implements AssetProcureService {
             });
             assetProcureDetailDao.insertBatch(detailDOS);
         }
+        //更新流程描述
+        updateDesc(updateReqVO);
+    }
+    private void updateDesc(AssetProcureUpdateReqVO updateReqVO) {
+        AssetProcureDO entity = findByInstanceId(updateReqVO.getInstanceId());
+        String flowDesc = "";
+        if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
+            flowDesc += "/" + entity.getUserNickname();
+        }
+        if (entity.getApplyTime()!=null) {
+            flowDesc += "/" + entity.getApplyTime();
+        }
+        if (entity.getTotalAmount()!=null) {
+            flowDesc += "/" + entity.getTotalAmount();
+        }
+        if (!Strings.isNullOrEmpty(entity.getProcureReason())) {
+            flowDesc += "/" + entity.getProcureReason();
+        }
+        if (!Strings.isNullOrEmpty(entity.getProjectId())&&"1".equals(entity.getProcureType())) {
+            Project project = projectService.selectById(entity.getProjectId());
+            flowDesc += "/" + project.getXmmc();
+        }
+        flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+        workflowClient.saveFlowDescribe(updateReqVO.getInstanceId(),flowDesc);
     }
-
     private void validateCommonCostExists(String id) {
         if (assetProcureDao.selectById(id) == null) {
             throw exception(COMMON_COST_NOT_EXISTS);

+ 21 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/loan/service/LoanFlowServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zjugis.business.flow.loan.service;
 
 
+import com.google.common.base.Strings;
 import com.zjugis.business.bean.entity.Loan;
 import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.constants.FlowStatusConstants;
@@ -122,8 +123,27 @@ public class LoanFlowServiceImpl implements LoanFlowService {
         // 更新
         Loan updateObj = LoanConvert.INSTANCE.convert(updateReqVO);
         loanDao.updateById(updateObj);
+        //更新流程描述
+        updateDesc(updateReqVO);
+    }
+    private void updateDesc(LoanUpdateReqVO updateReqVO) {
+        Loan entity = findByInstanceId(updateReqVO.getInstanceId());
+        String flowDesc = "";
+        if (!Strings.isNullOrEmpty(entity.getWorker())) {
+            flowDesc += "/" + entity.getWorker();
+        }
+        if (entity.getApplyDate()!=null) {
+            flowDesc += "/" + entity.getApplyDate();
+        }
+        if (entity.getLoanAmount()!=null) {
+            flowDesc += "/" + entity.getLoanAmount();
+        }
+        if (!Strings.isNullOrEmpty(entity.getDescription())) {
+            flowDesc += "/" + entity.getDescription();
+        }
+        flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+        workflowClient.saveFlowDescribe(updateReqVO.getInstanceId(),flowDesc);
     }
-
     private void validateCommonCostExists(String id) {
         if (loanDao.selectById(id) == null) {
             throw exception(COMMON_COST_NOT_EXISTS);

+ 25 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/outsourcePurchase/service/OutsourcePurchaseServiceImpl.java

@@ -2,6 +2,7 @@ package com.zjugis.business.flow.outsourcePurchase.service;
 
 import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson2.JSON;
+import com.google.common.base.Strings;
 import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.constants.DictConstants;
 import com.zjugis.business.constants.FlowStatusConstants;
@@ -101,8 +102,31 @@ public class OutsourcePurchaseServiceImpl implements OutsourcePurchaseService {
             });
             outsourcePurchaseDetDao.insertBatch(outsourcePurchaseDetList);
         }
+        //更新流程描述
+        updateDesc(updateReqVO);
+    }
+    public void updateDesc(OutsourcePurchaseUpdateReqVO updateReqVO) {
+        OutsourcePurchaseDO entity = findByInstanceId(updateReqVO.getInstanceId());
+        String flowDesc = "";
+        if (!Strings.isNullOrEmpty(entity.getUserId())) {
+            CommonResult<AdminUserRespDTO> result = adminUserApi.getUser(entity.getUserId());
+            if (result.isSuccess()) {
+                flowDesc += "/" + result.getData().getNickname();
+            }
+        }
+        if (entity.getApplyTime()!=null) {
+            flowDesc += "/" + entity.getApplyTime();
+        }
+        if (!Strings.isNullOrEmpty(entity.getBz1())) {
+            flowDesc += "/" + entity.getBz1();
+        }
+        if (!Strings.isNullOrEmpty(entity.getProjectId())) {
+            Project project = projectService.selectById(entity.getProjectId());
+            flowDesc += "/" + project.getXmmc();
+        }
+        flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+        workflowClient.saveFlowDescribe(updateReqVO.getInstanceId(),flowDesc);
     }
-
     @Override
     public void deleteOutsourcePurchase(String id) {
         // 校验存在

+ 22 - 0
zjugis-business/src/main/java/com/zjugis/business/flow/projectStatus/service/ProjectStatusServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zjugis.business.flow.projectStatus.service;
 
 
+import com.google.common.base.Strings;
 import com.zjugis.business.bean.entity.Project;
 import com.zjugis.business.constants.FlowStatusConstants;
 import com.zjugis.business.converter.ProjectStatus.ProjectStatusConvert;
@@ -109,6 +110,27 @@ public class ProjectStatusServiceImpl implements ProjectStatusService {
         // 更新
         ProjectStatusDO updateObj = ProjectStatusConvert.INSTANCE.convert(updateReqVO);
         projectStatusDao.updateById(updateObj);
+        //更新流程描述
+        updateDesc(updateReqVO);
+    }
+    private void updateDesc(ProjectStatusUpdateReqVO updateReqVO) {
+        ProjectStatusDO entity = findByInstanceId(updateReqVO.getInstanceId());
+        String flowDesc = "";
+        if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
+            flowDesc += "/" + entity.getUserNickname();
+        }
+        if (entity.getApplyTime()!=null) {
+            flowDesc += "/" + entity.getApplyTime();
+        }
+        if (!Strings.isNullOrEmpty(entity.getBz1())) {
+            flowDesc += "/" + entity.getBz1();
+        }
+        if (!Strings.isNullOrEmpty(entity.getProjectId())) {
+            Project project = projectService.selectById(entity.getProjectId());
+            flowDesc += "/" + project.getXmmc();
+        }
+        flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+        workflowClient.saveFlowDescribe(updateReqVO.getInstanceId(),flowDesc);
     }
 
     private void validateCommonCostExists(String id) {

+ 23 - 1
zjugis-business/src/main/java/com/zjugis/business/flow/usemoney/service/UseMoneyServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.google.common.base.Strings;
 import com.zjugis.business.bean.entity.ContractApply;
 import com.zjugis.business.bean.entity.ContractSub;
 import com.zjugis.business.bean.entity.Project;
@@ -46,6 +47,7 @@ import com.zjugis.business.utils.AmountToChinese;
 import com.zjugis.framework.common.exception.ServiceException;
 import com.zjugis.framework.common.pojo.CommonResult;
 import com.zjugis.framework.common.pojo.PageResult;
+import com.zjugis.framework.common.util.date.LocalDateTimeUtils;
 import com.zjugis.framework.mybatis.core.util.MyBatisUtils;
 import com.zjugis.framework.security.core.util.SecurityFrameworkUtils;
 import com.zjugis.framework.workflow.model.IFlowInstance;
@@ -532,8 +534,28 @@ public class UseMoneyServiceImpl implements UseMoneyService {
             });
             useMoneyDetailDao.insertBatch(detailDOS);
         }
+        //更新流程描述
+        updateDesc(updateReqVO);
+    }
+    private void updateDesc(UseMoneyUpdateReqVO updateReqVO) {
+        UseMoneyDO entity = findByInstanceId(updateReqVO.getInstanceId());
+        String flowDesc = "";
+        if (!Strings.isNullOrEmpty(entity.getUserNickname())) {
+            flowDesc += "/" + entity.getUserNickname();
+        }
+        if (entity.getCreateTime()!=null) {
+            flowDesc += "/" + LocalDateTimeUtils.format(entity.getCreateTime(), null);
+        }
+        if (entity.getTotalAmount()!=null) {
+            flowDesc += "/¥" + entity.getTotalAmount();
+        }
+        if (!Strings.isNullOrEmpty(entity.getProjectId())&&entity.getIsAgent()!=1) {
+            Project project = projectService.selectById(entity.getProjectId());
+            flowDesc += "/" + project.getXmmc();
+        }
+        flowDesc = flowDesc.length() > 1 ? flowDesc.substring(1) : flowDesc;
+        workflowClient.saveFlowDescribe(entity.getInstanceId(),flowDesc);
     }
-
     private void validateCommonCostExists(String id) {
         if (useMoneyDao.selectById(id) == null) {
             throw exception(COMMON_COST_NOT_EXISTS);