From 72d467736fdb6fd1a5e96a89123c34ce4beb4cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Fri, 6 Dec 2024 11:03:24 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9avgv=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/das/modules/calc/functions/FunctionAvgValue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/das/src/main/java/com/das/modules/calc/functions/FunctionAvgValue.java b/das/src/main/java/com/das/modules/calc/functions/FunctionAvgValue.java index 94b2359f..508c5f4a 100644 --- a/das/src/main/java/com/das/modules/calc/functions/FunctionAvgValue.java +++ b/das/src/main/java/com/das/modules/calc/functions/FunctionAvgValue.java @@ -63,7 +63,7 @@ public class FunctionAvgValue extends AbstractFunction { if (deviceInfoCache == null) { return AviatorNil.NIL; } - Double value = dataService.getTimeSumValue(deviceInfoCache.getDeviceId(), attrName, startTime.getTime(), endTime.getTime()); + Double value = dataService.getTimeAvgValue(deviceInfoCache.getDeviceId(), attrName, startTime.getTime(), endTime.getTime()); if (value == null){ return AviatorNil.NIL; } From 41d3be9e1a2928a79da02358ff083cad4183f430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=B7=E6=88=90=E4=BC=9F?= Date: Fri, 6 Dec 2024 11:50:07 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9avgv=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/service/impl/DataServiceImpl.java | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/das/src/main/java/com/das/modules/data/service/impl/DataServiceImpl.java b/das/src/main/java/com/das/modules/data/service/impl/DataServiceImpl.java index 2b9995d6..43fc2235 100644 --- a/das/src/main/java/com/das/modules/data/service/impl/DataServiceImpl.java +++ b/das/src/main/java/com/das/modules/data/service/impl/DataServiceImpl.java @@ -274,12 +274,13 @@ public class DataServiceImpl implements DataService { return null; } String tableName = ""; - if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){ - tableName = String.format("h_%s", deviceInfoCache.getDeviceId()); + if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); + return tdEngineService.getTimeSumCalcValue(tableName, attr.toLowerCase(), startTime, endTime); + } else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("h%d", deviceInfoCache.getDeviceId()); } else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){ - tableName = String.format("l_%s", deviceInfoCache.getDeviceId()); - } else if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){ - tableName = String.format("c_%s", deviceInfoCache.getDeviceId()); + tableName = String.format("l%d", deviceInfoCache.getDeviceId()); } return tdEngineService.getTimeTopValue(tableName, attr, startTime, endTime); } @@ -292,14 +293,14 @@ public class DataServiceImpl implements DataService { } String tableName = ""; if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){ - tableName = String.format("c_%s_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); - return tdEngineService.getTimeSumCalcValue(tableName, attr, startTime, endTime); - } else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){ - tableName = String.format("h_%s", deviceInfoCache.getDeviceId()); - } else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){ - tableName = String.format("l_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); + tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); + return tdEngineService.getTimeSumCalcValue(tableName, attr.toLowerCase(), startTime, endTime); + } else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("h%d", deviceInfoCache.getDeviceId()); + } else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("l%d", deviceInfoCache.getDeviceId()); } - return tdEngineService.getTimeSumValue(tableName, attr, startTime, endTime); + return tdEngineService.getTimeSumValue(tableName, attr.toLowerCase(), startTime, endTime); } @Override @@ -310,13 +311,13 @@ public class DataServiceImpl implements DataService { } String tableName = ""; if (cacheService.getIotModelCache().isCalculate(deviceInfoCache.getIotModelId(), attr)){ - tableName = String.format("c_%s_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); - return tdEngineService.getTimeAvgCalcValue(tableName, attr, startTime, endTime); - } else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){ - tableName = String.format("h_%s", deviceInfoCache.getDeviceId()); - } else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr.toLowerCase())){ - tableName = String.format("l_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); + tableName = String.format("c_%d_%s", deviceInfoCache.getDeviceId(), attr.toLowerCase()); + return tdEngineService.getTimeAvgCalcValue(tableName, attr.toLowerCase(), startTime, endTime); + } else if (cacheService.getIotModelCache().isHighSpeed(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("h%d", deviceInfoCache.getDeviceId()); + } else if (cacheService.getIotModelCache().isLowSpeed(deviceInfoCache.getIotModelId(), attr)){ + tableName = String.format("l%d", deviceInfoCache.getDeviceId()); } - return tdEngineService.getTimeAvgValue(tableName, attr, startTime, endTime); + return tdEngineService.getTimeAvgValue(tableName, attr.toLowerCase(), startTime, endTime); } } From 4dce76070f57af17b4573210cd74eb783080c706 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Fri, 6 Dec 2024 14:02:38 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/service/impl/NodeMessageServiceImpl.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java index 1ad634f1..01dcd83c 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java @@ -240,6 +240,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node JsonNode jsonNode = data.getData(); String deviceId = jsonNode.get("deviceId").asText(); JsonNode values = jsonNode.get("values"); + JsonNode archiveValues = jsonNode.get("archiveValues"); Long dataTime = jsonNode.get("dataTime").asLong(); Map keyValueMap = new HashMap<>(); String modelCode = dataService.deviceModelMap.get(deviceId); @@ -254,18 +255,19 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node String fieldName = keysHigh.next(); String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key, values.get(fieldName)); - if(fieldName.toLowerCase().equals("iwindspeed")){ - log.info("风速更新redis数据key:{},value:{}",key,values.get(fieldName)); - } + } + adminRedisTemplate.mSet(keyValueMap); + Iterator archiveKeys = archiveValues.fieldNames(); + while (archiveKeys.hasNext()) { + String fieldName = keysHigh.next(); + String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); + keyValueMap.put(key, values.get(fieldName)); if (highKey.contains(fieldName)){ highSpeedValueMap.put(fieldName,values.get(fieldName)); } if (lowKey.contains(fieldName)){ lowSpeedValueMap.put(fieldName,values.get(fieldName)); } - } - adminRedisTemplate.mSet(keyValueMap); - if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) { //更新td if (!highSpeedValueMap.isEmpty()){ List highSpeedData = new ArrayList<>(); From d8de6271991f6ded89c54b358cf1a96e442e98cc Mon Sep 17 00:00:00 2001 From: huguanghan Date: Fri, 6 Dec 2024 16:11:38 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/node/service/impl/NodeMessageServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java index 01dcd83c..290e977e 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java @@ -256,7 +256,9 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key, values.get(fieldName)); } - adminRedisTemplate.mSet(keyValueMap); + if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) { + archiveValues = values; + } Iterator archiveKeys = archiveValues.fieldNames(); while (archiveKeys.hasNext()) { String fieldName = keysHigh.next(); @@ -283,6 +285,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node tdEngineService.updateYCLowValues(lowSpeedData,modelCode); } } + adminRedisTemplate.mSet(keyValueMap); } @Override From 6bfe1d92825116fe85db305ef58883b7c782aeae Mon Sep 17 00:00:00 2001 From: huguanghan Date: Fri, 6 Dec 2024 16:42:29 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../das/modules/node/service/impl/NodeMessageServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java index 290e977e..a7cb163f 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java @@ -261,7 +261,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node } Iterator archiveKeys = archiveValues.fieldNames(); while (archiveKeys.hasNext()) { - String fieldName = keysHigh.next(); + String fieldName = archiveKeys.next(); String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key, values.get(fieldName)); if (highKey.contains(fieldName)){ From edc2e6f69b3c28cccbc88495f18870fc5ddef707 Mon Sep 17 00:00:00 2001 From: huguanghan Date: Fri, 6 Dec 2024 16:47:17 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E9=87=8F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8A=E6=8A=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/service/impl/NodeMessageServiceImpl.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java index a7cb163f..1c458a88 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java @@ -240,7 +240,6 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node JsonNode jsonNode = data.getData(); String deviceId = jsonNode.get("deviceId").asText(); JsonNode values = jsonNode.get("values"); - JsonNode archiveValues = jsonNode.get("archiveValues"); Long dataTime = jsonNode.get("dataTime").asLong(); Map keyValueMap = new HashMap<>(); String modelCode = dataService.deviceModelMap.get(deviceId); @@ -255,21 +254,15 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node String fieldName = keysHigh.next(); String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key, values.get(fieldName)); - } - if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) { - archiveValues = values; - } - Iterator archiveKeys = archiveValues.fieldNames(); - while (archiveKeys.hasNext()) { - String fieldName = archiveKeys.next(); - String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); - keyValueMap.put(key, values.get(fieldName)); if (highKey.contains(fieldName)){ highSpeedValueMap.put(fieldName,values.get(fieldName)); } if (lowKey.contains(fieldName)){ lowSpeedValueMap.put(fieldName,values.get(fieldName)); } + } + adminRedisTemplate.mSet(keyValueMap); + if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) { //更新td if (!highSpeedValueMap.isEmpty()){ List highSpeedData = new ArrayList<>(); @@ -285,7 +278,6 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node tdEngineService.updateYCLowValues(lowSpeedData,modelCode); } } - adminRedisTemplate.mSet(keyValueMap); } @Override From 0eb1ebe35a01f002b985c5fbdc8f5ddf0a2e8d3b Mon Sep 17 00:00:00 2001 From: geting <13585118195@163.com> Date: Fri, 6 Dec 2024 17:07:42 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=8A=9F=E7=8E=87=E6=9B=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statAnalysis/powerCurveAnalysis.vue | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue index 79da17a2..5bb94d49 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/powerCurveAnalysis.vue @@ -22,17 +22,22 @@
- {{ t('statAnalysis.interval') }} - - + 风速来源 + +
@@ -73,17 +78,12 @@ const { t } = useI18n() const statAnalysisFatory = ref('') const statAnalysisFatoryList: any = ref([]) -const statAnalysisInterval = ref('1h') +const statAnalysisSpeedSource = ref('AvgWindSpeed_10min') const statAnalysisDeviceId = ref('') const statAnalysisSelectOptions: any = reactive({ - interval: [ - { label: '一分钟', value: '1m' }, - { label: '五分钟', value: '5m' }, - { label: '十分钟', value: '10m' }, - { label: '十五分钟', value: '15m' }, - { label: '一小时', value: '1h' }, - { label: '一天', value: '1d' }, - { label: '原始', value: 'NONE' }, + speedSource: [ + { label: '原始风速', value: 'AvgWindSpeed_10min' }, + { label: '处理后风速', value: 'AvgWindSpeedCal_10min' }, ], deviceId: [], }) @@ -278,10 +278,9 @@ const statAnalysisOperate = () => { devices: [ { deviceId: deviceId, - attributes: ['iGenPower', 'iWindSpeed'], + attributes: [statAnalysisSpeedSource.value, 'AvgActivePower_10min'], }, ], - interval: statAnalysisInterval.value || '5m', startTime: new Date(statAnalysisTime.value[0]).getTime(), endTime: new Date(statAnalysisTime.value[1]).getTime(), } @@ -323,8 +322,8 @@ const statAnalysisOperate = () => { const resData0 = results[1][statAnalysisDeviceId.value.split(':')[2]] const resData1 = results[0] if (resData0) { - const iGenPower = resData0['iGenPower']['values'] - const iWindSpeed = resData0['iWindSpeed']['values'] + const iGenPower = resData0['AvgActivePower_10min']['values'] + const iWindSpeed = resData0[statAnalysisSpeedSource.value]['values'] if (!iWindSpeed.length) { ElMessage.info(`实时值数据为空`) } else { @@ -336,7 +335,7 @@ const statAnalysisOperate = () => { }) const series = { - type: 'line', + type: 'scatter', data: seriesData, name: '实际值', smooth: true, @@ -356,6 +355,8 @@ const statAnalysisOperate = () => { name: '理论值', smooth: true, animation: false, + symbolSize: 0.1, + symbol: 'circle', } option.series.push(series) option.legend.data.push('理论值') @@ -374,16 +375,14 @@ const statAnalysisExport = () => { devices: [ { deviceId: statAnalysisDeviceId.value.split(':')[2], - attributes: ['iGenPower', 'iWindSpeed'], + attributes: [statAnalysisSpeedSource.value, 'AvgActivePower_10min'], }, ], - interval: statAnalysisInterval.value || '5m', startTime: new Date(statAnalysisTime.value[0]).getTime(), endTime: new Date(statAnalysisTime.value[1]).getTime(), madeinfactory: params.split(':')[0], model: params.split(':')[1], } - console.log(requestData) powerCurveExport(requestData).then((res: any) => { const downloadUrl = window.URL.createObjectURL(res) const a = document.createElement('a') From 17c50ddba229ec98c0cf6d977f1389eef01a685d Mon Sep 17 00:00:00 2001 From: geting <13585118195@163.com> Date: Fri, 6 Dec 2024 17:17:50 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=8A=9F=E7=8E=87=E6=9B=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue index 10b31131..cdb626da 100644 --- a/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue +++ b/ui/dasadmin/src/views/backend/statAnalysis/trendAnalysis.vue @@ -399,9 +399,6 @@ const getTimeIntervals = (startTimestamp: number, endTimestamp: number) => { case '15m': count = Math.floor((endDate - startDate) / (15 * 60 * 1000)) break - case '15m': - count = Math.floor((endDate - startDate) / (15 * 60 * 1000)) - break case '1h': count = Math.floor((endDate - startDate) / (1 * 60 * 60 * 1000)) break