Browse Source

[101904] 上报列表支持 batchNo 查询, 已确认批次禁止改数

taosj 2 tuần trước cách đây
mục cha
commit
c0040de442

+ 14 - 0
forecast-backend-server/src/main/java/com/ufo/project/forecast/shortterm/power/controller/DataShortTermPowerForecastReportController.java

@@ -12,8 +12,11 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import com.ufo.base.common.utils.StringUtils;
 import com.ufo.base.framework.aspectj.lang.annotation.Log;
 import com.ufo.base.framework.aspectj.lang.enums.BusinessType;
+import com.ufo.project.forecast.fileupload.domain.DataPowerForecastReportBatch;
+import com.ufo.project.forecast.fileupload.service.IDataPowerForecastReportBatchService;
 import com.ufo.project.forecast.shortterm.power.domain.DataShortTermPowerForecastReport;
 import com.ufo.project.forecast.shortterm.power.service.IDataShortTermPowerForecastReportService;
 import com.ufo.base.framework.web.controller.BaseController;
@@ -34,6 +37,9 @@ public class DataShortTermPowerForecastReportController extends BaseController
     @Autowired
     private IDataShortTermPowerForecastReportService dataShortTermPowerForecastReportService;
 
+    @Autowired
+    private IDataPowerForecastReportBatchService dataPowerForecastReportBatchService;
+
     /**
      * 查询短期功率上报数据列表
      */
@@ -88,6 +94,14 @@ public class DataShortTermPowerForecastReportController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody DataShortTermPowerForecastReport dataShortTermPowerForecastReport)
     {
+        if (StringUtils.isNotEmpty(dataShortTermPowerForecastReport.getBatchNo()))
+        {
+            DataPowerForecastReportBatch batch = dataPowerForecastReportBatchService.selectByBatchNo(dataShortTermPowerForecastReport.getBatchNo());
+            if (batch != null && !Integer.valueOf(DataPowerForecastReportBatch.STATUS_PENDING).equals(batch.getStatus()))
+            {
+                return AjaxResult.error("上报批次已确认, 不允许修改数据");
+            }
+        }
         return toAjax(dataShortTermPowerForecastReportService.updateDataShortTermPowerForecastReport(dataShortTermPowerForecastReport));
     }
 

+ 14 - 0
forecast-backend-server/src/main/java/com/ufo/project/forecast/supershort/controller/DataSuperShortTermForecastReportController.java

@@ -12,8 +12,11 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import com.ufo.base.common.utils.StringUtils;
 import com.ufo.base.framework.aspectj.lang.annotation.Log;
 import com.ufo.base.framework.aspectj.lang.enums.BusinessType;
+import com.ufo.project.forecast.fileupload.domain.DataPowerForecastReportBatch;
+import com.ufo.project.forecast.fileupload.service.IDataPowerForecastReportBatchService;
 import com.ufo.project.forecast.supershort.domain.DataSuperShortTermForecastReport;
 import com.ufo.project.forecast.supershort.service.IDataSuperShortTermForecastReportService;
 import com.ufo.base.framework.web.controller.BaseController;
@@ -34,6 +37,9 @@ public class DataSuperShortTermForecastReportController extends BaseController
     @Autowired
     private IDataSuperShortTermForecastReportService dataSuperShortTermForecastReportService;
 
+    @Autowired
+    private IDataPowerForecastReportBatchService dataPowerForecastReportBatchService;
+
     /**
      * 查询超短期功率上报数据列表
      */
@@ -88,6 +94,14 @@ public class DataSuperShortTermForecastReportController extends BaseController
     @PutMapping
     public AjaxResult edit(@RequestBody DataSuperShortTermForecastReport dataSuperShortTermForecastReport)
     {
+        if (StringUtils.isNotEmpty(dataSuperShortTermForecastReport.getBatchNo()))
+        {
+            DataPowerForecastReportBatch batch = dataPowerForecastReportBatchService.selectByBatchNo(dataSuperShortTermForecastReport.getBatchNo());
+            if (batch != null && !Integer.valueOf(DataPowerForecastReportBatch.STATUS_PENDING).equals(batch.getStatus()))
+            {
+                return AjaxResult.error("上报批次已确认, 不允许修改数据");
+            }
+        }
         return toAjax(dataSuperShortTermForecastReportService.updateDataSuperShortTermForecastReport(dataSuperShortTermForecastReport));
     }
 

+ 1 - 0
forecast-backend-server/src/main/resources/mybatis/power/DataShortTermPowerForecastReportMapper.xml

@@ -44,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="forecastEndTime != null and forecastEndTime > 0"> and forecast_time &lt;= #{forecastEndTime}</if>
             <if test="predays != null "> and predays = #{predays}</if>
             <if test="power != null  and power != ''"> and power = #{power}</if>
+            <if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
         </where>
     </select>
     

+ 1 - 0
forecast-backend-server/src/main/resources/mybatis/supershort/DataSuperShortTermForecastReportMapper.xml

@@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="forecastTime != null "> and forecast_time = #{forecastTime}</if>
             <if test="preQrts != null "> and pre_qrts = #{preQrts}</if>
             <if test="power != null  and power != ''"> and power = #{power}</if>
+            <if test="batchNo != null and batchNo != ''"> and batch_no = #{batchNo}</if>
         </where>
     </select>