Browse Source

内报维护损失电量*0.6,公式由场站发电量改为其次发电量

xushili 1 year ago
parent
commit
c6755ebcfc

+ 7 - 6
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/auto/GhostService.java

@@ -152,7 +152,7 @@ public class GhostService {
             {
                 QueryWrapper<Windpowerinfoday> windturbineinfodayQueryWrapper = new QueryWrapper<>();
                 windturbineinfodayQueryWrapper.eq("recorddate",DateUtils.truncate(fr.getBegindate()));
-                windturbineinfodayQueryWrapper.eq("foreignkeyid",fr.getWpid());
+                windturbineinfodayQueryWrapper.eq("foreignkeyid",fr.getProjectid());
                 List<Windpowerinfoday> windturbineinfodayList = windpowerinfodayService.list(windturbineinfodayQueryWrapper);
 
                 Map<String,Windpowerinfoday> wtdaymap=new HashMap<>();
@@ -160,28 +160,29 @@ public class GhostService {
                 {
                     for ( Windpowerinfoday wtday:windturbineinfodayList)
                     {
-                        wtdaymap.put(wtday.getWindpowerstationid(),wtday);
+                        wtdaymap.put(wtday.getForeignkeyid(),wtday);
                     }
                 }
 
                 double gzsc=DateUtils.hoursDiff1(fr.getBegindate(),fr.getEnddate());
 
-                if(wtdaymap.containsKey(fr.getWpid()))
+                if(wtdaymap.containsKey(fr.getProjectid()))
                 {
-                    Windpowerinfoday wpday=wtdaymap.get(fr.getWpid());
+                    Windpowerinfoday wpday=wtdaymap.get(fr.getProjectid());
 
                     if(CacheContext.wpwtlsmap.containsKey(wpday.getWindpowerstationid()))
                     {
                         List<Windturbine> wtls=CacheContext.wpwtlsmap.get(wpday.getWindpowerstationid());
+                        wtls = wtls.stream().filter(a -> fr.getProjectid().equals(a.getProjectid())).collect(Collectors.toList());
                         double rfdl= wpday.getGeneratingcapacity2();
-                        double ssdl = new BigDecimal(rfdl).divide(new BigDecimal(wtls.size()), 4, RoundingMode.HALF_EVEN).divide(new BigDecimal(24), 4, RoundingMode.HALF_EVEN).multiply(new BigDecimal(gzsc)).doubleValue();
+                        double ssdl = new BigDecimal(rfdl).divide(new BigDecimal(wtls.size()), 2, RoundingMode.HALF_EVEN).divide(new BigDecimal(24), 2, RoundingMode.HALF_EVEN).multiply(new BigDecimal(gzsc)).doubleValue();
+                        if("内报".equals(fr.getType())) ssdl = ssdl * 0.6;
                         fr.setPowerloss(StringUtils.round(ssdl,2));
                         if(StringUtils.round(ssdl,2)==0)
                         {
                             ssdl=0.01;
                             fr.setPowerloss(ssdl);
                         }
-
                         mainrecordService.saveOrUpdate(fr);
                     }