From 23bd719cebe5feeff4e48fde925b0b39755eea93 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 15 十一月 2022 10:59:50 +0800
Subject: [PATCH] 2022.11.15

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationsubruleServiceImpl.kt |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationsubruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationsubruleServiceImpl.kt
index d80effc..199bea0 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationsubruleServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/EvaluationsubruleServiceImpl.kt
@@ -4,6 +4,7 @@
 import cn.flightfeather.supervision.domain.entity.Evaluationrule
 import cn.flightfeather.supervision.domain.entity.Evaluationsubrule
 import cn.flightfeather.supervision.domain.entity.Itemevaluation
+import cn.flightfeather.supervision.domain.enumeration.SceneType
 import cn.flightfeather.supervision.domain.mapper.*
 import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
 import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
@@ -38,9 +39,13 @@
         return evaluationsubruleMapper.selectByExample(example)
     }
 
-    override fun getScore(userId: String, time: String): List<EvaluationVo> {
+    override fun getScore(userId: String, time: String, platform:String?): List<EvaluationVo> {
         val userinfo = userinfoMapper.selectByPrimaryKey(userId) ?: return emptyList()
-        val sceneType = userinfo.extension2
+        var sceneType = userinfo.extension2
+        // FIXME: 2022/11/8 涓存椂娣诲姞杩囧害鍔熻兘锛屾彁渚涘井淇″皬绋嬪簭鍓嶇姹戒慨绫诲瀷鐨勫満鏅崟鐙殑璇勪及娓呭崟 锛屽満鏅被鍨嬩负 -7
+        if (platform == "weixin" && sceneType == SceneType.VehicleRepair.value.toString()) {
+            sceneType = "-7"
+        }
         //璇勫垎鎬昏鍒�
         val rules = evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
             createCriteria().andEqualTo("scensetypeid", sceneType)
@@ -88,7 +93,14 @@
                 2 -> resultList.add(EvaluationVo().apply {
                     id = it.guid
                     title1 = it.itemname
-                    score = it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                    scoreMode = it.extension1
+                    gradeMode = it.extension2
+                    score = when (gradeMode) {
+                        "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                        "add_mode" -> it.maxscore ?: 0
+                        else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                    }
+                    selectMode = it.extension3
 
                     //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
                     for (s in subRuleScores) {
@@ -104,7 +116,13 @@
                             r.sub1.add(SubEvaluationVo().apply {
                                 id = it.guid
                                 title2 = it.itemname
-                                score = it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                                gradeMode = it.extension2
+                                selectMode = it.extension3
+                                score = when (gradeMode) {
+                                    "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                                    "add_mode" -> it.maxscore ?: 0
+                                    else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
+                                }
                                 group = _group++
 
                                 //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
@@ -121,6 +139,7 @@
                 }
                 4 -> {
                     resultList.forEach{ r ->
+                        //4绾х殑璇勪及椤圭洿鎺ラ檮灞炰簬2绾ц瘎浼伴」
                         if (r.id == it.fatherid) {
                             if (r.sub1.isEmpty()) {
                                 r.sub1.add(SubEvaluationVo().apply {
@@ -128,13 +147,19 @@
                                     id = it.guid
                                     title2 = r.title1
                                     score = r.score
+                                    gradeMode = r.gradeMode
+                                    selectMode = r.selectMode
                                     group = _group++
                                 })
                             }
                             r.sub1[0].sub2.add(ThirdEvaluationVo().apply {
                                 id = it.guid
                                 content = it.itemname
-                                score = r.score.plus(it.maxscore ?: 0)
+                                score = when (r.sub1[0].gradeMode) {
+                                    "minus_mode" -> r.score.plus(it.maxscore ?: 0)
+                                    "add_mode" -> it.maxscore ?: 0
+                                    else -> r.score.plus(it.maxscore ?: 0)
+                                }
                                 //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
                                 for (s in subRuleScores) {
                                     if (it.guid == s.esrguid) {
@@ -149,7 +174,11 @@
                                     sr.sub2.add(ThirdEvaluationVo().apply {
                                         id = it.guid
                                         content = it.itemname
-                                        score = sr.score.plus(it.maxscore ?: 0)
+                                        score = when (sr.gradeMode) {
+                                            "minus_mode" -> sr.score.plus(it.maxscore ?: 0)
+                                            "add_mode" -> it.maxscore ?: 0
+                                            else -> sr.score.plus(it.maxscore ?: 0)
+                                        }
                                         //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
                                         for (s in subRuleScores) {
                                             if (it.guid == s.esrguid) {

--
Gitblit v1.9.3