Ver Fonte

给0点数值150,设置为常用,然后返回重新进入,一键应用选择刚才的策略,调控值变为150,期望约束为最大值99.52

xusl há 6 meses atrás
pai
commit
1e5d73d6bc

+ 16 - 1
cpp-admin/src/main/java/com/cpp/web/controller/regulation/DqRegulationController.java

@@ -282,6 +282,7 @@ public class DqRegulationController {
 
     @GetMapping("/trialData")
     public R trialData(String stationCode, Long time,String usualName,String selectRadio) {
+        ElectricField electricField = electricFieldService.findByStationCode(stationCode);
         int howLongAgo = DateTimeUtil.getDaysBetweenTwoDate(System.currentTimeMillis(),time);
         // 获取要调整的短期那天的最后时间
         long endTime = DateTimeUtil.getDayLastTime(time).getTime();
@@ -313,7 +314,14 @@ public class DqRegulationController {
                     tempShortRegulationDto.setYsValue(ysShortMap.get(tempTime));
                     tempShortRegulationDto.setSz(new BigDecimal("0"));
                     tempShortRegulationDto.setXs(new BigDecimal("1"));
-                    tempShortRegulationDto.setTkValue(forecastPowerShortCloudMap.get(tempTime));
+                    BigDecimal tkValue = forecastPowerShortCloudMap.get(tempTime);
+                    // 判断调控值小于0,则调控值为0,超出装机容量按装机处理
+                    if (tkValue.compareTo(new BigDecimal("0")) < 0) {
+                        tkValue = new BigDecimal("0");
+                    } else if (tkValue.compareTo(electricField.getCapacity()) > 0) {
+                        tkValue = electricField.getCapacity();
+                    }
+                    tempShortRegulationDto.setTkValue(tkValue);
                     tempShortRegulationDto.setStationCode(stationCode);
                     trialList.add(tempShortRegulationDto);
                 }
@@ -345,6 +353,13 @@ public class DqRegulationController {
                 tempShortRegulationDto.setXs(tempShortUsualDetail.getXs());
                 // 计算调控值,调控值=原始值*系数+数值
                 BigDecimal tkValue = ysShortMap.get(tempTime).multiply(tempShortUsualDetail.getXs()).add(tempShortUsualDetail.getSz()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                // 判断调控值小于0,则调控值为0,超出装机容量按装机处理
+                if (tkValue.compareTo(new BigDecimal("0")) < 0) {
+                    tkValue = new BigDecimal("0");
+                } else if (tkValue.compareTo(electricField.getCapacity()) > 0) {
+                    tkValue = electricField.getCapacity();
+                }
+
                 tempShortRegulationDto.setTkValue(tkValue);
                 tempShortRegulationDto.setStationCode(stationCode);
                 trialList.add(tempShortRegulationDto);