Browse Source

修改系统配置的时候更新连锁总表、详细便、总表临时表、详细表临时表的系统状态数据

sl 2 months ago
parent
commit
309ee42fd7

+ 50 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/controller/InterlockAvoidCircularController.java

@@ -0,0 +1,50 @@
+package org.jeecg.modules.interlockAvoidCircular.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.base.vo.InterlockBaseVo;
+import org.jeecg.modules.interlockAvoidCircular.service.InterlockAvoidCircularService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ClassName: InterlockAvoidCircularController
+ * Package: org.jeecg.modules.interlockAvoidCircular.controller
+ * Description:  避免循环调用创建的包
+ *
+ * @Author sl
+ * @Create 2024/8/28 10:04
+ * @Version 1.0
+ */
+@Api(tags="避免循环调用创建的包")
+@RestController
+@RequestMapping("/interlockAvoidCircular")
+public class InterlockAvoidCircularController {
+    @Autowired
+    private InterlockAvoidCircularService interlockAvoidCircularService;
+
+    @AutoLog(value = "修改系统配置")
+    @ApiOperation(value="修改系统配置", notes="修改系统配置")
+    @RequestMapping(value = "/updateGroup", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<String> updateGroup(@RequestBody InterlockBaseVo interlockBaseVo, HttpServletRequest request){
+
+        String code = interlockAvoidCircularService.updateGroup(interlockBaseVo,request);
+
+        if ("200".equals(code)){
+            return Result.OK("修改成功!");
+        }
+        return Result.error("修改失败!");
+        //return restClientService.updateGroup(groupName,groupId);
+    }
+
+}

+ 18 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/entity/InterlockSumDetail.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.interlockAvoidCircular.entity;
+
+import lombok.Data;
+import org.jeecg.modules.detail.entity.InterlockDetail;
+import org.jeecg.modules.summary.entity.InterlockSummary;
+
+/**
+ * ClassName: InterlockSumDetail
+ * Package: org.jeecg.modules.interlockAvoidCircular.entity
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 14:23
+ * @Version 1.0
+ */
+@Data
+public class InterlockSumDetail{
+}

+ 73 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/entity/InterlockSumOneDetailList.java

@@ -0,0 +1,73 @@
+package org.jeecg.modules.interlockAvoidCircular.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecg.modules.detail.entity.InterlockDetail;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.List;
+
+/**
+ * ClassName: InterlockSumOneDetailList
+ * Package: org.jeecg.modules.interlockAvoidCircular.entity
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 11:19
+ * @Version 1.0
+ */
+@Data
+public class InterlockSumOneDetailList {
+    private static final long serialVersionUID = 1L;
+
+    /**主键*/
+    private java.lang.String id;
+    /**联锁名称*/
+    private java.lang.String interlockName;
+    /**装置id*/
+    private java.lang.String interlockApparatusId;
+    /**系统id*/
+    private java.lang.String interlockSystemId;
+    /**联锁状态*/
+    @Dict(dicCode = "interlock_status")
+    private java.lang.String interlockStatus;
+    /**回路健康级别*/
+    private java.lang.String loopHealthLevel;
+    /**逻辑关系*/
+    private java.lang.String ljgx;
+    /**联锁输出值*/
+    private java.lang.String interlockOutValue;
+    /**联锁输出值-设备id*/
+    private java.lang.String deviceId;
+    /**联锁输出值-模块名称*/
+    private java.lang.String moduleName;
+    /**联锁输出值点位*/
+    private java.lang.String interlockOutValueTag;
+    /**创建人*/
+    private java.lang.String createBy;
+    /**创建日期*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private java.util.Date createTime;
+    /**更新人*/
+    private java.lang.String updateBy;
+    /**更新日期*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    private java.util.Date updateTime;
+    /**备注*/
+    private java.lang.String remark;
+    /**所属部门*/
+    private java.lang.String sysOrgCode;
+    /**点位当前时间*/
+    private java.lang.String tagTime;
+    /**联锁状态-统一定义*/
+    private java.lang.String interlockStatusPs;
+    /**联锁状态名称*/
+    private java.lang.String interlockStatusName;
+
+    List<InterlockDetail> interlockDetailList;
+
+
+}

+ 16 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/entity/InterlockSumSystemDetailList.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.interlockAvoidCircular.entity;
+
+import java.util.List;
+
+/**
+ * ClassName: InterlockSumSystemDetailList
+ * Package: org.jeecg.modules.interlockAvoidCircular.entity
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 11:20
+ * @Version 1.0
+ */
+public class InterlockSumSystemDetailList {
+    private List<InterlockSumOneDetailList> interlockSumOneDetailLists;
+}

+ 37 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/mapper/InterlockAvoidCircularMapper.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.interlockAvoidCircular.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.jeecg.modules.detail.entity.InterlockDetail;
+import org.jeecg.modules.interlockAvoidCircular.entity.InterlockSumSystemDetailList;
+import org.jeecg.modules.summary.entity.InterlockSummary;
+
+import java.util.List;
+
+/**
+ * ClassName: InterlockAvoidCircularMapper
+ * Package: org.jeecg.modules.interlockAvoidCircular.mapper
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 10:08
+ * @Version 1.0
+ */
+@Mapper
+public interface InterlockAvoidCircularMapper {
+    /**
+     *   根据系统id找到该系统下的所有联锁总表信息
+     */
+    @Select("select * from interlock_summary where interlock_system_id = #{interlockSystemId}")
+    List<InterlockSummary> getInterlockSummaryListBySystemId(@Param("interlockSystemId") String interlockSystemId);
+
+    /**
+     *   获取联锁总表id查询联锁详细表信息
+     */
+    @Select("select * from interlock_detail where summaryid=#{summaryid}")
+    List<InterlockDetail> getInterlockDetailListBySummaryId(@Param("summaryid") String summaryid);
+
+
+}

+ 15 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/mapper/xml/InterlockAvoidCircularMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.interlockAvoidCircular.mapper.InterlockAvoidCircularMapper">
+
+<!--    &lt;!&ndash; 某个系统下所有联锁的信息&ndash;&gt;-->
+<!--    <select id="getInterlockListBySystemId">-->
+<!--        select s.*, d.* from interlock_summary s-->
+<!--        left join interlock_detail d on d.summaryid=s.id-->
+<!--        where-->
+<!--            d.summaryid is not null-->
+<!--            and s.interlock_system_id=#{interlockSystemId}-->
+<!--        ORDER BY s.interlock_name-->
+<!--    </select>-->
+
+</mapper>

+ 24 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/service/InterlockAvoidCircularService.java

@@ -0,0 +1,24 @@
+package org.jeecg.modules.interlockAvoidCircular.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.vo.InterlockBaseVo;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * ClassName: InterlockAvoidCircularService
+ * Package: org.jeecg.modules.interlockAvoidCircular.service
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 10:13
+ * @Version 1.0
+ */
+public interface InterlockAvoidCircularService {
+
+    /**
+     *  修改系统配置
+     **/
+    String updateGroup(InterlockBaseVo interlockBaseVo, HttpServletRequest request);
+}

+ 290 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockAvoidCircular/service/impl/InterlockAvoidCircularServiceImpl.java

@@ -0,0 +1,290 @@
+package org.jeecg.modules.interlockAvoidCircular.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.base.convert.InterlockBaseConvert;
+import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.mapper.InterlockBaseMapper;
+import org.jeecg.modules.base.service.IInterlockBaseService;
+import org.jeecg.modules.base.vo.InterlockBaseVo;
+import org.jeecg.modules.detail.entity.InterlockDetail;
+import org.jeecg.modules.detail.service.IInterlockDetailService;
+import org.jeecg.modules.interlockAvoidCircular.entity.InterlockSumSystemDetailList;
+import org.jeecg.modules.interlockAvoidCircular.mapper.InterlockAvoidCircularMapper;
+import org.jeecg.modules.interlockAvoidCircular.service.InterlockAvoidCircularService;
+import org.jeecg.modules.iotedgeCollectData.entity.IotedgeCollectData;
+import org.jeecg.modules.iotedgeCollectData.service.IIotedgeCollectDataService;
+import org.jeecg.modules.iotedgeCollectData.service.RestClientService;
+import org.jeecg.modules.summary.constants.InterlockAllStatus;
+import org.jeecg.modules.summary.entity.InterlockSummary;
+import org.jeecg.modules.summary.service.IInterlockSummaryService;
+import org.jeecg.modules.temp.convert.TempConvert;
+import org.jeecg.modules.temp.entity.InterlockDetailTemp;
+import org.jeecg.modules.temp.entity.InterlockSummaryTemp;
+import org.jeecg.modules.temp.service.IInterlockDetailTempService;
+import org.jeecg.modules.temp.service.IInterlockSummaryTempService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.Duration;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * ClassName: InterlockAvoidCircularServiceImpl
+ * Package: org.jeecg.modules.interlockAvoidCircular.service.impl
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/28 10:14
+ * @Version 1.0
+ */
+@Service
+@Slf4j
+public class InterlockAvoidCircularServiceImpl implements InterlockAvoidCircularService {
+
+    @Autowired
+    private RestClientService restClientService;
+
+    @Autowired
+    private IInterlockBaseService baseService;
+
+    @Autowired
+    private IInterlockSummaryService interlockSummaryService;
+
+    @Autowired
+    private IInterlockDetailService interlockDetailService;
+
+    @Autowired
+    private IInterlockSummaryTempService interlockSummaryTempService;
+
+    @Autowired
+    private IInterlockDetailTempService interlockDetailTempService;
+
+    @Autowired
+    private InterlockAvoidCircularMapper interlockAvoidCircularMapper;
+    @Autowired
+    @SuppressWarnings("all")
+    private IIotedgeCollectDataService iotedgeCollectDataService;
+
+    private static final String SUCCESS_CODE = "200";
+    private static final String ERROR_CODE_ONE = "400";
+    private static final String ERROR_CODE_TWO = "500";
+
+    /**
+     *  修改系统配置
+     **/
+    @Override
+    public String updateGroup(InterlockBaseVo interlockBaseVo, HttpServletRequest request){
+        String resultCode = SUCCESS_CODE;
+
+        String groupName = interlockBaseVo.getGroupName();
+
+        InterlockBase interlockBase = InterlockBaseConvert.INSTANCE.toInterlockBase(interlockBaseVo);
+
+        InterlockBase base = baseService.getById(interlockBase);
+
+        baseService.updateInterlockBase(interlockBase);
+
+        updateInterlockSummaryStatus(interlockBase);//更新该系统下的所有联锁的联锁状态以及回路健康等级
+
+        if ("1".equals(interlockBase.getInterlockType())){
+            try {
+                JSONObject jsonObject = restClientService.updateGroup(groupName, base.getIotedgeGroupId());
+            } catch (Exception e) {
+                log.info("修改系统名称时,修改IoTEdge中对应组织的名称失败");
+                resultCode = ERROR_CODE_TWO;
+            }
+        }
+
+        if ("0".equals(interlockBase.getInterlockType())){
+            int count = 0;
+            List<InterlockBase> list = baseService.getListByPId(interlockBase.getId());
+            for (InterlockBase item : list) {
+                try {
+                    JSONObject jsonObject = restClientService.updateGroup(interlockBase.getInterlockName() + "_" + item.getInterlockName(), item.getIotedgeGroupId());
+                } catch (Exception e) {
+                    log.info("修改装置名称时,遍历修改IoTEdge中相关组织的名称失败");
+                    count++;
+                }
+            }
+            if (count > 0){
+                resultCode = ERROR_CODE_TWO;
+            }
+        }
+        return resultCode;
+    }
+
+    /**
+     * 修改系统时,修改联锁总表的联锁状态和回路健康等级
+     *
+     * @param base
+     */
+    public void updateInterlockSummaryStatus(InterlockBase base){
+        // 获取当前日期时间
+        LocalDateTime currentDateTime = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedDateTime = currentDateTime.format(formatter);
+
+        // 1.系统设置的各状态
+        // 控制系统状态(输入卡件状态、输出卡件状态、MP状态)
+        String controlSystemStatusNormal = base.getControlSystemStatusNormal(); //正常状态: 如正常
+        String controlSystemStatusAbnormal = editStatus(base.getControlSystemStatusNormal()); //故障状态:如非正常
+        // 旁路状态
+        String bypassYes = base.getBypassYes(); //正常状态: 如否、非旁路
+        String bypassNo = editStatus(base.getBypassYes()); //故障状态:如是、旁路
+        // 仪表状态
+        String instrumentStatusNormal = base.getInstrumentStatusNormal(); //正常状态:如正常
+        String instrumentStatusAbnormal = editStatus(base.getInstrumentStatusNormal()); //故障状态:如非正常
+        // 联锁状态
+        String interlockStatusTy = base.getInterlockStatusTy(); //正常状态: 如投用
+        String interlockStatusWty = editStatus(base.getInterlockStatusTy()); //故障状态:如未投用
+
+
+        //3.先查找该系统下的联锁总表信息
+        //需要更新的联锁总表信息
+        List<InterlockSummary> interlockSummaryNewList = new ArrayList<>();
+        //需要更新的联锁详细表信息
+        List<InterlockDetail> interlockDetailNewList = new ArrayList<>();
+        //需要更新的联锁总表临时表信息
+        List<InterlockSummaryTemp> interlockSummaryTempList = new ArrayList<>();
+        //需要更新的联锁详细数据临时表信息
+        List<InterlockDetailTemp> interlockDetailTempList = new ArrayList<>();
+
+        //根据系统id查找所有联锁总表信息
+        List<InterlockSummary> interlockSummaryList = interlockAvoidCircularMapper.getInterlockSummaryListBySystemId(base.getId());
+
+        for(InterlockSummary interlockSummary:interlockSummaryList){
+            //2.设置各状态默认值
+            String interlockStatus = interlockStatusTy;;//	先设置为 联锁状态-投用
+            String loopHealthLevel = "A";// 回路健康级别
+            String controlSystemStatus = controlSystemStatusNormal;// 总体 先设置为 控制系统状态-正常
+            String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
+            String bypass = bypassYes;// 总体 先设置为 旁路状态-非旁路
+            //根据总表id查找联锁详细表信息并进行处理
+            List<InterlockDetail> interlockDetailList = interlockAvoidCircularMapper.getInterlockDetailListBySummaryId(interlockSummary.getId());
+
+            for(InterlockDetail interlockDetail:interlockDetailList){
+                //联锁状态:旁路状态多个的话,任何一个旁路状态是故障状态,则联锁状态是故障状态,如果旁路状态都是正常状态,则联锁状态是正常状态
+                if(interlockDetail.getBypass()!=null && bypassNo.equals(interlockDetail.getBypass())) interlockStatus = interlockStatusWty;
+                //仪表状态
+                if(interlockDetail.getInstrumentStatusJuge()!=null){
+                    if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE0.equals(interlockDetail.getInstrumentStatusJuge())){
+                        //0直接读取位号
+                        interlockDetail.setInstrumentStatus(interlockDetail.getInstrumentStatusValue());
+                    } else if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE1.equals(interlockDetail.getInstrumentStatusJuge())){
+                        //1高低限判断
+                        BigDecimal ysmnlValue = new BigDecimal(interlockDetail.getYsmnlValue());
+                        BigDecimal lowerLimit = new BigDecimal(interlockDetail.getLowerLimit());
+                        BigDecimal upperLimit = new BigDecimal(interlockDetail.getUpperLimit());
+                        if(ysmnlValue.compareTo(lowerLimit) >= 0 && ysmnlValue.compareTo(upperLimit) <= 0) interlockDetail.setInstrumentStatus(instrumentStatusNormal); // 正常
+                        else interlockDetail.setInstrumentStatus(instrumentStatusAbnormal); // 故障
+
+                    } else if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE2.equals(interlockDetail.getInstrumentStatusJuge())){ //2突变超限判断
+                        //通过判断原始模拟量位号突变(与iotedge_collect_data表的数据进行比较)超过某阈值得出值
+                        // 去采集数据表中根据 设备id+模块名称+点位名称 查询设置的s之前的数据
+                        String yz = interlockDetail.getThresholdValue();  // 阈值
+                        String time = interlockDetail.getThresholdTime();  // 规定的时间
+                        String dw = interlockDetail.getThresholdTimeUnit();   // 时间单位
+
+                        if ("s".equals(dw)){
+                            // 本次原始模拟量值
+                            BigDecimal ysmnlValue = new BigDecimal(interlockDetail.getYsmnlValue());
+
+                            // 查询上一次原始模拟量值
+                            String endDate = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");  // 当前时间 规定时间的结束时间
+                            LocalDateTime endDateTime = LocalDateTime.parse(endDate, formatter);
+                            LocalDateTime beginDateTime = endDateTime.minus(Duration.ofSeconds(Long.parseLong(time)));
+                            String beginDate = beginDateTime.format(formatter);  // 开始时间 规定时间的开始时间
+
+                            IotedgeCollectData iotedgeData = iotedgeCollectDataService.getOneInfo(interlockDetail.getYsmnlDeviceId(),interlockDetail.getYsmnlModuleName(),interlockDetail.getYsmnlTag(),beginDate);
+                            BigDecimal beginValue = new BigDecimal(iotedgeData.getValue());
+                            BigDecimal num = ysmnlValue.subtract(beginValue);
+
+                            // (高限-底限) * 阈值  (数据库中的阈值是去掉百分比的直接乘即可)
+                            BigDecimal lowerLimit = new BigDecimal(interlockDetail.getLowerLimit());
+                            BigDecimal upperLimit = new BigDecimal(interlockDetail.getUpperLimit());
+
+                            BigDecimal number = upperLimit.subtract(lowerLimit);
+                            BigDecimal newYz = number.multiply(new BigDecimal(yz));
+//                        if ((num.divide(beginValue).compareTo(newYz)) > 0){
+//                            dto.setInstrumentStatus(instrumentStatusAbnormal); // 故障
+//                        }else dto.setInstrumentStatus(instrumentStatusNormal); // 正常
+                            //有可能出现无限循环小数,保留三位小数
+                            if ((num.divide(beginValue,2, RoundingMode.HALF_UP).compareTo(newYz)) > 0){
+                                interlockDetail.setInstrumentStatus(instrumentStatusAbnormal); // 故障
+                            }else interlockDetail.setInstrumentStatus(instrumentStatusNormal); // 正常
+                        }
+
+
+                    } else if(InterlockAllStatus.INSTRUMENT_STATUS_JUDGE3.equals(interlockDetail.getInstrumentStatusJuge())){
+                        //3默认正常
+                        interlockDetail.setInstrumentStatus(instrumentStatusNormal);
+                    }
+
+                    if(interlockDetail.getInstrumentStatus()!=null && interlockDetail.getInstrumentStatus().equals(instrumentStatusAbnormal)) instrumentStatus = instrumentStatusAbnormal;
+                }
+                //控制系统状态 ——  MP状态、输入卡件状态、输出卡件状态任何一个非正常则控制系统状态非正常。
+                if(controlSystemStatusAbnormal.equals(interlockDetail.getMpStatus()) || controlSystemStatusAbnormal.equals(interlockDetail.getInputStatus()) || controlSystemStatusAbnormal.equals(interlockDetail.getOutputStatus())) {
+                    interlockDetail.setControlSystemStatus(controlSystemStatusAbnormal); // 非正常
+                    controlSystemStatus = controlSystemStatusAbnormal;
+                } else interlockDetail.setControlSystemStatus(controlSystemStatusNormal); // 正常
+                interlockDetailNewList.add(interlockDetail);
+                //新增联锁详细信息表临时表数据
+                InterlockDetailTemp detailTemp = TempConvert.INSTANCE.toInterlockDetailTemp(interlockDetail);
+                interlockDetailTempList.add(detailTemp);
+            }
+
+            //联锁状态
+            interlockSummary.setInterlockStatus(interlockStatus);
+            //回路健康等级
+            loopHealthLevel = getLHL(instrumentStatus, instrumentStatusAbnormal,interlockStatus, interlockStatusWty, controlSystemStatus, controlSystemStatusAbnormal);
+            interlockSummaryNewList.add(interlockSummary);
+            //修改联锁总表临时表数据
+            InterlockSummaryTemp interlockSummaryTemp = TempConvert.INSTANCE.toInterlockSummaryTemp(interlockSummary);
+            interlockSummaryTempList.add(interlockSummaryTemp);
+        }
+
+        //4.将联锁总表和详细表信息更新到数据库
+        interlockSummaryService.updateBatchById(interlockSummaryNewList);
+        interlockDetailService.updateBatchById(interlockDetailNewList);
+        interlockSummaryTempService.updateBatchById(interlockSummaryTempList);
+        interlockDetailTempService.updateBatchById(interlockDetailTempList);
+
+        return;
+    }
+
+    /**
+     * 改状态
+     */
+    private String editStatus(String status){
+        if("0".equals(status)) return "1";
+        else return "0";
+    }
+
+    /**
+     * 判断回路健康等级
+     */
+    private String getLHL(String instrumentStatus, String instrumentStatusAbnormal, String interlockStatus, String interlockStatusWty, String controlSystemStatus, String controlSystemStatusAbnormal){
+        int i = 0;
+        if(instrumentStatusAbnormal.equals(instrumentStatus)) i++; // 仪表状态-故障
+        if(interlockStatusWty.equals(interlockStatus)) i++; // TODO 联锁状态 未投用、投用 哪个算不正常状态 先按0未投用不正常算
+        if(controlSystemStatusAbnormal.equals(controlSystemStatus)) i++; // 控制系统状态-非正常
+        if(i==0)  return "A";
+        else if(i==1) return "B";
+        else if(i==2) return "C";
+        else return "D";
+    }
+
+
+}