洪水预报优化

master
cxw 2024-10-21 09:16:25 +08:00
parent 49cef18716
commit f8651d12a5
1 changed files with 27 additions and 26 deletions

View File

@ -192,7 +192,12 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
} else {
qwExisted = new QueryWrapper<StPptnR>().in("stcd", stbs.stream().map(StStbprpB::getStcd).toArray(String[]::new)).ge("tm", startTime).le("tm", nowHourTime).orderBy(true, true, "tm");
// 获取预报数据
pptnRFutureList = getForecastDrpData(nowHourTime, "");
try {
pptnRFutureList = getForecastDrpData(nowHourTime, "");
} catch (IllegalArgumentException e) {
isHaveFuturePPtn = false;
log.error("该时间无预报数据");
}
}
List<StPptnR> pptnRExistedList = stPptnRService.list(qwExisted);
pptnRAllList.addAll(pptnRExistedList);
@ -253,9 +258,9 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
}
H1 = Double.parseDouble(rsvrR.getRz());
// 泄流量
List<StZqrlB> stZqrlBList = stZqrlBService.list(new QueryWrapper<StZqrlB>().eq("stcd", attResBase.getStcd()));
List<StZqrlB> stZqrlBList = stZqrlBService.list(new QueryWrapper<StZqrlB>().eq("stcd", attResBase.getStcd()).orderBy(true, true, "z"));
// 库容曲线
List<StZvarlB> zvarlBS = stZvarlBService.list(new QueryWrapper<StZvarlB>().eq("stcd", attResBase.getStcd()));
List<StZvarlB> zvarlBS = stZvarlBService.list(new QueryWrapper<StZvarlB>().eq("stcd", attResBase.getStcd()).orderBy(true, true, "rz"));
// 水位历史数据
List<StRsvrR> rsvrRRealList = stRsvrRService.list(new QueryWrapper<StRsvrR>().eq("stcd", attResBase.getStcd()).ge("tm", startTime).le("tm", endTime));
List<StRsvrR> resultList = reorganizeRsvrRData(rsvrRRealList, dt);
@ -406,36 +411,32 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
tm = eightSdf.format(now);
}
tm = tm.replaceAll(" ", "").replaceAll("-", "");
try {
List<RainGrib2Layer> gribList = forecastService.getGribData(tm, false);
//24小时每个网格的总量
List<RainGrib2Layer> total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList());
//24小时每个网格的逐小时雨量
List<RainGrib2Layer> detail = gribList.stream().filter(o -> o.getTmRange().getInterval() == 1).collect(Collectors.toList());
List<RainGrib2Layer> gribList = forecastService.getGribData(tm, false);
//24小时每个网格的总量
List<RainGrib2Layer> total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList());
//24小时每个网格的逐小时雨量
List<RainGrib2Layer> detail = gribList.stream().filter(o -> o.getTmRange().getInterval() == 1).collect(Collectors.toList());
// ForeRainVo vo = new ForeRainVo();
// vo.setStcd(stcd);
// vo.setLgtd(stStbprpB.getLgtd());
// vo.setLttd(stStbprpB.getLttd());
// List<ForeRainTimeVo> data = forecastService.getData(vo, total, detail);
// 2024-10-14 改为获取水库整个面的降雨
ForeRainStatVo vo = new ForeRainStatVo();
String[] paramValue = forecastUseparam.getParamValue().split(",");// x1,y1,x2,y2
vo.setGeom(buildRectangleGeoJson(Double.parseDouble(paramValue[0]), Double.parseDouble(paramValue[1]), Double.parseDouble(paramValue[2]), Double.parseDouble(paramValue[3]), total.get(0)));
List<ForeRainTimeVo> data = forecastService.getAreaData(vo, total, detail);
if (CollectionUtils.isNotEmpty(data)) {
for (ForeRainTimeVo foreRainTimeVo : data) {
// 只取当前时间之后的数据
if(foreRainTimeVo.getTm().compareTo(now) > 0){
StPptnR stPptnR = new StPptnR();
stPptnR.setStcd(stcd);
stPptnR.setTm(foreRainTimeVo.getTm());
stPptnR.setDrp(foreRainTimeVo.getDrp().toString());
pptnRFutureList.add(stPptnR);
}
// 2024-10-14 改为获取水库整个面的降雨
ForeRainStatVo vo = new ForeRainStatVo();
String[] paramValue = forecastUseparam.getParamValue().split(",");// x1,y1,x2,y2
vo.setGeom(buildRectangleGeoJson(Double.parseDouble(paramValue[0]), Double.parseDouble(paramValue[1]), Double.parseDouble(paramValue[2]), Double.parseDouble(paramValue[3]), total.get(0)));
List<ForeRainTimeVo> data = forecastService.getAreaData(vo, total, detail);
if (CollectionUtils.isNotEmpty(data)) {
for (ForeRainTimeVo foreRainTimeVo : data) {
// 只取当前时间之后的数据
if (foreRainTimeVo.getTm().compareTo(now) > 0) {
StPptnR stPptnR = new StPptnR();
stPptnR.setStcd(stcd);
stPptnR.setTm(foreRainTimeVo.getTm());
stPptnR.setDrp(foreRainTimeVo.getDrp().toString());
pptnRFutureList.add(stPptnR);
}
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return pptnRFutureList;
}