From 6077089c5f6ced73cf46a0abdca2c6d77a3b3878 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期三, 12 三月 2025 14:53:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/db/mysql.sql | 2 +- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java | 15 +++++++++++++-- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IndTimeLimitEnum.java | 1 + iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/sample/SampleInfoConstructor.java | 6 ++++-- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 16 ---------------- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IndTimeLimitEnum.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IndTimeLimitEnum.java index 57ad871..f379698 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IndTimeLimitEnum.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/common/enums/IndTimeLimitEnum.java @@ -22,6 +22,7 @@ THIS_YEAR_MONTH("THIS_YEAR_MONTH", "当年月份"), LAST_YEAR("LAST_YEAR", "去年"), THIS_YEAR("THIS_YEAR_MONTH", "今年"), + LAST_HOUR_24("LAST_HOUR_24", "最近24小时"), CUSTOM("CUSTOM", "自定义"); private String code; diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java index 64a70b6..127c42e 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/utils/IndSqlUtils.java @@ -167,7 +167,7 @@ whereSql.append(indItem.getTimeLabel()); whereSql.append("' < '"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); - whereSql.append("' AND '"); + whereSql.append("' AND "); whereSql.append(indItem.getTimeLabel()); whereSql.append(" >= '"); calendar.add(Calendar.MONTH, -1); @@ -178,7 +178,7 @@ whereSql.append(indItem.getTimeLabel()); whereSql.append(" <= '"); whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_MON)); - whereSql.append("' AND '"); + whereSql.append("' AND "); whereSql.append(indItem.getTimeLabel()); whereSql.append("' >= '"); calendar.add(Calendar.MONTH, -12); @@ -210,6 +210,17 @@ whereSql.append(DateUtils.format(calendar.getTime(), PATTERN_YEAR)); whereSql.append("'"); break; + case LAST_HOUR_24: + whereSql.append(indItem.getTimeLabel()); + whereSql.append(" <= '"); + whereSql.append(DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); + whereSql.append("' AND "); + whereSql.append(indItem.getTimeLabel()); + whereSql.append(" >= '"); + calendar.add(Calendar.HOUR_OF_DAY, -24); + whereSql.append(DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); + whereSql.append("'"); + break; case CUSTOM: whereSql.append(indItem.getTimeLabel()); whereSql.append(" <= '"); diff --git a/iailab-module-model/iailab-module-model-biz/db/mysql.sql b/iailab-module-model/iailab-module-model-biz/db/mysql.sql index 282b553..3e73a65 100644 --- a/iailab-module-model/iailab-module-model-biz/db/mysql.sql +++ b/iailab-module-model/iailab-module-model-biz/db/mysql.sql @@ -1010,4 +1010,4 @@ -- t_st_schedule_record 创建复合索引 -CREATE INDEX idx_scheme_id_create_time ON t_st_schedule_record (scheme_id, create_time DESC); +CREATE INDEX idx_st_schedule_record_scheme_result_time ON t_st_schedule_record (scheme_id, result_code, schedule_time DESC, create_time DESC); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 3c80215..159aabd 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -847,22 +847,6 @@ return true; } - /** - * 计算功率因数 p²/(根号:p²+Q²) - **/ - public Double calculateCos(Double PValue,Double QValue) { - // 绝对值 - PValue = Math.abs(PValue); - QValue = Math.abs(QValue); - //PValue [0,0.001] 直接判断为关闭返回0 - if (PValue >= 0 && PValue <= 0.001) { - return 0.0; - }else { - BigDecimal result = new BigDecimal(PValue).divide(BigDecimal.valueOf(Math.sqrt(Math.pow(PValue, 2) + Math.pow(QValue, 2))), 2, BigDecimal.ROUND_HALF_UP); - return result.doubleValue(); - } - } - private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { Date[] result = new Date[3]; Date predictTime = predictItem.getLastTime(); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java index 411dec7..334d710 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/MdkApiImpl.java @@ -325,7 +325,7 @@ } //返回结果是否存在 if (result.get(stScheduleModelOutDTO.getResultKey()) == null) { - log.error(result.get(stScheduleModelOutDTO.getResultKey()) + "resultKey匹配失败"); + log.error(stScheduleModelOutDTO.getResultKey() + "resultKey匹配失败"); continue; } Object resultValue = result.get(stScheduleModelOutDTO.getResultKey()); 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 ba11c8b..e4ba98b 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 @@ -85,7 +85,7 @@ break; case IND: case IND_ASCII: - dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), columnItem.getGranularity()); + dateTime = calculateTime(originalTime, true, columnItem.getDataLength() - 1, columnItem.getGranularity()); break; case NORMALITEM: case MERGEITEM: @@ -112,9 +112,11 @@ switch (ModelParamType.getEumByCode(columnItem.getParamType())) { case DATAPOINT: case PLAN: + dateTime = calculateTime(originalTime, true, 1, columnItem.getGranularity()); + break; case IND: case IND_ASCII: - dateTime = calculateTime(originalTime, true, 1, columnItem.getGranularity()); + dateTime = originalTime; break; case NORMALITEM: case MERGEITEM: -- Gitblit v1.9.3