Sfoglia il codice sorgente

定边报警系统修改

shilin 1 mese fa
parent
commit
c28a5ed53e

+ 3 - 1
alarm-custom/src/main/java/com/gyee/alarm/task/thread/ScheduledTasks.java

@@ -30,6 +30,8 @@ import javax.annotation.Resource;
 @Component
 public class ScheduledTasks {
 
+
+    private Logger logger = LoggerFactory.getLogger(this.getClass());
     @Resource
     private AlarmCtService alarmCtService;
     @Resource
@@ -40,7 +42,7 @@ public class ScheduledTasks {
 
         proEconAlarmRuleService.inital();
         CacheContext.alarmTags = alarmCtService.findTags(AlarmSuperTalbeType.CT.getCode());
-        System.out.println("当前时间: " + System.currentTimeMillis() / 1000);
+        logger.info("当前时间: " + System.currentTimeMillis() / 1000);
     }
 
 //    // 初始延迟1秒,之后每10秒执行一次

+ 2 - 3
alarm-web/src/main/java/com/gyee/alarm/mapper/auto/AlarmTsMapper.java

@@ -294,7 +294,6 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "</where>",
 
             " group by  components,stationid,alarmid,characteristic ",
-            " order by ts  ",
             "</script>"})
     List<ProBasicFeatureStat> findCtFeatureStatByWpId( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId, @Param("components") String components, @Param("alarmid") String alarmid, @Param("deviceType")String deviceType);
 
@@ -322,7 +321,7 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "</where>",
 
             " group by  components,lineid,alarmid,characteristic ",
-            " order by lineid  ",
+
             "</script>"})
     List<ProBasicFeatureStat> findCtFeatureStatByLnId( @Param("begin")long begin, @Param("end") long end, @Param("stationid") String stationid, @Param("modelId")String modelId, @Param("components") String components, @Param("alarmid") String alarmid, @Param("deviceType")String deviceType);
 
@@ -350,7 +349,7 @@ public interface AlarmTsMapper extends BaseMapper<AlarmTs> {
             "</where>",
 
             " group by  components,lineid,alarmid,characteristic ",
-            " order by ts  ",
+
             "</script>"})
     List<ProBasicFeatureStat> findCtFeatureStatByWtId( @Param("begin")long begin, @Param("end") long end, @Param("wtId") String wtId, @Param("modelId")String modelId, @Param("components") String components, @Param("alarmid") String alarmid, @Param("deviceType")String deviceType);
 

+ 50 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmBtService.java

@@ -88,6 +88,56 @@ public class AlarmBtService {
         return alarmVoList;
     }
 
+    public List<AlarmVo> initalAlarmVo(ProEconAlarmConfiguration alarm) {
 
+        List<ProEconAlarmConfiguration> btalarmls = CacheContext.btalarmls;
+
+
+        List<AlarmVo> alarmVoList = new ArrayList<>();
+        if (StringUtils.notEmp(alarm.getTagId()) &&
+                (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode()) || alarm.getAlarmType().equals(AlarmTypeValue.BTE.getCode()))) {
+            AlarmVo vo = new AlarmVo();
+            StringBuilder tbName = new StringBuilder();
+            tbName.append(alarm.getStationId()).append("_").append(alarm.getId());
+            vo.setTbName(String.valueOf(tbName));
+            vo.setAlarmId(alarm.getId());
+            vo.setTagid(alarm.getTagId());
+            vo.setAlarmType(alarm.getAlarmType());
+            vo.setCharacteristic(alarm.getCharacteristic());
+            vo.setComponents(alarm.getComponents());
+            vo.setDescription(alarm.getDescription());
+            vo.setDeviceId("");
+            vo.setDevicename("");
+            vo.setDeviceType(DeviceTypeValue.BT.getCode());
+            vo.setEnabled(alarm.getEnable());
+            vo.setLineid("");
+            vo.setLinename("");
+            vo.setModelId(alarm.getModelId());
+            vo.setProjectid("");
+            vo.setProjectname("");
+            vo.setRank(alarm.getRank());
+            vo.setResettable(alarm.getResetTable());
+            vo.setStationid(alarm.getStationId());
+            if (CacheContext.subwpmap.containsKey(alarm.getStationId())) {
+                ProBasicSubStation wp = CacheContext.subwpmap.get(alarm.getStationId());
+                vo.setStationname(wp.getName());
+            }
+            vo.setSubcomponents(alarm.getSubcomponents());
+            vo.setSuffix(alarm.getSuffix());
+            vo.setTriggertype(alarm.getTriggerType());
+            vo.setUniformcode(alarm.getUniformCode());
+            vo.setSuperTableName(AlarmSuperTalbeType.BT.getCode());
+            vo.setVal(0);
+            vo.setOval(0);
+
+            vo.setName(alarm.getName());
+            vo.setNemCode(alarm.getNemCode());
+            vo.setFaultCause(alarm.getFaultCause());
+            vo.setResolvent(alarm.getResolvent());
+            alarmVoList.add(vo);
+        }
+
+        return alarmVoList;
+    }
 
 }

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

@@ -86,7 +86,7 @@ public class AlarmConfigurationService {
         }
 
 
-        proEconAlarmConfigurationService.inital();
+//        proEconAlarmConfigurationService.inital(alarmRule);
 
         return result;
     }

+ 100 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmHistoryService.java

@@ -532,6 +532,26 @@ public class AlarmHistoryService   {
             d.setAlertText(fs.getDescription());
             d.setCount(fs.getTotal());
 
+            if(StringUtils.empty(fs.getTotalSeconds()))
+            {
+                fs.setTotalSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getAvgSeconds()))
+            {
+                fs.setAvgSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMinSeconds()))
+            {
+                fs.setMinSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMaxSeconds()))
+            {
+                fs.setMaxSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getTotal()))
+            {
+                fs.setTotal(0L);
+            }
             if(StringUtils.notEmp(timeType))
             {
                 if(AlarmTime.H.getCode().equals(timeType))
@@ -733,6 +753,26 @@ public class AlarmHistoryService   {
             d.setCount(fs.getTotal());
             d.setAlarmid(fs.getAlarmid());
 
+            if(StringUtils.empty(fs.getTotalSeconds()))
+            {
+                fs.setTotalSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getAvgSeconds()))
+            {
+                fs.setAvgSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMinSeconds()))
+            {
+                fs.setMinSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMaxSeconds()))
+            {
+                fs.setMaxSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getTotal()))
+            {
+                fs.setTotal(0L);
+            }
             if(CacheContext.ctAlarmMap.containsKey(fs.getAlarmid()))
             {
                 ProEconAlarmRule ar=CacheContext.ctAlarmMap.get(fs.getAlarmid());
@@ -861,6 +901,26 @@ public class AlarmHistoryService   {
             d.setCount(fs.getTotal());
             d.setAlarmid(fs.getAlarmid());
 
+            if(StringUtils.empty(fs.getTotalSeconds()))
+            {
+                fs.setTotalSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getAvgSeconds()))
+            {
+                fs.setAvgSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMinSeconds()))
+            {
+                fs.setMinSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMaxSeconds()))
+            {
+                fs.setMaxSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getTotal()))
+            {
+                fs.setTotal(0L);
+            }
             if(CacheContext.ctAlarmMap.containsKey(fs.getAlarmid()))
             {
                 ProEconAlarmRule ar=CacheContext.ctAlarmMap.get(fs.getAlarmid());
@@ -987,6 +1047,26 @@ public class AlarmHistoryService   {
             d.setCount(fs.getTotal());
             d.setAlarmid(fs.getAlarmid());
 
+            if(StringUtils.empty(fs.getTotalSeconds()))
+            {
+                fs.setTotalSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getAvgSeconds()))
+            {
+                fs.setAvgSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMinSeconds()))
+            {
+                fs.setMinSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMaxSeconds()))
+            {
+                fs.setMaxSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getTotal()))
+            {
+                fs.setTotal(0L);
+            }
 
             if(CacheContext.ctAlarmMap.containsKey(fs.getAlarmid()))
             {
@@ -1115,6 +1195,26 @@ public class AlarmHistoryService   {
             d.setCount(fs.getTotal());
             d.setAlarmid(fs.getAlarmid());
 
+            if(StringUtils.empty(fs.getTotalSeconds()))
+            {
+                fs.setTotalSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getAvgSeconds()))
+            {
+                fs.setAvgSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMinSeconds()))
+            {
+                fs.setMinSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getMaxSeconds()))
+            {
+                fs.setMaxSeconds(0.0);
+            }
+            if(StringUtils.empty(fs.getTotal()))
+            {
+                fs.setTotal(0L);
+            }
 
             if(CacheContext.ctAlarmMap.containsKey(fs.getAlarmid()))
             {

+ 80 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmInService.java

@@ -171,6 +171,86 @@ public class AlarmInService {
         return  alarmVoList;
     }
 
+    public List<AlarmVo> initalAlarmVo(ProEconAlarmConfiguration alarm) {
 
+        List<AlarmVo> alarmVoList=new ArrayList<>();
+        Map<String, List<ProEconAlarmConfiguration>> wtAlarmMap = CacheContext.wtAlarmMap;
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+//        HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
+//        List<ProBasicEquipment> wtls = tokenService.getWtls(request);
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+
+            if (wtpAimap.containsKey(wt.getId())) {
+                Map<String, ProBasicEquipmentPoint> pointMap = wtpAimap.get(wt.getId());
+
+
+                if (StringUtils.notEmp(pointMap) ) {
+                    if (pointMap.containsKey(alarm.getUniformCode())) {
+                        ProBasicEquipmentPoint equipmentPoint = pointMap.get(alarm.getUniformCode());
+
+                        if(StringUtils.notEmp(initialcode) &&
+                                StringUtils.notEmp(equipmentPoint.getNemCode()) &&
+                                !equipmentPoint.getNemCode().equals(initialcode) &&
+                                alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())
+                        )
+                        {
+                            AlarmVo vo=new AlarmVo();
+                            StringBuilder tbName = new StringBuilder();
+                            tbName.append(wt.getId()).append("_").append(alarm.getId());
+                            vo.setTbName(String.valueOf(tbName));
+                            vo.setAlarmId(alarm.getId());
+                            vo.setTagid(equipmentPoint.getNemCode());
+                            vo.setAlarmType(alarm.getAlarmType());
+                            vo.setCharacteristic(alarm.getCharacteristic());
+                            vo.setComponents(alarm.getComponents());
+                            vo.setDescription(alarm.getDescription());
+                            vo.setDeviceId(wt.getId());
+                            vo.setDevicename(wt.getName());
+                            vo.setDeviceType(alarm.getDeviceType());
+                            vo.setEnabled(alarm.getEnable());
+                            vo.setLineid(wt.getLineId());
+                            if(CacheContext.lnmap.containsKey(wt.getLineId()))
+                            {
+                                ProBasicLine ln=CacheContext.lnmap.get(wt.getLineId());
+                                vo.setLinename(ln.getName());
+                            }
+                            vo.setModelId(wt.getModelId());
+                            vo.setProjectid(wt.getProjectId());
+                            if(CacheContext.pjmap.containsKey(wt.getProjectId()))
+                            {
+                                ProBasicProject pj=CacheContext.pjmap.get(wt.getProjectId());
+                                vo.setProjectname(pj.getName());
+                            }
+                            vo.setRank(alarm.getRank());
+                            vo.setResettable(alarm.getResetTable());
+                            vo.setStationid(wt.getWindpowerstationId());
+                            if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+                            {
+                                ProBasicPowerstation wp=CacheContext.wpmap.get(wt.getWindpowerstationId());
+                                vo.setStationname(wp.getName());
+                            }
+                            vo.setSubcomponents(alarm.getSubcomponents());
+                            vo.setSuffix(alarm.getSuffix());
+                            vo.setTriggertype(alarm.getTriggerType());
+                            vo.setUniformcode(alarm.getUniformCode());
+                            vo.setSuperTableName(AlarmSuperTalbeType.WT.getCode());
+                            vo.setVal(0);
+
+                            vo.setName(alarm.getName());
+                            vo.setNemCode(alarm.getNemCode());
+                            vo.setFaultCause(alarm.getFaultCause());
+                            vo.setResolvent(alarm.getResolvent());
+
+                            alarmVoList.add(vo);
+                        }
+
+                    }
+                }
+            }
+
+        }
+        return  alarmVoList;
+    }
 
 }

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

@@ -185,7 +185,7 @@ public class AlarmRuleService {
             }
 
             //同步内存和实时数据库新建测点
-            proEconAlarmRuleService.inital(alarmRule);
+//            proEconAlarmRuleService.inital(alarmRule);
 
             proEconAlarmPlanService.updatePlanlistById(alarmRule.getId(), alarmRule.getAlarmPlan());
         }

+ 81 - 0
alarm-web/src/main/java/com/gyee/alarm/service/AlarmWtService.java

@@ -136,6 +136,87 @@ public class AlarmWtService {
         return  alarmVoList;
     }
 
+    public List<AlarmVo> initalAlarmVo(ProEconAlarmConfiguration alarm) {
+
+        List<AlarmVo> alarmVoList=new ArrayList<>();
+        Map<String, List<ProEconAlarmConfiguration>> wtAlarmMap = CacheContext.wtAlarmMap;
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
+
+
+        for (ProBasicEquipment wt : CacheContext.wtls) {
+
+
+            if (wtpAimap.containsKey(wt.getId())) {
+                Map<String, ProBasicEquipmentPoint> pointMap = wtpAimap.get(wt.getId());
+
+                if (StringUtils.notEmp(pointMap) ) {
+
+                    if (pointMap.containsKey(alarm.getUniformCode())) {
+                        ProBasicEquipmentPoint equipmentPoint = pointMap.get(alarm.getUniformCode());
+
+                        if(StringUtils.notEmp(initialcode) &&
+                                StringUtils.notEmp(equipmentPoint.getNemCode()) &&
+                                !equipmentPoint.getNemCode().equals(initialcode) &&
+                                alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())
+                        )
+                        {
+                            AlarmVo vo=new AlarmVo();
+                            StringBuilder tbName = new StringBuilder();
+                            tbName.append(wt.getId()).append("_").append(alarm.getId());
+//
+                            vo.setTbName(String.valueOf(tbName));
+                            vo.setAlarmId(alarm.getId());
+                            vo.setTagid(equipmentPoint.getNemCode());
+                            vo.setAlarmType(alarm.getAlarmType());
+                            vo.setCharacteristic(alarm.getCharacteristic());
+                            vo.setComponents(alarm.getComponents());
+                            vo.setDescription(alarm.getDescription());
+                            vo.setDeviceId(wt.getId());
+                            vo.setDevicename(wt.getName());
+                            vo.setDeviceType(alarm.getDeviceType());
+                            vo.setEnabled(alarm.getEnable());
+                            vo.setLineid(wt.getLineId());
+                            if(CacheContext.lnmap.containsKey(wt.getLineId()))
+                            {
+                                ProBasicLine ln=CacheContext.lnmap.get(wt.getLineId());
+                                vo.setLinename(ln.getName());
+                            }
+                            vo.setModelId(wt.getModelId());
+                            vo.setProjectid(wt.getProjectId());
+                            if(CacheContext.pjmap.containsKey(wt.getProjectId()))
+                            {
+                                ProBasicProject pj=CacheContext.pjmap.get(wt.getProjectId());
+                                vo.setProjectname(pj.getName());
+                            }
+                            vo.setRank(alarm.getRank());
+                            vo.setResettable(alarm.getResetTable());
+                            vo.setStationid(wt.getWindpowerstationId());
+                            if(CacheContext.wpmap.containsKey(wt.getWindpowerstationId()))
+                            {
+                                ProBasicPowerstation wp=CacheContext.wpmap.get(wt.getWindpowerstationId());
+                                vo.setStationname(wp.getName());
+                            }
+                            vo.setSubcomponents(alarm.getSubcomponents());
+                            vo.setSuffix(alarm.getSuffix());
+                            vo.setTriggertype(alarm.getTriggerType());
+                            vo.setUniformcode(alarm.getUniformCode());
+                            vo.setSuperTableName(AlarmSuperTalbeType.WT.getCode());
+                            vo.setVal(0);
+
+                            vo.setName(alarm.getName());
+                            vo.setNemCode(alarm.getNemCode());
+                            vo.setFaultCause(alarm.getFaultCause());
+                            vo.setResolvent(alarm.getResolvent());
+                            alarmVoList.add(vo);
+                        }
+
+                    }
+                }
+            }
+
+        }
+        return  alarmVoList;
+    }
 
 
 }

+ 1 - 1
alarm-web/src/main/java/com/gyee/alarm/service/auto/IProEconAlarmConfigurationService.java

@@ -23,5 +23,5 @@ public interface IProEconAlarmConfigurationService extends IService<ProEconAlarm
                                          String wpId,
                                          String modelId,String alarmType);
 
-    public void inital() throws Exception;
+    public void inital(ProEconAlarmConfiguration alarm) throws Exception;
 }

+ 221 - 43
alarm-web/src/main/java/com/gyee/alarm/service/auto/impl/ProEconAlarmConfigurationServiceImpl.java

@@ -1,10 +1,12 @@
 package com.gyee.alarm.service.auto.impl;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.gyee.alarm.init.CacheContext;
-import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
+import com.gyee.alarm.model.auto.*;
 import com.gyee.alarm.mapper.auto.ProEconAlarmConfigurationMapper;
+import com.gyee.alarm.model.vo.AlarmSuperTalbeType;
 import com.gyee.alarm.model.vo.AlarmTypeValue;
 import com.gyee.alarm.model.vo.AlarmVo;
 
@@ -54,52 +56,119 @@ public class ProEconAlarmConfigurationServiceImpl extends ServiceImpl<ProEconAla
     private AlarmInService alarmInService;
     @Resource
     private AlarmBtService alarmBtService;
-    public void inital() throws Exception {
-
-
-        List<ProEconAlarmConfiguration> templs =this.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
-        if (!templs.isEmpty()) {
-            for (ProEconAlarmConfiguration alarm : templs) {
-                if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
-                    CacheContext.wtalarmls.add(alarm);
-                    StringBuilder sb=new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if(CacheContext.wtAlarmMap.containsKey(String.valueOf(sb)))
-                    {
-                        List<ProEconAlarmConfiguration> ls=CacheContext.wtAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    }else
-                    {
-                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
-                        ls.add(alarm);
-                        CacheContext.wtAlarmMap.put(String.valueOf(sb),ls);
-                    }
-                } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
-                    CacheContext.btalarmls.add(alarm);
+    public void inital(ProEconAlarmConfiguration alarm) throws Exception {
 
+
+        if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
+
+
+            List<ProEconAlarmConfiguration> filteredList =  CacheContext.wtalarmls.stream()
+                    .filter(myObject -> myObject.getId().equals(alarm.getId()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.wtalarmls.add(alarm);
+            }else
+            {
+                updateAlarm(alarm, CacheContext.wtalarmls);
+            }
+
+            StringBuilder sb=new StringBuilder();
+            sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+            if(CacheContext.wtAlarmMap.containsKey(String.valueOf(sb)))
+            {
+                List<ProEconAlarmConfiguration> ls=CacheContext.wtAlarmMap.get(String.valueOf(sb));
+
+                List<ProEconAlarmConfiguration> list = ls.stream()
+                        .filter(myObject -> myObject.getId().equals(alarm.getId()))
+                        .collect(Collectors.toList());
+
+                if(list.isEmpty()){
+                    ls.add(alarm);
+                }else
+                {
+                    updateAlarm(alarm, ls);
                 }
-                else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
-                    CacheContext.inalarmls.add(alarm);
-                    StringBuilder sb=new StringBuilder();
-                    sb.append(alarm.getStationId()).append(alarm.getModelId());
-
-                    if(CacheContext.inAlarmMap.containsKey(String.valueOf(sb)))
-                    {
-                        List<ProEconAlarmConfiguration> ls=CacheContext.inAlarmMap.get(String.valueOf(sb));
-                        ls.add(alarm);
-                    }else
-                    {
-                        List<ProEconAlarmConfiguration> ls=new ArrayList<>();
-                        ls.add(alarm);
-                        CacheContext.inAlarmMap.put(String.valueOf(sb),ls);
-                    }
-                }
+
+            }else
+            {
+                List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                ls.add(alarm);
+                CacheContext.wtAlarmMap.put(String.valueOf(sb),ls);
+            }
+        } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
+
+
+            List<ProEconAlarmConfiguration> filteredList =   CacheContext.btalarmls.stream()
+                    .filter(myObject -> myObject.getId().equals(alarm.getId()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.btalarmls.add(alarm);
+            }else
+            {
+                updateAlarm(alarm, CacheContext.btalarmls);
             }
         }
+        else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
+
+
+            List<ProEconAlarmConfiguration> filteredList =   CacheContext.inalarmls.stream()
+                    .filter(myObject -> myObject.getId().equals(alarm.getId()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.inalarmls.add(alarm);
+            }else
+            {
+                updateAlarm(alarm, CacheContext.inalarmls);
+            }
+            StringBuilder sb=new StringBuilder();
+            sb.append(alarm.getStationId()).append(alarm.getModelId());
+
+            if(CacheContext.inAlarmMap.containsKey(String.valueOf(sb)))
+            {
+
+                List<ProEconAlarmConfiguration> ls=CacheContext.inAlarmMap.get(String.valueOf(sb));
 
+                List<ProEconAlarmConfiguration> list = ls.stream()
+                        .filter(myObject -> myObject.getId().equals(alarm.getId()))
+                        .collect(Collectors.toList());
+
+                if(list.isEmpty()){
+                    ls.add(alarm);
+                }else
+                {
+                    updateAlarm(alarm, ls);
+                }
+
+            }else
+            {
+                List<ProEconAlarmConfiguration> ls=new ArrayList<>();
+                ls.add(alarm);
+                CacheContext.inAlarmMap.put(String.valueOf(sb),ls);
+            }
+        }
         //风机报警初始化标签
-        CacheContext.alarmWtList=alarmWtService.initalAlarmVo();
+        List<AlarmVo> list=alarmWtService.initalAlarmVo(alarm);
+        if(!list.isEmpty())
+        {
+            AlarmVo alarmVo=list.get(0);
+
+            List<AlarmVo> filteredList =   CacheContext.alarmWtList.stream()
+                    .filter(myObject -> myObject.getTbName().equals(alarmVo.getTbName()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.alarmWtList.addAll(list);
+            }else
+            {
+                updateAlarmVo(alarm, alarmVo);
+            }
+
+        }
+
         if(!CacheContext.alarmWtList.isEmpty())
         {
             for(AlarmVo vo: CacheContext.alarmWtList)
@@ -119,7 +188,25 @@ public class ProEconAlarmConfigurationServiceImpl extends ServiceImpl<ProEconAla
             }
         }
         //逆变器报警初始化标签
-        CacheContext.alarmInList=alarmInService.initalAlarmVo();
+
+        List<AlarmVo> inList=alarmInService.initalAlarmVo(alarm);
+        if(!list.isEmpty())
+        {
+            AlarmVo alarmVo=list.get(0);
+
+            List<AlarmVo> filteredList =   CacheContext.alarmInList.stream()
+                    .filter(myObject -> myObject.getTbName().equals(alarmVo.getTbName()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.alarmInList.addAll(inList);
+            }else
+            {
+                updateAlarmVo(alarm, alarmVo);
+            }
+
+        }
+
         if(!CacheContext.alarmInList.isEmpty())
         {
             for(AlarmVo vo: CacheContext.alarmInList)
@@ -140,7 +227,26 @@ public class ProEconAlarmConfigurationServiceImpl extends ServiceImpl<ProEconAla
 
 
         //升压站报警初始化标签
-        CacheContext.alarmBtList=alarmBtService.initalAlarmVo();
+//        CacheContext.alarmBtList=alarmBtService.initalAlarmVo();
+
+        List<AlarmVo> btList=alarmBtService.initalAlarmVo(alarm);
+        if(!list.isEmpty())
+        {
+            AlarmVo alarmVo=list.get(0);
+
+            List<AlarmVo> filteredList =   CacheContext.alarmBtList.stream()
+                    .filter(myObject -> myObject.getTbName().equals(alarmVo.getTbName()))
+                    .collect(Collectors.toList());
+
+            if(filteredList.isEmpty()){
+                CacheContext.alarmBtList.addAll(btList);
+            }else
+            {
+                updateAlarmVo(alarm, alarmVo);
+            }
+
+        }
+
         if(!CacheContext.alarmBtList.isEmpty())
         {
             for(AlarmVo vo: CacheContext.alarmBtList)
@@ -160,5 +266,77 @@ public class ProEconAlarmConfigurationServiceImpl extends ServiceImpl<ProEconAla
         }
     }
 
+    private static void updateAlarmVo(ProEconAlarmConfiguration alarm, AlarmVo alarmVo) {
+        for(AlarmVo vo:CacheContext.alarmWtList)
+        {
+            if(vo.getTbName().equals(alarmVo.getTbName()))
+            {
+                vo.setTbName(alarmVo.getTbName());
+                vo.setAlarmId(alarmVo.getId());
+                vo.setTagid(alarmVo.getTagid());
+                vo.setAlarmType(alarmVo.getAlarmType());
+                vo.setCharacteristic(alarmVo.getCharacteristic());
+                vo.setComponents(alarmVo.getComponents());
+                vo.setDescription(alarmVo.getDescription());
+                vo.setDeviceId(alarmVo.getDeviceId());
+                vo.setDevicename(alarmVo.getDevicename());
+                vo.setDeviceType(alarmVo.getDeviceType());
+                vo.setEnabled(alarmVo.getEnabled());
+                vo.setLineid(alarmVo.getLineid());
+                vo.setLinename(alarmVo.getLinename());
+                vo.setModelId(alarmVo.getModelId());
+                vo.setProjectid(alarmVo.getProjectid());
+                vo.setProjectname(alarmVo.getProjectname());
+                vo.setRank(alarm.getRank());
+                vo.setResettable(alarm.getResetTable());
+                vo.setStationid(alarmVo.getStationid());
+                vo.setStationname(alarmVo.getStationname());
+                vo.setSubcomponents(alarmVo.getSubcomponents());
+                vo.setSuffix(alarmVo.getSuffix());
+                vo.setTriggertype(alarmVo.getTriggertype());
+                vo.setUniformcode(alarmVo.getUniformcode());
+                vo.setSuperTableName(alarmVo.getSuperTableName());
+                vo.setVal(alarmVo.getVal());
+                vo.setName(alarmVo.getName());
+                vo.setNemCode(alarmVo.getNemCode());
+                vo.setFaultCause(alarmVo.getFaultCause());
+                vo.setResolvent(alarmVo.getResolvent());
+                break;
+            }
+        }
+    }
+
+    private static void updateAlarm(ProEconAlarmConfiguration alarm, List<ProEconAlarmConfiguration> ls) {
+        for(ProEconAlarmConfiguration ac: ls)
+        {
+            if(ac.getId().equals(alarm.getId()))
+            {
+                ac.setId(alarm.getId());
+                ac.setTagId(alarm.getTagId());
+                ac.setTriggerType(alarm.getTriggerType());
+                ac.setDeviceId(alarm.getDeviceId());
+                ac.setSuffix(alarm.getSuffix());
+                ac.setRank(alarm.getRank());
+                ac.setUniformCode(alarm.getUniformCode());
+                ac.setStationId(alarm.getStationId());
+                ac.setModelId(alarm.getModelId());
+                ac.setAlarmType(alarm.getAlarmType());
+                ac.setDeviceType(alarm.getDeviceType());
+                ac.setComponents(alarm.getComponents());
+                ac.setSubcomponents(alarm.getSubcomponents());
+                ac.setDescription(alarm.getDescription());
+                ac.setCharacteristic(alarm.getCharacteristic());
+                ac.setResetTable(alarm.getResetTable());
+                ac.setEnable(alarm.getEnable());
+                ac.setName(alarm.getName());
+                ac.setNemCode(alarm.getNemCode());
+                ac.setFaultCause(alarm.getFaultCause());
+                ac.setResolvent(alarm.getResolvent());
+                break;
+            }
+
+        }
+    }
+
 }