Browse Source

处理山西大同遗留功能修改

xieshengjie 2 years ago
parent
commit
8402ce9782

+ 19 - 1
web/gdsx-ghost/src/main/java/com/gyee/ghost/controller/ghost/GhostController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("//ghost")
@@ -27,7 +28,7 @@ public class GhostController {
     @GetMapping("/wplist")
     @ResponseBody
     @CrossOrigin(origins = "*", maxAge = 3600)
-    public R function(){
+    public R wplist(){
         List<Windpowerstation> resultList = CacheContext.wpls;
         if (StringUtils.isNotNull(resultList)) {
             return R.ok((long) resultList.size()).data(resultList);
@@ -36,6 +37,23 @@ public class GhostController {
         }
     }
 
+    @GetMapping("/wtlist")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R wtlist( @RequestParam(value = "wpid",required = true)String wpid){
+        List<Windturbine> resultList = null;
+        if (StringUtils.isNotEmpty(wpid)){
+            resultList = CacheContext.wtls.stream().filter(wt -> wt.getWindpowerstationid().equals(wpid)).collect(Collectors.toList());
+        }else {
+            resultList = CacheContext.wtls;
+        }
+        if (StringUtils.isNotNull(resultList)) {
+            return R.ok((long) resultList.size()).data(resultList);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
     /**
      * 运行分析
      * @param wpid