فهرست منبع

fix:工具类

侯茂昌 1 سال پیش
والد
کامیت
b935f7f214

+ 56 - 0
ruoyi-process-execution/src/main/java/com/ruoyi/execution/produce/dispersed/runbpm/UniversalPopupData.java

@@ -0,0 +1,56 @@
+package com.ruoyi.execution.produce.dispersed.runbpm;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.ruoyi.execution.produce.dispersed.entity.BpmExecuteNode;
+import com.ruoyi.execution.produce.dispersed.entity.BpmExecuteNodeForm;
+import com.ruoyi.execution.produce.dispersed.mapper.BpmExecuteNodeFormMapper;
+import com.ruoyi.execution.produce.dispersed.mapper.BpmExecuteNodeMapper;
+import com.ruoyi.system.entity.CommonEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+/**
+ * @author hmc
+ * @date 2023-12-12 12:29
+ * @Description:
+ */
+@Service
+public class UniversalPopupData {
+
+
+    @Autowired
+    private BpmExecuteNodeFormMapper bpmExecuteNodeFormMapper;
+
+    @Autowired
+    private  BpmExecuteNodeMapper executeNodeMapper;
+
+    /**
+     * 返回弹窗数据的通用工具类
+     * @return
+     */
+    public CommonEntity getUniversalPopupDate(CommonEntity commonEntity) {
+        //拿到这个节点的 task_process_key【流程key】 task_node_key【节点key】 task_script_key【脚本key】
+        String taskProcessKey = commonEntity.getQueryMap().get("taskProcessKey").toString();
+        String taskNodeKey = commonEntity.getQueryMap().get("taskNodeKey").toString();
+        String tableName = commonEntity.getBasicMap().get("tableName").toString();
+        String taskScriptKey = commonEntity.getQueryMap().get("taskScriptKey").toString();
+        String taskPlanKey = commonEntity.getQueryMap().get("taskPlanKey").toString();
+        //查询节点上包含的数量记录(件数)---重量记录(重量)查询执行节点对应的表单数据信息
+        BpmExecuteNode bpmExecuteNode = executeNodeMapper.queryBpmExecuteNodeBytaskNodeKey(taskProcessKey, taskNodeKey);
+        HashMap bpmExecuteNodeMap=new HashMap();
+        bpmExecuteNodeMap.put("taskNodeNumber",bpmExecuteNode.getTaskNodeNumber());
+        bpmExecuteNodeMap.put("taskNodeWeight",bpmExecuteNode.getTaskNodeWeight());
+        //拿到前端传回来的条件
+        Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getConditionMap()));
+        //通用的查询接口
+        CommonEntity commonEntityRt = bpmExecuteNodeFormMapper.getInfoById(tableName, conditions);
+        //件数信息-重量信息放进去
+        commonEntityRt.getResultMap().put("bpmExecuteNode",bpmExecuteNodeMap);
+        return commonEntityRt;
+    }
+}

+ 16 - 0
ruoyi-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteNodeFormMapper.xml

@@ -159,4 +159,20 @@
         ${tableSql}
     </select>
 
+    <resultMap id="retMap" type="com.ruoyi.system.entity.CommonEntity" autoMapping="true">
+        <collection property="resultMap" ofType="map" autoMapping="true"
+                    javaType="map"></collection>
+    </resultMap>
+
+    <select id="getInfoById" resultMap="retMap">
+        select * from {DBNAME}.${tableName}
+        <where>
+            <if test="conditions != null">
+                <foreach collection="conditions" item="value" index="key" separator="and">
+                    ${key}=#{value}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
 </mapper>