Browse Source

修复对标bug

xieshengjie 3 years ago
parent
commit
b831fef9f9

+ 2 - 2
histroy/analysis-histroy-hb/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 spring:
   profiles:
-    active: hf
+#    active: hf
 #    active: dev
-#    active: test
+    active: test

+ 2 - 2
web/analysis-web-hb/src/main/resources/application.yml

@@ -1,4 +1,4 @@
 spring:
   profiles:
-    active: hf
-#    active: test
+#    active: hf
+    active: test

+ 1 - 1
web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/controller/benching/BenchmarkingController.java

@@ -483,7 +483,7 @@ public class BenchmarkingController {
     public R djhxdbbottom(@RequestParam(value = "wpid",required = true)String wpid,
                        @RequestParam(value = "wtids",required = true)String wtids,
                        @RequestParam(value = "date",required = true)String date){
-        List<Object> resultList =  benchmarkingService.djhxdbbottom(wpid,wtids,date);
+        Map<String,List<Windturbinecurvefitting>> resultList =  benchmarkingService.djhxdbbottom(wpid,wtids,date);
 
         if (StringUtils.isNotNull(resultList)) {
             return R.ok(resultList.size()).data(resultList);

+ 18 - 22
web/benchmarking-web-hb/src/main/java/com/gyee/benchmarkingweb/service/benching/BenchmarkingService.java

@@ -1768,8 +1768,8 @@ public class BenchmarkingService {
      * @param date
      * @return
      */
-    public List<Object> djhxdbbottom(String wpid, String wtids, String date) {
-        List<DjhxdbtopVo> resultList = new ArrayList<>();
+    public Map<String,List<Windturbinecurvefitting>> djhxdbbottom(String wpid, String wtids, String date) {
+       Map<String,List<Windturbinecurvefitting>> resultMap = new HashMap<>();
         QueryWrapper<Windturbinecurvefitting> qw = new QueryWrapper<>();
         Date recorddate = DateUtils.parseDate(date);
         if (StringUtils.isNotEmpty(wpid) && StringUtils.isNotEmpty(wtids)){
@@ -1781,27 +1781,23 @@ public class BenchmarkingService {
         }
         qw.eq("recorddate",recorddate);
         List<Windturbinecurvefitting> windturbinecurvefittingList = windturbinecurvefittingService.list(qw);
-        List<String> wtidList = windturbinecurvefittingList.stream().map(i -> i.getWindturbineid()).distinct().collect(Collectors.toList());
-        List<Object> rList = new ArrayList<>();
-        for (String wtid : wtidList) {
-            List<Windturbinecurvefitting> windturbinecurvefittings = windturbinecurvefittingList.stream().filter(i -> i.getWindturbineid().equals(wtid)).collect(Collectors.toList());
-            DjhxdbInitVo vo = new DjhxdbInitVo();
-            vo.setName(wtid);
-            try {
-                LinkedHashMap addMap = new LinkedHashMap();
-                LinkedHashMap addValMap = new LinkedHashMap();
-
-                for (Windturbinecurvefitting curve : windturbinecurvefittings) {
-                    addMap.put(String.valueOf(curve.getSpeed()), Class.forName("java.lang.Double"));
-                    addValMap.put(String.valueOf(curve.getSpeed()), curve.getActualpower());
-                }
-                Object blo = new ClassUtil().dynamicClass(vo, addMap, addValMap);
-                rList.add(blo);
-            } catch (Exception e) {
-                e.printStackTrace();
+
+        windturbinecurvefittingList.stream().forEach(w->{
+            String windturbineid = w.getWindturbineid();
+            if (resultMap.containsKey(windturbineid)){
+                resultMap.get(windturbineid).add(w);
+            }else {
+                List<Windturbinecurvefitting> list = new ArrayList<>();
+                resultMap.put(windturbineid,list);
             }
-        }
-        return rList;
+        });
+        Set<String> stringSet = resultMap.keySet();
+        stringSet.stream().forEach(s->{
+            SortUtils.sort(resultMap.get(s),"speed",SortUtils.ASC);
+        });
+
+
+        return resultMap;
     }
     /**
      * 对标首页下面部分

+ 2 - 2
web/benchmarking-web-hb/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 spring:
   profiles:
 #    active: jn
-    active: dev
-#    active: test
+#    active: dev
+    active: test