Bladeren bron

APP公司电量

wangb@gyee-china.com 1 jaar geleden
bovenliggende
commit
16f086c673

+ 1 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/Application/ApplicationController.java

@@ -11,9 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -48,7 +46,7 @@ public class ApplicationController {
             @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query")})
     public AjaxResult getelectricity(String wpId) throws Exception {
 
-        List<List> map = new ArrayList<>();
+        Map<String, String> map = new HashMap<>();
         if (!wpId.isEmpty()) {
             map = applicationService.electricity();
         }

+ 11 - 10
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Application/ApplicationService.java

@@ -115,7 +115,7 @@ public class ApplicationService {
         return map;
     }
 
-    public List electricity() throws Exception {
+    public Map electricity() throws Exception {
 
         long longDate = System.currentTimeMillis();
         Date nowDate = new Date(longDate);
@@ -130,6 +130,7 @@ public class ApplicationService {
 
         List<Double> list = new ArrayList<>();
         Map<String,Object> map = new HashMap<>();
+        Map<String,Object> zb = new HashMap<>();
         List<ProBasicPowerstation> wpls =  CacheContext.wpls;
 
 
@@ -147,7 +148,7 @@ public class ApplicationService {
 
         for (ProBasicPowerstation wp : wpls){
 
-            list = new ArrayList<>();
+            zb = new HashMap<>();
 
             //日发电量
             ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
@@ -167,18 +168,18 @@ public class ApplicationService {
             njhdl = year.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum();
             rjhdl = yjhdl / 30;
 
-            list.add(rfdl);
-            list.add(yfdl);
-            list.add(nfdl);
+            zb.put("rfdl",rfdl);
+            zb.put("yfdl",yfdl);
+            zb.put("nfdl",nfdl);
 
-            list.add(rjhdl);
-            list.add(yjhdl);
-            list.add(njhdl);
+            zb.put("rjhdl",rjhdl);
+            zb.put("yjhdl",yjhdl);
+            zb.put("njhdl",njhdl);
 
-            map.put(wp.getId(),list);
+            map.put(wp.getId(),zb);
         }
 
 
-        return list;
+        return map;
     }
 }