|
@@ -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;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|