|
@@ -1,106 +1,123 @@
|
|
|
-//package com.gyee.backconfig.config;
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-//import com.gyee.common.model.auto.Windturbine;
|
|
|
-//import com.gyee.common.service.IWindturbineService;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.boot.CommandLineRunner;
|
|
|
-//import org.springframework.stereotype.Component;
|
|
|
-//
|
|
|
-//import javax.annotation.Resource;
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.HashMap;
|
|
|
-//import java.util.List;
|
|
|
-//import java.util.Map;
|
|
|
-//
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @ClassName : CacheContext
|
|
|
-// * @Author : wang
|
|
|
-// * @Date: 2022/9/26 9:35
|
|
|
-// * @Description : 缓存
|
|
|
-// */
|
|
|
-//@Component
|
|
|
-//public class CacheContext implements CommandLineRunner {
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IRegionService regionService;//区域
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// private ICompanysService companysService;//公司
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// private IProjectService projectService;//期次
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// private ILineService lineService;//线路
|
|
|
-//
|
|
|
-// @Resource
|
|
|
-// private IWindpowerstationService windpowerstationService;//场站
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private IWindturbineService windturbineService;//风机
|
|
|
-//
|
|
|
-//
|
|
|
-// public static Map<String, Region> regionmap = new HashMap<>();
|
|
|
-// public static List<Region> regions = 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 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<>();
|
|
|
-//
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void run(String... args) throws Exception {
|
|
|
-//
|
|
|
-// cpls = companysService.list();
|
|
|
-// cpls.stream().forEach(Companys -> {
|
|
|
-// cpmap.put(Companys.getId(),Companys);
|
|
|
-// });
|
|
|
-//
|
|
|
-// wpls = windpowerstationService.list();
|
|
|
-// wpls.stream().forEach(windpowerstation -> {
|
|
|
-// wpmap.put(windpowerstation.getId(),windpowerstation);
|
|
|
-// });
|
|
|
-//
|
|
|
-// prols = projectService.list();
|
|
|
-// prols.stream().forEach(Project -> {
|
|
|
-// promap.put(Project.getWindpowerstationid(),Project);
|
|
|
-// });
|
|
|
-//
|
|
|
-//
|
|
|
-// //区域
|
|
|
-// regions = regionService.list();
|
|
|
-// regions.stream().forEach(region -> {
|
|
|
-// regionmap.put(region.getId(), region);
|
|
|
-// });
|
|
|
-//
|
|
|
-// //线路
|
|
|
-// lines = lineService.list();
|
|
|
-// lines.stream().forEach(line -> {
|
|
|
-// linemap.put(line.getId(), line);
|
|
|
-// });
|
|
|
-//
|
|
|
-// //风机
|
|
|
-// windturbines = windturbineService.list();
|
|
|
-// windturbines.stream().forEach(windturbine -> {
|
|
|
-// windturbinemap.put(windturbine.getId(), windturbine);
|
|
|
-// });
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.gyee.backconfig.config;
|
|
|
+
|
|
|
+
|
|
|
+import com.gyee.backconfig.model.auto.*;
|
|
|
+import com.gyee.backconfig.service.auto.*;
|
|
|
+import com.gyee.common.model.auto.Windturbine;
|
|
|
+import com.gyee.common.service.IWindturbineService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.CommandLineRunner;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : CacheContext
|
|
|
+ * @Author : wang
|
|
|
+ * @Date: 2022/9/26 9:35
|
|
|
+ * @Description : 缓存
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class CacheContext implements CommandLineRunner {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicEnergyGroupService proBasicEnergyGroupService;//集团
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IProBasicRegionService proBasicRegionService;//区域
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicCompanyService proBasicCompanyService;//公司
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicWindpowerstationService proBasicWindpowerstationService;//场站
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicProjectService proBasicProjectService;//期次
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicLineService proBasicLineService;//线路
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IProBasicWindturbineService proBasicWindturbineService;//风机
|
|
|
+
|
|
|
+ //集团
|
|
|
+ public static Map<String, ProBasicEnergyGroup> energymap = new HashMap<>();
|
|
|
+ public static List<ProBasicEnergyGroup> energy = new ArrayList<>();
|
|
|
+
|
|
|
+ //区域
|
|
|
+ public static Map<String, ProBasicRegion> regionmap = new HashMap<>();
|
|
|
+ public static List<ProBasicRegion> regions = new ArrayList<>();
|
|
|
+
|
|
|
+ //公司
|
|
|
+ public static Map<String, ProBasicCompany> cpmap = new HashMap<>();
|
|
|
+ public static List<ProBasicCompany> cpls = new ArrayList<>();
|
|
|
+
|
|
|
+ //场站
|
|
|
+ public static Map<String, ProBasicWindpowerstation> wpmap = new HashMap<>();
|
|
|
+ public static List<ProBasicWindpowerstation> wpls = new ArrayList<>();
|
|
|
+
|
|
|
+ //期次
|
|
|
+ public static Map<String, ProBasicProject> promap = new HashMap<>();
|
|
|
+ public static List<ProBasicProject> prols = new ArrayList<>();
|
|
|
+
|
|
|
+ //线路
|
|
|
+ public static Map<String, ProBasicLine> linemap = new HashMap<>();
|
|
|
+ public static List<ProBasicLine> lines = new ArrayList<>();
|
|
|
+
|
|
|
+ //风机
|
|
|
+ public static Map<String, ProBasicWindturbine> windturbinemap = new HashMap<>();
|
|
|
+ public static List<ProBasicWindturbine> windturbines = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run(String... args) throws Exception {
|
|
|
+
|
|
|
+ //集团
|
|
|
+ energy = proBasicEnergyGroupService.list();
|
|
|
+ energy.stream().forEach(energy -> {
|
|
|
+ energymap.put(energy.getId(), energy);
|
|
|
+ });
|
|
|
+
|
|
|
+ //区域
|
|
|
+ regions = proBasicRegionService.list();
|
|
|
+ regions.stream().forEach(region -> {
|
|
|
+ regionmap.put(region.getGroupId(), region);
|
|
|
+ });
|
|
|
+
|
|
|
+ //公司
|
|
|
+ cpls = proBasicCompanyService.list();
|
|
|
+ cpls.stream().forEach(Companys -> {
|
|
|
+ cpmap.put(Companys.getRegionId(), Companys);
|
|
|
+ });
|
|
|
+
|
|
|
+ //场站
|
|
|
+ wpls = proBasicWindpowerstationService.list();
|
|
|
+ wpls.stream().forEach(windpowerstation -> {
|
|
|
+ wpmap.put(windpowerstation.getCompanyId(), windpowerstation);
|
|
|
+ });
|
|
|
+
|
|
|
+ //期次
|
|
|
+ prols = proBasicProjectService.list();
|
|
|
+ prols.stream().forEach(Project -> {
|
|
|
+ promap.put(Project.getWindpowerstationId(), Project);
|
|
|
+ });
|
|
|
+
|
|
|
+ //线路
|
|
|
+ lines = proBasicLineService.list();
|
|
|
+ lines.stream().forEach(line -> {
|
|
|
+ linemap.put(line.getId(), line);
|
|
|
+ });
|
|
|
+
|
|
|
+ //风机
|
|
|
+ windturbines = proBasicWindturbineService.list();
|
|
|
+ windturbines.stream().forEach(windturbine -> {
|
|
|
+ windturbinemap.put(windturbine.getId(), windturbine);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|