|
@@ -2,13 +2,9 @@ package com.gyee.backconfig.config;
|
|
|
|
|
|
|
|
|
|
|
|
-import com.gyee.backconfig.model.auto.Companys;
|
|
|
-import com.gyee.backconfig.model.auto.Project;
|
|
|
-import com.gyee.backconfig.model.auto.Windpowerstation;
|
|
|
-import com.gyee.backconfig.service.auto.ICompanysService;
|
|
|
-import com.gyee.backconfig.service.auto.ILineService;
|
|
|
-import com.gyee.backconfig.service.auto.IProjectService;
|
|
|
-import com.gyee.backconfig.service.auto.IWindpowerstationService;
|
|
|
+import com.gyee.backconfig.model.auto.*;
|
|
|
+import com.gyee.backconfig.service.auto.*;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -29,21 +25,47 @@ import java.util.Map;
|
|
|
public class CacheContext implements CommandLineRunner {
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRegionService regionService;//区域
|
|
|
+
|
|
|
@Resource
|
|
|
- private ICompanysService companysService;
|
|
|
+ private ICompanysService companysService;//公司
|
|
|
+
|
|
|
@Resource
|
|
|
- private IWindpowerstationService windpowerstationService;
|
|
|
+ private IProjectService projectService;//期次
|
|
|
+
|
|
|
@Resource
|
|
|
- private IProjectService projectService;
|
|
|
+ private ILineService lineService;//线路
|
|
|
+
|
|
|
@Resource
|
|
|
- private ILineService lineService;
|
|
|
+ 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<com.gyee.backconfig.model.auto.Companys> cpls = new ArrayList<>();
|
|
|
+ public static List<Companys> cpls = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
|
|
@@ -63,10 +85,22 @@ public class CacheContext implements CommandLineRunner {
|
|
|
});
|
|
|
|
|
|
|
|
|
- List<Project> projectList = projectService.list();
|
|
|
- projectList.stream().forEach(project -> {
|
|
|
- promap.put(project.getId(),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);
|
|
|
+ });
|
|
|
}
|
|
|
}
|