瀏覽代碼

修正升压站报警异常

shilin 1 年之前
父節點
當前提交
2cd6b8cbb0

+ 1 - 1
alarm-custom/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -368,7 +368,7 @@ public class CacheContext implements CommandLineRunner {
 //            });
 //        }
 
-        wtls = proBasicEquipmentService.list().stream().filter(i->i.getIsable()==1).collect(Collectors.toList());
+        wtls = proBasicEquipmentService.list().stream().filter(i->runWpids.contains(i.getWindpowerstationId()) &&  i.getIsable()==1).collect(Collectors.toList());
         logger.info(wtls.size()+"");
         wtls.forEach(wt->{
             if(modelMap.containsKey(wt.getModelId()))

+ 1 - 1
alarm-custom/src/main/java/com/gyee/alarm/service/AlarmCustomService.java

@@ -104,7 +104,7 @@ public class AlarmCustomService {
             }
         }
 
-        List<ProBasicPowerstationPoint> wsPointList = CacheContext.wsPointList; //升压站测点集合
+//        List<ProBasicPowerstationPoint> wsPointList = CacheContext.wsPointList; //升压站测点集合
 
         //读取设备测点
         List<ProBasicEquipmentPoint> wtpols = new ArrayList<>();

+ 4 - 4
alarm-service/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -708,7 +708,7 @@ public class CacheContext implements CommandLineRunner {
                     ls.add(vo);
                     alarmWpMap.put(vo.getStationid(),ls);
                 }
-                alarmWtMap.put(vo.getTbName(),vo);
+                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
         //逆变器报警初始化标签
@@ -717,7 +717,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmInList)
             {
-                alarmInMap.put(vo.getTbName(),vo);
+                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
 
@@ -728,7 +728,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmBtList)
             {
-                alarmBtMap.put(vo.getTbName(),vo);
+                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
         //自定义报警初始化标签
@@ -737,7 +737,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmCtList)
             {
-                alarmCtMap.put(vo.getTbName(),vo);
+                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
 

+ 5 - 2
alarm-service/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -49,13 +49,16 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
 //tagid NCHAR(100),报警触发测点
 //triggertype INT,触发条件
 //uniformcode NCHAR(50)统一编码
-
+//name 故障名称
+//faultCause   故障原因
+//resolvent   解决方法
+//aname    别名
     @Update("CREATE STABLE if not exists ${superTableName} (ts TIMESTAMP,val INT,confirmed BOOL,endts TIMESTAMP,timeLong DOUBLE) " +
             "TAGS (alarmid NCHAR(100),alarmtype NCHAR(50),characteristic NCHAR(50)," +
             "components NCHAR(50),description NCHAR(500),deviceid NCHAR(50),devicename NCHAR(70)," +
             "devicetype NCHAR(50),enabled BOOL,lineid NCHAR(50),linename NCHAR(70),modelId NCHAR(50),projectid NCHAR(50)," +
             "projectname NCHAR(70),rank INT,resettable BOOL,stationid NCHAR(50),stationname NCHAR(70),subcomponents NCHAR(50)," +
-            "suffix NCHAR(50),tagid NCHAR(100),triggertype INT,uniformcode NCHAR(50),name NCHAR(100),nemCode NCHAR(50),faultCause NCHAR(500),resolvent NCHAR(500),faultType NCHAR(50),aname NCHAR(50) " +
+            "suffix NCHAR(50),tagid NCHAR(100),triggertype INT,uniformcode NCHAR(50),name NCHAR(100),nemCode NCHAR(50),faultCause NCHAR(1000),resolvent NCHAR(1000),faultType NCHAR(50),aname NCHAR(50) " +
             ")")
     int createAlarmSuperTable(@Param("superTableName") String superTableName);
 

+ 22 - 21
alarm-service/src/main/java/com/gyee/alarm/websocket/WebSocket.java

@@ -117,7 +117,7 @@ public class WebSocket {
      */
     @OnError
     public void onError(Session session, Throwable error)   {
-        logger.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
+
         error.printStackTrace();
 
 
@@ -164,26 +164,27 @@ public class WebSocket {
             }
         }catch (Exception e)
         {
-            if(StringUtils.notEmp(userId) && webSocketMap.containsKey(userId))
-            {
-                webSocketMap.remove(userId);
-                subOnlineCount();           //在线数减1
-                logger.info("用户{}关闭连接!当前在线人数为{}", userId, getOnlineCount());
-            }
-
-            try {
-                if(StringUtils.notEmp(session))
-                {
-                    session.close();
-                    logger.info("用户错误:" + this.userId + ",关闭session:" );
-                }else
-                {
-                    logger.info( ",session:null" );
-                }
-            }catch (IOException io)
-            {
-
-            }
+            logger.error("用户错误:" + this.userId + ",原因:" + e.getStackTrace());
+//            if(StringUtils.notEmp(userId) && webSocketMap.containsKey(userId))
+//            {
+//                webSocketMap.remove(userId);
+//                subOnlineCount();           //在线数减1
+//                logger.info("用户{}关闭连接!当前在线人数为{}", userId, getOnlineCount());
+//            }
+//
+//            try {
+//                if(StringUtils.notEmp(session))
+//                {
+//                    session.close();
+//                    logger.info("用户错误:" + this.userId + ",关闭session:" );
+//                }else
+//                {
+//                    logger.info( ",session:null" );
+//                }
+//            }catch (IOException io)
+//            {
+//                logger.error("用户错误:" + this.userId + ",原因:" + io.getMessage());
+//            }
         }
 
 

+ 0 - 1
alarm-service/src/test/java/com/gyee/AppTest.java

@@ -24,7 +24,6 @@ public class AppTest
 
 
         alarmWtService.createSuperTable();
-
         alarmWtService.initalWtAlarm();
         alarmInService.initalInAlarm();
 

+ 4 - 4
alarm-web/src/main/java/com/gyee/alarm/init/CacheContext.java

@@ -790,7 +790,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmWtList)
             {
-                alarmWtMap.put(vo.getTbName(),vo);
+                alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
         //逆变器报警初始化标签
@@ -799,7 +799,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmInList)
             {
-                alarmInMap.put(vo.getTbName(),vo);
+                alarmInMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
 
@@ -810,7 +810,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmBtList)
             {
-                alarmBtMap.put(vo.getTbName(),vo);
+                alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
         //自定义报警初始化标签
@@ -819,7 +819,7 @@ public class CacheContext implements CommandLineRunner {
         {
             for(AlarmVo vo: alarmCtList)
             {
-                alarmCtMap.put(vo.getTbName(),vo);
+                alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
             }
         }
 //        inputOrOutPutService.initialInputOrOutputSpeed();

+ 75 - 66
alarm-web/src/main/java/com/gyee/alarm/service/AlarmHistoryService.java

@@ -131,18 +131,20 @@ public class AlarmHistoryService   {
 
                     if(null !=tag.getTs())
                     {
-                        alarm.setTs(tag.getTs().getTime());
-                        if(StringUtils.notEmp(tag.getVal()))
-                        {
-                            alarm.setVal(tag.getVal().doubleValue());
-                        }
-
+//                        alarm.setTs(tag.getTs().getTime());
+//                        if(StringUtils.notEmp(tag.getVal()))
+//                        {
+//                            alarm.setVal(tag.getVal().doubleValue());
+//                        }
+//
                         alarm.setEndts(null!=tag.getEndts()?tag.getEndts().getTime():null);
                         alarm.setTimeLong(null!=tag.getTimelong()?tag.getTimelong():null);
+//                        alarm.setConfirmed(true);
+//                        savels.add(alarm);
+                    }
+                    alarm.setVal(1.0);
                         alarm.setConfirmed(true);
                         savels.add(alarm);
-                    }
-
                 }
             }
 
@@ -154,50 +156,57 @@ public class AlarmHistoryService   {
                 List<ProEconAlarmInfo> valuels = new ArrayList<>();
                 for (AlarmTag alarm : savels) {
                     AlarmVo vo =null;
-                    if (CacheContext.alarmWtMap.containsKey(alarm.getId())) {
-                         vo = CacheContext.alarmWtMap.get(alarm.getId());
-                    }else if (CacheContext.alarmInMap.containsKey(alarm.getId())) {
-                        vo = CacheContext.alarmInMap.get(alarm.getId());
-                    }else if (CacheContext.alarmBtMap.containsKey(alarm.getId())) {
-                        vo = CacheContext.alarmBtMap.get(alarm.getId());
-                    }else if (CacheContext.alarmCtMap.containsKey(alarm.getId())) {
-                        vo = CacheContext.alarmCtMap.get(alarm.getId());
+                    if (CacheContext.alarmWtMap.containsKey(alarm.getId().toUpperCase())) {
+                         vo = CacheContext.alarmWtMap.get(alarm.getId().toUpperCase());
+                    }else if (CacheContext.alarmInMap.containsKey(alarm.getId().toUpperCase())) {
+                        vo = CacheContext.alarmInMap.get(alarm.getId().toUpperCase());
+                    }else if (CacheContext.alarmBtMap.containsKey(alarm.getId().toUpperCase())) {
+                        vo = CacheContext.alarmBtMap.get(alarm.getId().toUpperCase());
+                    }else if (CacheContext.alarmCtMap.containsKey(alarm.getId().toUpperCase())) {
+                        vo = CacheContext.alarmCtMap.get(alarm.getId().toUpperCase());
                     }
 
-                    ProEconAlarmInfo po = new ProEconAlarmInfo();
-                    po.setTbname(vo.getTbName());
-                    po.setLastUpdateTime(new Date());
-                    po.setTagId(vo.getTagid());
-                    po.setTriggerType(vo.getTriggertype());
-                    po.setAlarmId(vo.getAlarmId());
-                    po.setDeviceId(vo.getDeviceId());
-                    po.setSubcomponents(vo.getSuffix());
-                    po.setRank(vo.getRank());
-                    po.setConfirmed(alarm.getConfirmed());
-                    po.setUniformCode(vo.getUniformcode());
-                    po.setAlarmType(vo.getAlarmType());
-                    po.setDeviceType(vo.getDeviceType());
-                    po.setComponents(vo.getComponents());
-                    po.setSubcomponents(vo.getSubcomponents());
-                    po.setDescription(vo.getDescription());
-                    po.setModelId(vo.getModelId());
-                    po.setResetTable(vo.getResettable());
-                    po.setEnable(vo.getEnabled());
-                    po.setCharacteristic(vo.getCharacteristic());
-                    po.setStationId(vo.getStationid());
-                    po.setProjectId(vo.getProjectid());
-                    po.setLineId(vo.getLineid());
-                    po.setStationName(vo.getStationname());
-                    po.setProjectiName(vo.getProjectname());
-                    po.setLineidName(vo.getLinename());
-                    po.setDeviceName(vo.getDevicename());
-                    po.setOval(alarm.getOval().intValue());
-                    po.setCloseTime(null!=alarm.getEndts()?new Date(alarm.getEndts()):null);
-                    po.setIsOpen(0);
-                    po.setVal(alarm.getVal().intValue());
-
-
-                    tempmap.put(po.getTbname(),po);
+                    if(StringUtils.notEmp(vo) && StringUtils.notEmp(vo.getTbName()))
+                    {
+                        ProEconAlarmInfo po = new ProEconAlarmInfo();
+
+
+                        po.setTbname(vo.getTbName());
+                        po.setLastUpdateTime(new Date());
+                        po.setTagId(vo.getTagid());
+                        po.setTriggerType(vo.getTriggertype());
+                        po.setAlarmId(vo.getAlarmId());
+                        po.setDeviceId(vo.getDeviceId());
+                        po.setSubcomponents(vo.getSuffix());
+                        po.setRank(vo.getRank());
+                        po.setConfirmed(alarm.getConfirmed());
+                        po.setUniformCode(vo.getUniformcode());
+                        po.setAlarmType(vo.getAlarmType());
+                        po.setDeviceType(vo.getDeviceType());
+                        po.setComponents(vo.getComponents());
+                        po.setSubcomponents(vo.getSubcomponents());
+                        po.setDescription(vo.getDescription());
+                        po.setModelId(vo.getModelId());
+                        po.setResetTable(vo.getResettable());
+                        po.setEnable(vo.getEnabled());
+                        po.setCharacteristic(vo.getCharacteristic());
+                        po.setStationId(vo.getStationid());
+                        po.setProjectId(vo.getProjectid());
+                        po.setLineId(vo.getLineid());
+                        po.setStationName(vo.getStationname());
+                        po.setProjectiName(vo.getProjectname());
+                        po.setLineidName(vo.getLinename());
+                        po.setDeviceName(vo.getDevicename());
+                        po.setOval(0);
+                        po.setCloseTime(null!=alarm.getEndts()?new Date(alarm.getEndts()):null);
+                        po.setIsOpen(0);
+                        po.setVal(alarm.getVal().intValue());
+
+
+                        tempmap.put(po.getTbname(),po);
+                    }
+
+
                 }
 
 
@@ -509,19 +518,19 @@ public class AlarmHistoryService   {
             {
                 if(AlarmTime.H.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else if(AlarmTime.M.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else
                 {
-                    d.setTime(fs.getAvgSeconds());
+                    d.setTime(fs.getTotalSeconds());
                 }
             }else
             {
-                double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                 d.setTime(times);
             }
 
@@ -703,19 +712,19 @@ public class AlarmHistoryService   {
             {
                 if(AlarmTime.H.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else if(AlarmTime.M.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else
                 {
-                    d.setTime(fs.getAvgSeconds());
+                    d.setTime(fs.getTotalSeconds());
                 }
             }else
             {
-                double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                 d.setTime(times);
             }
             d.setStationId(fs.getStationId());
@@ -823,19 +832,19 @@ public class AlarmHistoryService   {
             {
                 if(AlarmTime.H.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else if(AlarmTime.M.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else
                 {
-                    d.setTime(fs.getAvgSeconds());
+                    d.setTime(fs.getTotalSeconds());
                 }
             }else
             {
-                double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                 d.setTime(times);
             }
             d.setStationId(fs.getStationId());
@@ -943,19 +952,19 @@ public class AlarmHistoryService   {
             {
                 if(AlarmTime.H.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else if(AlarmTime.M.getCode().equals(timeType))
                 {
-                    double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                     d.setTime(times);
                 }else
                 {
-                    d.setTime(fs.getAvgSeconds());
+                    d.setTime(fs.getTotalSeconds());
                 }
             }else
             {
-                double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
+                double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
                 d.setTime(times);
             }
             d.setStationId(fs.getStationId());

+ 5 - 1
alarm-web/src/main/java/com/gyee/alarm/service/AlarmWtService.java

@@ -49,7 +49,7 @@ public class AlarmWtService {
 //            {
 //                System.out.println("");
 //            }
-//            if(wt.getId().contains("SXJ_KGDL_GJY_F_WT_0001_EQ"))
+//            if(wt.getId().contains("SXJ_KGDL_DJY_F_WT_0008_EQ"))
 //            {
 //                System.out.println("");
 //            }
@@ -75,6 +75,10 @@ public class AlarmWtService {
                                     AlarmVo vo=new AlarmVo();
                                     StringBuilder tbName = new StringBuilder();
                                     tbName.append(wt.getId()).append("_").append(alarm.getId());
+//                                    if(tbName.equals("SXJ_KGDL_DJY_F_WT_0008_EQ_UP_0859"))
+//                                    {
+//                                        System.out.println("");
+//                                    }
                                     vo.setTbName(String.valueOf(tbName));
                                     vo.setAlarmId(alarm.getId());
                                     vo.setTagid(equipmentPoint.getNemCode());

文件差異過大導致無法顯示
+ 485 - 1125
log/ota.log