From a5cdbf569067822e3232d2177b8a9aac1ed95b69 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 29 五月 2024 17:32:00 +0800 Subject: [PATCH] 1. 修改自评逻辑中,问题整改的判断方式为已整改并且整改审核通过; 2. 新增评估详情获取接口; --- src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt | 168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 165 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt index e3b006b..efd7cec 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt @@ -1,44 +1,203 @@ package cn.flightfeather.supervision.lightshare.vo +import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 +import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation +import com.fasterxml.jackson.annotation.JsonInclude + /** * 璇勫垎瑙勫垯鍙婂緱鍒� */ +@JsonInclude(JsonInclude.Include.NON_NULL) +class ScoreDetail { + // 鎬诲垎 + var totalScore: Int = 0 + + // 寰楀垎 + var score: Int = 0 + + // 寰楀垎缁嗗垯 + var details = mutableListOf<ScoreItem>() + + /** + * 鏂板涓�鏉¤瘎浼拌鍒欒褰� + * 璇勪及瑙勫垯鐨勪紶鍏ユ湁椤哄簭瑕佹眰锛屽繀椤绘槸鎸夌収娴呭眰绾ц嚦娣卞眰绾х殑椤哄簭浼犲叆锛岃瘎浼板眰绾� @see [Evaluationsubrule2.ertype] + * @param details 缁撴灉 + * @param rule 璇勪及瑙勫垯 + * @param level 璇勪及瑙勫垯瀵瑰簲鐨勫眰绾ф繁搴︼紝浠�1寮�濮嬮�掑锛�1涓烘渶椤跺眰 + * @param resList 鍚勬潯瑙勫垯瀵瑰簲鐨勮瘎浼扮粨鏋� + * @param onlyShowSelected 鍙坊鍔犻�変腑鐨勯�夐」 + */ + fun addDetail( + details: MutableList<ScoreItem>, + rule: Evaluationsubrule2, + level: Int, + resList: List<Itemevaluation>, + onlyShowSelected: Boolean = false, + ) { + if (level == 1) { + val scoreItem = ScoreItem.fromRule(rule, resList) + if (onlyShowSelected) { + if (scoreItem.select) details.add(scoreItem) + } else { + details.add(scoreItem) + } + } else if (level > 1) { + var isFind = false + // 鍒ゆ柇鎻掑叆瑙勫垯鏄惁鏄綋鍓嶅眰绾ц瘎浼伴泦鍚堜腑鏌愪竴椤圭殑瀛愯瘎浼� + for (d in details) { + if (rule.fatherid == d.id) { + if (d.subList == null) d.subList = mutableListOf() + addDetail(d.subList!!, rule, 1, resList, onlyShowSelected) + isFind = true + break + } + } + // 鑻ユ湭鎵惧埌锛屽垯寰�涓嬩竴灞傜骇缁х画鏌ユ壘 + if (!isFind && (level - 1 > 1)) { + details.forEach { d -> + d.subList?.let { + addDetail(it, rule, level - 1, resList, onlyShowSelected) + } + } + } + } + } + + /** + * 璁$畻鎬诲垎鍜屽緱鍒� + */ + 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 + } + } + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +class ScoreItem { + //鎺掑簭绱㈠紩 + var index: Int? = null + + //璇勪及瑙勫垯绾у埆锛�2锛�3锛�4)锛屽�艰秺澶х骇鍒秺浣� + var level: Int? = null + + //瑙勫垯id + var id: String? = null + + //瑙勫垯鎻忚堪 + var title: String? = null + + //鎬诲垎鍊� + var maxScore: Int = 0 + + //瀹為檯寰楀垎 + var score: Int = 0 + + //鏄惁閫変腑 + var select: Boolean = false + + //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒� + var scoreMode: String? = null + + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var gradeMode: String? = null + + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var selectMode: String? = null + + //浜岀骇瀛愯鍒� + var subList: MutableList<ScoreItem>? = null + + companion object { + /** + * 鏍规嵁瑙勫垯鍜屽緱鍒嗙粨鏋滅敓鎴愬緱鍒嗛」 + * @param rule + * @param resList + */ + fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem { + return ScoreItem().apply { + index = rule.displayid?.toInt() + level = rule.ertype + id = rule.guid + title = rule.itemname + scoreMode = rule.extension1 + gradeMode = rule.extension2 + maxScore = rule.maxscore ?: 0 + selectMode = rule.extension3 + + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in resList) { + if (rule.guid == s.esrguid) { + score = s.value?.toInt() ?: 0 + select = s.extension1 == "true" + break + } + } + } + } + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) class EvaluationVo { //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 - var title1: String? = null - //鍒嗗�� + var title: String? = null + + //鎬诲垎鍊� + var maxScore: Int = 0 + + //瀹為檯寰楀垎 var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false + //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒� var scoreMode: String? = "basic_score" + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 var selectMode: String? = "single_mode" + //浜岀骇瀛愯鍒� - var sub1: MutableList<SubEvaluationVo> = mutableListOf() + var subList: MutableList<SubEvaluationVo> = mutableListOf() } class SubEvaluationVo { //鏈夋椂鍊欎竴绾х殑瑙勫垯涓嬮潰鐩存帴鏄笁绾ц鍒欙紝娌℃湁浜岀骇瑙勫垯锛屽洜姝ゆ鏃剁殑浜岀骇瑙勫垯鍙槸涓轰簡缁撴瀯瀹屾暣鎬ц�屽嚭鐜扮殑 var placeholder: Boolean = false + //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 var title2: String? = null + //鍒嗗�� var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱 var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱 var selectMode: String? = "single_mode" + //浜岀骇瑙勫垯鍒嗙粍 var group: Int? = null + //涓夌骇瀛愯鍒� var sub2: MutableList<ThirdEvaluationVo> = mutableListOf() } @@ -46,10 +205,13 @@ class ThirdEvaluationVo { //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 var content: String? = null + //鍒嗗�� var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false } \ No newline at end of file -- Gitblit v1.9.3