xushili 1 tahun lalu
induk
melakukan
bd5764d184

+ 2 - 2
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/bmk/BenchmarkingController.java

@@ -420,14 +420,14 @@ public class BenchmarkingController {
 
     @GetMapping("/sbdb")
     @ResponseBody
-    @ApiOperation(value = "阵区对标", notes = "阵区对标")
+    @ApiOperation(value = "设备对标", notes = "设备对标")
     public R sbdb(@RequestParam(value = "companys",required = true) String companys,
                   @RequestParam(value = "type",required = true) String type,
                   @RequestParam(value = "wpids",required = true) String wpids,
                   @RequestParam(value = "projectids",required = true) String projectids,
                   @RequestParam(value = "lineids",required = true) String lineids,
                   @RequestParam(value = "squareids",required = true) String squareids,
-                  @RequestParam(value = "windturbineids",required = true) String windturbineids,
+                  @RequestParam(value = "windturbineids",required = false) String windturbineids,
                   @RequestParam(value = "beginDate",required = true) String beginDate,
                   @RequestParam(value = "endDate",required = true) String endDate,
                   @RequestParam(value = "target",required = false) String target,

+ 20 - 11
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -774,41 +774,39 @@ public class BenchmarkingService {
                 .stream().collect(Collectors.toMap(ProBasicOrganizeTree::getId, ProBasicOrganizeTree::getOrderNum));
 
         List<ProEconEquipmentInfoDay1> list = proEconEquipmentInfoDay1Service.list(qw);
-        //list = list.stream().filter(a -> a.getSquareId() != null).collect(Collectors.toList());
+        if (!type.equals(TYPE_DATE))
+            list = list.stream().filter(a -> a.getWindpowerstationId() != null || a.getProjectId() != null ||
+                    a.getLineId() != null || a.getWindturbineId() != null || a.getSquareId() != null ||
+                    a.getId() != null).collect(Collectors.toList());
         for (ProEconEquipmentInfoDay1 i : list) {
             WxsslVo vo = new WxsslVo();
 
             if (type.equals(TYPE_WIND)) {
-                list = list.stream().filter(a -> a.getWindpowerstationId() != null).collect(Collectors.toList());
                 vo.setId(i.getWindpowerstationId());
                 vo.setName(CacheContext.wpmap.get(i.getWindpowerstationId().trim()).getAname());
                 vo.setOrdernum(station.get(i.getWindpowerstationId()).doubleValue());
             } else if (type.equals(TYPE_PROJECT)) {
-                list = list.stream().filter(a -> a.getProjectId() != null).collect(Collectors.toList());
                 vo.setId(i.getProjectId());
                 vo.setName(CacheContext.pjmap.get(i.getProjectId().trim()).getAname());
                 vo.setOrdernum(CacheContext.pjmap.get(i.getProjectId().trim()).getOrderNum().doubleValue());
             } else if (type.equals(TYPE_LINE)) {
-                list = list.stream().filter(a -> a.getLineId() != null).collect(Collectors.toList());
                 vo.setId(i.getLineId());
                 vo.setName(CacheContext.lnmap.get(i.getLineId().trim()).getAname());
                 vo.setOrdernum(CacheContext.lnmap.get(i.getLineId().trim()).getOrderNum().doubleValue());
             } else if (type.equals(TYPE_WINDTURBINE)) {
-                list = list.stream().filter(a -> a.getWindturbineId() != null).collect(Collectors.toList());
                 vo.setId(i.getWindturbineId());
                 vo.setName(CacheContext.wtmap.get(i.getWindturbineId().trim()).getAname());
                 vo.setOrdernum(CacheContext.wtmap.get(i.getWindturbineId().trim()).getOrderNum().doubleValue());
             } else if (type.equals(TYPE_SQUARE)) {
-                list = list.stream().filter(a -> a.getSquareId() != null).collect(Collectors.toList());
                 vo.setId(i.getSquareId());
                 vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getAname());
                 vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getSquareId()).getOrderNum().doubleValue());
             } else if (type.equals(TYPE_COMPANY)) {
-                list = list.stream().filter(a -> a.getId() != null).collect(Collectors.toList());
                 vo.setId(i.getId());
                 vo.setName(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getAname());
                 vo.setOrdernum(CacheContext.proBasicOrganizeTreesMap.get(i.getId()).getOrderNum().doubleValue());
             }
+
             vo.setDate(i.getRecordDate());
             vo.setFdl(DoubleUtils.keepPrecision(i.getRfdl() / 10000, 2));
             vo.setLlfdl(DoubleUtils.keepPrecision(i.getRllfdl() / 10000, 2));
@@ -895,6 +893,10 @@ public class BenchmarkingService {
             qw.eq("project_id", id);
         } else if (id.endsWith("LN")) {
             qw.eq("line_id", id);
+        } else if (id.endsWith("AG")) {
+            qw.eq("square_id", id);
+        } else if (id.endsWith("EQ")) {
+            qw.eq("windturbine_id", id);
         }
         qw.groupBy("windturbine_id");
 
@@ -978,14 +980,21 @@ public class BenchmarkingService {
         String sql = ",sum(rfdl) rfdl,sum(rllfdl) rllfdl,avg(rpjfs) rpjfs,sum(rjxssdl) rjxssdl,sum(rcnsljxssdl) rcnsljxssdl,sum(rgzssdl) rgzssdl,sum(rcnslgzssdl) rcnslgzssdl,sum(rxdtjssdl) rxdtjssdl,sum(rxdjclssdl) rxdjclssdl,sum(rdjssdl) rdjssdl,sum(rqxjclssdl) rqxjclssdl,sum(rsdtjssdl) rsdtjssdl,sum(rxnssdl) rxnssdl,sum(rcwsldwssdl) rcwsldwssdl,sum(rcwsltqssdl) rcwsltqssdl";
         qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
 
-        if (companys.endsWith("RGN")) {
+        String[] split = companys.split(",");
+
+        if (companys.contains("RGN")) {
+            for (String s : split) {
+                if(s.endsWith("RGN")){
+                    companys = s;
+                }
+            }
             qw.select("region_id id" + sql);
             qw.eq("region_id", companys);
             qw.groupBy("region_id");
         } else {
             qw.select("company_id id" + sql);
-            qw.eq("company_id", companys);
-            qw.groupBy("region_id");
+            qw.in("company_id", Arrays.asList(split));
+            qw.groupBy("company_id");
         }
         if (type.equals("-1")) {
             qw.like("windturbine_id", "_WT_");
@@ -1001,7 +1010,7 @@ public class BenchmarkingService {
                 SortUtils.sort(resultList, target, SortUtils.DESC);
             }
         } else {
-            SortUtils.sort(resultList, "date", SortUtils.ASC);
+            SortUtils.sort(resultList, "ordernum", SortUtils.ASC);
         }
         return wxsslVoList;
     }