소스 검색

fix 联锁新增、编辑

LLL 2 달 전
부모
커밋
4e92407cd5
1개의 변경된 파일172개의 추가작업 그리고 13개의 파일을 삭제
  1. 172 13
      jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/service/impl/InterlockSummaryServiceImpl.java

+ 172 - 13
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/service/impl/InterlockSummaryServiceImpl.java

@@ -163,24 +163,40 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         // 系统设置的各状态
         InterlockBase base = interlockBaseService.getById(interlockAddDTO.getInterlockSystemId());
+
+
         // 控制系统状态(输入卡件状态、输出卡件状态、MP状态)
         String controlSystemStatusNormal = base.getControlSystemStatusNormal(); // 正常
         String controlSystemStatusAbnormal = editStatus(base.getControlSystemStatusNormal()); // 非正常
+        String controlSystemStatusNormalName = base.getControlSystemStatusNormalName(); // 正常-名称
+        String controlSystemStatusAbnormalName = base.getControlSystemStatusAbnormalName(); // 非正常-名称
+
+        String controlSystemStatus = controlSystemStatusNormal;// 总体 先设置为 控制系统状态-正常
+
         // 旁路状态
         String bypassYes = base.getBypassYes(); // 是
+        String bypassYesName = base.getBypassYesName(); // 是-名称
+        String bypassNoName = base.getBypassNoName(); // 是-名称
+
         // 仪表状态
         String instrumentStatusNormal = base.getInstrumentStatusNormal(); // 正常
-        String instrumentStatusAbnormal = editStatus(base.getInstrumentStatusNormal()); // 正常
+        String instrumentStatusAbnormal = editStatus(base.getInstrumentStatusNormal()); // 非正常
+        String instrumentStatusNormalName = base.getInstrumentStatusNormalName(); // 正常-名称
+        String instrumentStatusAbnormalName = base.getInstrumentStatusAbnormalName(); // 非正常名称
+
+        String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
+
         // 联锁状态
         String interlockStatusTy = base.getInterlockStatusTy(); // 投用
         String interlockStatusWty = editStatus(base.getInterlockStatusTy()); // 未投用
-
+        String interlockStatusTyName = base.getInterlockStatusTyName(); // 投用-名称
+        String interlockStatusWtyName = base.getInterlockStatusWtyName(); // 未投用-名称
 
         String interlockStatus = interlockStatusTy;;//	先设置为 联锁状态-投用
-        String loopHealthLevel = "A";// 回路健康级别
+        String interlockStatusName = interlockStatusTyName; // 联锁状态-名称,先设置为 联锁状态-投用
+        String interlockStatusPs = InterlockAllStatus.INTERLOCK_STATUS_TY; // 联锁状态-名称,先设置为 联锁状态-投用
 
-        String controlSystemStatus = controlSystemStatusNormal;// 总体 先设置为 控制系统状态-正常
-        String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
+        String loopHealthLevel = "";// 回路健康级别
 
 
         //删除该联锁的所有联锁详细信息的所有点位
@@ -202,12 +218,41 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         for (InterlockDetailAddDTO dto : interlockDetailAddDTOList){
 
+            //控制系统状态-先设置为正常
+            String controlSystemStatusName = controlSystemStatusNormalName; //正常
+            String controlSystemStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //旁路状态-先设置为是
+            String bypassName = bypassYesName; // 旁路状态-是
+            String bypassPs = InterlockAllStatus.BY_PASS_YES; // 旁路状态-是
+            // 仪表状态-先设置为正常
+            String instrumentStatusName = instrumentStatusNormalName; //正常
+            String instrumentStatusPs = InterlockAllStatus.INSTRUMENT_STATUS_NORMAL; //正常
+            //输入卡件状态-先设置为正常
+            String inputStatusName = controlSystemStatusNormalName; //正常
+            String inputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //输出卡件状态-先设置为正常
+            String outputStatusName = controlSystemStatusNormalName; //正常
+            String outputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //MP状态-先设置为正常
+            String mpStatusName = controlSystemStatusNormalName; //正常
+            String mpStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+
             dto.setThresholdTimeUnit("s"); // TODO 暂定单位为秒
             dto.setSummaryid(summaryId);
 
 
             //联锁状态; 旁路状态是多个的话,任何一个旁路状态为“是”,则联锁状态是“未投用(摘除)”,旁路状态都为“否”,则联锁状态是“投用”。
-            if(dto.getBypass()!=null && bypassYes.equals(dto.getBypass())) interlockStatus = interlockStatusWty;
+            if(dto.getBypass()!=null && bypassYes.equals(dto.getBypass())){
+                interlockStatus = interlockStatusWty;
+                interlockStatusName = interlockStatusWtyName;
+                interlockStatusPs = InterlockAllStatus.INTERLOCK_STATUS_WTY;
+            }
+            if(dto.getBypass()!=null && !bypassYes.equals(dto.getBypass())){
+                bypassName = bypassNoName; // 旁路状态-是
+                bypassPs = InterlockAllStatus.BY_PASS_NO; // 旁路状态-是
+            }
+            dto.setBypassName(bypassName);
+            dto.setBypassPs(bypassPs);
 
             //仪表状态
             if(dto.getInstrumentStatusJuge()!=null){
@@ -257,14 +302,46 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
                 }
 
-                if(dto.getInstrumentStatus()!=null && dto.getInstrumentStatus().equals(instrumentStatusAbnormal)) instrumentStatus = instrumentStatusAbnormal;
+                if(dto.getInstrumentStatus()!=null && dto.getInstrumentStatus().equals(instrumentStatusAbnormal)){
+                    instrumentStatus = instrumentStatusAbnormal;
+                    instrumentStatusPs = InterlockAllStatus.INSTRUMENT_STATUS_GZ;
+                    instrumentStatusName = instrumentStatusAbnormalName;
+                }
+                dto.setInstrumentStatusName(instrumentStatusName);
+                dto.setInstrumentStatusPs(instrumentStatusPs);
+            }
+
+            // MP状态、输入卡件状态、输出卡件状态
+            if(!dto.getInputStatus().equals(controlSystemStatusNormal)){
+                inputStatusName = controlSystemStatusAbnormalName ; //不正常
+                inputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+            }
+            dto.setInputStatusPs(inputStatusPs);
+            dto.setInputStatusName(inputStatusName);
+
+            if(!dto.getOutputStatus().equals(controlSystemStatusNormal)){
+                outputStatusName = controlSystemStatusAbnormalName ; //不正常
+                outputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+            }
+            dto.setOutputStatusPs(outputStatusPs);
+            dto.setOutputStatusName(outputStatusName);
+
+            if(!dto.getMpStatus().equals(controlSystemStatusNormal)){
+                mpStatusName = controlSystemStatusAbnormalName ; //不正常
+                mpStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
             }
+            dto.setMpStatusPs(mpStatusPs);
+            dto.setMpStatusName(mpStatusName);
 
             //控制系统状态 ——  MP状态、输入卡件状态、输出卡件状态任何一个非正常则控制系统状态非正常。
             if(controlSystemStatusAbnormal.equals(dto.getMpStatus()) || controlSystemStatusAbnormal.equals(dto.getInputStatus()) || controlSystemStatusAbnormal.equals(dto.getOutputStatus())) {
                 dto.setControlSystemStatus(controlSystemStatusAbnormal); // 非正常
                 controlSystemStatus = controlSystemStatusAbnormal;
+                controlSystemStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+                controlSystemStatusName = controlSystemStatusAbnormalName;
             } else dto.setControlSystemStatus(controlSystemStatusNormal); // 正常
+            dto.setControlSystemStatusName(controlSystemStatusName);
+            dto.setControlSystemStatusPs(controlSystemStatusPs);
 
             InterlockDetail detail = InterlockDetailConvert.INSTANCE.toEntity(dto, interlockAddDTO.getInterlockName(),formattedDateTime, interlockAddDTO.getInterlockSystemId());
 
@@ -283,6 +360,8 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         InterlockSummary interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary1(interlockAddDTO,interlockStatus,loopHealthLevel);
         //修改联锁总表数据
+        interlockSummary.setInterlockStatusPs(interlockStatusPs);
+        interlockSummary.setInterlockStatusName(interlockStatusName);
         interlockSummaryMapper.updateById(interlockSummary);
         //修改联锁总表临时表数据
         InterlockSummaryTemp interlockSummaryTemp = TempConvert.INSTANCE.toInterlockSummaryTemp(interlockSummary);
@@ -304,24 +383,41 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         // 系统设置的各状态
         InterlockBase base = interlockBaseService.getById(interlockAddDTO.getInterlockSystemId());
+
+
         // 控制系统状态(输入卡件状态、输出卡件状态、MP状态)
         String controlSystemStatusNormal = base.getControlSystemStatusNormal(); // 正常
         String controlSystemStatusAbnormal = editStatus(base.getControlSystemStatusNormal()); // 非正常
+        String controlSystemStatusNormalName = base.getControlSystemStatusNormalName(); // 正常-名称
+        String controlSystemStatusAbnormalName = base.getControlSystemStatusAbnormalName(); // 非正常-名称
+
+        String controlSystemStatus = controlSystemStatusNormal;// 总体 先设置为 控制系统状态-正常
+
         // 旁路状态
         String bypassYes = base.getBypassYes(); // 是
+        String bypassYesName = base.getBypassYesName(); // 是-名称
+        String bypassNoName = base.getBypassNoName(); // 是-名称
+
         // 仪表状态
         String instrumentStatusNormal = base.getInstrumentStatusNormal(); // 正常
-        String instrumentStatusAbnormal = editStatus(base.getInstrumentStatusNormal()); // 正常
+        String instrumentStatusAbnormal = editStatus(base.getInstrumentStatusNormal()); // 非正常
+        String instrumentStatusNormalName = base.getInstrumentStatusNormalName(); // 正常-名称
+        String instrumentStatusAbnormalName = base.getInstrumentStatusAbnormalName(); // 非正常名称
+
+        String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
+
         // 联锁状态
         String interlockStatusTy = base.getInterlockStatusTy(); // 投用
         String interlockStatusWty = editStatus(base.getInterlockStatusTy()); // 未投用
-
+        String interlockStatusTyName = base.getInterlockStatusTyName(); // 投用-名称
+        String interlockStatusWtyName = base.getInterlockStatusWtyName(); // 未投用-名称
 
         String interlockStatus = interlockStatusTy;;//	先设置为 联锁状态-投用
+        String interlockStatusName = interlockStatusTyName; // 联锁状态-名称,先设置为 联锁状态-投用
+        String interlockStatusPs = InterlockAllStatus.INTERLOCK_STATUS_TY; // 联锁状态-名称,先设置为 联锁状态-投用
+
         String loopHealthLevel = "";// 回路健康级别
 
-        String controlSystemStatus = controlSystemStatusNormal;// 总体 先设置为 控制系统状态-正常
-        String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
 
         //新增——联锁总表数据
         InterlockSummary interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary(interlockAddDTO);
@@ -334,12 +430,41 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         for (InterlockDetailAddDTO dto : interlockDetailAddDTOList){
 
+            //控制系统状态-先设置为正常
+            String controlSystemStatusName = controlSystemStatusNormalName; //正常
+            String controlSystemStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //旁路状态-先设置为是
+            String bypassName = bypassYesName; // 旁路状态-是
+            String bypassPs = InterlockAllStatus.BY_PASS_YES; // 旁路状态-是
+            // 仪表状态-先设置为正常
+            String instrumentStatusName = instrumentStatusNormalName; //正常
+            String instrumentStatusPs = InterlockAllStatus.INSTRUMENT_STATUS_NORMAL; //正常
+            //输入卡件状态-先设置为正常
+            String inputStatusName = controlSystemStatusNormalName; //正常
+            String inputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //输出卡件状态-先设置为正常
+            String outputStatusName = controlSystemStatusNormalName; //正常
+            String outputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+            //MP状态-先设置为正常
+            String mpStatusName = controlSystemStatusNormalName; //正常
+            String mpStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_NORMAL; //正常
+
             dto.setThresholdTimeUnit("s"); // TODO 暂定单位为秒
             dto.setSummaryid(summaryId);
 
 
             //联锁状态; 旁路状态是多个的话,任何一个旁路状态为“是”,则联锁状态是“未投用(摘除)”,旁路状态都为“否”,则联锁状态是“投用”。
-            if(dto.getBypass()!=null && bypassYes.equals(dto.getBypass())) interlockStatus = interlockStatusWty;
+            if(dto.getBypass()!=null && bypassYes.equals(dto.getBypass())){
+                interlockStatus = interlockStatusWty;
+                interlockStatusName = interlockStatusWtyName;
+                interlockStatusPs = InterlockAllStatus.INTERLOCK_STATUS_WTY;
+            }
+            if(dto.getBypass()!=null && !bypassYes.equals(dto.getBypass())){
+                bypassName = bypassNoName; // 旁路状态-是
+                bypassPs = InterlockAllStatus.BY_PASS_NO; // 旁路状态-是
+            }
+            dto.setBypassName(bypassName);
+            dto.setBypassPs(bypassPs);
 
             //仪表状态
             if(dto.getInstrumentStatusJuge()!=null){
@@ -389,14 +514,46 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
                     }
                 }
 
-                if(dto.getInstrumentStatus()!=null && dto.getInstrumentStatus().equals(instrumentStatusAbnormal)) instrumentStatus = instrumentStatusAbnormal;
+                if(dto.getInstrumentStatus()!=null && dto.getInstrumentStatus().equals(instrumentStatusAbnormal)){
+                    instrumentStatus = instrumentStatusAbnormal;
+                    instrumentStatusPs = InterlockAllStatus.INSTRUMENT_STATUS_GZ;
+                    instrumentStatusName = instrumentStatusAbnormalName;
+                }
+                dto.setInstrumentStatusName(instrumentStatusName);
+                dto.setInstrumentStatusPs(instrumentStatusPs);
+            }
+
+            // MP状态、输入卡件状态、输出卡件状态
+            if(!dto.getInputStatus().equals(controlSystemStatusNormal)){
+                inputStatusName = controlSystemStatusAbnormalName ; //不正常
+                inputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+            }
+            dto.setInputStatusPs(inputStatusPs);
+            dto.setInputStatusName(inputStatusName);
+
+            if(!dto.getOutputStatus().equals(controlSystemStatusNormal)){
+                outputStatusName = controlSystemStatusAbnormalName ; //不正常
+                outputStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+            }
+            dto.setOutputStatusPs(outputStatusPs);
+            dto.setOutputStatusName(outputStatusName);
+
+            if(!dto.getMpStatus().equals(controlSystemStatusNormal)){
+                mpStatusName = controlSystemStatusAbnormalName ; //不正常
+                mpStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
             }
+            dto.setMpStatusPs(mpStatusPs);
+            dto.setMpStatusName(mpStatusName);
 
             //控制系统状态 ——  MP状态、输入卡件状态、输出卡件状态任何一个非正常则控制系统状态非正常。
             if(controlSystemStatusAbnormal.equals(dto.getMpStatus()) || controlSystemStatusAbnormal.equals(dto.getInputStatus()) || controlSystemStatusAbnormal.equals(dto.getOutputStatus())) {
                 dto.setControlSystemStatus(controlSystemStatusAbnormal); // 非正常
                 controlSystemStatus = controlSystemStatusAbnormal;
+                controlSystemStatusPs = InterlockAllStatus.CONTROL_SYSTEM_STATUS_ABNORMAL;
+                controlSystemStatusName = controlSystemStatusAbnormalName;
             } else dto.setControlSystemStatus(controlSystemStatusNormal); // 正常
+            dto.setControlSystemStatusName(controlSystemStatusName);
+            dto.setControlSystemStatusPs(controlSystemStatusPs);
 
             InterlockDetail detail = InterlockDetailConvert.INSTANCE.toEntity(dto, interlockAddDTO.getInterlockName(), formattedDateTime, interlockAddDTO.getInterlockSystemId());
             //新增联锁详细信息表数据
@@ -415,6 +572,8 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
 
         interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary2(interlockSummary,interlockStatus,loopHealthLevel);
         //修改联锁总表数据
+        interlockSummary.setInterlockStatusPs(interlockStatusPs);
+        interlockSummary.setInterlockStatusName(interlockStatusName);
         interlockSummaryMapper.updateById(interlockSummary);
         //新增联锁总表临时表数据
         InterlockSummaryTemp interlockSummaryTemp = TempConvert.INSTANCE.toInterlockSummaryTemp(interlockSummary);