Browse Source

添加基础信息缓存

wangchangsheng 2 years atrás
parent
commit
46d90729e1

+ 49 - 15
web/backmanagerconfig/src/main/java/com/gyee/backconfig/config/CacheContext.java

@@ -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);
+        });
     }
 }

+ 1 - 1
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/CompanysController.java

@@ -22,7 +22,7 @@ import java.util.List;
 
 /**
  * <p>
- * 前端控制器
+ * 前端控制器(公司)
  * </p>
  *
  * @author wang

+ 63 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/PointGenerateController.java

@@ -0,0 +1,63 @@
+package com.gyee.backconfig.controller;
+
+
+import com.gyee.backconfig.config.R;
+import com.gyee.backconfig.model.auto.Project;
+import com.gyee.backconfig.service.auto.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author wang
+ * @since 2022-09-22
+ */
+@RestController
+@RequestMapping("//generate")
+public class PointGenerateController {
+
+
+    @Autowired
+    private IRegionService regionService;//区域
+
+    @Resource
+    private ICompanysService companysService;//公司
+
+    @Resource
+    private IProjectService projectService;//期次
+
+    @Resource
+    private ILineService lineService;//线路
+
+    @Resource
+    private IWindpowerstationService windpowerstationService;//场站
+
+    @Autowired
+    private IWindturbineService windturbineService;//风机
+
+
+
+    @PostMapping(value = "/add")
+    public R GeneratePoint(
+                           @RequestParam(value = "regionCode", required = false) String regionCode,
+                           @RequestParam(value = "companysId", required = false) String companysId,
+                           @RequestParam(value = "stationId", required = false) String stationId,
+                           @RequestParam(value = "projectId", required = false) String projectId,
+                           @RequestParam(value = "lineId", required = false) String lineId,
+                           @RequestParam(value = "type", required = false) String type){
+
+
+
+
+
+
+        return null;
+    }
+
+
+}

+ 1 - 1
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/RegionController.java

@@ -16,7 +16,7 @@ import java.util.List;
 
 /**
  * <p>
- *  前端控制器
+ *  前端控制器(区域)
  * </p>
  *
  * @author wang

+ 0 - 1
web/backmanagerconfig/src/main/java/com/gyee/backconfig/controller/WindpowerstationpointnewController.java

@@ -118,7 +118,6 @@ public class WindpowerstationpointnewController {
         }else {
             return R.error().data("更新失败!");
         }
-
     }
 
 

+ 11 - 0
web/backmanagerconfig/src/main/java/com/gyee/backconfig/service/PointGenerateService.java

@@ -0,0 +1,11 @@
+package com.gyee.backconfig.service;
+
+
+import org.springframework.stereotype.Service;
+
+/**
+ * 生成测点服务类
+ */
+@Service
+public class PointGenerateService {
+}