From c9dd12a0042b50af36edf2ae710d33430542385d Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期二, 24 十二月 2024 10:15:43 +0800 Subject: [PATCH] 预测值 开始时间计算bug,数据补全bug --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java | 4 ++-- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java | 3 +++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java | 1 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java | 2 +- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleDataConstructor.java | 21 ++++----------------- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java index ac3c99d..be43446 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/plan/PlanItemApiImpl.java @@ -70,6 +70,9 @@ @Override public List<ApiPlanItemDTO> getInfoByIds(Set<String> planIds) { + if (CollectionUtils.isEmpty(planIds)) { + return new ArrayList<>(); + } List<PlanItemEntity> plans = planItemService.getInfoByIds(planIds); return ConvertUtils.sourceToTarget(plans,ApiPlanItemDTO.class); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java index c66d887..6ec3e55 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java @@ -147,8 +147,8 @@ ex.printStackTrace(); throw ex; } catch (Exception ex) { - log.error("调用发生异常,异常信息为:{1}", ex); -// ex.printStackTrace(); +// log.error("调用发生异常,异常信息为:{0}", ex.getMessage()); + ex.printStackTrace(); throw new ModelInvokeException(ex.getMessage()); } return result; diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java index 19d75fd..0ce89d0 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleConstructor.java @@ -32,6 +32,7 @@ SampleDataConstructor sampleDataConstructor = sampleFactory.createSampelData(typeA); return sampleDataConstructor.prepareSampleData(sampleInfo); } catch (Exception e) { + e.printStackTrace(); throw new ModelInvokeException(MessageFormat.format("{0},Name:{1}", ModelInvokeException.errorGetModelArithParam, itemName)); } 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..e3c6e3e 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; @@ -63,23 +64,9 @@ 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 = PredGranularityEnum.MIN1.getCode() * 1000L; + start = start - (start % oneMin) + oneMin; + end = end - (end % oneMin) + oneMin; mins = ((end - start) / oneMin); break; case DATAPOINT: 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 3f8f72b..6057a7b 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 @@ -100,7 +100,7 @@ break; case NORMALITEM: case MERGEITEM: - dateTime = calendar.getTime(); + dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); break; case IND: dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); -- Gitblit v1.9.3