Quellcode durchsuchen

[1014] 功率修正逻辑优化: 超短期/短期/中期multiplierUpdate与单点update修正时同步回写对应时刻上报数据功率

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
taosj vor 1 Woche
Ursprung
Commit
50a914b854

+ 11 - 3
forecast-backend-server/src/main/java/com/ufo/project/forecast/mediumterm/power/controller/DataMediumTermPowerForecastCorrectController.java

@@ -142,6 +142,8 @@ public class DataMediumTermPowerForecastCorrectController extends BaseController
                 continue;
             }
             String newPower = multiplyPower(report.getPower(), factor);
+            report.setPower(newPower);
+            dataMediumTermPowerForecastReportMapper.updateDataMediumTermPowerForecastReport(report);
             DataMediumTermPowerForecastCorrect existing = dataMediumTermPowerForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, report.getForecastTime());
             if (existing != null)
             {
@@ -195,17 +197,23 @@ public class DataMediumTermPowerForecastCorrectController extends BaseController
             return AjaxResult.error("修正功率必须为数字");
         }
 
+        // 取该时刻最新一条上报数据: 同步回写修正功率, 无修正数据时作为新增模板
+        List<DataMediumTermPowerForecastReport> reportList = dataMediumTermPowerForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
+        DataMediumTermPowerForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
+
         DataMediumTermPowerForecastCorrect existing = dataMediumTermPowerForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, forecastTime);
         if (existing != null)
         {
             existing.setPower(power.trim());
             dataMediumTermPowerForecastCorrectMapper.updateDataMediumTermPowerForecastCorrect(existing);
+            if (report != null)
+            {
+                report.setPower(power.trim());
+                dataMediumTermPowerForecastReportMapper.updateDataMediumTermPowerForecastReport(report);
+            }
             return AjaxResult.success();
         }
 
-        // 无修正数据时, 取该时刻最新一条上报数据作为新增模板
-        List<DataMediumTermPowerForecastReport> reportList = dataMediumTermPowerForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
-        DataMediumTermPowerForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
         if (report == null)
         {
             return AjaxResult.error("未找到对应时刻的上报数据,无法新增修正数据");

+ 11 - 3
forecast-backend-server/src/main/java/com/ufo/project/forecast/shortterm/power/controller/DataShortTermPowerForecastCorrectController.java

@@ -142,6 +142,8 @@ public class DataShortTermPowerForecastCorrectController extends BaseController
                 continue;
             }
             String newPower = multiplyPower(report.getPower(), factor);
+            report.setPower(newPower);
+            dataShortTermPowerForecastReportMapper.updateDataShortTermPowerForecastReport(report);
             DataShortTermPowerForecastCorrect existing = dataShortTermPowerForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, report.getForecastTime());
             if (existing != null)
             {
@@ -195,17 +197,23 @@ public class DataShortTermPowerForecastCorrectController extends BaseController
             return AjaxResult.error("修正功率必须为数字");
         }
 
+        // 取该时刻最新一条上报数据: 同步回写修正功率, 无修正数据时作为新增模板
+        List<DataShortTermPowerForecastReport> reportList = dataShortTermPowerForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
+        DataShortTermPowerForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
+
         DataShortTermPowerForecastCorrect existing = dataShortTermPowerForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, forecastTime);
         if (existing != null)
         {
             existing.setPower(power.trim());
             dataShortTermPowerForecastCorrectMapper.updateDataShortTermPowerForecastCorrect(existing);
+            if (report != null)
+            {
+                report.setPower(power.trim());
+                dataShortTermPowerForecastReportMapper.updateDataShortTermPowerForecastReport(report);
+            }
             return AjaxResult.success();
         }
 
-        // 无修正数据时, 取该时刻最新一条上报数据作为新增模板
-        List<DataShortTermPowerForecastReport> reportList = dataShortTermPowerForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
-        DataShortTermPowerForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
         if (report == null)
         {
             return AjaxResult.error("未找到对应时刻的上报数据,无法新增修正数据");

+ 11 - 3
forecast-backend-server/src/main/java/com/ufo/project/forecast/supershort/controller/DataSuperShortTermForecastCorrectController.java

@@ -142,6 +142,8 @@ public class DataSuperShortTermForecastCorrectController extends BaseController
                 continue;
             }
             String newPower = multiplyPower(report.getPower(), factor);
+            report.setPower(newPower);
+            dataSuperShortTermForecastReportMapper.updateDataSuperShortTermForecastReport(report);
             DataSuperShortTermForecastCorrect existing = dataSuperShortTermForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, report.getForecastTime());
             if (existing != null)
             {
@@ -194,17 +196,23 @@ public class DataSuperShortTermForecastCorrectController extends BaseController
             return AjaxResult.error("修正功率必须为数字");
         }
 
+        // 取该时刻最新一条上报数据: 同步回写修正功率, 无修正数据时作为新增模板
+        List<DataSuperShortTermForecastReport> reportList = dataSuperShortTermForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
+        DataSuperShortTermForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
+
         DataSuperShortTermForecastCorrect existing = dataSuperShortTermForecastCorrectMapper.selectLatestByEntityAndForecastTime(entityId, forecastTime);
         if (existing != null)
         {
             existing.setPower(power.trim());
             dataSuperShortTermForecastCorrectMapper.updateDataSuperShortTermForecastCorrect(existing);
+            if (report != null)
+            {
+                report.setPower(power.trim());
+                dataSuperShortTermForecastReportMapper.updateDataSuperShortTermForecastReport(report);
+            }
             return AjaxResult.success();
         }
 
-        // 无修正数据时, 取该时刻最新一条上报数据作为新增模板
-        List<DataSuperShortTermForecastReport> reportList = dataSuperShortTermForecastReportMapper.selectLatestByWindow(entityId, forecastTime - 1, forecastTime);
-        DataSuperShortTermForecastReport report = (reportList == null || reportList.isEmpty()) ? null : reportList.get(0);
         if (report == null)
         {
             return AjaxResult.error("未找到对应时刻的上报数据,无法新增修正数据");