Browse Source

流程审批相关修改

yzc 1 year ago
parent
commit
9be070fd37

+ 20 - 5
hx-flow/src/main/java/com/fjhx/flow/service/flow/impl/FlowProcessServiceImpl.java

@@ -208,10 +208,6 @@ public class FlowProcessServiceImpl implements FlowProcessService {
     @DSTransactional
     @DSTransactional
     @Override
     @Override
     public FlowResult jump(JumpDto dto) {
     public FlowResult jump(JumpDto dto) {
-        if (ObjectUtil.isNotEmpty(dto.getData())) {
-            flowExampleService.update(q -> q.eq(FlowExample::getId, dto.getFlowId()).set(FlowExample::getStartData, dto.getData().toJSONString()));
-        }
-
         FlowJumpContext context = new FlowJumpContext(dto);
         FlowJumpContext context = new FlowJumpContext(dto);
         FlowThreadLocalUtil flowThreadLocal = FlowThreadLocalUtil.create();
         FlowThreadLocalUtil flowThreadLocal = FlowThreadLocalUtil.create();
 
 
@@ -511,11 +507,30 @@ public class FlowProcessServiceImpl implements FlowProcessService {
         FlowDefinitionNode currentNode = context.getCurrentNode();
         FlowDefinitionNode currentNode = context.getCurrentNode();
         FlowDefinitionNode jumpNode = context.getJumpNode();
         FlowDefinitionNode jumpNode = context.getJumpNode();
 
 
+        //退回发起人后 重新赋值流程标题
+        if (ObjectUtil.isNotEmpty(dto.getData())) {
+            // 获取流程委托对象
+            FlowDelegate flowDelegate = FlowBean.getBean(flowExample.getFlowKey());
+            // 查询流程定义
+            FlowDefinition flowDefinition = flowDefinitionService.getOne(q -> q
+                    .eq(FlowDefinition::getFlowKey, flowExample.getFlowKey())
+                    .eq(FlowDefinition::getCurrentVersion, StatusConstant.YES));
+            if (flowDefinition == null) {
+                throw new ServiceException("流程未配置,请联系管理员");
+            }
+
+            //重新赋值流程标题
+            Map<String, Object> templateMap = flowDelegate.initTemplateMap(dto.getData(), dto.getData());
+            flowExample.setTitle(templateParse(flowDefinition.getTitleTemplate(), templateMap));
+
+            //重新赋值流程发起数据
+            flowExample.setStartData(dto.getData().toJSONString());
+        }
+
         // 更新流程实例
         // 更新流程实例
         flowExample.setDefinitionNodeId(jumpNode.getId());
         flowExample.setDefinitionNodeId(jumpNode.getId());
         flowExample.setHandleUserId(context.getJumpHandleUserId());
         flowExample.setHandleUserId(context.getJumpHandleUserId());
         flowExample.setStatus(context.getFlowStatus().getKey());
         flowExample.setStatus(context.getFlowStatus().getKey());
-        flowExample.setStartData(null);
         boolean updateFlag = flowExampleService.updateById(flowExample);
         boolean updateFlag = flowExampleService.updateById(flowExample);
         if (!updateFlag) {
         if (!updateFlag) {
             throw new ServiceException("流程已被处理");
             throw new ServiceException("流程已被处理");