From 630fcec2d5da618fe4ddd2bc0215c2f9017af00d Mon Sep 17 00:00:00 2001
From: mg <maokecheng@163.com>
Date: 星期六, 08 十月 2022 14:46:27 +0800
Subject: [PATCH] 新增消息类

---
 ycl-platform/src/main/java/com/ycl/entity/caseHandler/WorkflowConfigStep.java        |    3 +
 ycl-platform/src/main/java/com/ycl/mapper/caseHandler/WorkflowConfigStepMapper.java  |    3 +
 ycl-platform/src/main/resources/mapper/caseHandler/DisposeRecordMapper.xml           |    5 --
 ycl-platform/src/main/resources/mapper/caseHandler/WorkflowConfigStepMapper.xml      |   29 +++++++++++---
 ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java |   30 +++++++++++----
 ycl-platform/src/main/java/com/ycl/controller/message/MessageController.java         |   12 ++++++
 6 files changed, 61 insertions(+), 21 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/message/MessageController.java b/ycl-platform/src/main/java/com/ycl/controller/message/MessageController.java
new file mode 100644
index 0000000..6e299ba
--- /dev/null
+++ b/ycl-platform/src/main/java/com/ycl/controller/message/MessageController.java
@@ -0,0 +1,12 @@
+package com.ycl.controller.message;
+
+/**
+ * <p>
+ *   娑堟伅绠$悊  鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author mg
+ * @since 2022-10-08
+ */
+public class MessageController {
+}
diff --git a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/WorkflowConfigStep.java b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/WorkflowConfigStep.java
index 30ab61a..44f254f 100644
--- a/ycl-platform/src/main/java/com/ycl/entity/caseHandler/WorkflowConfigStep.java
+++ b/ycl-platform/src/main/java/com/ycl/entity/caseHandler/WorkflowConfigStep.java
@@ -10,6 +10,7 @@
 import lombok.EqualsAndHashCode;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -63,5 +64,5 @@
      */
     @TableField(value = "disposeRecord",exist = false)
     @ApiModelProperty(value = "澶勭疆娴佺▼璁板綍")
-    private DisposeRecord disposeRecord;
+    private List<DisposeRecord> disposeRecords;
 }
diff --git a/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/WorkflowConfigStepMapper.java b/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/WorkflowConfigStepMapper.java
index a80a186..24236e8 100644
--- a/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/WorkflowConfigStepMapper.java
+++ b/ycl-platform/src/main/java/com/ycl/mapper/caseHandler/WorkflowConfigStepMapper.java
@@ -4,6 +4,7 @@
 import com.ycl.entity.caseHandler.WorkflowConfigStep;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -15,5 +16,5 @@
  */
 public interface WorkflowConfigStepMapper extends BaseMapper<WorkflowConfigStep> {
 
-   List<WorkflowConfigStep> selectRecordByWorkflowConfigStepId(Integer id);
+   List<WorkflowConfigStep> selectRecordByWorkflowConfigStepId(Map map);
 }
diff --git a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
index e47ebfe..5e32871 100644
--- a/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
+++ b/ycl-platform/src/main/java/com/ycl/service/caseHandler/impl/BaseCaseServiceImpl.java
@@ -33,7 +33,9 @@
 import java.time.Duration;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -217,6 +219,9 @@
         QueryWrapper<BaseCase> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(BaseCase::getCode, code);
         BaseCase baseCase = baseCaseMapper.selectOne(wrapper);
+        if (baseCase == null) {
+            return null;
+        }
         bcd.setBaseCase(baseCase);
         //2.鏌ヨ鍔炵悊缁忚繃淇℃伅
         //2.1鏌ヨ澶勭疆娴佺▼閰嶇疆
@@ -234,15 +239,23 @@
             }
         }
         //2.2鏌ヨ澶勭疆娴佺▼鐜妭閰嶇疆
-        List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(ddlcId);
+        Map mapWcs = new HashMap();
+        mapWcs.put("workflowConfigId", ddlcId);
+        mapWcs.put("baseCaseId", ddlcId);
+        List<WorkflowConfigStep> listWcs = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(mapWcs);
         //澶勭悊鐢ㄧ幆鑺傛椂闂�
         for (WorkflowConfigStep step : listWcs) {
-            DisposeRecord record = step.getDisposeRecord();
-            record.setLinkTime(
-                    DateUtil.getDistanceDateTime(
-                            DateUtil.fromLocalDateTime(baseCase.getAlarmTime()),
-                            DateUtil.fromLocalDateTime(record.getCreateTime())));
-            step.setDisposeRecord(record);
+            List<DisposeRecord> records = step.getDisposeRecords();
+            if (records == null) {
+                continue;
+            }
+            for (DisposeRecord record : records) {
+                record.setLinkTime(
+                        DateUtil.getDistanceDateTime(
+                                DateUtil.fromLocalDateTime(baseCase.getAlarmTime()),
+                                DateUtil.fromLocalDateTime(record.getCreateTime())));
+            }
+            step.setDisposeRecords(records);
         }
         //2.3璁剧疆璋冨害娴佺▼
         handlePassVo.setWorkflowConfigSteps(listWcs);
@@ -257,7 +270,8 @@
         //4.鏌ヨ闂澶勭悊淇℃伅
         ProblemProVo problemProVo = new ProblemProVo();
         //4.2鏌ヨ澶勭疆娴佺▼鐜妭閰嶇疆
-        List<WorkflowConfigStep> listWcsPp = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(wtcllcId);
+        mapWcs.put("workflowConfigId", wtcllcId);
+        List<WorkflowConfigStep> listWcsPp = workflowConfigStepMapper.selectRecordByWorkflowConfigStepId(mapWcs);
         //4.3璁剧疆璋冨害娴佺▼
         problemProVo.setWorkflowConfigSteps(listWcsPp);
         bcd.setProblemProVo(problemProVo);
diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/DisposeRecordMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/DisposeRecordMapper.xml
index be82f85..6aa50ed 100644
--- a/ycl-platform/src/main/resources/mapper/caseHandler/DisposeRecordMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/caseHandler/DisposeRecordMapper.xml
@@ -21,9 +21,4 @@
     <sql id="Base_Column_List">
         id, base_case_id, step_name, start_time, handler_role_id, end_time, state, handler_id, create_user, create_time
     </sql>
-    <select id="selectByWorkflowConfigStepId" parameterType="Integer" resultMap="BaseResultMap">
-        SELECT * FROM ums_dispose_record udr
-        WHERE udr.workflow_config_step_id=#{id}
-    </select>
-
 </mapper>
diff --git a/ycl-platform/src/main/resources/mapper/caseHandler/WorkflowConfigStepMapper.xml b/ycl-platform/src/main/resources/mapper/caseHandler/WorkflowConfigStepMapper.xml
index 9cc2038..9dfc088 100644
--- a/ycl-platform/src/main/resources/mapper/caseHandler/WorkflowConfigStepMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/caseHandler/WorkflowConfigStepMapper.xml
@@ -16,12 +16,29 @@
         id, workflow_config_id "workflowConfigId", name "name",role_id "roleId",seq "seq"
     </sql>
     <resultMap type="com.ycl.entity.caseHandler.WorkflowConfigStep" id="RecordResultMap" extends="BaseResultMap">
-        <association property="disposeRecord" column="id"
-                     select="com.ycl.mapper.caseHandler.DisposeRecordMapper.selectByWorkflowConfigStepId"
-                     javaType="com.ycl.entity.caseHandler.DisposeRecord" />
+        <collection property="disposeRecords" javaType="ArrayList" ofType="com.ycl.entity.caseHandler.DisposeRecord">
+            <id column="id" property="id" />
+            <result column="base_case_id" property="baseCaseId" />
+            <result column="workflow_config_step_id" property="workflowConfigStepId" />
+            <result column="step_name" property="stepName" />
+            <result column="start_time" property="startTime" />
+            <result column="handler_role_id" property="handlerRoleId" />
+            <result column="end_time" property="endTime" />
+            <result column="state" property="state" />
+            <result column="handler_id" property="handlerId" />
+            <result column="create_user" property="createUser" />
+            <result column="create_time" property="createTime" />
+        </collection>
     </resultMap>
-    <select id="selectRecordByWorkflowConfigStepId" parameterType="Integer" resultMap="RecordResultMap">
-        SELECT * FROM ums_workflow_config_step uwcs
-                 WHERE uwcs.workflow_config_id=#{id}
+
+    <select id="selectRecordByWorkflowConfigStepId" parameterType="map" resultMap="RecordResultMap">
+        SELECT
+            *
+        FROM
+            ums_workflow_config_step uwcs
+                LEFT JOIN ums_dispose_record udr ON uwcs.id = udr.workflow_config_step_id
+        WHERE
+            uwcs.workflow_config_id = #{workflowConfigId}
+          AND udr.base_case_id = #{baseCaseId}
     </select>
 </mapper>

--
Gitblit v1.8.0