From 8b98a3cb5017aedec0eb46716f1925fc8d624ec5 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期三, 08 一月 2025 11:44:40 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java index 0d6431e..f025e51 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java @@ -11,6 +11,7 @@ import com.iailab.module.model.mdk.sample.dto.ColumnItem; import com.iailab.module.model.mdk.sample.dto.SampleInfo; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import java.util.Calendar; import java.util.Date; @@ -36,9 +37,9 @@ * @param predictTime * @return */ - protected SampleInfo prepareSampleInfo(String modelId, Date predictTime) { + protected SampleInfo prepareSampleInfo(String modelId, Date predictTime, Map<Integer, Integer> dynamicDataLength) { //样本的列信息 - return getColumnInfo(modelId, predictTime); + return getColumnInfo(modelId, predictTime, dynamicDataLength); } /** @@ -57,7 +58,7 @@ * @param predictTime * @return */ - protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime); + protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime, Map<Integer, Integer> dynamicDataLength); /** * 样本的采样周期 @@ -186,7 +187,7 @@ if (backward) { timeLength = (-1) * dataLength; } else { - timeLength = dataLength - 1; + timeLength = dataLength; } Date desTime = originalTime; Calendar calendar = Calendar.getInstance(); @@ -196,4 +197,14 @@ calendar.add(Calendar.SECOND, timeLength * granularity); return calendar.getTime(); } + + protected int getDataLength(Map<Integer, Integer> dynamicDataLength, Integer port, Integer dataLength) { + if (CollectionUtils.isEmpty(dynamicDataLength)) { + return dataLength; + } + if (dynamicDataLength.containsKey(port)) { + return dynamicDataLength.get(port); + } + return dataLength; + } } \ No newline at end of file -- Gitblit v1.9.3