From cc6270c5f434f93bf51f4c454e3de512be70b584 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期三, 02 四月 2025 13:10:33 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java index ebaee0f..d8548a3 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/PredictResultHandler.java @@ -3,6 +3,7 @@ import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.iailab.module.model.common.enums.CommonDict; import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; +import com.iailab.module.model.mcs.pre.enums.PredGranularityEnum; import com.iailab.module.model.mcs.pre.service.MmItemResultService; import com.iailab.module.model.mcs.sche.service.StAdjustResultService; import com.iailab.module.model.mdk.factory.ItemEntityFactory; @@ -41,6 +42,11 @@ List<DataValueVO> predictDataList = new ArrayList<>(); Calendar calendar = Calendar.getInstance(); calendar.setTime(predictResult.getPredictTime()); + + if (predictResult.getGranularity() < PredGranularityEnum.D1.getCode()) { + // 如果小于天粒度,则从下个时间粒度开始 + calendar.add(Calendar.SECOND, predictResult.getGranularity()); + } for (Integer i = 0; i < rows; i++) { DataValueVO predictData = new DataValueVO(); predictData.setDataTime(calendar.getTime()); @@ -59,7 +65,7 @@ // 时间 预测时间+预测长度*粒度 Calendar calendar = Calendar.getInstance(); calendar.setTime(predictResult.getPredictTime()); - calendar.add(Calendar.SECOND, predictResult.getGranularity() * (rows - 1)); + calendar.add(Calendar.SECOND, predictResult.getGranularity() * rows); predictData.setDataTime(calendar.getTime()); //值 所有值相加/除数 BigDecimal sum = BigDecimal.valueOf(Arrays.stream(entry.getValue()).sum()); @@ -85,12 +91,13 @@ Calendar calendar = Calendar.getInstance(); calendar.setTime(predictResult.getPredictTime()); for (Integer i = 0; i < rows; i++) { + // 从下个时间粒度开始 + calendar.add(Calendar.SECOND, predictResult.getGranularity()); + DataValueVO predictData = new DataValueVO(); predictData.setDataTime(calendar.getTime()); predictData.setDataValue(Double.valueOf(entry.getValue()[i])); predictDataList.add(predictData); - - calendar.add(Calendar.SECOND, predictResult.getGranularity()); } predictLists.put(entry.getKey().getResultstr(), predictDataList); } @@ -112,11 +119,12 @@ * savePredictAdjustResult * * @param predictResult + * @param configId */ @DSTransactional - public void savePredictAdjustResult(PredictResultVO predictResult, String adjustValue, String scheduleModelId) { + public void savePredictAdjustResult(PredictResultVO predictResult, String adjustValue, String scheduleModelId, String configId) { Map<String, List<DataValueVO>> resultMap = convertToPredictData(predictResult); - stAdjustResultService.saveResult(resultMap, predictResult.getPredictTime(), adjustValue, scheduleModelId); + stAdjustResultService.saveResult(resultMap, predictResult.getPredictTime(), adjustValue, scheduleModelId,configId); } public List<DataValueVO> getPredictValueByItemNo(String itemNo, Date start, Date end) { -- Gitblit v1.9.3