From fa8ae4322ab7cc3bf6067c418469b158f23efad6 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 24 三月 2025 13:21:13 +0800 Subject: [PATCH] 处理预测累计 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 81248b6..f480fbe 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -425,6 +425,19 @@ default: break; } + + //处理预测累计 + if (outPut.getIscumulant() != null && outPut.getIscumulant() == 1) { + /*if (StringUtils.isNotBlank(outPut.getCumulpoint())) { + dataView.setCumulantRealData(getHisData(outPut.getCumulpoint(), startTime, endTime)); + }*/ + List<Object[]> cumulantPreList = mmItemResultService.getData(outPut.getId() + CommonDict.CUMULANT_SUFFIX, startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); + dataView.setCumulantPreData(cumulantPreList); + if (!CollectionUtils.isEmpty(cumulantPreList)) { + dataView.setCumulantPreLast(new BigDecimal(cumulantPreList.get(cumulantPreList.size() - 1)[1].toString()).setScale(2, BigDecimal.ROUND_HALF_UP)); + } + } + if (!CollectionUtils.isEmpty(dataView.getRealData())) { Object[] rdo = dataView.getRealData().get(dataView.getRealData().size() - 1); dataView.setCurrValue(new BigDecimal(rdo[1].toString())); @@ -473,19 +486,6 @@ } } catch (Exception ex) { ex.printStackTrace(); - } - List<MmItemOutputEntity> outs = mmItemOutputService.getByItemid(predictItem.getId()); - for (MmItemOutputEntity out : outs) { - //处理预测累计 - if (out.getIscumulant() == 1) { - dataView.setCumulantPreData(mmItemResultService.getData(out.getId() + CommonDict.CUMULANT_SUFFIX, startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); - } - } - if (!CollectionUtils.isEmpty(dataView.getCumulantPreData())) { - List<Double> cumulantPreList = dataView.getCumulantPreData().stream().map(t -> { - return new Double(t[1].toString()); - }).collect(Collectors.toList()); - dataView.setCumulantPreLast(new BigDecimal(cumulantPreList.get(cumulantPreList.size() - 1)).setScale(2, BigDecimal.ROUND_HALF_UP)); } result.setPredictTime(predictTime); -- Gitblit v1.9.3