From 1a677d2b4a4bc615602f8c2a22bc07ec1356e5be Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 16 十月 2025 17:39:06 +0800
Subject: [PATCH] 2025.10.16 1. 根据全局响应增强器GlobalResponseAdvice,将原先的BaseResPack接口包装函数统一去除; 2. 新增三种类型的数据产品数据库实体 3. 新增典型问题场景清单中间数据产品接口
---
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
index 417ca2d..bf5e921 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
@@ -74,8 +74,14 @@
var tempAvg = TempResult()
var tempMax = TempResult()
var tempMin = TempResult()
+ var deviceCode: String? = null
dataList.forEach {
- // 鐩戞祴鐐规湁澶氬彴璁惧鏃讹紝姣忓彴璁惧鍗曠嫭缁熻锛屽彇鍧囧�兼渶楂樼殑涓虹粺璁$粨鏋�
+ // 鐩戞祴鐐规湁澶氬彴璁惧鏃讹紝姣忓彴璁惧鍗曠嫭璁板綍
+ deviceCode = if (it.isNotEmpty()) {
+ getDeviceCode(it[0])
+ } else {
+ null
+ }
val _tempExceedTimes = TempResult()
val _tempAvg = TempResult()
val _tempMax = TempResult()
@@ -99,6 +105,7 @@
val dustDataResult = DustDataResult().apply {
drSceneId = evaluationScene.scene.value?.guid
drSceneName = evaluationScene.scene.value?.name
+ drDeviceCode = deviceCode
drTime = source?.config?.startTime
drExceedTimes = tempExceedTimes.count
drAvg = tempAvg.avg
@@ -106,6 +113,8 @@
drMin = tempMin.total
drOverAvgPer = overAvgRate(drAvg, dAvg)
drDataNum = count(dataList)
+ // 褰撴暟鎹噺涓�0鏃讹紝瓒呮湀搴﹀尯鍧囧�肩櫨鍒嗘瘮鍙樹负0
+ if (drDataNum == 0) drOverAvgPer = .0
drEffectiveRate = effectiveRate(dataList, evaluationScene)
}
//鏇存柊鍏ュ簱
@@ -118,6 +127,11 @@
* 褰撳墠涓鸿寖鍥村唴鍏ㄩ儴鐩戞祴鐐圭殑鍧囧��
*/
abstract fun districtAvg(source: AopDataSource?): Double?
+
+ /**
+ * 鑾峰彇璁惧缂栧彿
+ */
+ abstract fun getDeviceCode(data: T?): String?
/**
* 鑾峰彇鍘熷鐩戞祴鏁版嵁
@@ -147,7 +161,13 @@
/**
* 瓒呮湀鍧囧�肩櫨鍒嗘瘮
*/
- abstract fun overAvgRate(avg: Double, dAvg: Double?): Double?
+ open fun overAvgRate(avg: Double, dAvg: Double?): Double? {
+ return if (dAvg != null && dAvg != .0) {
+ round(((avg - dAvg) / dAvg) * 1000) / 1000
+ } else {
+ .0
+ }
+ }
/**
* 鏁版嵁涓暟
--
Gitblit v1.9.3