Procházet zdrojové kódy

agc曲线偏差分析配置离线环境

宁檬 před 1 rokem
rodič
revize
c3f376e193

+ 13 - 8
power-fitting/src/main/java/com/gyee/power/fitting/controller/analyse/AgcDeviateController.java

@@ -9,7 +9,10 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 获取各个场站AGC偏差分析数据
@@ -32,15 +35,17 @@ public class AgcDeviateController {
      * @return
      */
     @GetMapping("/deviate")
-    public List<AgcDeviateTag> getData(@RequestParam(value = "startTs") long startTs,
-                                       @RequestParam(value = "endTs") long endTs,
-                                       @RequestParam(value = "id") String id,
-                                       @RequestParam(value = "interval", defaultValue = "60", required = false) int interval) {
-        if(isOffline){
-            return agcDeviateService.getAgcDeviateTagsOffline(id, startTs, endTs, interval);
-        }else {
-            return agcDeviateService.getAgcDeviateTags(id, startTs, endTs, interval);
+    public Map<String, AgcDeviateTag> getData(@RequestParam(value = "startTs") long startTs,
+                                              @RequestParam(value = "endTs") long endTs,
+                                              @RequestParam(value = "id") String id,
+                                              @RequestParam(value = "interval", defaultValue = "60", required = false) int interval) {
+        List<AgcDeviateTag> ls = new ArrayList<>();
+        if (isOffline) {
+            ls = agcDeviateService.getAgcDeviateTagsOffline(id, startTs, endTs, interval);
+        } else {
+            ls = agcDeviateService.getAgcDeviateTags(id, startTs, endTs, interval);
         }
+        return ls.stream().collect(Collectors.toMap(AgcDeviateTag::getName, f -> f));
     }
 
     /**