| | |
| | | @Service |
| | | public class HstPredictServiceImpl extends ServiceImpl<HstPredictMapper, HstPredict> implements IHstPredictService { |
| | | @Autowired |
| | | private INkyService nkyService; |
| | | private INkyService nkyService; |
| | | @Autowired |
| | | private IZtApiService ztApiService; |
| | | private IZtApiService ztApiService; |
| | | @Autowired |
| | | private IHsybService hsybService; |
| | | private IHsybService hsybService; |
| | | |
| | | |
| | | @Override |
| | |
| | | List<DataResChildrenPo> collect = cdList.stream().filter(item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42128140006")).collect(Collectors.toList()); |
| | | |
| | | |
| | | if (type.equals("1")){ |
| | | 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); |
| | | } |
| | | // 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")){ |
| | | } 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); |
| | | } |
| | | // 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")){ |
| | | } 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); |
| | | // 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 arimaPredictReqPoY = new HstPredictReqPo(dataResChildrenPo, "4", po); |
| | | nkyService.hstPredict(arimaPredictReqPoY); |
| | | |
| | | HstPredictReqPo arimaPredictReqPoZ = new HstPredictReqPo(dataResChildrenPo, "5",po); |
| | | nkyService.hstPredict(arimaPredictReqPoZ); |
| | | } |
| | | HstPredictReqPo arimaPredictReqPoZ = new HstPredictReqPo(dataResChildrenPo, "5", po); |
| | | nkyService.hstPredict(arimaPredictReqPoZ); |
| | | } |
| | | // } |
| | | }); |
| | | } |
| | | resCd = ""; |
| | |
| | | @Override |
| | | public List<HstPredictVO> getFutureData(String resCd, String type) { |
| | | List<HstPredictVO> list = new ArrayList<>(); |
| | | if (type.equals("3")){ |
| | | list = baseMapper.getFutureDataWy(resCd,type); |
| | | }else { |
| | | list = baseMapper.getFutureData(resCd,type); |
| | | if (type.equals("3")) { |
| | | list = baseMapper.getFutureDataWy(resCd, type); |
| | | } else { |
| | | list = baseMapper.getFutureData(resCd, type); |
| | | } |
| | | |
| | | |
| | | list.forEach(hstPredict -> { |
| | | if (hstPredict.getPredictList() != null){ |
| | | if (hstPredict.getPredictList() != null) { |
| | | hstPredict.setPredictList(JSON.parse(hstPredict.getPredictList().toString())); |
| | | }else { |
| | | } else { |
| | | hstPredict.setPredictList("[]"); |
| | | } |
| | | hstPredict.setPreWaterList(JSON.parse(hstPredict.getPreWaterList().toString())); |
| | |
| | | |
| | | List<HstPredict> list = baseMapper.selectTodayData(entity); |
| | | |
| | | if (list.size()>0){ |
| | | if (list.size() > 0) { |
| | | //删除该数据,添加最新数据 |
| | | // baseMapper.deleteById(list.get(0)); |
| | | // return super.save(entity); |
| | | return false; |
| | | }else { |
| | | return false; |
| | | } else { |
| | | return super.save(entity); |
| | | } |
| | | } |