Преглед изворни кода

improvement:执行流程查询列表,执行逻辑

韩帛霖 пре 1 година
родитељ
комит
0084fec39b

+ 26 - 19
ruoyi-process-execution/src/main/java/com/ruoyi/execution/produce/dispersed/runbpm/PreExecutionToolClass.java

@@ -67,29 +67,14 @@ public class PreExecutionToolClass<R> {
      */
     @Transactional
     public int ReadyToExecute(CommonEntity commonEntity) {
-        IntoProduction intoProduction = new IntoProduction();  // 启动流程所需参数实体
-        commonEntity.getConditionMap().entrySet().forEach(item -> {
-            // 得到当前表的主键字段 // 得到当前表的主键值
-            intoProduction.setGuid(item.getKey() + "=" + item.getValue().toString());
-        });
-        // 得到当前表名
-        intoProduction.setTableName(commonEntity.getBasicMap().get("tableName").toString());
-        // 得到流程别名
-        intoProduction.setTaskProcessKey(commonEntity.getCommMap().get("plantaskkey").toString());
-        // 得到单前表所需的状态字段,启动流程所需kv
-        intoProduction.setStateMap(commonEntity.getConditionMap());
-        intoProduction.getStateMap().putAll(commonEntity.getBtnParametersMap());
-
-
-        //        if (!commonEntity.getConditionMap().isEmpty()) {
-        //        }
-
-
+        // 获取发起流程所需数据
+        IntoProduction intoProduction = this.obtainData(commonEntity);
         /**
          * 根据流程key校验当前流程数据的完整性,是否可以运行
          */
         //        if (!iVerifyExecutionProcess.VerifyProcessData(intoProduction.getTaskProcessKey()))
         //            return HttpStatus.EXECUTEPROCESS;
+
         /**1️⃣1️⃣1️⃣ 得到当前投产需要执行的流程详细信息*/
         //--得到当前流程的详细信息
         BpmProcess bpmProcess = bpmProcessMapper.selectBpmProcessByProcessKey(intoProduction.getTaskProcessKey());
@@ -324,7 +309,6 @@ public class PreExecutionToolClass<R> {
             bpmRunNodeVo1.setImplementationName(nextBpmExecuteNodeMiddle.getTaskArtificialScriptKey());
 
 
-
             BpmExecuteProcess bpmExecuteProcess = new BpmExecuteProcess();
             bpmExecuteProcess.setTaskKey(bpmRunNodeVo.getTaskProcessKey());
             bpmExecuteProcess.setTaskNodeKey(bpmRunNodeVo.getTaskNodeKey());
@@ -345,6 +329,29 @@ public class PreExecutionToolClass<R> {
         return HttpStatus.SUCCESS;
     }
 
+    /**
+     * 获取发起流程数据
+     *
+     * @param commonEntity
+     * @return
+     */
+    public IntoProduction obtainData(CommonEntity commonEntity) {
+        IntoProduction intoProduction = new IntoProduction();  // 启动流程所需参数实体
+        commonEntity.getConditionMap().entrySet().forEach(item -> {
+            // 得到当前表的主键字段 // 得到当前表的主键值
+            intoProduction.setGuid(item.getKey() + "=" + item.getValue().toString());
+        });
+        // 得到当前表名
+        intoProduction.setTableName(commonEntity.getBasicMap().get("tableName").toString());
+        // 得到需要执行的流程编码
+        intoProduction.setTaskProcessKey(commonEntity.getCommMap().get("process_key").toString());
+        // 得到单前表所需的状态字段,启动流程所需kv
+        intoProduction.setStateMap(commonEntity.getConditionMap());
+        intoProduction.getStateMap().putAll(commonEntity.getBtnParametersMap());
+        return intoProduction;
+    }
+
+
     // 弃用保留
     public int updateNodeState(String taskProcessKey, String taskNodeKey, CommonEntity commonEntity) {
         BpmExecuteNode bpmExecuteNode1 = new BpmExecuteNode();

+ 11 - 0
ruoyi-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteProcessMapper.xml

@@ -200,6 +200,17 @@
             </foreach>
         </if>
         )
+        <if test="taskKey != null  and taskKey != ''">and bep.task_key = #{bpmExecuteProcessTaskKey}</if>
+        <if test="taskName != null  and taskName != ''">and bep.task_name like concat('%', #{bepTaskName}, '%')</if>
+        <if test="taskNodeKey != null  and taskNodeKey != ''">and bep.task_node_key = #{bepTaskNodeKey}</if>
+        <if test="taskNodeNextKey != null  and taskNodeNextKey != ''">and bep.task_node_next_key = #{bpmExecuteProcessTaskNodeNextKey}
+        </if>
+        <if test="taskProcessKey != null  and taskProcessKey != ''">and bep.task_process_key = #{bepTaskProcessKey}</if>
+        <if test="taskProcessState != null ">and bep.task_process_state = #{bepTaskProcessState}</if>
+        <if test="taskProcessNote != null  and taskProcessNote != ''">and bep.task_process_note = #{bepTaskProcessNote}
+        </if>
+        <if test="taskProcessType != null  and taskProcessType != ''">and bep.task_process_type = #{bepTaskProcessType}
+        </if>
         order by ben.create_time desc
     </select>