| | |
| | | |
| | | import com.iailab.module.data.api.ind.IndItemApi; |
| | | import com.iailab.module.data.api.ind.dto.ApiIndItemDTO; |
| | | 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.data.enums.DataPointFreqEnum; |
| | | import com.iailab.module.data.enums.TimeGranularityEnum; |
| | | import com.iailab.module.data.enums.TimeGranularitySecEnum; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mdk.common.enums.ModelParamType; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItem; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItemPort; |
| | | 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; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * @createTime 2024年09月03日 |
| | | */ |
| | | abstract class SampleInfoConstructor { |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private PlanItemApi planItemApi; |
| | | |
| | | @Autowired |
| | | private IndItemApi indItemApi; |
| | |
| | | * @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime); |
| | | protected abstract SampleInfo getColumnInfo(String modelId, Date predictTime, Map<Integer, Integer> dynamicDataLength); |
| | | |
| | | /** |
| | | * 样本的采样周期 |
| | |
| | | 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; |
| | | } |
| | | } |