xujuanning 3 månader sedan
förälder
incheckning
83aca08370

+ 4 - 2
generationXK-service/src/main/java/com/gyee/generation/service/realtimelibrary/ElectricityMeteringService.java

@@ -23,6 +23,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
 
 @Service
 @Slf4j
@@ -41,7 +42,7 @@ public class ElectricityMeteringService {
     public void saveGenerationDatas() throws Exception {
 
         List<ProBasicLine> lnls = CacheContext.lnls;
-        List<ProBasicMeterPoint> meterpoints = CacheContext.meterpoints;
+        List<ProBasicMeterPoint> meterpoint = CacheContext.meterpoints;
         List<ProBasicProject> projects = CacheContext.pjls;
         List<ProBasicPowerstation> wpls = CacheContext.wpls;
         Map<String, Map<String, ProBasicPowerstationPoint>> linepointmap = CacheContext.linepointmap;
@@ -61,7 +62,8 @@ public class ElectricityMeteringService {
             Map<String, ProBasicPowerstationPoint> proBasicWppointMap = linepointmap.get(line.getId());
             //线路发电量
             log.info(line.getName() + "电计量电量计算开始!");
-            Optional<ProBasicMeterPoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineId().equals(line.getId()) && me.getUniformCode().equals("ZXYG") && me.getMeterType().equals("进线") && me.getMeterSort().equals("主")).findFirst();
+            List<ProBasicMeterPoint> meterpoints = meterpoint.stream().filter(me -> null != me.getLineId()).collect(Collectors.toList());
+            Optional<ProBasicMeterPoint> fdlOptional = meterpoints.stream().filter(me -> me.getLineId().equals(line.getId()) && "ZXYG".equals(me.getUniformCode()) && "进线".equals(me.getMeterType()) && "主".equals(me.getMeterSort())).findFirst();
             getLineFdl(line.getId(), samedayZero, monthFirstZero, yearFirstZero, date, currentDate, lineResultList, proBasicWppointMap, fdlOptional);
             log.info(line.getName() + "电计量电量计算完毕!");