feiyu02
2024-07-08 b212ef0208cb094f63ea8a239a1361f8e859c839
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
@@ -3,17 +3,27 @@
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import com.fasterxml.jackson.annotation.JsonInclude
import java.util.*
/**
 * 评分规则及得分
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
class ScoreDetail {
    // 工地状态(在建或完工)
    var status: String? = null
    // 总分
    var totalScore: Int = 0
    // 得分
    var score: Int = 0
    // 规范性等级
    var grade: String? = null
    // 更新时间
    var updateTime: Date? = null
    // 得分细则
    var details = mutableListOf<ScoreItem>()
@@ -69,12 +79,27 @@
    fun calScore() {
        details.forEach {
            totalScore += it.maxScore
            if (it.gradeMode == "minus_mode") {
                score += (it.score + it.maxScore)
            } else if (it.gradeMode == "add_mode") {
                score += it.score
            score += when (it.gradeMode) {
                "minus_mode" -> {
                    (it.score + it.maxScore)
                }
                "add_mode" -> {
                    it.score
                }
                else -> {
                    (it.score + it.maxScore)
                }
            }
        }
        grade = when {
            score >= 95 -> "规范"
            // 基本规范(90..94)和规范(>=95)
            score >= 90 -> "基本规范"
            // 不规范
            score >= 50 -> "不规范"
            // 严重不规范
            else -> "严重不规范"
        }
    }
}