xieshengjie 1 tahun lalu
induk
melakukan
0c4271af4a

+ 51 - 20
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -392,20 +392,42 @@ public class EconomicService {
 
         for (EconomicVo wt2 : wt) {
 
-            ProBasicEquipmentPoint sjgl = null;
-            ProBasicEquipmentPoint llgl = null;
-
+            String sjgl = null;
+            String llgl = null;
+            Optional<ProBasicEquipmentPoint> sszglpbpp = null;
+            Optional<ProBasicEquipmentPoint> llglpbpp = null;
             if (type.equals("-2")) {
-                sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
-                llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+//                sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+//                llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+
+                sszglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIG007".equals(pbpp.getUniformCode()) && wt2.getId().equals(pbpp.getWindturbineId())).findFirst();
+                llglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIG007".equals(pbpp.getUniformCode()) && wt2.getId().equals(pbpp.getWindturbineId())).findFirst();
+
+                if (sszglpbpp.isPresent()) {
+                    sjgl = sszglpbpp.get().getNemCode();
+                }
+                if (llglpbpp.isPresent()) {
+                    llgl = llglpbpp.get().getNemCode();
+                }
+
             }
             if (type.equals("-1")) {
-                sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
-                llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
-            }
-            if (sjgl.getId() == null) {
-                continue;
+//                sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+//                llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
+
+                sszglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIG007".equals(pbpp.getUniformCode()) && wt2.getId().equals(pbpp.getWindturbineId())).findFirst();
+                llglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIG007".equals(pbpp.getUniformCode()) && wt2.getId().equals(pbpp.getWindturbineId())).findFirst();
+
+                if (sszglpbpp.isPresent()) {
+                    sjgl = sszglpbpp.get().getNemCode();
+                }
+                if (llglpbpp.isPresent()) {
+                    llgl = llglpbpp.get().getNemCode();
+                }
             }
+//            if (sjgl.getId() == null) {
+//                continue;
+//            }
 
 
             List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
@@ -423,7 +445,7 @@ public class EconomicService {
 
                 temp1 = sjglls.get(i).getPointValueInDouble();
 
-                if (sjgl.getWindturbineId().contains(wt2.getId())) {
+                if (sszglpbpp.get().getWindturbineId().contains(wt2.getId())) {
 //                            Date date = new Date(sjglls.get(i).getPointTime());
 //                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 //                            String formattedDate = sdf.format(date);
@@ -435,7 +457,7 @@ public class EconomicService {
                 }
 
                 temp2 = llglls.get(i).getPointValueInDouble();
-                if (llgl.getWindturbineId().contains(wt2.getId())) {
+                if (llglpbpp.get().getWindturbineId().contains(wt2.getId())) {
                     vos.setYcgl(StringUtils.round(temp2, 2));
                 }
 
@@ -510,18 +532,27 @@ public class EconomicService {
                 wt.add(vo1);
             }
         }
-
+        Optional<ProBasicEquipmentPoint> sszglpbpp = null;
         for (EconomicVo wt2 : wt) {
-            ProBasicEquipmentPoint pjgzd = null;
+            String pjgzd = null;
             if (type.equals("-2")) {
-                pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
+//                pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
+                sszglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIEMI002".equals(pbpp.getUniformCode()) && wt2.getId().contains(pbpp.getWindturbineId())).findFirst();
+
+                if (sszglpbpp.isPresent()) {
+                    pjgzd = sszglpbpp.get().getNemCode();
+                }
             }
             if (type.equals("-1")) {
-                pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
-            }
-            if (pjgzd.getId() == null) {
-                continue;
+                sszglpbpp = CacheContext.proBasicEquipmentPointList.stream().filter(pbpp -> "AIEMI002".equals(pbpp.getUniformCode()) && wt2.getId().contains(pbpp.getWindturbineId())).findFirst();
+
+                if (sszglpbpp.isPresent()) {
+                    pjgzd = sszglpbpp.get().getNemCode();
+                }
             }
+//            if (pjgzd.getId() == null) {
+//                continue;
+//            }
 
             List<PointData> pjgzdls = edosUtil.getHistoryDatasSnap(pjgzd, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
 
@@ -539,7 +570,7 @@ public class EconomicService {
                 vos.setId("0");
                 vos.setTime(2023);
                 temp1 = pjgzdls.get(i).getPointValueInDouble();
-                if (pjgzd.getWindturbineId().contains(wt2.getId())) {
+                if (sszglpbpp.get().getWindturbineId().contains(wt2.getId())) {
                     vos.setTime(pjgzdls.get(i).getPointTime());
                     vos.setId(wt2.getId());
                     vos.setName(wt2.getName());