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

增加系统自定义状态

丁治程 пре 2 месеци
родитељ
комит
549d7407a5

+ 121 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/binlog/PostgreSQLClient.java

@@ -159,6 +159,27 @@ public class PostgreSQLClient implements ApplicationRunner {
                         String ifBypass = (String) changeDataMap.get("if_bypass");  // 是否旁路  (若 "是" 则 bypass 等于 点位值;若 "否" 则 bypass 等于 输入值)
                         String tagTime = (String) changeDataMap.get("tag_time");   // 点位时间
 
+
+                        String sysPlStatus = (String) changeDataMap.get("bypass_ps");  // 系统定义的旁路状态 0否1是
+                        String sysPlStatusName = (String) changeDataMap.get("bypass_name");  // 系统定义的旁路状态名称 0否1是
+
+                        String sysYbStatus = (String) changeDataMap.get("instrument_status_ps");  // 系统定义的仪表状态 0正常1故障
+                        String sysYbStatusName = (String) changeDataMap.get("instrument_status_name");  // 系统定义的仪表状态名称 0正常1故障
+
+                        String sysKzxtStatus = (String) changeDataMap.get("instrument_status_ps");  // 系统定义的控制系统状态 0正常1非正常
+                        String sysKzxtStatusName = (String) changeDataMap.get("instrument_status_name");  // 系统定义的控制系统状态名称 0正常1非正常
+
+                        String sysInputStatus = (String) changeDataMap.get("input_status_ps");  // 系统定义的输入卡件状态 0正常1非正常
+                        String sysInputStatusName = (String) changeDataMap.get("input_status_name");  // 系统定义的输入卡件状态名称 0正常1非正常
+
+                        String sysOutputStatus = (String) changeDataMap.get("output_status_ps");  // 系统定义的输出卡件状态 0正常1非正常
+                        String sysOutputStatusName = (String) changeDataMap.get("output_status_name");  // 系统定义的输出卡件状态名称 0正常1非正常
+
+                        String sysMpStatus = (String) changeDataMap.get("mp_status_ps");  // 系统定义的MP状态 0正常1非正常
+                        String sysMpStatusName = (String) changeDataMap.get("mp_status_name");  // 系统定义的MP状态名称 0正常1非正常
+
+
+
                         // 根据联锁系统ID查询出 每个正常状态 对应的值
                         InterlockBase base = baseService.getById(systemId);
 
@@ -254,6 +275,79 @@ public class PostgreSQLClient implements ApplicationRunner {
                         upDetailQuery.eq("id",id);
                         detailService.update(upDetailQuery);
 
+                        if(baseYbNormalStatus.equals(ybStatus)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("instrument_status_ps","0").set("instrument_status_name","正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("instrument_status_ps","1").set("instrument_status_name","故障");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
+                        if (baseKzxtNormalStatus.equals(kzxtStatus)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("control_system_status_ps","0").set("control_system_status_name","正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("control_system_status_ps","1").set("control_system_status_name","非正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
+                        if (basePlNormalStatus.equals(plTag)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("bypass_ps","1").set("bypass_name","是");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("bypass_ps","0").set("bypass_name","否");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
+                        if (baseKzxtNormalStatus.equals(inputStatusTag)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("input_status_ps","0").set("input_status_name","正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("input_status_ps","1").set("input_status_name","非正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
+                        if (baseKzxtNormalStatus.equals(outputStatusTag)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("output_status_ps","0").set("output_status_name","正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("output_status_ps","1").set("output_status_name","非正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
+
+                        if (baseKzxtNormalStatus.equals(mpStatusTag)){
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("mp_status_ps","0").set("mp_status_name","正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }else {
+                            UpdateWrapper<InterlockDetail> u = new UpdateWrapper<>();
+                            u.set("mp_status_ps","1").set("mp_status_name","非正常");
+                            u.eq("id",id);
+                            detailService.update(upDetailQuery);
+                        }
+
                         // 根据总表id 查询数所有的联锁条件
                         String zdybzt = "0";   // 该联锁下 所有联锁条件的 (总)仪表状态
                         String zdkzxtzt = "0"; // 该联锁下 所有联锁条件的 (总)控制系统状态
@@ -340,6 +434,19 @@ public class PostgreSQLClient implements ApplicationRunner {
                         upSummaryQuery.eq("id",summaryId);
                         summaryService.update(upSummaryQuery);
 
+
+                        if (lsStatus.equals(baseLsNormalStatus)){
+                            UpdateWrapper<InterlockSummary> u = new UpdateWrapper<>();
+                            u.set("interlock_status_ps","1").set("interlock_status_name","投用");
+                            u.eq("id",summaryId);
+                            summaryService.update(upSummaryQuery);
+                        }else {
+                            UpdateWrapper<InterlockSummary> u = new UpdateWrapper<>();
+                            u.set("interlock_status_ps","0").set("interlock_status_name","未投用");
+                            u.eq("id",summaryId);
+                            summaryService.update(upSummaryQuery);
+                        }
+
                         // 只要有任意一个状态发生了变化 就将当前联锁、联锁条件记录到历史数据中  (可此时记录的状态确实是未改变之前的,但是点位值却是已经改变之后的)
                         if ("1".equals(ifYbStatus) || "1".equals(ifLsStatus) || "1".equals(ifKzxtStatus) || "1".equals(ifHljkjbStatus) || "1".equals(ifPlStatus)){
                             QueryWrapper<InterlockSummaryTemp> summaryTempQuery = new QueryWrapper<>();
@@ -378,6 +485,18 @@ public class PostgreSQLClient implements ApplicationRunner {
                                 .set("input_status",inputStatusTag)
                                 .set("output_status",outputStatusTag)
                                 .set("mp_status",mpStatusTag)
+                                .set("bypass_ps",sysPlStatus)
+                                .set("bypass_name",sysPlStatusName)
+                                .set("input_status_ps",sysInputStatus)
+                                .set("input_status_name",sysInputStatusName)
+                                .set("instrument_status_ps",sysYbStatus)
+                                .set("instrument_status_name",sysYbStatusName)
+                                .set("control_system_status_ps",sysKzxtStatus)
+                                .set("control_system_status_name",sysKzxtStatusName)
+                                .set("output_status_ps",sysOutputStatus)
+                                .set("output_status_name",sysOutputStatusName)
+                                .set("mp_status_ps",sysMpStatus)
+                                .set("mp_status_name",sysMpStatusName)
                                 .set("tag_time",tagTime);
                         upTempDetailQuery.eq("id",id);
                         detailTempService.update(upTempDetailQuery);
@@ -387,6 +506,8 @@ public class PostgreSQLClient implements ApplicationRunner {
                         upTempSummaryQuery.set("interlock_status",lsStatus)
                                 .set("loop_health_level",hljkjbStatus)
                                 .set("interlock_out_value",interLock.getInterlockOutValue())
+                                .set("interlock_status_ps",interLock.getInterlockStatusPs())
+                                .set("interlock_status_name",interLock.getInterlockStatusName())
                                 .set("tag_time",interLock.getTagTime());
                         upTempSummaryQuery.eq("id",summaryId);
                         summaryTempService.update(upTempSummaryQuery);