| | |
| | | import cn.gistack.nky.requestpojo.PredictWatersPo; |
| | | import cn.gistack.nky.requestpojo.QueryReqPo; |
| | | import cn.gistack.nky.resultpojo.DataResChildrenPo; |
| | | import cn.gistack.nky.resultpojo.NewSwFuturePo; |
| | | import cn.gistack.nky.service.IHstPredictService; |
| | | import cn.gistack.nky.service.IHsybService; |
| | | import cn.gistack.nky.service.INkyService; |
| | |
| | | @Override |
| | | public void getData(String type) { |
| | | List<DataResChildrenPo> cdList = getCdList(type); |
| | | List<DataResChildrenPo> collect = cdList.stream().filter(item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42128140006")).collect(Collectors.toList()); |
| | | List<DataResChildrenPo> collect = cdList.stream().filter( |
| | | // item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42128140006") |
| | | item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42130350046")|| item.getRes_cd().equals("42092250024")|| item.getRes_cd().equals("42022250039")|| item.getRes_cd().equals("42132150292") |
| | | |
| | | ).collect(Collectors.toList()); |
| | | collect.forEach(dataResChildrenPo -> { |
| | | //循环请求预测结果 |
| | | QueryReqPo queryReqPo = new QueryReqPo(dataResChildrenPo, type); |
| | |
| | | @Override |
| | | public void predictData(String type) { |
| | | List<DataResChildrenPo> cdList = getCdList(type); |
| | | //暂时筛选出这两个水库的数据 |
| | | List<DataResChildrenPo> collect = cdList.stream().filter(item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42128140006")).collect(Collectors.toList()); |
| | | //暂时筛选出数据 |
| | | List<DataResChildrenPo> collect = cdList.stream().filter( |
| | | item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42130350046")|| item.getRes_cd().equals("42092250024")|| item.getRes_cd().equals("42022250039")|| item.getRes_cd().equals("42132150292") |
| | | ).collect(Collectors.toList()); |
| | | |
| | | predict(collect,type); |
| | | // predict(collect,type); |
| | | |
| | | newPredict(collect,type); |
| | | |
| | | |
| | | // |
| | | // if (type.equals("1")) { |
| | | // //渗压 |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type, po); |
| | | // //循环预测请求 |
| | | // nkyService.hstPredict(arimaPredictReqPo); |
| | | // } |
| | | //// } |
| | | // }); |
| | | // } else if (type.equals("2")) { |
| | | // //渗流 |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type, po); |
| | | // //循环预测请求 |
| | | // nkyService.hstPredict(arimaPredictReqPo); |
| | | // } |
| | | //// } |
| | | // }); |
| | | // |
| | | // |
| | | // } else if (type.equals("3") || type.equals("4") || type.equals("5")) { |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // //循环预测请求(位移一起请求减少请求次数) |
| | | // HstPredictReqPo arimaPredictReqPoX = new HstPredictReqPo(dataResChildrenPo, "3", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoX); |
| | | // |
| | | // HstPredictReqPo arimaPredictReqPoY = new HstPredictReqPo(dataResChildrenPo, "4", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoY); |
| | | // |
| | | // HstPredictReqPo arimaPredictReqPoZ = new HstPredictReqPo(dataResChildrenPo, "5", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoZ); |
| | | // } |
| | | //// } |
| | | // }); |
| | | } |
| | | |
| | | private void newPredict(List<DataResChildrenPo> collect, String type) { |
| | | |
| | | String resCd = ""; |
| | | //无数据直接返回 |
| | | if (collect.size() == 0){ |
| | | return; |
| | | } |
| | | List<NewSwFuturePo> future = new ArrayList<>(); |
| | | if (type.equals("1") || type.equals("2")){ |
| | | |
| | | for (int i = 0; i < collect.size(); i++) { |
| | | DataResChildrenPo dataResChildrenPo = collect.get(i); |
| | | String currentResCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | //第一个水库 |
| | | if (future.size() == 0 && resCd.equals("")){ |
| | | future = hsybService.getNewFuture(currentResCd); |
| | | //当前水库 |
| | | resCd = currentResCd; |
| | | } else if (!resCd.equals(currentResCd)) { |
| | | //其他水库,获取新的预测数据 |
| | | future = hsybService.getNewFuture(currentResCd); |
| | | //更换为新水库 |
| | | resCd = currentResCd; |
| | | } |
| | | |
| | | //预测数据构造请求数据 |
| | | if (future != null && future.size() > 0) { |
| | | List<PredictWatersPo> po = new ArrayList<>(); |
| | | future.forEach(item -> { |
| | | PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | //设置时间 |
| | | predictWatersPo.setTime(item.getTime()); |
| | | //设置预测水位 |
| | | predictWatersPo.setValue(Double.parseDouble(item.getSw())); |
| | | po.add(predictWatersPo); |
| | | }); |
| | | HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type, po); |
| | | //循环预测请求 |
| | | nkyService.hstPredict(arimaPredictReqPo); |
| | | } |
| | | |
| | | |
| | | } |
| | | }else if (type.equals("3") || type.equals("4") || type.equals("5")){ |
| | | |
| | | // } |
| | | // resCd = ""; |
| | | for (int i = 0; i < collect.size(); i++) { |
| | | DataResChildrenPo dataResChildrenPo = collect.get(i); |
| | | String currentResCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | //第一个水库 |
| | | if (future.size() == 0 && resCd.equals("")){ |
| | | future = hsybService.getNewFuture(currentResCd); |
| | | //当前水库 |
| | | resCd = currentResCd; |
| | | } else if (!resCd.equals(currentResCd)) { |
| | | //其他水库,获取新的预测数据 |
| | | future = hsybService.getNewFuture(currentResCd); |
| | | //更换为新水库 |
| | | resCd = currentResCd; |
| | | } |
| | | |
| | | //预测数据构造请求数据 |
| | | if (future != null && future.size() > 0) { |
| | | List<PredictWatersPo> po = new ArrayList<>(); |
| | | future.forEach(item -> { |
| | | PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | //设置时间 |
| | | predictWatersPo.setTime(item.getTime()); |
| | | //设置预测水位 |
| | | predictWatersPo.setValue(Double.parseDouble(item.getSw())); |
| | | po.add(predictWatersPo); |
| | | }); |
| | | //循环预测请求(位移一起请求减少请求次数) |
| | | HstPredictReqPo arimaPredictReqPoX = new HstPredictReqPo(dataResChildrenPo, "3", po); |
| | | nkyService.hstPredict(arimaPredictReqPoX); |
| | | |
| | | HstPredictReqPo arimaPredictReqPoY = new HstPredictReqPo(dataResChildrenPo, "4", po); |
| | | nkyService.hstPredict(arimaPredictReqPoY); |
| | | |
| | | HstPredictReqPo arimaPredictReqPoZ = new HstPredictReqPo(dataResChildrenPo, "5", po); |
| | | nkyService.hstPredict(arimaPredictReqPoZ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void predict(List<DataResChildrenPo> collect, String type) { |