From 271fed395d4d3e4ab8cdb44ccf466859ba485e46 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期四, 09 一月 2025 17:45:33 +0800 Subject: [PATCH] Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java index 0c4d554..9fb4dd6 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java @@ -8,8 +8,10 @@ import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; import com.iailab.module.data.common.ApiDataQueryDTO; import com.iailab.module.data.common.ApiDataValueDTO; +import com.iailab.module.model.common.enums.OutResultType; import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; import com.iailab.module.model.mcs.pre.service.MmItemOutputService; +import com.iailab.module.model.mcs.pre.service.MmItemResultJsonService; import com.iailab.module.model.mcs.pre.service.MmItemResultService; import com.iailab.module.model.mcs.pre.service.MmItemTypeService; import com.iailab.module.model.mdk.common.enums.ModelParamType; @@ -19,6 +21,7 @@ import com.iailab.module.model.mdk.sample.dto.SampleInfo; import com.iailab.module.model.mdk.vo.DataValueVO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +50,9 @@ private MmItemResultService mmItemResultService; @Autowired + private MmItemResultJsonService mmItemResultJsonService; + + @Autowired private MmItemTypeService mmItemTypeService; @Autowired @@ -60,7 +66,7 @@ * @return */ @Override - public List<SampleData> prepareSampleData(SampleInfo sampleInfo) throws Exception { + public List<SampleData> prepareSampleData(SampleInfo sampleInfo) throws Exception { List<SampleData> sampleDataList = new ArrayList<>(); Map<String, ApiPointDTO> pointMap = sampleInfo.getPointMap(); Map<String, ApiPlanItemDTO> planMap = sampleInfo.getPlanMap(); @@ -85,17 +91,19 @@ //对每一项依次进行数据查询,然后将查询出的值赋给matrix对应的位置 for (int i = 0; i < entry.getColumnItemList().size(); i++) { try { - List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i),pointMap,planMap); + List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i), pointMap, planMap); //补全数据 ColumnItem columnItem = entry.getColumnItemList().get(i); - dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime, - columnItem.paramId, columnItem.getParamType(),pointMap,planMap); + dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime, columnItem.getParamType(),columnItem.getGranularity()); /** 如果数据取不满,把缺失的数据点放在后面 */ if (dataEntityList != null && dataEntityList.size() != 0) { logger.info("设置matrix, i = " + i + ", size = " + dataEntityList.size()); for (int k = 0; k < dataEntityList.size(); k++) { - matrix[k][i] = dataEntityList.get(k).getDataValue(); + Double dataValue = dataEntityList.get(k).getDataValue(); + if (null != dataValue) { + matrix[k][i] = dataValue; + } } } } catch (Exception e) { @@ -141,8 +149,8 @@ break; case NORMALITEM: case MERGEITEM: - MmItemOutputEntity outPut = mmItemOutputService.getOutPutById(columnItem.getParamId()); - List<DataValueVO> predictValue = mmItemResultService.getPredictValue(outPut.getId(), columnItem.getStartTime(), columnItem.getEndTime()); + List<DataValueVO> predictValue = mmItemResultService.getPredictValue(columnItem.getParamId(), columnItem.getStartTime(), columnItem.getEndTime()); + if (CollectionUtils.isEmpty(predictValue)) { break; } @@ -166,7 +174,9 @@ default: break; } - log.debug("数据获取,columnItem:" + columnItem + ",dataList" + dataList); + // 避免生产环境日志过多,分级打印 + log.debug("数据获取,columnItem:" + columnItem + ",dataList:" + dataList); + log.info("数据获取,columnItem:" + columnItem + ",dataListLength:" + dataList.size()); return dataList; } } -- Gitblit v1.9.3