Ver código fonte

2023-3-28 一体机消息相关接口。

chaiyunlong 2 anos atrás
pai
commit
65cb731aaa

+ 43 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/domain/vo/LabMessageGroupVO.java

@@ -0,0 +1,43 @@
+package com.zd.laboratory.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 消息VO对象
+ *
+ * @Author: cyl
+ * @Date: 2023/03/28/10:43
+ * @Description:
+ */
+@ApiModel("消息组合表")
+@Data
+public class LabMessageGroupVO {
+
+    /**
+     * 消息的id
+     */
+    @ApiModelProperty("消息id")
+    private Long id;
+
+    /**
+     * 消息的内容
+     */
+    @ApiModelProperty("消息的内容")
+    private String messContent;
+
+    /**
+     * 消息类型,1是来自消息表,2是来自整改表
+     */
+    @ApiModelProperty("消息类型,1是来自消息表,2是来自整改表")
+    private Integer messType;
+
+    /**
+     * 创建时间,用于排序
+     */
+    @ApiModelProperty("创建时间,用于排序")
+    private Date createTime;
+}

+ 2 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabCheckMachineMsgMapper.java

@@ -63,4 +63,6 @@ public interface LabCheckMachineMsgMapper {
     void updateByCheckRecordId(Long checkRecordId);
 
     List<LabCheckMachineMsgVo> selectCheckMsgBySubId(LabCheckMachineMsg labCheckMachineMsg);
+
+    List<LabCheckMachineMsg> selectCheckNewMsgBySubId(Long subId);
 }

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabMessageContentMapper.java

@@ -47,6 +47,14 @@ public interface LabMessageContentMapper {
     public List<LabMessageContentVO> selectLabClearMessageList(LabMessageContentListQuery labMessageContent);
 
     /**
+     * 查询消息发布列表VO
+     *
+     * @param subId 实验室id
+     * @return 消息发布集合
+     */
+    public List<LabMessageContentVO> selectLabNewMessageContentVOList(Long subId);
+
+    /**
      * 新增消息发布
      *
      * @param labMessageContent 消息发布

+ 70 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/onemachine/controller/OneMachineController.java

@@ -9,9 +9,12 @@ import com.zd.laboratory.api.entity.SensorFunctionStatus;
 import com.zd.laboratory.api.vo.HardwareCVO;
 import com.zd.laboratory.api.vo.SenseValVO;
 import com.zd.laboratory.domain.FaceVO;
+import com.zd.laboratory.domain.LabCheckMachineMsg;
 import com.zd.laboratory.domain.LabRotationChart;
 import com.zd.laboratory.domain.dto.LabHazardDTO;
 import com.zd.laboratory.domain.dto.LabHazardNewVo;
+import com.zd.laboratory.domain.vo.LabMessageContentVO;
+import com.zd.laboratory.domain.vo.LabMessageGroupVO;
 import com.zd.laboratory.domain.vo.SubLayoutVO;
 import com.zd.laboratory.domain.vo.SubSimpleVO;
 import com.zd.laboratory.mapper.LabHazardMapper;
@@ -24,6 +27,8 @@ import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.domain.ResultData;
+import com.zd.model.domain.per.PerFun;
+import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.entity.SysUser;
 import com.zd.model.enums.HardwareTypeEnum;
 import com.zd.model.enums.SignEnum;
@@ -41,8 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -101,6 +105,12 @@ public class OneMachineController extends BaseController {
     @Autowired
     private SubMessageSendManager messageSendService;
 
+    @Autowired
+    private ILabMessageContentService labMessageContentService;
+
+    @Autowired
+    private ILabCheckMachineMsgService labCheckMachineMsgService;
+
 //    /**
 //     * 最低危险等级
 //     */
@@ -441,4 +451,62 @@ public class OneMachineController extends BaseController {
         return oneMachineService.lotPostSignIn(code, faceVO.getData());
     }
 
+
+    /**
+     * 查询消息发布列表
+     */
+    @GetMapping("/{subId}/newMsg")
+    public TableDataInfo newMsg(@PathVariable("subId") Long subId) {
+        startPage();
+        List<LabMessageContentVO> list = labMessageContentService.selectLabNewMessageContentVOList(subId);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询整改消息最新列表
+     */
+    @GetMapping("/{subId}/checkNewMsg")
+    public TableDataInfo checkNewMsg(@PathVariable("subId") Long subId) {
+        startPage();
+        List<LabCheckMachineMsg> list = labCheckMachineMsgService.selectCheckNewMsgBySubId(subId);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 查询组合消息滚动
+     */
+    @GetMapping("/{subId}/newMsgGroup")
+    public ResultData newMsgGroup(@PathVariable("subId") Long subId) {
+        List<LabMessageGroupVO> messageGroupVOList = new ArrayList <>();
+
+        List<LabMessageContentVO> msgList = labMessageContentService.selectLabNewMessageContentVOList(subId);
+        Optional.ofNullable(msgList).orElseGet(Collections::emptyList)
+                .stream()
+                .forEach(a->{
+                    LabMessageGroupVO labMessageGroupVO = new LabMessageGroupVO();
+                    labMessageGroupVO.setId(a.getId());
+                    labMessageGroupVO.setMessContent(a.getContent());
+                    labMessageGroupVO.setMessType(1);
+                    labMessageGroupVO.setCreateTime(a.getCreateTime());
+                    messageGroupVOList.add(labMessageGroupVO);
+                });
+        List<LabCheckMachineMsg> checkList = labCheckMachineMsgService.selectCheckNewMsgBySubId(subId);
+        Optional.ofNullable(checkList).orElseGet(Collections::emptyList)
+                .stream()
+                .forEach(b->{
+                    LabMessageGroupVO labMessageGroupVO = new LabMessageGroupVO();
+                    labMessageGroupVO.setId(b.getId());
+                    labMessageGroupVO.setMessContent(b.getCheckMsg());
+                    labMessageGroupVO.setMessType(2);
+                    labMessageGroupVO.setCreateTime(b.getCreateTime());
+                    messageGroupVOList.add(labMessageGroupVO);
+                });
+
+        return ResultData.success(Optional.ofNullable(messageGroupVOList).orElseGet(Collections::emptyList)
+                .stream()
+                .sorted(Comparator.comparing(LabMessageGroupVO::getCreateTime).reversed())
+                .collect(Collectors.toList()));
+    }
+
 }

+ 2 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabCheckMachineMsgService.java

@@ -75,4 +75,6 @@ public interface ILabCheckMachineMsgService {
     public int deleteLabCheckMachineMsgById(Long id);
 
     List<LabCheckMachineMsgVo> selectCheckMsg(LabCheckMachineMsg labCheckMachineMsg);
+
+    List<LabCheckMachineMsg> selectCheckNewMsgBySubId(Long subId);
 }

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabMessageContentService.java

@@ -39,6 +39,14 @@ public interface ILabMessageContentService {
     public List<LabMessageContentVO> selectLabMessageContentVOList(LabMessageContentListQuery labMessageContent);
 
     /**
+     * 查询消息发布列表VO
+     *
+     * @param subId 实验室id
+     * @return 消息发布集合
+     */
+    public List<LabMessageContentVO> selectLabNewMessageContentVOList(Long subId);
+
+    /**
      * 发送预警消息
      * @param subId 实验室ID
      * @param newRiskPlan 预案

+ 6 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabCheckMachineMsgServiceImpl.java

@@ -514,4 +514,10 @@ public class LabCheckMachineMsgServiceImpl implements ILabCheckMachineMsgService
 
         return list;
     }
+
+
+    @Override
+    public List<LabCheckMachineMsg> selectCheckNewMsgBySubId(Long subId) {
+        return labCheckMachineMsgMapper.selectCheckNewMsgBySubId(subId);
+    }
 }

+ 11 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabMessageContentServiceImpl.java

@@ -141,6 +141,17 @@ public class LabMessageContentServiceImpl implements ILabMessageContentService {
         return labMessageContentMapper.selectLabMessageContentVOList(labMessageContent);
     }
 
+    /**
+     * 查询消息发布列表
+     *
+     * @param subId 实验室id
+     * @return 消息发布
+     */
+    @Override
+    public List<LabMessageContentVO> selectLabNewMessageContentVOList(Long subId) {
+        return labMessageContentMapper.selectLabNewMessageContentVOList(subId);
+    }
+
 
     /**
      * 新的发送消息

+ 6 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabCheckMachineMsgMapper.xml

@@ -83,6 +83,12 @@
         ORDER BY cr.create_time DESC
     </select>
 
+    <select id="selectCheckNewMsgBySubId" resultMap="LabCheckMachineMsgResult">
+        select cmm.* from lab_check_record cr inner join lab_check_machine_msg cmm on cr.id = cmm.check_record_id
+        where cr.laboratory_id = #{subId}
+        order by cmm.create_time desc
+    </select>
+
     <insert id="insertLabCheckMachineMsg" parameterType="com.zd.laboratory.domain.LabCheckMachineMsg"
             useGeneratedKeys="true" keyProperty="id">
         insert into lab_check_machine_msg

+ 8 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabMessageContentMapper.xml

@@ -139,6 +139,14 @@
         <include refid="selectDetail"/>
     </select>
 
+    <select id="selectLabNewMessageContentVOList" resultType="com.zd.laboratory.domain.vo.LabMessageContentVO">
+        <include refid="selectlistVO"/>
+        where
+            t.mess_class = 3
+            AND FIND_IN_SET(#{subId}, t.`sub_ids`)
+        order by t.create_time desc
+    </select>
+
     <insert id="insertLabMessageContent" parameterType="com.zd.laboratory.api.entity.LabMessageContent" useGeneratedKeys="true" keyProperty="id">
         insert into lab_message_content
         <trim prefix="(" suffix=")" suffixOverrides=",">