From db8472b9471de96a68c7fcdb2e66124b2f16854b Mon Sep 17 00:00:00 2001 From: liriming <1343021927@qq.com> Date: 星期三, 02 四月 2025 17:14:56 +0800 Subject: [PATCH] 采纳建议接口 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 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 b4b3cfa..d54714e 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 @@ -215,7 +215,7 @@ viewDto.setOutId(outId); viewDto.setResultstr(output.getResultstr()); viewDto.setResultName(output.getResultName()); - viewDto.setRealData(getHisData(output.getPointid(), startTime, endTime)); + viewDto.setRealData(getHisData(output.getPointid(), startTime, endTime, reqVO.getPrec())); viewDto.setPreDataN(mmItemResultService.getData(output.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); viewDto.setPreDataL(mmItemResultLastPointService.getData(output.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); viewDto.setCurData(mmItemResultJsonService.getData(output.getId(), predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); @@ -271,7 +271,7 @@ //处理预测累计 if (output.getIscumulant() == 1) { if (StringUtils.isNotBlank(output.getCumulpoint())) { - viewDto.setCumulantRealData(getHisData(output.getCumulpoint(), startTime, endTime)); + viewDto.setCumulantRealData(getHisData(output.getCumulpoint(), startTime, endTime, reqVO.getPrec())); } viewDto.setCumulantPreData(mmItemResultService.getData(output.getId() + CommonDict.CUMULANT_SUFFIX, startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); } @@ -330,13 +330,13 @@ legend.add(out.getResultName()); PreDataSampleViewRespDTO viewDto = new PreDataSampleViewRespDTO(); if (StringUtils.isNotBlank(out.getPointid())) { - viewDto.setRealData(getHisData(out.getPointid(), startTime, endTime)); + viewDto.setRealData(getHisData(out.getPointid(), startTime, endTime, reqVO.getPrec())); } viewDto.setPreDataN(mmItemResultService.getData(out.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); //处理预测累计 if (out.getIscumulant() == 1) { if (StringUtils.isNotBlank(out.getCumulpoint())) { - viewDto.setCumulantRealData(getHisData(out.getCumulpoint(), startTime, endTime)); + viewDto.setCumulantRealData(getHisData(out.getCumulpoint(), startTime, endTime, reqVO.getPrec())); } viewDto.setCumulantPreData(mmItemResultService.getData(out.getId() + CommonDict.CUMULANT_SUFFIX, startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); } @@ -561,9 +561,10 @@ * @param pointId * @param startTime * @param endTime + * @param prec * @return */ - private List<Object[]> getHisData(String pointId, Date startTime, Date endTime) { + private List<Object[]> getHisData(String pointId, Date startTime, Date endTime, Integer prec) { List<Object[]> result = new ArrayList<>(); if (StringUtils.isBlank(pointId)) { return result; @@ -577,10 +578,17 @@ if (CollectionUtils.isEmpty(valueDTOS)) { return result; } + int defaultPrec = 3; valueDTOS.forEach(item -> { Object[] values = new Object[2]; values[0] = DateUtils.format(item.getT(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); - values[1] = new BigDecimal(item.getV()).setScale(3, BigDecimal.ROUND_HALF_UP); + if (prec != null && prec < 0) { + values[1] = item.getV(); + } else if (prec != null && prec > 0) { + values[1] = new BigDecimal(item.getV()).setScale(prec, BigDecimal.ROUND_HALF_UP); + } else { + values[1] = new BigDecimal(item.getV()).setScale(defaultPrec, BigDecimal.ROUND_HALF_UP); + } result.add(values); }); return result; @@ -877,6 +885,11 @@ return mmItemResultLastPointService.getData(reqVO.getOutputid(),reqVO.getStartTime(),reqVO.getEndTime(),reqVO.getTimeFormat()); } + @Override + public Boolean useSuggest(StAlarmAndSuggestReqVO reqVO) { + return stScheduleSuggestService.useSuggest(reqVO); + } + private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { Date[] result = new Date[3]; Date predictTime = predictItem.getLastTime(); -- Gitblit v1.9.3