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/SampleDataConstructor.java | 38 +++++++------------------------------- 1 files changed, 7 insertions(+), 31 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 c25dae4..5f5befc 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 @@ -6,6 +6,7 @@ import com.iailab.module.data.api.point.dto.ApiPointDTO; import com.iailab.module.data.enums.DataPointFreqEnum; import com.iailab.module.data.enums.TimeGranularitySecEnum; +import com.iailab.module.model.mcs.pre.enums.PredGranularityEnum; import com.iailab.module.model.mdk.common.enums.ModelParamType; import com.iailab.module.model.mdk.sample.dto.SampleData; import com.iailab.module.model.mdk.sample.dto.SampleInfo; @@ -41,11 +42,9 @@ * @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, Map<String, ApiPointDTO> pointMap, Map<String, ApiPlanItemDTO> planMap) { + public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, String paramType, Integer granularity) { if (CollectionUtils.isEmpty(dataEntityList) || length == dataEntityList.size()) { return dataEntityList; } else if (length < dataEntityList.size()) { @@ -63,29 +62,15 @@ case NORMALITEM: case MERGEITEM: // 预测值 - Calendar calendar = Calendar.getInstance(); - calendar.setTime(startTime); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - calendar.add(Calendar.DAY_OF_YEAR, 1); - startTime = calendar.getTime(); - start = startTime.getTime(); - - calendar.setTime(endTime); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - endTime = calendar.getTime(); - end = endTime.getTime(); - - oneMin = 60 * 1000L; + oneMin = granularity * 1000L; + start = start - (start % oneMin); + end = end - (end % oneMin); mins = ((end - start) / oneMin); break; case DATAPOINT: + case PLAN: // 测点值 - ApiPointDTO dataPoint = pointMap.get(paramId); - oneMin = 1000L * DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue(); + oneMin = 1000L * granularity; // 设置时间偏移量 start = start - (start % oneMin) + oneMin; end = end - (end % oneMin) + oneMin; @@ -106,15 +91,6 @@ calendar2.set(Calendar.MINUTE, 0); calendar2.set(Calendar.SECOND, 0); end = calendar2.getTime().getTime(); - mins = ((end - start) / oneMin); - break; - case PLAN: - // 计划数据 - ApiPlanItemDTO planItem = planMap.get(paramId); - oneMin = 1000L * TimeGranularitySecEnum.getEumByCode(planItem.getTimeGranularity()).getValue(); - // 设置时间偏移量 - start = start - (start % oneMin) + oneMin; - end = end - (end % oneMin) + oneMin; mins = ((end - start) / oneMin); break; default: -- Gitblit v1.9.3