优化洪水预测错误提示
parent
18b01cd459
commit
1bc5a7615b
|
|
@ -83,7 +83,7 @@ public class ForecastResultsController {
|
||||||
|
|
||||||
@Operation(summary = "获取人工交互洪水预报结果")
|
@Operation(summary = "获取人工交互洪水预报结果")
|
||||||
@PostMapping("/getHumanForecastResult")
|
@PostMapping("/getHumanForecastResult")
|
||||||
public R<ForecastProject> getHumanForecastResult(@RequestBody ForecastTask forecastTask) throws Exception {
|
public R<ForecastProject> getHumanForecastResult(@RequestBody ForecastTask forecastTask) {
|
||||||
ForecastProject forecastProject = new ForecastProject();
|
ForecastProject forecastProject = new ForecastProject();
|
||||||
List<ForecastResultVo> voList = service.getHumanForecastResult(forecastTask);
|
List<ForecastResultVo> voList = service.getHumanForecastResult(forecastTask);
|
||||||
forecastProject.setType("2");
|
forecastProject.setType("2");
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
||||||
* @auther: cxw
|
* @auther: cxw
|
||||||
* @date: 2024-07-31, 周三, 11:09:24
|
* @date: 2024-07-31, 周三, 11:09:24
|
||||||
*/
|
*/
|
||||||
public List<ForecastResultVo> getHumanForecastResult(ForecastTask forecastTask) throws Exception {
|
public List<ForecastResultVo> getHumanForecastResult(ForecastTask forecastTask) {
|
||||||
// 当前时间整点,作为获取雨量数据历史、预测分隔点
|
// 当前时间整点,作为获取雨量数据历史、预测分隔点
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
|
@ -120,8 +120,13 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
Date nowHourTime = calendar.getTime();
|
Date nowHourTime = calendar.getTime();
|
||||||
forecastTask.setNowTime(nowHourTime);
|
forecastTask.setNowTime(nowHourTime);
|
||||||
List<ForecastResultVo> voList = excuteForecast(forecastTask);
|
List<ForecastResultVo> voList = null;
|
||||||
voList.sort(Comparator.comparing(ForecastResultVo::getTm));
|
try {
|
||||||
|
voList = excuteForecast(forecastTask);
|
||||||
|
voList.sort(Comparator.comparing(ForecastResultVo::getTm));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException("数据异常!");
|
||||||
|
}
|
||||||
return voList;
|
return voList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,10 +226,16 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
||||||
if (CollectionUtils.isNotEmpty(filterList)) {
|
if (CollectionUtils.isNotEmpty(filterList)) {
|
||||||
retMap = reorganizePptnRData(filterList, dt, period[0], period[1]);
|
retMap = reorganizePptnRData(filterList, dt, period[0], period[1]);
|
||||||
}
|
}
|
||||||
|
if(ObjectUtils.isEmpty(retMap.get("listForForecast"))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
List<String> pForecastList = retMap.get("listForForecast").stream().map(s -> s.getDrp()).collect(Collectors.toList());
|
List<String> pForecastList = retMap.get("listForForecast").stream().map(s -> s.getDrp()).collect(Collectors.toList());
|
||||||
if(pForecastList.size() == 0){
|
if(pForecastList.size() == 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(ObjectUtils.isEmpty(retMap.get("listForReal"))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Map<String, String> pRealMap = retMap.get("listForReal").stream().collect(Collectors.toMap(pptnR -> sdfMinute.format(pptnR.getTm()), StPptnR::getDrp));
|
Map<String, String> pRealMap = retMap.get("listForReal").stream().collect(Collectors.toMap(pptnR -> sdfMinute.format(pptnR.getTm()), StPptnR::getDrp));
|
||||||
double[] PList = pForecastList.stream().mapToDouble(Double::parseDouble).toArray();
|
double[] PList = pForecastList.stream().mapToDouble(Double::parseDouble).toArray();
|
||||||
// 预测执行
|
// 预测执行
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue