ソースを参照

品牌对标接口bug修改

wangb 1 年間 前
コミット
7766b1c98a

+ 47 - 27
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -1303,7 +1303,7 @@ public class BenchmarkingService {
             qw.like("windturbine_id", "_IN_");
         }
         qw.groupBy("windpowerstation_id");
-        List<WxsslVo> wxsslVoList = getxinWxsslSortVos(qw, resultList, TYPE_WIND, wpids, model);
+        List<WxsslVo> wxsslVoList = getxinWxsslSortVos(qw, resultList, TYPE_WIND, companys,wpids, model);
         if (StringUtils.isNotEmpty(target) && StringUtils.isNotEmpty(sort)) {
             if (sort.equals("1")) {
                 SortUtils.sort(resultList, target, SortUtils.ASC);
@@ -1317,7 +1317,7 @@ public class BenchmarkingService {
     }
 
 
-    private List<WxsslVo> getxinWxsslSortVos(QueryWrapper<ProEconEquipmentInfoDay1> qw, List<WxsslVo> resultList, String type, String wpids, String model) {
+    private List<WxsslVo> getxinWxsslSortVos(QueryWrapper<ProEconEquipmentInfoDay1> qw, List<WxsslVo> resultList, String type, String companys,String wpids, String model) {
 
         List<ProEconEquipmentInfoDay1> peeidls = new ArrayList<>();
         String[] splitMd = model.split(",");
@@ -1327,9 +1327,17 @@ public class BenchmarkingService {
 
 //                    List<String> wtls = CacheContext.wtls.stream().filter(c -> !Objects.isNull(c.getModelId()) && c.getNemName().contains("逆变器") &&
 //                            s1.equals(c.getModelId())).map(ot -> ot.getId()).collect(Collectors.toList());
-
-                List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
-                        oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+                List<String> wtls = null;
+                if (!wpids.isEmpty()) {
+                    wtls = CacheContext.organizeEquipmentList.stream().filter(
+                            oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+                }else if (wpids.isEmpty() && companys.endsWith("ZGS")){
+                    wtls = CacheContext.organizeEquipmentList.stream().filter(
+                            oe -> companys.contains(oe.getCompanyId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+                }else if (wpids.isEmpty()&&companys.endsWith("RGN")){
+                    wtls = CacheContext.organizeEquipmentList.stream().filter(
+                            oe -> companys.contains(oe.getRegionId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+                }
 
                 if (wtls.size() == 0) continue;
                 QueryWrapper<ProEconEquipmentInfoDay1> wiqw = qw.clone().in("windturbine_id", wtls);
@@ -1361,37 +1369,49 @@ public class BenchmarkingService {
                 peeidls.add(infoDay1);
             }
         } else if (model.isEmpty()) {
-            List<String> wtls = CacheContext.organizeEquipmentList.stream().filter(
-                    oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+            List<String> wtls = null;
+            if (!wpids.isEmpty()) {
+                wtls = CacheContext.organizeEquipmentList.stream().filter(
+                        oe -> wpids.contains(oe.getWindpowerstationId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+            }else if (wpids.isEmpty() && companys.endsWith("ZGS")){
+                wtls = CacheContext.organizeEquipmentList.stream().filter(
+                        oe -> companys.contains(oe.getCompanyId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+            }else if (wpids.isEmpty()&&companys.endsWith("RGN")){
+                wtls = CacheContext.organizeEquipmentList.stream().filter(
+                        oe -> companys.contains(oe.getRegionId())).map(ot -> ot.getWindturbineId()).collect(Collectors.toList());
+            }
 
             QueryWrapper<ProEconEquipmentInfoDay1> wiqw = qw.clone().in("windturbine_id", wtls);
             List<ProEconEquipmentInfoDay1> listls = proEconEquipmentInfoDay1Service.list(wiqw);
+            List<ProBasicOrganizeTree> treeList = CacheContext.wtls.stream().filter(wt -> wt.getEqType().equals("IN")).collect(Collectors.toList());
 
-            ProEconEquipmentInfoDay1 infoDay1 = new ProEconEquipmentInfoDay1();
 
-            for (ProBasicOrganizeTree t1 : CacheContext.wtls) {
                 for (ProEconEquipmentInfoDay1 listl : listls) {
-                    infoDay1.setRfdl((infoDay1.getRfdl() != null ? infoDay1.getRfdl() : 0) + (listl.getRfdl() != null ? listl.getRfdl() : 0));
-                    infoDay1.setRllfdl((infoDay1.getRllfdl() != null ? infoDay1.getRllfdl() : 0) + (listl.getRllfdl() != null ? listl.getRllfdl() : 0));
-                    infoDay1.setRpjfs((infoDay1.getRpjfs() != null ? infoDay1.getRpjfs() : 0) + (listl.getRpjfs() != null ? listl.getRpjfs() : 0));
-                    infoDay1.setRjxssdl((infoDay1.getRjxssdl() != null ? infoDay1.getRjxssdl() : 0) + (listl.getRjxssdl() != null ? listl.getRjxssdl() : 0));
-                    infoDay1.setRcnsljxssdl((infoDay1.getRcnsljxssdl() != null ? infoDay1.getRcnsljxssdl() : 0) + (listl.getRcnsljxssdl() != null ? listl.getRcnsljxssdl() : 0));
-                    infoDay1.setRgzssdl((infoDay1.getRgzssdl() != null ? infoDay1.getRgzssdl() : 0) + (listl.getRgzssdl() != null ? listl.getRgzssdl() : 0));
-                    infoDay1.setRcnslgzssdl((infoDay1.getRcnslgzssdl() != null ? infoDay1.getRcnslgzssdl() : 0) + (listl.getRcnslgzssdl() != null ? listl.getRcnslgzssdl() : 0));
-                    infoDay1.setRxdtjssdl((infoDay1.getRxdtjssdl() != null ? infoDay1.getRxdtjssdl() : 0) + (listl.getRxdtjssdl() != null ? listl.getRxdtjssdl() : 0));
-                    infoDay1.setRxdjclssdl((infoDay1.getRxdjclssdl() != null ? infoDay1.getRxdjclssdl() : 0) + (listl.getRxdjclssdl() != null ? listl.getRxdjclssdl() : 0));
-                    infoDay1.setRdjssdl((infoDay1.getRdjssdl() != null ? infoDay1.getRdjssdl() : 0) + (listl.getRdjssdl() != null ? listl.getRdjssdl() : 0));
-                    infoDay1.setRqxjclssdl((infoDay1.getRqxjclssdl() != null ? infoDay1.getRqxjclssdl() : 0) + (listl.getRqxjclssdl() != null ? listl.getRqxjclssdl() : 0));
-                    infoDay1.setRsdtjssdl((infoDay1.getRsdtjssdl() != null ? infoDay1.getRsdtjssdl() : 0) + (listl.getRsdtjssdl() != null ? listl.getRsdtjssdl() : 0));
-                    infoDay1.setRxnssdl((infoDay1.getRxnssdl() != null ? infoDay1.getRxnssdl() : 0) + (listl.getRxnssdl() != null ? listl.getRxnssdl() : 0));
-                    infoDay1.setRcwsldwssdl((infoDay1.getRcwsldwssdl() != null ? infoDay1.getRcwsldwssdl() : 0) + (listl.getRcwsldwssdl() != null ? listl.getRcwsldwssdl() : 0));
-                    infoDay1.setRcwsltqssdl((infoDay1.getRcwsltqssdl() != null ? infoDay1.getRcwsltqssdl() : 0) + (listl.getRcwsltqssdl() != null ? listl.getRcwsltqssdl() : 0));
-                    infoDay1.setWindpowerstationId(listl.getWindpowerstationId());
-                    if (t1.getId().equals(wtls.get(0)))
+                    ProEconEquipmentInfoDay1 infoDay1 = new ProEconEquipmentInfoDay1();
+                    for (ProBasicOrganizeTree t1 : treeList) {
+                    if (t1.getPcodes().contains(listl.getWindpowerstationId())) {
+                        infoDay1.setRfdl((infoDay1.getRfdl() != null ? infoDay1.getRfdl() : 0) + (listl.getRfdl() != null ? listl.getRfdl() : 0));
+                        infoDay1.setRllfdl((infoDay1.getRllfdl() != null ? infoDay1.getRllfdl() : 0) + (listl.getRllfdl() != null ? listl.getRllfdl() : 0));
+                        infoDay1.setRpjfs((infoDay1.getRpjfs() != null ? infoDay1.getRpjfs() : 0) + (listl.getRpjfs() != null ? listl.getRpjfs() : 0));
+                        infoDay1.setRjxssdl((infoDay1.getRjxssdl() != null ? infoDay1.getRjxssdl() : 0) + (listl.getRjxssdl() != null ? listl.getRjxssdl() : 0));
+                        infoDay1.setRcnsljxssdl((infoDay1.getRcnsljxssdl() != null ? infoDay1.getRcnsljxssdl() : 0) + (listl.getRcnsljxssdl() != null ? listl.getRcnsljxssdl() : 0));
+                        infoDay1.setRgzssdl((infoDay1.getRgzssdl() != null ? infoDay1.getRgzssdl() : 0) + (listl.getRgzssdl() != null ? listl.getRgzssdl() : 0));
+                        infoDay1.setRcnslgzssdl((infoDay1.getRcnslgzssdl() != null ? infoDay1.getRcnslgzssdl() : 0) + (listl.getRcnslgzssdl() != null ? listl.getRcnslgzssdl() : 0));
+                        infoDay1.setRxdtjssdl((infoDay1.getRxdtjssdl() != null ? infoDay1.getRxdtjssdl() : 0) + (listl.getRxdtjssdl() != null ? listl.getRxdtjssdl() : 0));
+                        infoDay1.setRxdjclssdl((infoDay1.getRxdjclssdl() != null ? infoDay1.getRxdjclssdl() : 0) + (listl.getRxdjclssdl() != null ? listl.getRxdjclssdl() : 0));
+                        infoDay1.setRdjssdl((infoDay1.getRdjssdl() != null ? infoDay1.getRdjssdl() : 0) + (listl.getRdjssdl() != null ? listl.getRdjssdl() : 0));
+                        infoDay1.setRqxjclssdl((infoDay1.getRqxjclssdl() != null ? infoDay1.getRqxjclssdl() : 0) + (listl.getRqxjclssdl() != null ? listl.getRqxjclssdl() : 0));
+                        infoDay1.setRsdtjssdl((infoDay1.getRsdtjssdl() != null ? infoDay1.getRsdtjssdl() : 0) + (listl.getRsdtjssdl() != null ? listl.getRsdtjssdl() : 0));
+                        infoDay1.setRxnssdl((infoDay1.getRxnssdl() != null ? infoDay1.getRxnssdl() : 0) + (listl.getRxnssdl() != null ? listl.getRxnssdl() : 0));
+                        infoDay1.setRcwsldwssdl((infoDay1.getRcwsldwssdl() != null ? infoDay1.getRcwsldwssdl() : 0) + (listl.getRcwsldwssdl() != null ? listl.getRcwsldwssdl() : 0));
+                        infoDay1.setRcwsltqssdl((infoDay1.getRcwsltqssdl() != null ? infoDay1.getRcwsltqssdl() : 0) + (listl.getRcwsltqssdl() != null ? listl.getRcwsltqssdl() : 0));
+                        infoDay1.setWindpowerstationId(listl.getWindpowerstationId());
                         infoDay1.setWindturbineId(t1.getModelId());
+                    }
                 }
+                    peeidls.add(infoDay1);
             }
-            peeidls.add(infoDay1);
+
         }
 
         if (!peeidls.isEmpty() && peeidls.size() > 0) {