From 7f0bcd00c556889ba890e5e68c681f1b5d4267e1 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期四, 19 十二月 2024 18:07:20 +0800 Subject: [PATCH] 预测项状态添加模型结果异常 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java index 6b62536..f8547d6 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/ScheduleSampleInfoConstructor.java @@ -1,7 +1,11 @@ package com.iailab.module.model.mdk.sample; +import com.iailab.module.data.api.point.DataPointApi; +import com.iailab.module.data.api.point.dto.ApiPointDTO; +import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; import com.iailab.module.model.mcs.sche.entity.StScheduleModelParamEntity; import com.iailab.module.model.mcs.sche.service.StScheduleModelParamService; +import com.iailab.module.model.mdk.common.enums.ModelParamType; import com.iailab.module.model.mdk.sample.dto.ColumnItem; import com.iailab.module.model.mdk.sample.dto.ColumnItemPort; import org.springframework.beans.factory.annotation.Autowired; @@ -11,12 +15,18 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; @Component public class ScheduleSampleInfoConstructor extends SampleInfoConstructor { @Autowired private StScheduleModelParamService stScheduleModelParamService; + + @Autowired + private DataPointApi dataPointApi; @Override protected Integer getSampleColumn(String modelId) { @@ -37,14 +47,19 @@ int curPortOrder = modelInputParamEntityList.get(0).getModelparamportorder(); //设置当前查询数据长度,初始值为最小端口数据长度 int curDataLength = modelInputParamEntityList.get(0).getDatalength(); + // 统一获取测点的信息 + List<String> pointIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.DATAPOINT)).map(StScheduleModelParamEntity::getModelparamid).collect(Collectors.toList()); + List<ApiPointDTO> points = dataPointApi.getInfoByIds(pointIds); + Map<String, ApiPointDTO> pointMap = points.stream().collect(Collectors.toMap(ApiPointDTO::getId, Function.identity())); + for (StScheduleModelParamEntity entry : modelInputParamEntityList) { columnInfo.setParamType(entry.getModelparamtype()); columnInfo.setParamId(entry.getModelparamid()); columnInfo.setDataLength(entry.getDatalength()); columnInfo.setModelParamOrder(entry.getModelparamorder()); columnInfo.setModelParamPortOrder(entry.getModelparamportorder()); - columnInfo.setStartTime(getStartTime(columnInfo, predictTime)); - columnInfo.setEndTime(getEndTime(columnInfo, predictTime)); + columnInfo.setStartTime(getStartTime(columnInfo, predictTime,pointMap)); + columnInfo.setEndTime(getEndTime(columnInfo, predictTime,pointMap)); columnInfo.setGranularity(super.getGranularity(columnInfo)); //对每一个爪进行数据项归并 -- Gitblit v1.9.3