|
@@ -7,10 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.gyee.alarm.model.vo.AlarmCustomType;
|
|
|
import com.gyee.alarm.model.vo.AlarmTypeValue;
|
|
|
import com.gyee.alarm.model.vo.AlarmVo;
|
|
|
-import com.gyee.alarm.service.AlarmBtService;
|
|
|
-import com.gyee.alarm.service.AlarmCtService;
|
|
|
-import com.gyee.alarm.service.AlarmInService;
|
|
|
-import com.gyee.alarm.service.AlarmWtService;
|
|
|
+import com.gyee.alarm.service.*;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.alarm.model.auto.*;
|
|
|
import com.gyee.alarm.service.auto.*;
|
|
@@ -104,6 +101,10 @@ public class CacheContext implements CommandLineRunner {
|
|
|
@Resource
|
|
|
private IProEconAlarmTypeService proEconAlarmTypeService;
|
|
|
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AlarmInitalService alarmInitalService;
|
|
|
+
|
|
|
public static List<ProEconAlarmSwitch> asls = new ArrayList<>();
|
|
|
public static Map<String, Map<String, ProBasicPowerstationPoint>> weatherwppointmap = new HashMap<>();
|
|
|
public static List<ProBasicWeatherStation> weawpls = new ArrayList<>();
|
|
@@ -201,7 +202,7 @@ public class CacheContext implements CommandLineRunner {
|
|
|
|
|
|
public static List<AlarmVo> alarmWtList = new ArrayList<>();
|
|
|
public static Map<String, AlarmVo> alarmWtMap = new HashMap<>();
|
|
|
-
|
|
|
+ public static Map<String,List<AlarmVo>> alarmWpMap=new HashMap<>();
|
|
|
public static List<AlarmVo> alarmBtList = new ArrayList<>();
|
|
|
public static Map<String, AlarmVo> alarmBtMap = new HashMap<>();
|
|
|
|
|
@@ -666,173 +667,176 @@ public class CacheContext implements CommandLineRunner {
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- List<ProEconAlarmRule> customls = proEconAlarmRuleService.list();
|
|
|
-
|
|
|
- if (!customls.isEmpty()) {
|
|
|
- customls = customls.stream().filter(i -> null != i.getEnable() && i.getEnable()).collect(Collectors.toList());
|
|
|
- }
|
|
|
- List<ProEconAlarmRule> wtCustomls = new ArrayList<>();
|
|
|
- List<ProEconAlarmRule> btCustomls = new ArrayList<>();
|
|
|
-// List<ProEconAlarmRule> btCustomls=new ArrayList<>();
|
|
|
- if (!customls.isEmpty()) {
|
|
|
- for (ProEconAlarmRule vo : customls) {
|
|
|
-
|
|
|
- ctAlarmMap.put(vo.getId(),vo);
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- sb.append(vo.getStationId()).append(vo.getModelId());
|
|
|
- if (StringUtils.notEmp(vo.getCategory())) {
|
|
|
-
|
|
|
-
|
|
|
- if (vo.getCategory().equals(AlarmCustomType.WT.getCode())) {
|
|
|
- if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
|
|
|
- List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
|
|
|
- ls.add(vo);
|
|
|
- ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
- } else {
|
|
|
- List<ProEconAlarmRule> ls = new ArrayList<>();
|
|
|
- ls.add(vo);
|
|
|
- ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
- }
|
|
|
- wtCustomls.add(vo);
|
|
|
- }
|
|
|
- if (vo.getCategory().equals(AlarmCustomType.IN.getCode())) {
|
|
|
- if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
|
|
|
- List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
|
|
|
- ls.add(vo);
|
|
|
- } else {
|
|
|
- List<ProEconAlarmRule> ls = new ArrayList<>();
|
|
|
- ls.add(vo);
|
|
|
- ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
- }
|
|
|
- wtCustomls.add(vo);
|
|
|
- } else if (vo.getCategory().equals(AlarmCustomType.BT.getCode())) {
|
|
|
- btCustomls.add(vo);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- alarmRulesMap.put(AlarmCustomType.WT.getCode(), wtCustomls);
|
|
|
- alarmRulesMap.put(AlarmCustomType.BT.getCode(), btCustomls);
|
|
|
-
|
|
|
-
|
|
|
- List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
|
|
|
- if (!templs.isEmpty()) {
|
|
|
- for (ProEconAlarmConfiguration alarm : templs) {
|
|
|
-
|
|
|
- alarmMap.put(alarm.getId(), alarm);
|
|
|
- if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
|
|
|
- wtalarmls.add(alarm);
|
|
|
- alarmMap.put(alarm.getId(), alarm);
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- sb.append(alarm.getStationId()).append(alarm.getModelId());
|
|
|
-
|
|
|
- if (wtAlarmMap.containsKey(String.valueOf(sb))) {
|
|
|
- List<ProEconAlarmConfiguration> ls = wtAlarmMap.get(String.valueOf(sb));
|
|
|
- ls.add(alarm);
|
|
|
- } else {
|
|
|
- List<ProEconAlarmConfiguration> ls = new ArrayList<>();
|
|
|
- ls.add(alarm);
|
|
|
- wtAlarmMap.put(String.valueOf(sb), ls);
|
|
|
- }
|
|
|
- }else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
|
|
|
- inalarmls.add(alarm);
|
|
|
-
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
- sb.append(alarm.getStationId()).append(alarm.getModelId());
|
|
|
-
|
|
|
- if (inAlarmMap.containsKey(String.valueOf(sb))) {
|
|
|
- List<ProEconAlarmConfiguration> ls = inAlarmMap.get(String.valueOf(sb));
|
|
|
- ls.add(alarm);
|
|
|
- } else {
|
|
|
- List<ProEconAlarmConfiguration> ls = new ArrayList<>();
|
|
|
- ls.add(alarm);
|
|
|
- inAlarmMap.put(String.valueOf(sb), ls);
|
|
|
- }
|
|
|
- } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
|
|
|
- btalarmls.add(alarm);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- wtls.forEach(wt -> {
|
|
|
- if (wpByEmMap.containsKey(wt.getWindpowerstationId())) {
|
|
|
- Set<ProEconEquipmentmodel> set = wpByEmMap.get(wt.getWindpowerstationId());
|
|
|
- if (modelMap.containsKey(wt.getModelId())) {
|
|
|
- ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
|
|
|
- set.add(model);
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
- Set<ProEconEquipmentmodel> set = new HashSet<>();
|
|
|
- if (modelMap.containsKey(wt.getModelId())) {
|
|
|
- ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
|
|
|
- set.add(model);
|
|
|
- }
|
|
|
- wpByEmMap.put(wt.getWindpowerstationId(), set);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- weawpls = proBasicWeatherStationService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
- weawpls.stream().forEach(weather -> {
|
|
|
-
|
|
|
- String subString = redisService.get(weather.getId());
|
|
|
- Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
- });
|
|
|
- weatherwppointmap.put(weather.getId(), stringWindpowerstationpointnewMap);
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- alarmTypeList = proEconAlarmTypeService.list();
|
|
|
-
|
|
|
- if (!alarmTypeList.isEmpty()) {
|
|
|
- for (ProEconAlarmType at : alarmTypeList) {
|
|
|
- alarmTypeMap.put(at.getNemCode(), at);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //风机报警初始化标签
|
|
|
- alarmWtList=alarmWtService.initalAlarmVo();
|
|
|
- if(!alarmWtList.isEmpty())
|
|
|
- {
|
|
|
- for(AlarmVo vo: alarmWtList)
|
|
|
- {
|
|
|
- alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
- }
|
|
|
- }
|
|
|
- //逆变器报警初始化标签
|
|
|
- alarmInList=alarmInService.initalAlarmVo();
|
|
|
- if(!alarmInList.isEmpty())
|
|
|
- {
|
|
|
- for(AlarmVo vo: alarmInList)
|
|
|
- {
|
|
|
- alarmInMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //升压站报警初始化标签
|
|
|
- alarmBtList=alarmBtService.initalAlarmVo();
|
|
|
- if(!alarmBtList.isEmpty())
|
|
|
- {
|
|
|
- for(AlarmVo vo: alarmBtList)
|
|
|
- {
|
|
|
- alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
- }
|
|
|
- }
|
|
|
- //自定义报警初始化标签
|
|
|
- alarmCtList=alarmCtService.initalAlarmVo();
|
|
|
- if(!alarmCtList.isEmpty())
|
|
|
- {
|
|
|
- for(AlarmVo vo: alarmCtList)
|
|
|
- {
|
|
|
- alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
- }
|
|
|
- }
|
|
|
+//
|
|
|
+// List<ProEconAlarmRule> customls = proEconAlarmRuleService.list();
|
|
|
+//
|
|
|
+// if (!customls.isEmpty()) {
|
|
|
+// customls = customls.stream().filter(i -> null != i.getEnable() && i.getEnable()).collect(Collectors.toList());
|
|
|
+// }
|
|
|
+// List<ProEconAlarmRule> wtCustomls = new ArrayList<>();
|
|
|
+// List<ProEconAlarmRule> btCustomls = new ArrayList<>();
|
|
|
+//// List<ProEconAlarmRule> btCustomls=new ArrayList<>();
|
|
|
+// if (!customls.isEmpty()) {
|
|
|
+// for (ProEconAlarmRule vo : customls) {
|
|
|
+//
|
|
|
+// ctAlarmMap.put(vo.getId(),vo);
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// sb.append(vo.getStationId()).append(vo.getModelId());
|
|
|
+// if (StringUtils.notEmp(vo.getCategory())) {
|
|
|
+//
|
|
|
+//
|
|
|
+// if (vo.getCategory().equals(AlarmCustomType.WT.getCode())) {
|
|
|
+// if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
|
|
|
+// List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
|
|
|
+// ls.add(vo);
|
|
|
+// ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
+// } else {
|
|
|
+// List<ProEconAlarmRule> ls = new ArrayList<>();
|
|
|
+// ls.add(vo);
|
|
|
+// ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
+// }
|
|
|
+// wtCustomls.add(vo);
|
|
|
+// }
|
|
|
+// if (vo.getCategory().equals(AlarmCustomType.IN.getCode())) {
|
|
|
+// if (ctAlarmlsMap.containsKey(String.valueOf(sb))) {
|
|
|
+// List<ProEconAlarmRule> ls = ctAlarmlsMap.get(String.valueOf(sb));
|
|
|
+// ls.add(vo);
|
|
|
+// } else {
|
|
|
+// List<ProEconAlarmRule> ls = new ArrayList<>();
|
|
|
+// ls.add(vo);
|
|
|
+// ctAlarmlsMap.put(String.valueOf(sb), ls);
|
|
|
+// }
|
|
|
+// wtCustomls.add(vo);
|
|
|
+// } else if (vo.getCategory().equals(AlarmCustomType.BT.getCode())) {
|
|
|
+// btCustomls.add(vo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// alarmRulesMap.put(AlarmCustomType.WT.getCode(), wtCustomls);
|
|
|
+// alarmRulesMap.put(AlarmCustomType.BT.getCode(), btCustomls);
|
|
|
+//
|
|
|
+//
|
|
|
+// List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
|
|
|
+// if (!templs.isEmpty()) {
|
|
|
+// for (ProEconAlarmConfiguration alarm : templs) {
|
|
|
+//
|
|
|
+// alarmMap.put(alarm.getId(), alarm);
|
|
|
+// if (alarm.getAlarmType().equals(AlarmTypeValue.WT.getCode())) {
|
|
|
+// wtalarmls.add(alarm);
|
|
|
+// alarmMap.put(alarm.getId(), alarm);
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// sb.append(alarm.getStationId()).append(alarm.getModelId());
|
|
|
+//
|
|
|
+// if (wtAlarmMap.containsKey(String.valueOf(sb))) {
|
|
|
+// List<ProEconAlarmConfiguration> ls = wtAlarmMap.get(String.valueOf(sb));
|
|
|
+// ls.add(alarm);
|
|
|
+// } else {
|
|
|
+// List<ProEconAlarmConfiguration> ls = new ArrayList<>();
|
|
|
+// ls.add(alarm);
|
|
|
+// wtAlarmMap.put(String.valueOf(sb), ls);
|
|
|
+// }
|
|
|
+// }else if (alarm.getAlarmType().equals(AlarmTypeValue.IN.getCode())) {
|
|
|
+// inalarmls.add(alarm);
|
|
|
+//
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// sb.append(alarm.getStationId()).append(alarm.getModelId());
|
|
|
+//
|
|
|
+// if (inAlarmMap.containsKey(String.valueOf(sb))) {
|
|
|
+// List<ProEconAlarmConfiguration> ls = inAlarmMap.get(String.valueOf(sb));
|
|
|
+// ls.add(alarm);
|
|
|
+// } else {
|
|
|
+// List<ProEconAlarmConfiguration> ls = new ArrayList<>();
|
|
|
+// ls.add(alarm);
|
|
|
+// inAlarmMap.put(String.valueOf(sb), ls);
|
|
|
+// }
|
|
|
+// } else if (alarm.getAlarmType().equals(AlarmTypeValue.BT.getCode())) {
|
|
|
+// btalarmls.add(alarm);
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// wtls.forEach(wt -> {
|
|
|
+// if (wpByEmMap.containsKey(wt.getWindpowerstationId())) {
|
|
|
+// Set<ProEconEquipmentmodel> set = wpByEmMap.get(wt.getWindpowerstationId());
|
|
|
+// if (modelMap.containsKey(wt.getModelId())) {
|
|
|
+// ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
|
|
|
+// set.add(model);
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// Set<ProEconEquipmentmodel> set = new HashSet<>();
|
|
|
+// if (modelMap.containsKey(wt.getModelId())) {
|
|
|
+// ProEconEquipmentmodel model = modelMap.get(wt.getModelId());
|
|
|
+// set.add(model);
|
|
|
+// }
|
|
|
+// wpByEmMap.put(wt.getWindpowerstationId(), set);
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+// weawpls = proBasicWeatherStationService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+// weawpls.stream().forEach(weather -> {
|
|
|
+//
|
|
|
+// String subString = redisService.get(weather.getId());
|
|
|
+// Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+// });
|
|
|
+// weatherwppointmap.put(weather.getId(), stringWindpowerstationpointnewMap);
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+//
|
|
|
+// alarmTypeList = proEconAlarmTypeService.list();
|
|
|
+//
|
|
|
+// if (!alarmTypeList.isEmpty()) {
|
|
|
+// for (ProEconAlarmType at : alarmTypeList) {
|
|
|
+// alarmTypeMap.put(at.getNemCode(), at);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// //风机报警初始化标签
|
|
|
+// alarmWtList=alarmWtService.initalAlarmVo();
|
|
|
+// if(!alarmWtList.isEmpty())
|
|
|
+// {
|
|
|
+// for(AlarmVo vo: alarmWtList)
|
|
|
+// {
|
|
|
+// alarmWtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //逆变器报警初始化标签
|
|
|
+// alarmInList=alarmInService.initalAlarmVo();
|
|
|
+// if(!alarmInList.isEmpty())
|
|
|
+// {
|
|
|
+// for(AlarmVo vo: alarmInList)
|
|
|
+// {
|
|
|
+// alarmInMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// //升压站报警初始化标签
|
|
|
+// alarmBtList=alarmBtService.initalAlarmVo();
|
|
|
+// if(!alarmBtList.isEmpty())
|
|
|
+// {
|
|
|
+// for(AlarmVo vo: alarmBtList)
|
|
|
+// {
|
|
|
+// alarmBtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// //自定义报警初始化标签
|
|
|
+// alarmCtList=alarmCtService.initalAlarmVo();
|
|
|
+// if(!alarmCtList.isEmpty())
|
|
|
+// {
|
|
|
+// for(AlarmVo vo: alarmCtList)
|
|
|
+// {
|
|
|
+// alarmCtMap.put(vo.getTbName().toUpperCase(),vo);
|
|
|
+// }
|
|
|
+// }
|
|
|
// inputOrOutPutService.initialInputOrOutputSpeed();
|
|
|
|
|
|
+ alarmInitalService.initialAlarm();;
|
|
|
|
|
|
logger.info("缓存结束------------------------------------------------------------");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|