From fde993948625751908d4e67bd5e77e8e2ce47d05 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期五, 20 十二月 2024 17:18:52 +0800 Subject: [PATCH] 计算预测项 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java | 21 +++++---------------- 1 files changed, 5 insertions(+), 16 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java index 7ea01d2..31d481e 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictItemMergeHandlerImpl.java @@ -1,19 +1,15 @@ package com.iailab.module.model.mdk.predict.impl; +import com.alibaba.fastjson.JSON; import com.iailab.module.data.api.point.DataPointApi; -import com.iailab.module.data.api.point.dto.ApiPointDTO; -import com.iailab.module.data.enums.DataPointFreqEnum; import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; -import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; import com.iailab.module.model.mcs.pre.service.MmItemOutputService; import com.iailab.module.model.mcs.pre.service.MmItemResultService; -import com.iailab.module.model.mdk.common.enums.ItemPredictStatus; import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; import com.iailab.module.model.mdk.factory.ItemEntityFactory; import com.iailab.module.model.mdk.factory.PredictItemFactory; import com.iailab.module.model.mdk.predict.PredictItemHandler; import com.iailab.module.model.mdk.predict.PredictResultHandler; -import com.iailab.module.model.mdk.vo.DataValueVO; import com.iailab.module.model.mdk.vo.ItemVO; import com.iailab.module.model.mdk.vo.PredictResultVO; import lombok.extern.slf4j.Slf4j; @@ -21,9 +17,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import java.sql.Timestamp; import java.util.*; -import java.util.stream.Collectors; /** * @author PanZhibao @@ -64,7 +58,6 @@ public PredictResultVO predict(Date predictTime, ItemVO predictItemDto, Map<String, double[]> predictValueMap) throws ItemInvokeException { PredictResultVO predictResult = new PredictResultVO(); - ItemPredictStatus itemStatus = ItemPredictStatus.PREDICTING; String itemId = predictItemDto.getId(); try { String expression = itemEntityFactory.getMergeItem(itemId).getExpression(); @@ -136,24 +129,20 @@ // } // predictResult.setPredictMatrix(matrix); // } - log.info("计算预测模型结果:" + predictResultMat); predictResult.setPredictId(itemId); List<MmItemOutputEntity> outputServiceByItemid = mmItemOutputService.getByItemid(itemId); - if (CollectionUtils.isEmpty(outputServiceByItemid)) { + if (!CollectionUtils.isEmpty(outputServiceByItemid)) { Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(); predictMatrixs.put(outputServiceByItemid.get(0),predictResultMat); predictResult.setPredictMatrixs(predictMatrixs); } predictResult.setPredictTime(predictTime); - //预测项预测成功的状态 - itemStatus = ItemPredictStatus.SUCCESS; } catch (Exception e) { - //预测项预测失败的状态 - itemStatus = ItemPredictStatus.FAILED; - log.debug("merge项预测失败,itemId:" + itemId); + log.error("merge项预测失败,itemId:" + itemId); + e.printStackTrace(); throw e; } - log.debug("预测完成,itemId:" + itemId + ",itemStatus:" + itemStatus.getValue()); + log.info("merge项预测完成,itemId:" + itemId + ",结果:" + JSON.toJSONString(predictResult)); return predictResult; } } \ No newline at end of file -- Gitblit v1.9.3