|
@@ -0,0 +1,634 @@
|
|
|
+package com.gyee.alarm.init;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.gyee.alarm.model.vo.AlarmCustomType;
|
|
|
+import com.gyee.alarm.model.vo.AlarmTypeValue;
|
|
|
+import com.gyee.alarm.model.vo.AlarmVo;
|
|
|
+import com.gyee.common.model.StringUtils;
|
|
|
+import com.gyee.alarm.model.auto.*;
|
|
|
+import com.gyee.alarm.service.auto.*;
|
|
|
+
|
|
|
+import com.gyee.alarm.init.redis.RedisService;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : CacheContext
|
|
|
+ * @Author : xieshengjie
|
|
|
+ * @Date: 2021/5/18 9:35
|
|
|
+ * @Description : 缓存
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class CacheContext implements CommandLineRunner {
|
|
|
+ Logger logger = LoggerFactory.getLogger(CacheContext.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicEquipmentService proBasicEquipmentService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicLineService proBasicLineService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicProjectService proBasicProjectService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicPowerstationService proBasicWindpowerstationService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicMeterPointService proBasicMeterPointService;
|
|
|
+ @Resource
|
|
|
+ private IProEconEquipmentmodelService proEconEquipmentmodelService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconWtPowerCurveFittingService proEconWtPowerCurveFittingService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicWindturbinePowerService proBasicWindturbinePowerService;
|
|
|
+ @Resource
|
|
|
+ private RedisService redisService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicModelPowerService proBasicModelPowerService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicSubStationService proBasicSubStationService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicSquareService proBasicSquareService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicCompanyService proBasicCompanyService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicRegionService proBasicRegionService;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicModelPowerRdService proBasicModelPowerRdService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicWeatherStationService proBasicWeatherStationService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicBranchService proBasicBranchService;
|
|
|
+ @Resource
|
|
|
+ private IProBasicEnergyGroupService proBasicEnergyGroupService;
|
|
|
+ @Resource
|
|
|
+ private IProEconStateAiService proEconStateAiService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicStatusPointService proBasicStatusPointService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconAlarmConfigurationService proEconAlarmConfigurationService;
|
|
|
+ @Value("${runWindpowerstation}")
|
|
|
+ private String runWindpowerstation;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProEconAlarmRuleService proEconAlarmRuleService;
|
|
|
+
|
|
|
+ public static Map<String, List<ProEconAlarmRule>> alarmRulesMap = new HashMap<>();
|
|
|
+ public static List<ProBasicEquipment> wtls = new ArrayList<>();
|
|
|
+ public static List<ProBasicEquipment> wt_fjls = new ArrayList<>();
|
|
|
+ public static List<ProBasicProject> pjls = new ArrayList<>();
|
|
|
+ public static List<ProBasicLine> lnls = new ArrayList<>();
|
|
|
+ public static List<ProBasicSubStation> subwpls = new ArrayList<>();
|
|
|
+
|
|
|
+ public static Map<String, ProBasicSubStation> subwpmap = new HashMap<>();
|
|
|
+ public static List<ProBasicWeatherStation> wswpls = new ArrayList<>();
|
|
|
+
|
|
|
+ public static List<ProBasicSquare> sqls = new ArrayList<>();
|
|
|
+ public static List<ProBasicPowerstation> wpls = new ArrayList<>();
|
|
|
+ public static List<ProBasicPowerstation> zwpls = new ArrayList<>();
|
|
|
+ public static List<ProBasicCompany> cpls = new ArrayList<>();
|
|
|
+ public static List<ProBasicRegion> rgls = new ArrayList<>();
|
|
|
+ public static List<ProBasicEnergyGroup> egls = new ArrayList<>();
|
|
|
+ public static Map<String, ProBasicProject> pjmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicLine> lnmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicRegion> rgmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicEnergyGroup> egmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicCompany> cpmap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, List<ProBasicPowerstation>> cpwpmap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, List<ProBasicCompany>> rgcpmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicSquare> sqmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicPowerstation> wpmap = new HashMap<>();
|
|
|
+ public static List<ProBasicMeterPoint> meterpoints = new ArrayList<>();
|
|
|
+ public static Map<String, ProBasicMeterPoint> meterpointMap = new HashMap<>();
|
|
|
+ public static Map<String, List<ProBasicProject>> wppromap = new HashMap<>();
|
|
|
+ public static Map<String, List<ProBasicLine>> prolinemap = new HashMap<>();
|
|
|
+ public static Map<String, List<ProBasicEquipment>> wpwtmap = new HashMap<>();
|
|
|
+ public static Map<String, List<ProBasicEquipment>> pjwtmap = new HashMap<>();
|
|
|
+ public static Map<String, List<ProBasicEquipment>> lnwtmap = new HashMap<>();
|
|
|
+ public static List<ProBasicWeatherStation> wsls = new ArrayList<>();
|
|
|
+ public static Map<String, List<ProBasicWeatherStation>> poWsStationMap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, List<ProBasicEquipment>> sqwtmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = new HashMap<>();// 风电机测点AI表
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> linepointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> propointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> subwppointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> wswppointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> companypointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> regionpointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> grouppointmap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, Map<Double, Double>> zbzglMap = new HashMap<>();
|
|
|
+ public static Map<String, ProEconEquipmentmodel> modelMap = new HashMap<>();
|
|
|
+ public static Map<String, Map<Double, Double>> zzsglMap = new HashMap<>();
|
|
|
+ public static Map<String, Double> modelpower = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, String> wtstandardmap = new HashMap<>();
|
|
|
+ public static Map<String, ProBasicEquipment> wtmap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, Map<Double, ProBasicModelPower>> modelpowermap = new TreeMap<>();
|
|
|
+
|
|
|
+ public static List<ProBasicModelPower> mpls = new ArrayList<>();
|
|
|
+
|
|
|
+ public static List<ProEconEquipmentmodel> equipmentmodels = new ArrayList<>();
|
|
|
+
|
|
|
+ public static Map<String, List<ProBasicEquipment>> subWtsMap = new HashMap<>();
|
|
|
+ public static List<ProBasicModelPowerRd> theoreticalPowerList = new ArrayList<>();
|
|
|
+ public static Map<String, Map<Double, ProBasicModelPowerRd>> theoreticalPowerMap = new HashMap<>(); //理论,保证功率
|
|
|
+ public static Map<String, Map<Double, ProEconWtPowerCurveFitting>> curveFittingPowerMap = new HashMap<>(); //自算,最优功率
|
|
|
+ public static Map<String, List<ProBasicStatusPoint>> statusMap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicPowerstationPoint>> wspointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<String, ProBasicEquipmentPoint>> zlpointmap = new HashMap<>();
|
|
|
+ public static Map<String, Map<Integer, Integer>> aistateMap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String, Integer> redisDbMap = new HashMap<>();
|
|
|
+
|
|
|
+ public static List<ProBasicStatusPoint> pointdis = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ public static List<ProEconAlarmConfiguration> btalarmls = new ArrayList<>();
|
|
|
+ public static List<ProEconAlarmConfiguration> wtalarmls = new ArrayList<>();
|
|
|
+ public static List<ProEconAlarmConfiguration> customalarmls = new ArrayList<>();
|
|
|
+ public static Map<String, Map<String, ProBasicStatusPoint>> pointdismap = new HashMap<>();
|
|
|
+
|
|
|
+ public static Map<String,List<ProEconAlarmConfiguration>> wtAlarmMap=new HashMap<>();
|
|
|
+ public static Map<String,ProEconAlarmConfiguration> alarmMap=new HashMap<>();
|
|
|
+
|
|
|
+ public static List<AlarmVo> alarmWtList=new ArrayList<>();
|
|
|
+ public static Map<String,AlarmVo> alarmWtMap=new HashMap<>();
|
|
|
+
|
|
|
+ public static List<AlarmVo> alarmBtList=new ArrayList<>();
|
|
|
+ public static Map<String,AlarmVo> alarmBtMap=new HashMap<>();
|
|
|
+
|
|
|
+ public static List<AlarmVo> alarmCtList=new ArrayList<>();
|
|
|
+ public static Map<String,AlarmVo> alarmCtMap=new HashMap<>();
|
|
|
+
|
|
|
+ @Override
|
|
|
+
|
|
|
+ public void run(String... args) throws Exception {
|
|
|
+ logger.info("缓存开始------------------------------------------------------------");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
|
|
|
+ logger.info(runWpids.get(0) + "------------------" + runWpids.size());
|
|
|
+ wsls = proBasicWeatherStationService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ if (!wsls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProBasicWeatherStation ws : wsls) {
|
|
|
+ if (poWsStationMap.containsKey(ws.getWindpowerstationId())) {
|
|
|
+ List<ProBasicWeatherStation> ls = poWsStationMap.get(ws.getWindpowerstationId());
|
|
|
+ ls.add(ws);
|
|
|
+ poWsStationMap.put(ws.getWindpowerstationId(), ls);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ List<ProBasicWeatherStation> ls = new ArrayList<>();
|
|
|
+ ls.add(ws);
|
|
|
+ poWsStationMap.put(ws.getWindpowerstationId(), ls);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ theoreticalPowerList = proBasicModelPowerRdService.list();
|
|
|
+ equipmentmodels = proEconEquipmentmodelService.list();
|
|
|
+ equipmentmodels.stream().forEach(e -> {
|
|
|
+ modelMap.put(e.getId(), e);
|
|
|
+ });
|
|
|
+ mpls = proBasicModelPowerService.list();
|
|
|
+ mpls.sort(Comparator.comparing(ProBasicModelPower::getSpeed));
|
|
|
+ if (!mpls.isEmpty()) {
|
|
|
+
|
|
|
+ for (ProBasicModelPower mp : mpls) {
|
|
|
+ if (modelpowermap.containsKey(mp.getModelId())) {
|
|
|
+ Map<Double, ProBasicModelPower> tempmap = modelpowermap.get(mp.getModelId());
|
|
|
+ tempmap.put(mp.getSpeed(), mp);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ Map<Double, ProBasicModelPower> tempmap = new HashMap<>();
|
|
|
+ tempmap.put(mp.getSpeed(), mp);
|
|
|
+ modelpowermap.put(mp.getModelId(), tempmap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sqls = proBasicSquareService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ if (!sqls.isEmpty()) {
|
|
|
+ for (ProBasicSquare sq : sqls) {
|
|
|
+ sqmap.put(sq.getId(), sq);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ cpls = proBasicCompanyService.list().stream().filter(i -> i.getIsAble().equals(1)).collect(Collectors.toList());
|
|
|
+ if (!cpls.isEmpty()) {
|
|
|
+ for (ProBasicCompany sq : cpls) {
|
|
|
+ cpmap.put(sq.getId(), sq);
|
|
|
+
|
|
|
+ if (redisService.hasKey(sq.getId() + "0")) {
|
|
|
+ String cp0String = redisService.get(sq.getId() + "0");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ companypointmap.put(sq.getId() + "0", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-1")) {
|
|
|
+ String cp1String = redisService.get(sq.getId() + "-1");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ companypointmap.put(sq.getId() + "-1", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-2")) {
|
|
|
+ String cp2String = redisService.get(sq.getId() + "-2");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ companypointmap.put(sq.getId() + "-2", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ rgls = proBasicRegionService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ if (!rgls.isEmpty()) {
|
|
|
+ for (ProBasicRegion sq : rgls) {
|
|
|
+ rgmap.put(sq.getId(), sq);
|
|
|
+
|
|
|
+ if (redisService.hasKey(sq.getId() + "0")) {
|
|
|
+ String cp0String = redisService.get(sq.getId() + "0");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ regionpointmap.put(sq.getId() + "0", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-1")) {
|
|
|
+ String cp1String = redisService.get(sq.getId() + "-1");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ regionpointmap.put(sq.getId() + "-1", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-2")) {
|
|
|
+ String cp2String = redisService.get(sq.getId() + "-2");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ regionpointmap.put(sq.getId() + "-2", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ egls = proBasicEnergyGroupService.list().stream().filter(i -> i.getIsAble() == 1 && !i.getParentid().equals("0")).collect(Collectors.toList());
|
|
|
+ if (!egls.isEmpty()) {
|
|
|
+ for (ProBasicEnergyGroup sq : egls) {
|
|
|
+ egmap.put(sq.getId(), sq);
|
|
|
+
|
|
|
+ if (redisService.hasKey(sq.getId() + "0")) {
|
|
|
+ String eg0String = redisService.get(sq.getId() + "0");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ grouppointmap.put(sq.getId() + "0", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-1")) {
|
|
|
+ String eg1String = redisService.get(sq.getId() + "-1");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ grouppointmap.put(sq.getId() + "-1", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ if (redisService.hasKey(sq.getId() + "-2")) {
|
|
|
+ String eg2String = redisService.get(sq.getId() + "-2");
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ grouppointmap.put(sq.getId() + "-2", stringWindpowerstationpointnewMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (ProBasicCompany cp : cpls) {
|
|
|
+ if (rgcpmap.containsKey(cp.getRegionId())) {
|
|
|
+ rgcpmap.get(cp.getRegionId()).add(cp);
|
|
|
+ } else {
|
|
|
+ List<ProBasicCompany> wps = new ArrayList<>();
|
|
|
+ wps.add(cp);
|
|
|
+ rgcpmap.put(cp.getRegionId(), wps);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ProBasicPowerstation wp : wpls) {
|
|
|
+ if (cpwpmap.containsKey(wp.getCompanyId())) {
|
|
|
+ cpwpmap.get(wp.getCompanyId()).add(wp);
|
|
|
+ } else {
|
|
|
+ List<ProBasicPowerstation> wps = new ArrayList<>();
|
|
|
+ wps.add(wp);
|
|
|
+ cpwpmap.put(wp.getCompanyId(), wps);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ wsls.stream().forEach(p -> {
|
|
|
+
|
|
|
+
|
|
|
+ String wsString = redisService.get(p.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(wsString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ wspointmap.put(p.getId(), stringWindpowerstationpointnewMap);
|
|
|
+
|
|
|
+ });
|
|
|
+// //支路
|
|
|
+// List<ProBasicBranch> basicBranches = proBasicBranchService.list();
|
|
|
+// if (basicBranches != null && basicBranches.size() > 0) {
|
|
|
+// basicBranches.stream().forEach(b -> {
|
|
|
+// String wsString = redisService.get(b.getId());
|
|
|
+// Map<String, ProBasicEquipmentPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(wsString, new TypeReference<Map<String, ProBasicEquipmentPoint>>() {
|
|
|
+// });
|
|
|
+// zlpointmap.put(b.getId(), stringWindpowerstationpointnewMap);
|
|
|
+// });
|
|
|
+// }
|
|
|
+
|
|
|
+ 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())) {
|
|
|
+ ProEconEquipmentmodel equipmentmodel = modelMap.get(wt.getModelId());
|
|
|
+ modelpower.put(wt.getModelId(), equipmentmodel.getPowerProduction().doubleValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wt.getId().contains("_F_")) {
|
|
|
+ wt_fjls.add(wt);
|
|
|
+ }
|
|
|
+
|
|
|
+ wtmap.put(wt.getId(), wt);
|
|
|
+ //标杆风机初始化
|
|
|
+ wtstandardmap.put(wt.getId(), wt.getId());
|
|
|
+ String wtString = redisService.get(wt.getId());
|
|
|
+ Map<String, ProBasicEquipmentPoint> stringWindturbinetestingpointnewMap = JSONObject.parseObject(wtString, new TypeReference<Map<String, ProBasicEquipmentPoint>>() {
|
|
|
+ });
|
|
|
+ wtpAimap.put(wt.getId(), stringWindturbinetestingpointnewMap);
|
|
|
+
|
|
|
+
|
|
|
+ if (wpwtmap.containsKey(wt.getWindpowerstationId())) {
|
|
|
+ wpwtmap.get(wt.getWindpowerstationId()).add(wt);
|
|
|
+ } else {
|
|
|
+ List<ProBasicEquipment> wps = new ArrayList<>();
|
|
|
+ wps.add(wt);
|
|
|
+ wpwtmap.put(wt.getWindpowerstationId(), wps);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pjwtmap.containsKey(wt.getProjectId())) {
|
|
|
+ pjwtmap.get(wt.getProjectId()).add(wt);
|
|
|
+ } else {
|
|
|
+ List<ProBasicEquipment> pjs = new ArrayList<>();
|
|
|
+ pjs.add(wt);
|
|
|
+ pjwtmap.put(wt.getProjectId(), pjs);
|
|
|
+ }
|
|
|
+ if (lnwtmap.containsKey(wt.getLineId())) {
|
|
|
+ lnwtmap.get(wt.getLineId()).add(wt);
|
|
|
+ } else {
|
|
|
+ List<ProBasicEquipment> lnls = new ArrayList<>();
|
|
|
+ lnls.add(wt);
|
|
|
+ lnwtmap.put(wt.getLineId(), lnls);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sqwtmap.containsKey(wt.getSquareId())) {
|
|
|
+ sqwtmap.get(wt.getSquareId()).add(wt);
|
|
|
+ } else {
|
|
|
+ List<ProBasicEquipment> lnls = new ArrayList<>();
|
|
|
+ lnls.add(wt);
|
|
|
+ sqwtmap.put(wt.getSquareId(), lnls);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //初始化标杆风机
|
|
|
+ for (ProBasicEquipment wt : wtls) {
|
|
|
+ if (wpwtmap.containsKey(wt.getLineId())) {
|
|
|
+ List<ProBasicEquipment> wts = wpwtmap.get(wt.getLineId());
|
|
|
+ for (ProBasicEquipment w : wts) {
|
|
|
+ if (StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard() != 0) {
|
|
|
+ wtstandardmap.put(wt.getId(), w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (pjwtmap.containsKey(wt.getLineId())) {
|
|
|
+ List<ProBasicEquipment> wts = pjwtmap.get(wt.getLineId());
|
|
|
+ for (ProBasicEquipment w : wts) {
|
|
|
+ if (StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard() != 0) {
|
|
|
+ wtstandardmap.put(wt.getId(), w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lnwtmap.containsKey(wt.getLineId())) {
|
|
|
+ List<ProBasicEquipment> wts = lnwtmap.get(wt.getLineId());
|
|
|
+ for (ProBasicEquipment w : wts) {
|
|
|
+ if (StringUtils.notEmp(w.getIsStandard()) && w.getIsStandard() != 0) {
|
|
|
+ wtstandardmap.put(wt.getId(), w.getId());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ pjls = proBasicProjectService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ pjls.stream().forEach(p -> {
|
|
|
+ pjmap.put(p.getId(), p);
|
|
|
+ if (wppromap.containsKey(p.getWindpowerstationId())) {
|
|
|
+ wppromap.get(p.getWindpowerstationId()).add(p);
|
|
|
+ } else {
|
|
|
+ List<ProBasicProject> prolist = new ArrayList<>();
|
|
|
+ prolist.add(p);
|
|
|
+ wppromap.put(p.getWindpowerstationId(), prolist);
|
|
|
+ }
|
|
|
+ String pjString = redisService.get(p.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(pjString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ propointmap.put(p.getId(), stringWindpowerstationpointnewMap);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ subwpls = proBasicSubStationService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ subwpls.stream().forEach(sub -> {
|
|
|
+
|
|
|
+ subwpmap.put(sub.getId(),sub);
|
|
|
+ String subString = redisService.get(sub.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ subwppointmap.put(sub.getId(), stringWindpowerstationpointnewMap);
|
|
|
+
|
|
|
+ List<ProBasicEquipment> collect = wtls.stream().filter(wt -> wt.getSubstationId().equals(sub.getId())).collect(Collectors.toList());
|
|
|
+ subWtsMap.put(sub.getId(), collect);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ wswpls = proBasicWeatherStationService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ wswpls.stream().forEach(ws -> {
|
|
|
+
|
|
|
+ String subString = redisService.get(ws.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ wswppointmap.put(ws.getId(), stringWindpowerstationpointnewMap);
|
|
|
+
|
|
|
+// List<ProBasicEquipment> collect = wtls.stream().filter(wt -> wt.getSubstationId().equals(sub.getId())).collect(Collectors.toList());
|
|
|
+// subWtsMap.put(sub.getId(),collect);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ List<ProEconStateAi> proEconStateAis = proEconStateAiService.list();
|
|
|
+ proEconStateAis.stream().forEach(ai -> {
|
|
|
+ if (aistateMap.containsKey(ai.getModelid())) {
|
|
|
+ aistateMap.get(ai.getModelid()).put(ai.getOriginalState(), ai.getMappingState());
|
|
|
+ } else {
|
|
|
+ Map<Integer, Integer> stateMap = new HashMap<>();
|
|
|
+ stateMap.put(ai.getOriginalState(), ai.getMappingState());
|
|
|
+ aistateMap.put(ai.getModelid(), stateMap);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ lnls = proBasicLineService.list().stream().filter(i -> StringUtils.isNotNull(pjmap.get(i.getProjectId())) && runWpids.contains(pjmap.get(i.getProjectId()).getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ lnls.stream().forEach(l -> {
|
|
|
+ lnmap.put(l.getId(), l);
|
|
|
+ if (prolinemap.containsKey(l.getProjectId())) {
|
|
|
+ prolinemap.get(l.getProjectId()).add(l);
|
|
|
+ } else {
|
|
|
+ List<ProBasicLine> lineList = new ArrayList<>();
|
|
|
+ lineList.add(l);
|
|
|
+ prolinemap.put(l.getProjectId(), lineList);
|
|
|
+ }
|
|
|
+ String lnString = redisService.get(l.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(lnString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ linepointmap.put(l.getId(), stringWindpowerstationpointnewMap);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ zwpls = proBasicWindpowerstationService.list().stream().filter(i -> runWpids.contains(i.getId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ wpls = proBasicWindpowerstationService.list().stream().filter(i -> runWpids.contains(i.getId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ ;
|
|
|
+ meterpoints = proBasicMeterPointService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
|
|
|
+ meterpoints.stream().forEach(meterpoint -> {
|
|
|
+ meterpointMap.put(meterpoint.getNemCode(), meterpoint);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ wpls.stream().forEach(wp -> {
|
|
|
+
|
|
|
+ wpmap.put(wp.getId(), wp);
|
|
|
+ String wpString = redisService.get(wp.getId());
|
|
|
+ Map<String, ProBasicPowerstationPoint> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
|
|
|
+ });
|
|
|
+ wppointmap.put(wp.getId(), stringMapMap);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+// String llglString = redisService.get("ZLLGL");
|
|
|
+// theoreticalPowerMap = JSONObject.parseObject(llglString, new TypeReference<Map<String, Map<Double, ProBasicModelPowerRd>>>() {
|
|
|
+// });
|
|
|
+//
|
|
|
+// String sszzt = redisService.get("SSZZT");
|
|
|
+// statusMap = JSONObject.parseObject(sszzt, new TypeReference<Map<String, List<ProBasicStatusPoint>>>() {
|
|
|
+// });
|
|
|
+//
|
|
|
+// List<ProEconWtPowerCurveFitting> econWtPowerCurveFittings = proEconWtPowerCurveFittingService.list();
|
|
|
+// if (StringUtils.isNotNull(econWtPowerCurveFittings)) {
|
|
|
+// econWtPowerCurveFittings.stream().forEach(curveFitting -> {
|
|
|
+// if (curveFittingPowerMap.containsKey(curveFitting.getWindturbineId())) {
|
|
|
+// curveFittingPowerMap.get(curveFitting.getWindturbineId()).put(curveFitting.getSpeed(), curveFitting);
|
|
|
+// } else {
|
|
|
+// Map<Double, ProEconWtPowerCurveFitting> powerMap = new HashMap<>();
|
|
|
+// powerMap.put(curveFitting.getSpeed(), curveFitting);
|
|
|
+// curveFittingPowerMap.put(curveFitting.getWindturbineId(), powerMap);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+// for (int i = 0; i < 9; i++) {
|
|
|
+// Set<String> keys = redisService.keys(i);
|
|
|
+//
|
|
|
+// for (String key : keys) {
|
|
|
+// redisDbMap.put(key, i);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// pointdis = proBasicStatusPointService.list();
|
|
|
+//
|
|
|
+// Map<String, ProBasicStatusPoint> items = null;
|
|
|
+// if (pointdis != null && !pointdis.isEmpty()) {
|
|
|
+// for (int i = 0; i < pointdis.size(); i++) {
|
|
|
+// ProBasicStatusPoint point = pointdis.get(i);
|
|
|
+// if (pointdismap.containsKey(point.getWindturbineId())) {
|
|
|
+// items = pointdismap.get(point.getWindturbineId());
|
|
|
+// items.put(point.getUniformCode(), point);
|
|
|
+// } else {
|
|
|
+// items = new HashMap<String, ProBasicStatusPoint>();
|
|
|
+// pointdismap.put(point.getWindturbineId(), items);
|
|
|
+// items.put(point.getUniformCode(), point);
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ List<ProEconAlarmRule> customls =proEconAlarmRuleService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ProEconAlarmRule> wtCustomls=new ArrayList<>();
|
|
|
+ List<ProEconAlarmRule> wpCustomls=new ArrayList<>();
|
|
|
+// List<ProEconAlarmRule> btCustomls=new ArrayList<>();
|
|
|
+ if(!customls.isEmpty())
|
|
|
+ {
|
|
|
+ for(ProEconAlarmRule vo: customls)
|
|
|
+ {
|
|
|
+ if(vo.getCategory().equals(AlarmCustomType.WT.getCode()))
|
|
|
+ {
|
|
|
+ wtCustomls.add(vo);
|
|
|
+ }else if(vo.getCategory().equals(AlarmCustomType.WP.getCode()))
|
|
|
+ {
|
|
|
+ wpCustomls.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ alarmRulesMap.put(AlarmCustomType.WT.getCode(),wtCustomls);
|
|
|
+ alarmRulesMap.put(AlarmCustomType.WP.getCode(),wpCustomls);
|
|
|
+
|
|
|
+
|
|
|
+ List<ProEconAlarmConfiguration> templs = proEconAlarmConfigurationService.list().stream().filter(i -> i.getEnable()).collect(Collectors.toList());
|
|
|
+ if (!templs.isEmpty()) {
|
|
|
+ for (ProEconAlarmConfiguration alarm : templs) {
|
|
|
+ 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.BT.getCode())) {
|
|
|
+ btalarmls.add(alarm);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// inputOrOutPutService.initialInputOrOutputSpeed();
|
|
|
+ logger.info("缓存结束------------------------------------------------------------");
|
|
|
+ }
|
|
|
+}
|