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

【编辑】风险概要日志处理

linfutong пре 3 година
родитељ
комит
4dcf5886ba

+ 7 - 0
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabRiskPlanAbnormalDescMapper.java

@@ -30,6 +30,13 @@ public interface LabRiskPlanAbnormalDescMapper {
     int updateById(LabRiskPlanAbnormalDesc labRiskPlanAbnormalDesc);
 
     /**
+     * 根据 ID 修改
+     *
+     * @param labRiskPlanAbnormalDesc 实体对象
+     */
+    int updateByGroupId(LabRiskPlanAbnormalDesc labRiskPlanAbnormalDesc);
+
+    /**
      * 根据 ID 删除
      *
      * @param descId 主键ID

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

@@ -62,10 +62,10 @@ public interface ILabRiskPlanAbnormalDescService {
 
     /**
      * 更新风险概况
-     * @param descId
+     * @param groupId
      * @param handledPerson
      * @param recordVideo
      * @return
      */
-    int updateLabRiskPlanAbnormalDesc(long descId, String handledPerson, String recordVideo);
+    int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo);
 }

+ 4 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanAbnormalDescServiceImpl.java

@@ -101,11 +101,12 @@ public class LabRiskPlanAbnormalDescServiceImpl implements ILabRiskPlanAbnormalD
     }
 
     @Override
-    public int updateLabRiskPlanAbnormalDesc(long descId, String handledPerson, String recordVideo) {
+    public int updateLabRiskPlanAbnormalDesc(long groupId, String handledPerson, String recordVideo) {
         LabRiskPlanAbnormalDesc desc = new LabRiskPlanAbnormalDesc();
-        desc.setDescId(descId);
+        desc.setGroupId(groupId);
         desc.setHandledPerson(handledPerson);
         desc.setRecordVideo(recordVideo);
-        return updateById(desc);
+        desc.setUpdateTime(new Date());
+        return labRiskPlanAbnormalDescMapper.updateByGroupId(desc);
     }
 }

+ 13 - 7
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabRiskPlanServiceImpl.java

@@ -1252,6 +1252,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                 LabRiskPlanAbnormalGroup newGroupOP = new LabRiskPlanAbnormalGroup();
                 newGroupOP.setId(groupVo.getId());
                 newGroupOP.setStatus(0L);
+                newGroupOP.setUpdateTime(new Date());
                 labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
                 // todo 操作人和视频结束时候的 url
 
@@ -1265,6 +1266,10 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
 
                     }
                 }
+                //TODO 更新风险概要  recordVideo - 视频记录存放地址
+                String handlePerson = null;
+                String recordVideo = "";
+                labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
 
                 //结束前向前端发送mqtt预案触发提示
                 messageSendService.riskPlanTriggerNotice();
@@ -1318,17 +1323,14 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
                                 playVo.setParams(paramVo);
                                 playVoList.add(playVo);
                                 remoteSpeakService.stopPlayMusic(map.get("deviceSn") + "", audioSyntheses.get(0).getNewMusicUrl());
-
                             }
                         }
-
                     }
                 }
             } catch (Exception e) {
                 log.error("关闭喇叭失败!!!!!:" + e);
             }
 
-
             LabRiskPlanAbnormalLog labRiskPlanAbnormalLogByGroupId = new LabRiskPlanAbnormalLog();
             labRiskPlanAbnormalLogByGroupId.setGroupId(groupVo.getId());
             List<LabRiskPlanAbnormalLog> newPlanAbnormalLogList = labRiskPlanAbnormalLogMapper.selectLabRiskPlanAbnormalLogOrderByList(labRiskPlanAbnormalLogByGroupId);
@@ -1363,7 +1365,12 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
             LabRiskPlanAbnormalGroup newGroupOP = new LabRiskPlanAbnormalGroup();
             newGroupOP.setId(groupVo.getId());
             newGroupOP.setStatus(0L);
+            newGroupOP.setUpdateTime(new Date());
             labRiskPlanAbnormalGroupMapper.updateLabRiskPlanAbnormalGroup(newGroupOP);
+            //TODO 更新风险概要
+            String handlePerson = null;
+            String recordVideo = "";
+            labRiskPlanAbnormalDescService.updateLabRiskPlanAbnormalDesc(groupVo.getId(),handlePerson, recordVideo);
             //插入预案结束日志
             insertPlanAbnormalLogByOver(groupVo, allRiskPlanJson, subFunction);
             //向一体机传感器预警
@@ -1403,7 +1410,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         labRiskPlanAbnormalGroup.setSubjectId(subjectId);
         labRiskPlanAbnormalGroup.setRiskAttribute(newRiskPlan.getRiskAttribute());
         if(labRiskPlanAbnormalGroupMapper.insertLabRiskPlanAbnormalGroup(labRiskPlanAbnormalGroup) > 0) {
-            //TODO 添加风险概况
+            //添加风险概况
             labRiskPlanAbnormalDescService.addLabRiskPlanAbnormalDesc(labRiskPlanAbnormalGroup.getId(),subjectId, "", riskPlanLevel);
         }
         return labRiskPlanAbnormalGroup;
@@ -1502,7 +1509,6 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
         }
     }
 
-
     public void insertPlanAbnormalLogByHard(LabRiskPlanLevel labRiskPlanLevel/*LabRiskPlan newRiskPlan*/, LabRiskPlanHardwareRelation hardRelation, Long subjectId, Long groupId, String riskPlanJson) {
         log.error("打开硬件记录风险日志");
         LabRiskPlanAbnormalLog labRiskPlanAbnormalLog = new LabRiskPlanAbnormalLog();
@@ -1584,7 +1590,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     /**
      * 调用执行硬件的接口,交由接口实现具体的设备开启或关闭
      *
-     * @param newRiskPlan 预案PO,subjectId 实验室id
+     * @param labRiskPlanLevel 预案PO,subjectId 实验室id
      * @return 结果
      */
     public void operateHardWareInfo(LabRiskPlanLevel labRiskPlanLevel/*LabRiskPlan newRiskPlan*/, Long subjectId, Long groupId, String riskPlanJson) {
@@ -1674,7 +1680,7 @@ public class LabRiskPlanServiceImpl extends ServiceImpl<LabRiskPlanMapper, LabRi
     /**
      * 智能匹配预案
      *
-     * @param riskPlanList 预案列表,senseFuncList 传感器功能列表
+     * @param subFunction 传感器功能列表
      * @return 结果
      */
     public LabRiskPlanLevel matchingRiskPlan(SubFunction<SensorFunctionStatus> subFunction) {

+ 19 - 0
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabRiskPlanAbnormalDescMapper.xml

@@ -78,6 +78,25 @@
         where desc_id = #{descId}
     </update>
 
+    <update id="updateByGroupId"  parameterType="com.zd.laboratory.domain.LabRiskPlanAbnormalDesc">
+        update lab_risk_plan_abnormal_desc
+        <set>
+            <if test="riskReason != null and riskReason != ''">risk_reason = #{riskReason},</if>
+            <if test="riskLevel != null">risk_level = #{riskLevel},</if>
+            <if test="startDate != null">start_date = #{startDate},</if>
+            <if test="endDate != null">end_date = #{endDate},</if>
+            <if test="riskDuration != null and riskDuration != ''">risk_duration = #{riskDuration},</if>
+            <if test="handledPerson != null and handledPerson != ''">handled_person = #{handledPerson},</if>
+            <if test="internalPerson != null and internalPerson != ''">internal_person = #{internalPerson},</if>
+            <if test="recordVideo != null and recordVideo != ''">record_video = #{recordVideo},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
+            <if test="updateBy !=null and updateBy != ''">update_by = #{updateBy},</if>
+            update_time = sysdate()
+        </set>
+        where group_id = #{groupId}
+    </update>
+
     <delete id="deleteById" >
         delete from lab_risk_plan_abnormal_desc where menu_id = #{descId}
     </delete>