Browse Source

测点生成器

wangchangsheng 2 years ago
parent
commit
aaf5751554

+ 10 - 4
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/controller/ProEconTestingPointController.java

@@ -103,14 +103,20 @@ public class ProEconTestingPointController {
     }
 
 
+    /**
+     * 测点生成器
+     * @param points 测点,多条逗号隔开 默认空:全部
+     * @param station 场站 默认空(全场)
+     * @param type fj:风机测点;fc:风场测点;sbs:变电所测点;ws:气象站测点;sq:方正测点 默认空:全部
+     * @return
+     */
     @PostMapping(value = "/generatePoint")
     @ApiOperation(value = "设备or场站测点生成", notes = "设备or场站测点生成")
-    @ApiImplicitParams({ @ApiImplicitParam(name = "points", value = "统一编码", required = true, dataType = "string[]", paramType = "query"),
-            @ApiImplicitParam(name = "station", value = "场站编码", required = true, dataType = "string", paramType = "query")})
     public R generatePoint(@RequestParam(value = "points", required = false) String[] points,
-                              @RequestParam(value = "station", required = false) String station) {
+                           @RequestParam(value = "station", required = false) String station,
+                           @RequestParam(value = "type", required = false) String type) {
         try {
-            proEconTestingPointService.generatePoint(station,points);
+            proEconTestingPointService.generatePoint(station, points, type);
         } catch (Exception e) {
             e.printStackTrace();
             return R.error();

+ 1 - 1
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/IProEconTestingPointService.java

@@ -14,7 +14,7 @@ import com.gyee.backconfig.model.auto.ProEconTestingPoint;
  */
 public interface IProEconTestingPointService extends IService<ProEconTestingPoint> {
 
-     void generatePoint(String station,String[] points);
+     void generatePoint(String station,String[] points,String type);
 
      void generateSubStationPoint(String station,String[] points);
 

+ 40 - 8
web/backmanagerconfig-xktj/src/main/java/com/gyee/backconfig/service/auto/impl/ProEconTestingPointServiceImpl.java

@@ -53,14 +53,41 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
     public IProBasicPowerstationService proBasicPowerstationService;
 
     @Override
-    public void generatePoint(String station, String[] setpoints) {
-
-            List<ProBasicEquipmentPoint> equipmentPoints =  initalFj(station,setpoints);
-            List<ProBasicPowerstationPoint> powerstationPoints = initalFc();
-
+    public void generatePoint(String station, String[] setpoints,String type) {
+
+        List<ProBasicEquipmentPoint> equipmentPoints =  new ArrayList<>();
+        List<ProBasicPowerstationPoint> powerstationPoints = new ArrayList<>();
+
+
+        switch (type){
+            case "fj":
+                equipmentPoints = initalFj(station, setpoints);
+                proBasicEquipmentPointService.batchAddEquipmentPoint(equipmentPoints);
+                break;
+            case "fc":
+                powerstationPoints = initalFc();
+                proBasicPowerstationPointService.batchAddPowerstationPoints(powerstationPoints);
+                break;
+            case "sbs":
+                generateSubStationPoint(station, setpoints);
+                break;
+            case "ws":
+                generateWsStationPoint(station, setpoints);
+                break;
+            case "sq":
+                generateSquareStationPoint(station, setpoints);
+                break;
+            default:
+                equipmentPoints = initalFj(station, setpoints);
+                powerstationPoints = initalFc();
+                proBasicEquipmentPointService.batchAddEquipmentPoint(equipmentPoints);
+                proBasicPowerstationPointService.batchAddPowerstationPoints(powerstationPoints);
+                generateSubStationPoint(station, setpoints);
+                generateWsStationPoint(station, setpoints);
+                generateSquareStationPoint(station, setpoints);
+                break;
+        }
 
-            proBasicEquipmentPointService.batchAddEquipmentPoint(equipmentPoints);
-            proBasicPowerstationPointService.batchAddPowerstationPoints(powerstationPoints);
 
 
     }
@@ -138,7 +165,12 @@ public class ProEconTestingPointServiceImpl extends ServiceImpl<ProEconTestingPo
             if (null == CacheContext.poSquareMap || CacheContext.poSquareMap.size() <= 0) {
                 continue;
             }
-            List<ProBasicSquare> squaare = CacheContext.poSquareMap.get(postation.getId()).stream().filter(i -> i.getTypes().equals("jz")).collect(Collectors.toList());
+            List<ProBasicSquare> squaare = CacheContext.poSquareMap.get(postation.getId());
+            if(null == squaare || squaare.size()<=0){
+               continue;
+            }
+            squaare = squaare.stream().filter(i -> i.getTypes().equals("jz")).collect(Collectors.toList());
+
             //循环阵区生成测点code
             for (ProBasicSquare ss : squaare) {
                 List<ProBasicPowerstationPoint> points = new ArrayList<>();