From 49cef18716c2348601d47e13dfa21ac113660f67 Mon Sep 17 00:00:00 2001 From: cxw <1520264117@qq.com> Date: Fri, 18 Oct 2024 14:45:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=AA=E6=B0=B4=E9=A2=84=E6=8A=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyt/service/ForecastResultsService.java | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/gunshi/project/xyt/service/ForecastResultsService.java b/src/main/java/com/gunshi/project/xyt/service/ForecastResultsService.java index 984c805..eaf9a6d 100644 --- a/src/main/java/com/gunshi/project/xyt/service/ForecastResultsService.java +++ b/src/main/java/com/gunshi/project/xyt/service/ForecastResultsService.java @@ -406,32 +406,36 @@ public class ForecastResultsService extends ServiceImpl gribList = forecastService.getGribData(tm, false); - //24小时每个网格的总量 - List total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList()); - //24小时每个网格的逐小时雨量 - List detail = gribList.stream().filter(o -> o.getTmRange().getInterval() == 1).collect(Collectors.toList()); + try { + List gribList = forecastService.getGribData(tm, false); + //24小时每个网格的总量 + List total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList()); + //24小时每个网格的逐小时雨量 + List 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 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]))); - List 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 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; } @@ -683,7 +687,13 @@ public class ForecastResultsService extends ServiceImpl 0 || dh.compareTo(BigDecimal.valueOf(y2 - y1)) > 0){ + throw new IllegalArgumentException("Geom参数区域范围不足预测降雨网格最小单位!!!"); + } // 校验数据是否在最大允许范围(预测降雨所划定区域) Double x11 = ForecastService.x1; Double y11 = ForecastService.y1;