From 8bf5531fcc2566bd932216e1a8dafab2a59f4f78 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 23 十二月 2024 15:58:46 +0800 Subject: [PATCH] sampleInfo.setPlanMap 统一获取计划数据的信息,避免重复查询 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java index dba4323..c25dae4 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java @@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; -import java.sql.Timestamp; import java.util.*; abstract class SampleDataConstructor { @@ -42,10 +41,11 @@ * @param dataEntityList * @param startTime * @param endTime + * @param planMap * @return */ public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, - String paramId, String paramType) { + String paramId, String paramType, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) { if (CollectionUtils.isEmpty(dataEntityList) || length == dataEntityList.size()) { return dataEntityList; } else if (length < dataEntityList.size()) { @@ -84,7 +84,7 @@ break; case DATAPOINT: // 测点值 - ApiPointDTO dataPoint = dataPointApi.getInfoById(paramId); + ApiPointDTO dataPoint = pointMap.get(paramId); oneMin = 1000L * DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue(); // 设置时间偏移量 start = start - (start % oneMin) + oneMin; @@ -110,7 +110,7 @@ break; case PLAN: // 计划数据 - ApiPlanItemDTO planItem = planItemApi.getInfoById(paramId); + ApiPlanItemDTO planItem = planMap.get(paramId); oneMin = 1000L * TimeGranularitySecEnum.getEumByCode(planItem.getTimeGranularity()).getValue(); // 设置时间偏移量 start = start - (start % oneMin) + oneMin; -- Gitblit v1.9.3