feiyu02
2025-03-28 7d74f3fd087d4a8192ed556a6c2e3a2ea3c81cff
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)
                    }
                }
            }
        }