From 7d74f3fd087d4a8192ed556a6c2e3a2ea3c81cff Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 28 三月 2025 17:43:48 +0800
Subject: [PATCH] 1. 新增扬尘监测数据上传功能

---
 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
index 7d9819a..ae7a4d5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
@@ -10,6 +10,8 @@
 import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
 import org.springframework.stereotype.Component
 import java.time.LocalDate
+import java.time.ZoneId
+import java.util.*
 
 /**
  * 鏍规嵁鑷姩璇勪及[AopEvaluation]缁撴灉鐢熸垚鐜俊鐮�
@@ -33,9 +35,19 @@
             userMapRep.findFromSupervision(it)?.let { s ->
                 // 浠庨缇界洃绠$郴缁熶腑鏌ユ壘璇勫垎
                 val e = evaluationRep.findByScene(s.guid, date)
-                e?.resultscorebef?.toInt()?.let {score ->
+                if (e.isNotEmpty()) {
                     // 鏍规嵁璇勫垎鐢熸垚瀵瑰簲鐨勭幆淇$爜
+                    var score = 0
+                    e.forEach {eva ->
+                        val s = eva?.resultscorebef?.toInt() ?: 0
+                        if (s > score) score = s
+                    }
                     overallEvaluationRep.insertOrUpdateOne(it?.guid, score, sceneType, date, endDate)
+                } else {
+                    // TODO: 2024/12/6 褰撴病鏈夋壘鍒拌嚜鍔ㄨ瘎鍒嗚褰曟椂锛岄噰鐢ㄥ巻鍙叉渶鏂扮殑鐜俊鐮佽褰曚綔涓烘湰鏈熻褰�
+                    overallEvaluationRep.selectLatest(it?.guid)?.let {o ->
+                        overallEvaluationRep.insertOrUpdateOne(o.biGuid, o.oeScore, sceneType, date, endDate)
+                    }
                 }
             }
         }

--
Gitblit v1.9.3