Browse Source

feat:BPM项目同步处理乱序问题

侯茂昌 1 year ago
parent
commit
e928b13225

+ 2 - 1
zkqy-common/src/main/java/com/zkqy/common/core/controller/BaseController.java

@@ -86,7 +86,8 @@ public class BaseController
         rspData.setCode(HttpStatus.SUCCESS);
         rspData.setMsg("查询成功");
         rspData.setRows(list);
-        rspData.setTotal(new PageInfo(list).getTotal());
+        long total = new PageInfo(list).getTotal();
+        rspData.setTotal(total);
         return rspData;
     }
 

+ 5 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/CommonEntity.java

@@ -15,7 +15,7 @@ import java.util.Map;
  * @author hanzihang
  * @date 2023/7/19 4:05 PM
  */
-public class CommonEntity extends BaseEntity implements Serializable {
+public class CommonEntity extends BaseEntity implements Serializable,Cloneable {
 
     private static final long serialVersionUID = 2938L;
 
@@ -90,6 +90,10 @@ public class CommonEntity extends BaseEntity implements Serializable {
         return sb.toString();
     }
 
+    @Override
+    public CommonEntity clone() throws CloneNotSupportedException {
+        return (CommonEntity) super.clone();
+    }
     public CommonEntity(Map<String, Object> basicMap, Map<String, Object> queryMap, Map<String, Object> conditionMap, Map<String, Object> resultMap, Map<String, Object> commMap, List<Map<String, String>> addListMap, String execlMap, Map<String, Object> btnParametersMap) {
         this.basicMap = basicMap;
         this.queryMap = queryMap;

+ 14 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmExecuteProcessServiceImpl.java

@@ -104,7 +104,20 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
             // 首先根据当前登陆用户得到他可以执行的所有节点
             List<CommonEntity> commonEntities = runBpmExecuteProcessMapper.queryExecuteProcess(objectMap);
             // 查询异常脚本信息
-            return bpmExecuteNodeMiddleService.addExceptionScript(commonEntities);
+            List<CommonEntity> commonEntities1 = bpmExecuteNodeMiddleService.addExceptionScript(commonEntities);
+            commonEntities.forEach(item -> {
+                String keyName = item.getResultMap().get("benTaskNodeKey").toString();
+                item.getResultMap().putAll(
+                        commonEntities1.stream()
+                                .filter(ctem ->
+                                        ctem.getResultMap().get("benTaskNodeKey")
+                                                .equals(keyName))
+                                .findFirst()
+                                .get()
+                                .getResultMap()
+                );
+            });
+            return commonEntities;
         }
         return null;
     }

+ 1 - 1
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteNodeLogMapper.xml

@@ -122,7 +122,7 @@
         <foreach collection="taskProcessList" item="task" open="(" separator="," close=")">
             #{task}
         </foreach>
-        GROUP BY task_process_key, task_node_key, task_node_name
+        GROUP BY id
         ORDER BY task_process_key, MIN(id)
     </select>
 

+ 21 - 22
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteProcessMapper.xml

@@ -65,8 +65,8 @@
     <select id="selectBpmExecuteProcessListLog" resultMap="retMap">
         select
         bep.*
-        from {DBNAME}.bpm_execute_node_middle benm
-        join {DBNAME}.bpm_execute_process bep on bep.task_key = benm.task_process_key
+        from {DBNAME}.bpm_execute_process bep
+        join {DBNAME}.bpm_execute_node_middle benm on bep.task_key = benm.task_process_key
         where
         FIND_IN_SET(#{userId}, benm.task_execute_user_no) > 0
         <if test="taskRealRoleList != null and taskRealRoleList.size() > 0">
@@ -75,26 +75,25 @@
                 FIND_IN_SET(#{role}, benm.task_real_role) > 0
             </foreach>
         </if>
-        <where>
-            <if test="taskKey != null  and taskKey != ''">and bep.task_key = #{taskKey}</if>
-            <if test="taskName != null  and taskName != ''">and bep.task_name like concat('%', #{taskName}, '%')</if>
-            <if test="taskNodeKey != null  and taskNodeKey != ''">and bep.task_node_key = #{taskNodeKey}</if>
-            <if test="taskNodeNextKey != null  and taskNodeNextKey != ''">and bep.task_node_next_key =
-                #{taskNodeNextKey}
-            </if>
-            <if test="taskProcessKey != null  and taskProcessKey != ''">and bep.task_process_key = #{taskProcessKey}
-            </if>
-            <if test="taskProcessXmlContent != null  and taskProcessXmlContent != ''">and bep.task_process_xml_content =
-                #{taskProcessXmlContent}
-            </if>
-            <if test="taskProcessState != null ">and bep.task_process_state = #{taskProcessState}</if>
-            <if test="taskProcessNote != null  and taskProcessNote != ''">and bep.task_process_note =
-                #{taskProcessNote}
-            </if>
-            <if test="taskProcessType != null  and taskProcessType != ''">and bep.task_process_type =
-                #{taskProcessType}
-            </if>
-        </where>
+
+        <if test="taskKey != null  and taskKey != ''">and bep.task_key = #{taskKey}</if>
+        <if test="taskName != null  and taskName != ''">and bep.task_name like concat('%', #{taskName}, '%')</if>
+        <if test="taskNodeKey != null  and taskNodeKey != ''">and bep.task_node_key = #{taskNodeKey}</if>
+        <if test="taskNodeNextKey != null  and taskNodeNextKey != ''">and bep.task_node_next_key =
+            #{taskNodeNextKey}
+        </if>
+        <if test="taskProcessKey != null  and taskProcessKey != ''">and bep.task_process_key = #{taskProcessKey}
+        </if>
+        <if test="taskProcessXmlContent != null  and taskProcessXmlContent != ''">and bep.task_process_xml_content =
+            #{taskProcessXmlContent}
+        </if>
+        <if test="taskProcessState != null ">and bep.task_process_state = #{taskProcessState}</if>
+        <if test="taskProcessNote != null  and taskProcessNote != ''">and bep.task_process_note =
+            #{taskProcessNote}
+        </if>
+        <if test="taskProcessType != null  and taskProcessType != ''">and bep.task_process_type =
+            #{taskProcessType}
+        </if>
         GROUP BY benm.task_process_key
     </select>