From 730d1944e3a13c517c77df2b0712df05645a38dd Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 06 一月 2025 16:00:58 +0800 Subject: [PATCH] chartParamList api --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.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/PredictSampleInfoConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.java index c79b974..ae066fe 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleInfoConstructor.java @@ -1,5 +1,7 @@ package com.iailab.module.model.mdk.sample; +import com.iailab.module.data.api.plan.PlanItemApi; +import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO; 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; @@ -38,6 +40,9 @@ @Autowired private DataPointApi dataPointApi; + @Autowired + private PlanItemApi planItemApi; + /** * 返回样本矩阵的列数 * @@ -57,7 +62,7 @@ * @return */ @Override - protected SampleInfo getColumnInfo(String modelId, Date predictTime) { + protected SampleInfo getColumnInfo(String modelId, Date predictTime, Map<Integer, Integer> dynamicDataLength) { SampleInfo sampleInfo = new SampleInfo(); List<ColumnItemPort> resultList = new ArrayList<>(); List<ColumnItem> columnItemList = new ArrayList<>(); @@ -70,24 +75,28 @@ //设置当前端口号,初始值为最小端口(查询结果按端口号从小到达排列) int curPortOrder = modelInputParamEntityList.get(0).getModelparamportorder(); //设置当前查询数据长度,初始值为最小端口数据长度 - int curDataLength = modelInputParamEntityList.get(0).getDatalength(); + int curDataLength = super.getDataLength(dynamicDataLength, curPortOrder, modelInputParamEntityList.get(0).getDatalength()); // 统一获取测点的信息 Set<String> pointIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.DATAPOINT)).map(MmModelParamEntity::getModelparamid).collect(Collectors.toSet()); List<ApiPointDTO> points = dataPointApi.getInfoByIds(pointIds); - Map<String, ApiPointDTO> pointMap = points.stream().collect(Collectors.toMap(ApiPointDTO::getId, Function.identity(), (e1,e2) -> e1)); + Map<String, ApiPointDTO> pointMap = points.stream().collect(Collectors.toMap(ApiPointDTO::getId, Function.identity(), (e1, e2) -> e1)); + // 统一获取计划数据的信息 + Set<String> planIds = modelInputParamEntityList.stream().filter(e -> ModelParamType.getEumByCode(e.getModelparamtype()).equals(ModelParamType.PLAN)).map(MmModelParamEntity::getModelparamid).collect(Collectors.toSet()); + List<ApiPlanItemDTO> plans = planItemApi.getInfoByIds(planIds); + Map<String, ApiPlanItemDTO> planMap = plans.stream().collect(Collectors.toMap(ApiPlanItemDTO::getId, Function.identity(), (e1, e2) -> e1)); for (MmModelParamEntity entry : modelInputParamEntityList) { columnInfo.setParamType(entry.getModelparamtype()); columnInfo.setParamId(entry.getModelparamid()); - columnInfo.setDataLength(entry.getDatalength()); + columnInfo.setDataLength(super.getDataLength(dynamicDataLength, entry.getModelparamportorder(), entry.getDatalength())); columnInfo.setModelParamOrder(entry.getModelparamorder()); columnInfo.setModelParamPortOrder(entry.getModelparamportorder()); - columnInfo.setStartTime(getStartTime(columnInfo, predictTime,pointMap)); - columnInfo.setEndTime(getEndTime(columnInfo, predictTime,pointMap)); - columnInfo.setGranularity(super.getGranularity(columnInfo)); + columnInfo.setStartTime(getStartTime(columnInfo, predictTime, pointMap, planMap)); + columnInfo.setEndTime(getEndTime(columnInfo, predictTime, pointMap, planMap)); + columnInfo.setGranularity(super.getGranularity(columnInfo, pointMap, planMap)); //对每一个爪进行数据项归并 - if (curPortOrder != entry.getModelparamportorder()){ + if (curPortOrder != entry.getModelparamportorder()) { //当数据项端口号不为当前端口号时,封装上一个端口类,操作下一个端口类 curPort.setColumnItemList(columnItemList); curPort.setDataLength(curDataLength); @@ -109,6 +118,7 @@ resultList.add(curPort); sampleInfo.setColumnInfo(resultList); sampleInfo.setPointMap(pointMap); + sampleInfo.setPlanMap(planMap); return sampleInfo; } -- Gitblit v1.9.3