From 52a0c16de9b0955a5f092560b73f16e41684f97b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 31 十二月 2024 10:13:35 +0800
Subject: [PATCH] 1. 环信码生成时,如果在线场景当期没有评估(未巡查)结果,则延用历史最新一次的结果; 2. 新增跨时间跨月度的历史整改记录查询逻辑 3. 优化获取顶层任务和日任务的获取逻辑

---
 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