CacheContext.java 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. package com.gyee.generation.init;
  2. import cn.hutool.core.util.ObjectUtil;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.alibaba.fastjson.TypeReference;
  5. import com.gyee.generation.model.auto.*;
  6. import com.gyee.generation.service.auto.*;
  7. import com.gyee.generation.util.redis.RedisService;
  8. import jakarta.annotation.Resource;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.beans.factory.annotation.Value;
  12. import org.springframework.boot.CommandLineRunner;
  13. import org.springframework.stereotype.Component;
  14. import jakarta.annotation.Resource;
  15. import java.util.*;
  16. import java.util.stream.Collectors;
  17. /**
  18. * @description: 初始化类缓存数据
  19. * @author: shilin
  20. * @date: 2024/5/29 9:18
  21. * @param:
  22. * @return:
  23. **/
  24. @Component
  25. public class CacheContext implements CommandLineRunner {
  26. Logger logger = LoggerFactory.getLogger(CacheContext.class);
  27. @Resource
  28. private IProBasicEquipmentService proBasicEquipmentService;
  29. @Resource
  30. private IProBasicLineService proBasicLineService;
  31. @Resource
  32. private IProBasicProjectService proBasicProjectService;
  33. @Resource
  34. private IProBasicPowerstationService proBasicWindpowerstationService;
  35. @Resource
  36. private IProEconEquipmentmodelService proEconEquipmentmodelService;
  37. @Resource
  38. private IProBasicMeterPointService proBasicMeterPointService;
  39. @Resource
  40. private RedisService redisService;
  41. @Resource
  42. private IProBasicStatusAiService proBasicStatusAiService;
  43. @Resource
  44. private IProBasicStatusDiService proBasicStatusDiService;
  45. @Resource
  46. private IProBasicSubStationService proBasicSubStationService;
  47. @Resource
  48. private IProBasicSquareService proBasicSquareService;
  49. @Resource
  50. private IProBasicCompanyService proBasicCompanyService;
  51. @Resource
  52. private IProBasicRegionService proBasicRegionService;
  53. @Resource
  54. private IProBasicWeatherStationService proBasicWeatherStationService;
  55. @Resource
  56. private IProBasicEnergyGroupService proBasicEnergyGroupService;
  57. @Value("${runWindpowerstation}")
  58. private String runWindpowerstation;
  59. public static List<ProBasicEnergyGroup> egls = new ArrayList<>();
  60. public static List<ProBasicRegion> rgls = new ArrayList<>();
  61. public static List<ProBasicCompany> cpls = new ArrayList<>();
  62. public static List<ProBasicPowerstation> wpls = new ArrayList<>();
  63. public static List<ProBasicSubStation> subwpls = new ArrayList<>();
  64. public static List<ProBasicWeatherStation> wsls = new ArrayList<>();
  65. public static List<ProBasicSquare> sqls = new ArrayList<>();
  66. public static List<ProBasicProject> pjls = new ArrayList<>();
  67. public static List<ProBasicLine> lnls = new ArrayList<>();
  68. public static List<ProBasicEquipment> wtls = new ArrayList<>();
  69. public static List<ProBasicEquipment> wtfdls = new ArrayList<>();
  70. public static List<ProBasicEquipment> wtgfls = new ArrayList<>();
  71. public static List<ProBasicEquipment> wt_fjls = new ArrayList<>();
  72. public static List<ProBasicMeterPoint> meterpoints = new ArrayList<>();
  73. public static List<ProEconEquipmentmodel> models=new ArrayList<>();
  74. public static Map<String, ProBasicEnergyGroup> egmap = new HashMap<>();
  75. public static Map<String, ProBasicRegion> rgmap = new HashMap<>();
  76. public static Map<String, ProBasicCompany> cpmap = new HashMap<>();
  77. public static Map<String, ProBasicPowerstation> wpmap = new HashMap<>();
  78. public static Map<String, ProBasicProject> pjmap = new HashMap<>();
  79. public static Map<String, ProBasicLine> lnmap = new HashMap<>();
  80. public static Map<String, ProBasicSubStation> submap = new HashMap<>();
  81. public static Map<String, ProBasicWeatherStation> wsmap = new HashMap<>();
  82. public static Map<String, ProBasicSquare> sqmap = new HashMap<>();
  83. public static Map<String, ProBasicEquipment> eqmap = new HashMap<>();
  84. public static Map<String, ProBasicMeterPoint> meterMap = new HashMap<>();
  85. public static Map<String, ProEconEquipmentmodel> modelMap = new HashMap<>();
  86. public static Map<String, String> wtstandardmap = new HashMap<>();
  87. public static Map<String, List<ProBasicPowerstation>> cpwpmap = new HashMap<>();
  88. public static Map<String, List<ProBasicCompany>> rgcpmap = new HashMap<>();
  89. public static Map<String, List<ProBasicMeterPoint>> wpmeterMap = new HashMap<>();
  90. public static Map<String, List<ProBasicWeatherStation>> poWsStationMap = new HashMap<>();
  91. public static Map<String, List<ProBasicProject>> wppromap = new HashMap<>();
  92. public static Map<String, List<ProBasicLine>> prolinemap = new HashMap<>();
  93. public static Map<String, List<ProBasicEquipment>> wpwtmap = new HashMap<>();
  94. public static Map<String, List<ProBasicEquipment>> pjwtmap = new HashMap<>();
  95. public static Map<String, List<ProBasicEquipment>> lnwtmap = new HashMap<>();
  96. public static Map<String, List<ProBasicEquipment>> sqwtmap = new HashMap<>();
  97. public static Map<String, Map<String, ProBasicEquipmentPoint>> eqpointmap = new HashMap<>();
  98. public static Map<String, Map<String, ProBasicPowerstationPoint>> linepointmap = new HashMap<>();
  99. public static Map<String, Map<String, ProBasicPowerstationPoint>> propointmap = new HashMap<>();
  100. public static Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = new HashMap<>();
  101. public static Map<String, Map<String, ProBasicPowerstationPoint>> subwppointmap = new HashMap<>();
  102. public static Map<String, Map<String, ProBasicPowerstationPoint>> wswppointmap = new HashMap<>();
  103. public static Map<String, Map<String, ProBasicPowerstationPoint>> companypointmap = new HashMap<>();
  104. public static Map<String, Map<String, ProBasicPowerstationPoint>> regionpointmap = new HashMap<>();
  105. public static Map<String, Map<String, ProBasicPowerstationPoint>> grouppointmap = new HashMap<>();
  106. public static Map<String, Map<String, ProBasicStatusDi>> pointdismap = new HashMap<>();
  107. public static Map<String, Map<Integer, Integer>> aistateMap = new HashMap<>();
  108. public static Map<String, List<ProBasicEquipment>> subWtsMap = new HashMap<>();
  109. public static Map<String, Integer> redisDbMap = new HashMap<>();
  110. @Override
  111. public void run(String... args) throws Exception {
  112. logger.info("缓存开始------------------------------------------------------------");
  113. List<String> runWpids = Arrays.asList(runWindpowerstation.split(","));
  114. logger.info(runWpids.get(0) + "------------------" + runWpids.size());
  115. sqls = proBasicSquareService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  116. if (!sqls.isEmpty()) {
  117. for (ProBasicSquare sq : sqls) {
  118. sqmap.put(sq.getNemCode(), sq);
  119. }
  120. }
  121. cpls = proBasicCompanyService.list().stream().filter(i -> i.getIsAble().equals(1)).collect(Collectors.toList());
  122. if (!cpls.isEmpty()) {
  123. for (ProBasicCompany sq : cpls) {
  124. cpmap.put(sq.getNemCode(), sq);
  125. if (redisService.hasKey(sq.getNemCode() + "0")) {
  126. String cp0String = redisService.get(sq.getNemCode() + "0");
  127. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  128. });
  129. companypointmap.put(sq.getNemCode() + "0", stringWindpowerstationpointnewMap);
  130. }
  131. if (redisService.hasKey(sq.getNemCode() + "-1")) {
  132. String cp1String = redisService.get(sq.getNemCode() + "-1");
  133. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  134. });
  135. companypointmap.put(sq.getNemCode() + "-1", stringWindpowerstationpointnewMap);
  136. }
  137. if (redisService.hasKey(sq.getNemCode() + "-2")) {
  138. String cp2String = redisService.get(sq.getNemCode() + "-2");
  139. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  140. });
  141. companypointmap.put(sq.getNemCode() + "-2", stringWindpowerstationpointnewMap);
  142. }
  143. }
  144. }
  145. rgls = proBasicRegionService.list().stream().filter(i -> i.getIsAble() == 1).collect(Collectors.toList());
  146. if (!rgls.isEmpty()) {
  147. for (ProBasicRegion sq : rgls) {
  148. rgmap.put(sq.getNemCode(), sq);
  149. if (redisService.hasKey(sq.getNemCode() + "0")) {
  150. String cp0String = redisService.get(sq.getNemCode() + "0");
  151. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  152. });
  153. regionpointmap.put(sq.getNemCode() + "0", stringWindpowerstationpointnewMap);
  154. }
  155. if (redisService.hasKey(sq.getNemCode() + "-1")) {
  156. String cp1String = redisService.get(sq.getNemCode() + "-1");
  157. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  158. });
  159. regionpointmap.put(sq.getNemCode() + "-1", stringWindpowerstationpointnewMap);
  160. }
  161. if (redisService.hasKey(sq.getNemCode() + "-2")) {
  162. String cp2String = redisService.get(sq.getNemCode() + "-2");
  163. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(cp2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  164. });
  165. regionpointmap.put(sq.getNemCode() + "-2", stringWindpowerstationpointnewMap);
  166. }
  167. }
  168. }
  169. egls = proBasicEnergyGroupService.list().stream().filter(i -> i.getIsAble() == 1 && !i.getParentId().equals("0")).collect(Collectors.toList());
  170. if (!egls.isEmpty()) {
  171. for (ProBasicEnergyGroup sq : egls) {
  172. egmap.put(sq.getNemCode(), sq);
  173. if (redisService.hasKey(sq.getNemCode() + "0")) {
  174. String eg0String = redisService.get(sq.getNemCode() + "0");
  175. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg0String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  176. });
  177. grouppointmap.put(sq.getNemCode() + "0", stringWindpowerstationpointnewMap);
  178. }
  179. if (redisService.hasKey(sq.getNemCode() + "-1")) {
  180. String eg1String = redisService.get(sq.getNemCode() + "-1");
  181. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg1String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  182. });
  183. grouppointmap.put(sq.getNemCode() + "-1", stringWindpowerstationpointnewMap);
  184. }
  185. if (redisService.hasKey(sq.getNemCode() + "-2")) {
  186. String eg2String = redisService.get(sq.getNemCode() + "-2");
  187. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(eg2String, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  188. });
  189. grouppointmap.put(sq.getNemCode() + "-2", stringWindpowerstationpointnewMap);
  190. }
  191. }
  192. }
  193. for (ProBasicCompany cp : cpls) {
  194. if (rgcpmap.containsKey(cp.getRegionId())) {
  195. rgcpmap.get(cp.getRegionId()).add(cp);
  196. } else {
  197. List<ProBasicCompany> wps = new ArrayList<>();
  198. wps.add(cp);
  199. rgcpmap.put(cp.getRegionId(), wps);
  200. }
  201. }
  202. for (ProBasicPowerstation wp : wpls) {
  203. if (cpwpmap.containsKey(wp.getCompanyId())) {
  204. cpwpmap.get(wp.getCompanyId()).add(wp);
  205. } else {
  206. List<ProBasicPowerstation> wps = new ArrayList<>();
  207. wps.add(wp);
  208. cpwpmap.put(wp.getCompanyId(), wps);
  209. }
  210. }
  211. wpls = proBasicWindpowerstationService.list();
  212. for (ProBasicPowerstation station : wpls) {
  213. wpmap.put(station.getNemCode(), station);
  214. }
  215. wsls.stream().forEach(p -> {
  216. String wsString = redisService.get(p.getNemCode());
  217. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(wsString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  218. });
  219. wswppointmap.put(p.getNemCode(), stringWindpowerstationpointnewMap);
  220. });
  221. wtls = proBasicEquipmentService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsable() == 1).collect(Collectors.toList());
  222. logger.info(wtls.size() + "");
  223. wtls.forEach(wt -> {
  224. if (wt.getNemCode().contains("_G_")) {
  225. wtgfls.add(wt);
  226. } else if (wt.getNemCode().contains("_F_")) {
  227. wtfdls.add(wt);
  228. }
  229. if (wt.getNemCode().contains("_F_")) {
  230. wt_fjls.add(wt);
  231. }
  232. eqmap.put(wt.getNemCode(), wt);
  233. String wtString = redisService.get(wt.getNemCode());
  234. Map<String, ProBasicEquipmentPoint> stringWindturbinetestingpointnewMap = JSONObject.parseObject(wtString, new TypeReference<Map<String, ProBasicEquipmentPoint>>() {
  235. });
  236. eqpointmap.put(wt.getNemCode(), stringWindturbinetestingpointnewMap);
  237. if (wpwtmap.containsKey(wt.getWindpowerstationId())) {
  238. wpwtmap.get(wt.getWindpowerstationId()).add(wt);
  239. } else {
  240. List<ProBasicEquipment> wps = new ArrayList<>();
  241. wps.add(wt);
  242. wpwtmap.put(wt.getWindpowerstationId(), wps);
  243. }
  244. if (pjwtmap.containsKey(wt.getProjectId())) {
  245. pjwtmap.get(wt.getProjectId()).add(wt);
  246. } else {
  247. List<ProBasicEquipment> pjs = new ArrayList<>();
  248. pjs.add(wt);
  249. pjwtmap.put(wt.getProjectId(), pjs);
  250. }
  251. if (lnwtmap.containsKey(wt.getLineId())) {
  252. lnwtmap.get(wt.getLineId()).add(wt);
  253. } else {
  254. List<ProBasicEquipment> lnls = new ArrayList<>();
  255. lnls.add(wt);
  256. lnwtmap.put(wt.getLineId(), lnls);
  257. }
  258. if (sqwtmap.containsKey(wt.getSquareId())) {
  259. sqwtmap.get(wt.getSquareId()).add(wt);
  260. } else {
  261. List<ProBasicEquipment> lnls = new ArrayList<>();
  262. lnls.add(wt);
  263. sqwtmap.put(wt.getSquareId(), lnls);
  264. }
  265. });
  266. //初始化标杆风机
  267. for (ProBasicEquipment wt : wtls) {
  268. if (wpwtmap.containsKey(wt.getWindpowerstationId())) {
  269. List<ProBasicEquipment> wts = wpwtmap.get(wt.getWindpowerstationId());
  270. for (ProBasicEquipment w : wts) {
  271. wtstandardmap.put(wt.getNemCode(), w.getNemCode());
  272. break;
  273. }
  274. }
  275. }
  276. pjls = proBasicProjectService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  277. pjls.stream().forEach(p -> {
  278. pjmap.put(p.getNemCode(), p);
  279. if (wppromap.containsKey(p.getWindpowerstationId())) {
  280. wppromap.get(p.getWindpowerstationId()).add(p);
  281. } else {
  282. List<ProBasicProject> prolist = new ArrayList<>();
  283. prolist.add(p);
  284. wppromap.put(p.getWindpowerstationId(), prolist);
  285. }
  286. String pjString = redisService.get(p.getNemCode());
  287. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(pjString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  288. });
  289. propointmap.put(p.getNemCode(), stringWindpowerstationpointnewMap);
  290. });
  291. subwpls = proBasicSubStationService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  292. subwpls.stream().forEach(sub -> {
  293. String subString = redisService.get(sub.getNemCode());
  294. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  295. });
  296. subwppointmap.put(sub.getNemCode(), stringWindpowerstationpointnewMap);
  297. submap.put(sub.getNemCode(),sub);
  298. List<ProBasicEquipment> collect = wtls.stream().filter(wt -> wt.getSubstationId().equals(sub.getNemCode())).collect(Collectors.toList());
  299. subWtsMap.put(sub.getNemCode(), collect);
  300. });
  301. wsls = proBasicWeatherStationService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  302. if (!wsls.isEmpty()) {
  303. for (ProBasicWeatherStation ws : wsls) {
  304. wsmap.put(ws.getName(),ws);
  305. if (poWsStationMap.containsKey(ws.getWindpowerstationId())) {
  306. List<ProBasicWeatherStation> ls = poWsStationMap.get(ws.getWindpowerstationId());
  307. ls.add(ws);
  308. poWsStationMap.put(ws.getWindpowerstationId(), ls);
  309. } else {
  310. List<ProBasicWeatherStation> ls = new ArrayList<>();
  311. ls.add(ws);
  312. poWsStationMap.put(ws.getWindpowerstationId(), ls);
  313. }
  314. }
  315. }
  316. wsls.stream().forEach(weather -> {
  317. String subString = redisService.get(weather.getNemCode());
  318. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(subString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  319. });
  320. wswppointmap.put(weather.getNemCode(), stringWindpowerstationpointnewMap);
  321. });
  322. lnls = proBasicLineService.list().stream().filter(i -> ObjectUtil.isNotEmpty(pjmap.get(i.getProjectId())) && runWpids.contains(pjmap.get(i.getProjectId()).getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  323. lnls.stream().forEach(l -> {
  324. lnmap.put(l.getNemCode(), l);
  325. if (prolinemap.containsKey(l.getProjectId())) {
  326. prolinemap.get(l.getProjectId()).add(l);
  327. } else {
  328. List<ProBasicLine> lineList = new ArrayList<>();
  329. lineList.add(l);
  330. prolinemap.put(l.getProjectId(), lineList);
  331. }
  332. String lnString = redisService.get(l.getNemCode());
  333. Map<String, ProBasicPowerstationPoint> stringWindpowerstationpointnewMap = JSONObject.parseObject(lnString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  334. });
  335. linepointmap.put(l.getNemCode(), stringWindpowerstationpointnewMap);
  336. });
  337. wpls = proBasicWindpowerstationService.list().stream().filter(i -> runWpids.contains(i.getNemCode()) && i.getIsAble() == 1).collect(Collectors.toList());
  338. ;
  339. meterpoints = proBasicMeterPointService.list().stream().filter(i -> runWpids.contains(i.getWindpowerstationId()) && i.getIsAble() == 1).collect(Collectors.toList());
  340. meterpoints.stream().forEach(meterpoint -> {
  341. meterMap.put(meterpoint.getNemCode(), meterpoint);
  342. });
  343. for (ProBasicMeterPoint meterpoint2 : meterpoints) {
  344. if (wpmap.containsKey(meterpoint2.getWindpowerstationId())) {
  345. meterMap.put(meterpoint2.getNemCode(), meterpoint2);
  346. if (wpmeterMap.containsKey(meterpoint2.getWindpowerstationId())) {
  347. wpmeterMap.get(meterpoint2.getWindpowerstationId()).add(meterpoint2);
  348. } else {
  349. List<ProBasicMeterPoint> list = new ArrayList<>();
  350. list.add(meterpoint2);
  351. wpmeterMap.put(meterpoint2.getWindpowerstationId(), list);
  352. }
  353. }
  354. }
  355. for (ProBasicMeterPoint meterpoint2 : proBasicMeterPointService.list()) {
  356. if (wpmap.containsKey(meterpoint2.getWindpowerstationId())) {
  357. meterMap.put(meterpoint2.getNemCode(), meterpoint2);
  358. if (wpmeterMap.containsKey(meterpoint2.getWindpowerstationId())) {
  359. wpmeterMap.get(meterpoint2.getWindpowerstationId()).add(meterpoint2);
  360. } else {
  361. List<ProBasicMeterPoint> list = new ArrayList<>();
  362. list.add(meterpoint2);
  363. wpmeterMap.put(meterpoint2.getWindpowerstationId(), list);
  364. }
  365. }
  366. }
  367. wpls.stream().forEach(wp -> {
  368. wpmap.put(wp.getNemCode(), wp);
  369. String wpString = redisService.get(wp.getNemCode());
  370. Map<String, ProBasicPowerstationPoint> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, ProBasicPowerstationPoint>>() {
  371. });
  372. wppointmap.put(wp.getNemCode(), stringMapMap);
  373. });
  374. for (int i = 0; i < 9; i++) {
  375. Set<String> keys = redisService.keys(i);
  376. for (String key : keys) {
  377. redisDbMap.put(key, i);
  378. }
  379. }
  380. List<ProBasicStatusDi> statusdis = proBasicStatusDiService.list();
  381. Map<String, ProBasicStatusDi> items = null;
  382. if (statusdis != null && !statusdis.isEmpty()) {
  383. for (int i = 0; i < statusdis.size(); i++) {
  384. ProBasicStatusDi point = statusdis.get(i);
  385. if (pointdismap.containsKey(point.getWindturbineId())) {
  386. items = pointdismap.get(point.getWindturbineId());
  387. items.put(point.getUniformCode(), point);
  388. } else {
  389. items = new HashMap<>();
  390. pointdismap.put(point.getWindturbineId(), items);
  391. items.put(point.getUniformCode(), point);
  392. }
  393. }
  394. }
  395. List<ProBasicStatusAi> statusais = proBasicStatusAiService.list();
  396. statusais.stream().forEach(ai -> {
  397. if (aistateMap.containsKey(ai.getModelId())) {
  398. aistateMap.get(ai.getModelId()).put(ai.getOriginalState(), ai.getMappingState());
  399. } else {
  400. Map<Integer, Integer> stateMap = new HashMap<>();
  401. stateMap.put(ai.getOriginalState(), ai.getMappingState());
  402. aistateMap.put(ai.getModelId(), stateMap);
  403. }
  404. });
  405. models = proEconEquipmentmodelService.list();
  406. models.stream().forEach(e->{
  407. modelMap.put(e.getNemCode(),e);
  408. });
  409. logger.info("缓存结束------------------------------------------------------------");
  410. }
  411. }