dengzedong
2024-12-25 3ddbb6f6f8ecb625bf81b750a788e7d75309334c
模型输入时间计算调整
已修改2个文件
32 ■■■■ 文件已修改
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/PredictSampleDataConstructor.java
@@ -166,7 +166,7 @@
            default:
                break;
        }
        log.info("数据获取,columnItem:" + columnItem + ",dataList" + dataList);
        log.debug("数据获取,columnItem:" + columnItem + ",dataList" + dataList);
        return dataList;
    }
}
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 = calculateTime(originalTime, true, columnItem.getDataLength(), 60);
                dateTime = calendar.getTime();
                break;
            case IND:
                dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60);
@@ -132,25 +132,17 @@
        calendar.setTime(originalTime);
        switch (ModelParamType.getEumByCode(columnItem.getParamType())) {
            case DATAPOINT:
                ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId());
                if (dataPoint == null) {
                    return null;
                }
                dateTime = calendar.getTime();
                break;
            case NORMALITEM:
            case MERGEITEM:
                dateTime = calendar.getTime();
                dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60);
                break;
            case IND:
                dateTime = calendar.getTime();
                break;
            case PLAN:
                ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId());
                if (apiPlanItemDTO == null) {
                    return null;
                }
                dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue());
                dateTime = calendar.getTime();
                break;
            default:
                break;
@@ -213,22 +205,6 @@
        calendar.set(Calendar.MILLISECOND, 0);
        // 数据长度 * 粒度
        calendar.add(Calendar.SECOND, timeLength * granularity);
        return calendar.getTime();
    }
    public Date calculateDate(Date originalTime, Boolean backward, int dataLength, int field) {
        int timeLength;
        if (backward) {
            timeLength = (-1) * dataLength;
        } else {
            timeLength = dataLength - 1;
        }
        Date desTime = originalTime;
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(desTime);
        calendar.set(Calendar.MILLISECOND, 0);
        // 数据长度 * 粒度
        calendar.add(Calendar.SECOND, timeLength);
        return calendar.getTime();
    }
}