|
@@ -1,7 +1,6 @@
|
|
|
package com.gyee.backconfig.config;
|
|
|
|
|
|
|
|
|
-
|
|
|
import com.gyee.backconfig.model.auto.*;
|
|
|
import com.gyee.backconfig.service.auto.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -13,6 +12,7 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -43,60 +43,163 @@ public class CacheContext implements CommandLineRunner {
|
|
|
private IWindturbineService windturbineService;//风机
|
|
|
|
|
|
|
|
|
- public static Map<String, Region> regionmap = new HashMap<>();
|
|
|
+ public static Map<String, Companys> cpmap = new HashMap<>();
|
|
|
+ public static List<Companys> cpls = new ArrayList<>();
|
|
|
+
|
|
|
+ public static Map<String, Region> regionmap = new HashMap<>();
|
|
|
public static List<Region> regions = new ArrayList<>();
|
|
|
|
|
|
+ public static Map<String, Windpowerstation> wpmap = new HashMap<>();
|
|
|
+ public static List<Windpowerstation> wpls = new ArrayList<>();
|
|
|
+ public static Map<String, List<Windpowerstation>> wpmapGroupGCRegion = new HashMap<>();
|
|
|
+ public static Map<String, List<Windpowerstation>> wpmapGroupGCCompany = new HashMap<>();
|
|
|
+ public static Map<String, List<Windpowerstation>> wpmapGroupFCRegion = new HashMap<>();
|
|
|
+ public static Map<String, List<Windpowerstation>> wpmapGroupFCCompany = new HashMap<>();
|
|
|
|
|
|
- public static Map<String, Line> linemap = new HashMap<>();
|
|
|
+ public static Map<String, Project> promap = new HashMap<>();
|
|
|
+ public static List<Project> prols = new ArrayList<>();
|
|
|
+
|
|
|
+ public static Map<String, Line> linemap = new HashMap<>();
|
|
|
public static List<Line> lines = new ArrayList<>();
|
|
|
|
|
|
|
|
|
- public static Map<String, Windturbine> windturbinemap = new HashMap<>();
|
|
|
+ public static Map<String, Windturbine> windturbinemap = new HashMap<>();
|
|
|
public static List<Windturbine> windturbines = new ArrayList<>();
|
|
|
-
|
|
|
- public static Map<String, Project> promap = new HashMap<>();
|
|
|
- public static List<Project> prols = new ArrayList<>();
|
|
|
- public static Map<String,Windpowerstation> wpmap = new HashMap<>();
|
|
|
- public static List<Windpowerstation> wpls = new ArrayList<>();
|
|
|
- public static Map<String, Companys> cpmap = new HashMap<>();
|
|
|
- public static List<Companys> cpls = new ArrayList<>();
|
|
|
-
|
|
|
+ public static Map<String, List<Windturbine>> poequipmentmap = new HashMap<>();
|
|
|
+ public static Map<String, List<Windturbine>> pjequipmentmap = new HashMap<>();
|
|
|
+ public static Map<String, List<Windturbine>> liequipmentmap = new HashMap<>();
|
|
|
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
|
|
|
+ System.out.println(">>>>>>>>>>>>>>>服务启动,正在缓存数据<<<<<<<<<<<<<<");
|
|
|
+ //公司
|
|
|
+ initcompanyList();
|
|
|
+
|
|
|
+ //区域
|
|
|
+ initSegionList();
|
|
|
+
|
|
|
+ //场站
|
|
|
+ initPowerstationList();
|
|
|
+
|
|
|
+ //期次
|
|
|
+ initProjectList();
|
|
|
+
|
|
|
+ //线路
|
|
|
+ initLineList();
|
|
|
+
|
|
|
+// 发电设备
|
|
|
+ initEquipmentList();
|
|
|
+
|
|
|
+// //变电所
|
|
|
+// initSubStationList();
|
|
|
+//
|
|
|
+// //方阵
|
|
|
+// initSquaresList();
|
|
|
+
|
|
|
+ System.out.println(">>>>>>>>>>>>>>>数据缓存完成<<<<<<<<<<<<<<");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化公司表
|
|
|
+ */
|
|
|
+ public void initcompanyList() {
|
|
|
+ //清理集合中的数据
|
|
|
+ cpls.clear();
|
|
|
+ cpmap.clear();
|
|
|
+ //重新加载集合数据
|
|
|
cpls = companysService.list();
|
|
|
cpls.stream().forEach(Companys -> {
|
|
|
- cpmap.put(Companys.getId(),Companys);
|
|
|
+ cpmap.put(Companys.getId(), Companys);
|
|
|
});
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化区域表
|
|
|
+ */
|
|
|
+ public void initSegionList() {
|
|
|
+ //清理集合中的数据
|
|
|
+ regions.clear();
|
|
|
+ regionmap.clear();
|
|
|
+ regions = regionService.list();
|
|
|
+ regions.stream().forEach(region -> {
|
|
|
+ regionmap.put(region.getId(), region);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化场站表
|
|
|
+ */
|
|
|
+ public void initPowerstationList() {
|
|
|
+ //清理集合数据
|
|
|
+ wpls.clear();
|
|
|
+ wpmap.clear();
|
|
|
+ wpmapGroupGCCompany.clear();
|
|
|
+ wpmapGroupFCCompany.clear();
|
|
|
+ wpmapGroupGCRegion.clear();
|
|
|
+ wpmapGroupFCRegion.clear();
|
|
|
|
|
|
wpls = windpowerstationService.list();
|
|
|
wpls.stream().forEach(windpowerstation -> {
|
|
|
- wpmap.put(windpowerstation.getId(),windpowerstation);
|
|
|
+ wpmap.put(windpowerstation.getId(), windpowerstation);
|
|
|
});
|
|
|
|
|
|
- prols = projectService.list();
|
|
|
- prols.stream().forEach(Project -> {
|
|
|
- promap.put(Project.getWindpowerstationid(),Project);
|
|
|
- });
|
|
|
|
|
|
+ wpmapGroupGCRegion = wpls.stream().filter(p -> p.getId().indexOf("_GDC_") >= 0).collect(Collectors.groupingBy(Windpowerstation::getRegionid));
|
|
|
+ wpmapGroupFCRegion = wpls.stream().filter(p -> p.getId().indexOf("_FDC_") >= 0).collect(Collectors.groupingBy(Windpowerstation::getRegionid));
|
|
|
|
|
|
- //区域
|
|
|
- regions = regionService.list();
|
|
|
- regions.stream().forEach(region -> {
|
|
|
- regionmap.put(region.getId(), region);
|
|
|
+
|
|
|
+ wpmapGroupGCCompany = wpls.stream().filter(p -> p.getId().indexOf("_GDC_") >= 0).collect(Collectors.groupingBy(Windpowerstation::getCompanyid));
|
|
|
+ wpmapGroupFCCompany = wpls.stream().filter(p -> p.getId().indexOf("_FDC_") >= 0).collect(Collectors.groupingBy(Windpowerstation::getCompanyid));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 初始化期次表
|
|
|
+ */
|
|
|
+ public void initProjectList() {
|
|
|
+ //清理集合数据
|
|
|
+ prols.clear();
|
|
|
+ promap.clear();
|
|
|
+ prols = projectService.list();
|
|
|
+ prols.stream().forEach(Project -> {
|
|
|
+ promap.put(Project.getWindpowerstationid(), Project);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
- //线路
|
|
|
+ /**
|
|
|
+ * 初始化线路表
|
|
|
+ */
|
|
|
+ public void initLineList() {
|
|
|
+ //清理集合数据
|
|
|
+ lines.clear();
|
|
|
+ linemap.clear();
|
|
|
lines = lineService.list();
|
|
|
lines.stream().forEach(line -> {
|
|
|
linemap.put(line.getId(), line);
|
|
|
});
|
|
|
+ }
|
|
|
|
|
|
- //风机
|
|
|
- windturbines = windturbineService.list();
|
|
|
+ /**
|
|
|
+ * 初始化风机表
|
|
|
+ */
|
|
|
+ public void initEquipmentList() {
|
|
|
+ //清理集合数据
|
|
|
+ //清理集合数据
|
|
|
+ windturbines.clear();
|
|
|
+ windturbinemap.clear();
|
|
|
+ poequipmentmap.clear();
|
|
|
+ pjequipmentmap.clear();
|
|
|
+ liequipmentmap.clear();
|
|
|
+
|
|
|
+ windturbines = windturbineService.list();
|
|
|
windturbines.stream().forEach(windturbine -> {
|
|
|
windturbinemap.put(windturbine.getId(), windturbine);
|
|
|
});
|
|
|
+ poequipmentmap = windturbines.stream().collect(Collectors.groupingBy(Windturbine::getWindpowerstationid));
|
|
|
+ pjequipmentmap = windturbines.stream().collect(Collectors.groupingBy(Windturbine::getProjectid));
|
|
|
+ liequipmentmap = windturbines.stream().collect(Collectors.groupingBy(Windturbine::getLineid));
|
|
|
}
|
|
|
}
|