diff --git a/src/main/java/com/gunshi/project/xyt/controller/ForecastProjectController.java b/src/main/java/com/gunshi/project/xyt/controller/ForecastProjectController.java index 37cb8ca..4172806 100644 --- a/src/main/java/com/gunshi/project/xyt/controller/ForecastProjectController.java +++ b/src/main/java/com/gunshi/project/xyt/controller/ForecastProjectController.java @@ -20,6 +20,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.Mapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.io.Serializable; +import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; @@ -124,7 +126,7 @@ public class ForecastProjectController { @Operation(summary = "根据方案id查看方案洪水预报结果") - @PostMapping("/getForecastProjectResults") + @GetMapping("/getForecastProjectResults") public R getForecastProjectResults(@Schema(name = "projectId", description = "预测方案id") @RequestParam("projectId") String projectId) { ForecastProject forecastProject = service.getById(projectId); if (Objects.isNull(forecastProject)) { @@ -142,7 +144,9 @@ public class ForecastProjectController { vo.setRealCkQValue(result.getRealCkQValue()); vo.setYcSwHValue(result.getYcSwHValue()); vo.setRealSwHValue(result.getRealSwHValue()); - vo.setSwHDValue(result.getYcSwHValue().subtract(result.getRealSwHValue()));// 处理预测与实测水位差 + BigDecimal ycSwHValue = result.getYcSwHValue() == null ? BigDecimal.ZERO : result.getYcSwHValue(); + BigDecimal realSwHValue = result.getRealSwHValue() == null ? BigDecimal.ZERO : result.getRealSwHValue(); + vo.setSwHDValue(ycSwHValue.subtract(realSwHValue));// 处理预测与实测水位差 vo.setDrp(result.getDrp()); vo.setIspreDrp(result.getIspreDrp()); vo.setR(result.getR());