소스 검색

微观选址代码移植

王波 1 개월 전
부모
커밋
b920ea2bf1
1개의 변경된 파일98개의 추가작업 그리고 0개의 파일을 삭제
  1. 98 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/base/WindInfoController.java

+ 98 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/base/WindInfoController.java

@@ -0,0 +1,98 @@
+package com.gyee.runeconomy.controller.base;
+
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.runeconomy.dto.result.JsonResult;
+import com.gyee.runeconomy.dto.result.ResultCode;
+import com.gyee.runeconomy.model.auto.ProBasicEquipment;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 场站风机等基础数据
+ */
+@RestController
+@CrossOrigin
+@RequestMapping("/base")
+public class WindInfoController {
+
+
+    @Autowired
+    private ProEconPowerFittingAnalySisService powerService;
+
+    @Resource
+    private TokenService tokenService;
+
+    @Autowired
+    private HttpServletRequest request;
+
+
+    @GetMapping("station")
+    public JSONObject getStation() {
+        List<ProBasicPowerstation> list = InitialRunner.wpNewList;
+//        List<ProBasicPowerstation> list = tokenService.getWpls(request);
+//        list = list.stream().filter(f -> f.getId().contains("FDC")).collect(Collectors.toList());
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+    @GetMapping("windturbine")
+    public JSONObject getWindTurbine(String stationId) {
+        List<ProBasicEquipment> list = InitialRunner.wpNewMap.get(stationId);
+        List<ProBasicEquipment> orderlist = list.stream()
+                .sorted(Comparator.comparing(ProBasicEquipment::getOrderNum))
+                .collect(Collectors.toList());
+        return JsonResult.successData(ResultCode.SUCCESS, orderlist);
+    }
+
+    @GetMapping("/gfstation")
+    public JSONObject getGFStation() {
+
+        List<ProBasicPowerstation> list = tokenService.getWpls(request);
+        list = list.stream().filter(f -> f.getId().contains("GDC")).collect(Collectors.toList());
+//        List<ProBasicPowerstation> list = InitialRunner.gfwpNewList;
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+    @GetMapping("/inverter")
+    public JSONObject getInverter(String stationId) {
+        List<ProBasicEquipment> list = InitialRunner.gfwpNewMap.get(stationId);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+
+
+
+    /**
+     * 获取风机经纬度信息
+     * @param ids
+     * @return
+     */
+    @GetMapping("location")
+    public JSONObject dataLocation(String ids){
+        List<ProBasicEquipment> result = new ArrayList<>();
+        List<ProEconPowerFittingAnalySis> list = powerService.listByIds(Arrays.asList(ids.split(",")));
+        for (ProEconPowerFittingAnalySis obj : list){
+            String[] pids = obj.getProcessid().split(",");
+            for (String id : pids){
+                ProEconPowerFittingAnalySis item = powerService.getById(id);
+                ProBasicEquipment wt = InitialRunner.wtNewMap.get(item.getWindturbineId());
+                wt.setProcessId(id);
+                wt.setFittingId(obj.getId());
+                result.add(wt);
+            }
+        }
+        return JsonResult.successData(ResultCode.SUCCESS, result);
+    }
+
+}