|
@@ -0,0 +1,72 @@
|
|
|
+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 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 ICompanysService companysService;
|
|
|
+ @Resource
|
|
|
+ private IWindpowerstationService windpowerstationService;
|
|
|
+ @Resource
|
|
|
+ private IProjectService projectService;
|
|
|
+ @Resource
|
|
|
+ private ILineService lineService;
|
|
|
+
|
|
|
+ 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<>();
|
|
|
+ @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);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ List<Project> projectList = projectService.list();
|
|
|
+ projectList.stream().forEach(project -> {
|
|
|
+ promap.put(project.getId(),project);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+}
|