浏览代码

理论功率bug修复

xushili 1 年之前
父节点
当前提交
af5ab16c97

+ 1 - 1
electricity/wind/src/main/java/com/gyee/gaia/electricity/wind/job/CalcEquipPowerGenDay.java

@@ -331,7 +331,7 @@ public class CalcEquipPowerGenDay {
                 }
                 theoryPower += power / 1000 / 60;
             }*/
-            value.setTheoryGeneration(BigDecimal.valueOf(sratMap.get(equipId).getTheoryGeneration()).setScale(2, RoundingMode.HALF_UP));
+            value.setTheoryGeneration(BigDecimal.valueOf(sratMap.get(equipId).getTheoryGeneration()/60).setScale(2, RoundingMode.HALF_UP));
             value.setMeanWindSpeed(BigDecimal.valueOf(sratMap.get(equipId).getWindSpeed()).setScale(2, RoundingMode.HALF_UP));
         }
 

+ 14 - 5
electricity/wind/src/main/java/com/gyee/gaia/electricity/wind/serviceimpl/EquipPowerGenDayServiceImpl.java

@@ -32,10 +32,10 @@ public class EquipPowerGenDayServiceImpl extends ServiceImpl<EquipPowerGenDayMap
     @Override
     public List<EquipPowerGenDay> fjjxb(String wpids, String projectids, String lineids, String beginDate, String endDate, String type, String target, String sort) {
         QueryWrapper<EquipPowerGenDay> epgdWrapper = new QueryWrapper<>();
-        epgdWrapper.select("facility_id", "round(sum(generating_capacity)/1000,2) generating_capacity", "round(sum(theory_generation)/1000,2) theory_generation"
-                , "round(sum(loss_power)/1000,2) loss_power", "round(sum(fault_loss_power)/1000,2) fault_loss_power"
-                , "round(sum(maintain_loss_power)/1000,2) maintain_loss_power", "round(sum(implicate_loss_power)/1000,2) implicate_loss_power"
-                , "round(sum(limit_loss_power)/1000,2) limit_loss_power", "round(sum(performance_loss_power)/1000,2) performance_loss_power"
+        epgdWrapper.select("facility_id", "round(sum(generating_capacity)/10000,2) generating_capacity", "round(sum(theory_generation)/10000,2) theory_generation"
+                , "round(sum(loss_power)/10000,2) loss_power", "round(sum(fault_loss_power)/10000,2) fault_loss_power"
+                , "round(sum(maintain_loss_power)/10000,2) maintain_loss_power", "round(sum(implicate_loss_power)/10000,2) implicate_loss_power"
+                , "round(sum(limit_loss_power)/10000,2) limit_loss_power", "round(sum(performance_loss_power)/10000,2) performance_loss_power"
                 , "round(avg(mean_wind_speed),2) mean_wind_speed");
 
         if("1".equals(type)){
@@ -86,7 +86,16 @@ public class EquipPowerGenDayServiceImpl extends ServiceImpl<EquipPowerGenDayMap
             list = list.stream().peek(d -> d.setUniformCode(CacheContext.splssMap.get(d.getFacilityId()))).sorted(Comparator.comparing(EquipPowerGenDay::getFacilityId)).collect(Collectors.toList());
             list.add(powerGenDay);
         }
-        list=list.stream().peek(l->l.setCategory(String.valueOf(l.getTheoryGeneration().divide(l.getGeneratingCapacity(),2, RoundingMode.HALF_EVEN)))).collect(Collectors.toList());
+        list=list.stream().peek(l->{
+            if(l.getGeneratingCapacity().compareTo(BigDecimal.ZERO)==0){
+                if(l.getTheoryGeneration().compareTo(BigDecimal.ZERO)==0){
+                    l.setGeneratingCapacity(new BigDecimal(1));
+                }else {
+                    l.setGeneratingCapacity(l.getTheoryGeneration());
+                }
+            }
+            l.setCategory(String.valueOf(l.getTheoryGeneration().divide(l.getGeneratingCapacity(),2, RoundingMode.HALF_EVEN)));
+        }).collect(Collectors.toList());
         return list;
     }
 }

+ 4 - 3
realtime/wind/src/main/java/com/gyee/gaia/realtime/wind/job/CauseJobHandler.java

@@ -110,8 +110,9 @@ public class CauseJobHandler implements ApplicationRunner {
                 pointCode = entryValue.get(uniformcodeOne.get("wind-speed"));
                 if (pointCode != null) {
                     //风速
-                    v = pdaqMap.get(pointCode).stream().mapToDouble(PointData::getDoubleValue).average().orElse(0);
-                    if (v == 0.0) {
+                    ArrayDeque<PointData> pointData = pdaqMap.get(pointCode);
+                    v = pointData.stream().mapToDouble(PointData::getDoubleValue).average().orElse(0);
+                    if (System.currentTimeMillis()-pointData.getFirst().getTs()>5*60*1000) {
                         //如果离线或者别的原因获取不到风速,从全场实时平均风速获取
                         Map<String, PointData> latest = adapterApi.getLatest(CacheContext.stationRealMeanSpeedMap.get(CacheContext.equipMap.get(entry.getKey()).getWindpowerstationId()));
                         Iterator<PointData> iterator = latest.values().iterator();
@@ -134,7 +135,7 @@ public class CauseJobHandler implements ApplicationRunner {
                         power = CacheContext.mpdsMapMap.get(CacheContext.equipModelMap.get(entry.getKey())).get(speed);
                     }
                     if (power == null) power = 0.0;
-                    target.setTheoryGeneration(NumberUtil.round(power / 60, 4).floatValue());
+                    target.setTheoryGeneration(NumberUtil.round(power, 2).floatValue());
                 }
                 pointCode = entryValue.get(uniformcodeOne.get("active-power"));
                 if (pointCode != null) {