From 34961791ca6d802f7bb8055b16771c9d00057f67 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期二, 10 十二月 2024 10:51:42 +0800
Subject: [PATCH] 1. 新增后台任务状态类的自定义序列化类 (解决解决BgTaskStatus类中计算属性runTime无法序列化的问题)2. 新增LocalDateTime类型的时间格式序列化和反序列化类 (解决BgTaskStatus类中LocalDateTime类型无法序列化为正确的时间格式问题)

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt |  121 ++++++++++++++++++++++++----------------
 1 files changed, 73 insertions(+), 48 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..8dbc046 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
@@ -1,55 +1,80 @@
 package cn.flightfeather.supervision.lightshare.vo
 
+import cn.flightfeather.supervision.common.utils.UUIDGenerator
+import cn.flightfeather.supervision.domain.ds1.entity.*
+import java.util.*
+
 /**
- * 璇勫垎瑙勫垯鍙婂緱鍒�
+ * 璇勪及鎬诲垎
+ * @date 2024/9/24
+ * @author feiyu02
  */
-class EvaluationVo {
-    //瑙勫垯id
-    var id: String? = null
-    //瑙勫垯鎻忚堪
-    var title1: String? = null
-    //鍒嗗��
-    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()
-}
+class EvaluationVo : Evaluation() {
 
-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()
-}
+    /**
+     * 鏇存柊寰楀垎
+     */
+    fun updateScore(score: Int) {
 
-class ThirdEvaluationVo {
-    //瑙勫垯id
-    var id: String? = null
-    //瑙勫垯鎻忚堪
-    var content: String? = null
-    //鍒嗗��
-    var score: Int = 0
-    //鏄惁閫変腑
-    var select: Boolean = false
+    }
+
+    companion object {
+        /**
+         * 鏂板涓�鏉¤嚜鍔ㄨ瘎鍒嗙殑鎬诲緱鍒嗚褰�
+         * @param inspection 宸℃煡璁板綍
+         * @param subTask 宸℃煡瀛愪换鍔�
+         * @param scene 琚贰鏌ュ満鏅�
+         * @param rule 浣跨敤鐨勮瘎鍒嗚鍒�
+         * @param totalScore 鎬诲緱鍒�
+         */
+        fun newAutoEvaluation(
+            inspection: Inspection?, subTask: Subtask?, scene: Scense, rule: Evaluationrule?,
+            totalScore: Int,
+        ) = newEvaluation(inspection, subTask, scene, rule, totalScore, Userinfo().apply {
+            guid = "admin"
+            acountname = "admin"
+            realname = "admin"
+        })
+
+        /**
+         * 鏂板涓�鏉¤瘎鍒嗙殑鎬诲緱鍒嗚褰�
+         * @param inspection 宸℃煡璁板綍
+         * @param subTask 宸℃煡瀛愪换鍔�
+         * @param scene 琚贰鏌ュ満鏅�
+         * @param rule 浣跨敤鐨勮瘎鍒嗚鍒�
+         * @param totalScore 鎬诲緱鍒�
+         * @param userinfo 璇勪及鐢ㄦ埛
+         */
+        fun newEvaluation(
+            inspection: Inspection?, subTask: Subtask?, scene: Scense,
+            rule: Evaluationrule?, totalScore: Int, userinfo: Userinfo,
+        ) = Evaluation().apply {
+            guid = UUIDGenerator.generate16ShortUUID()
+            iguid = inspection?.guid
+            stguid = subTask?.stguid
+            sguid = subTask?.scenseid
+            scensetypeid = scene.typeid
+            scensetype = scene.type
+            subscensetypeid = scene.scensesubtypeid
+            subscensetype = scene.scensesubtype
+            ertype = rule?.ruletype?.toByte()
+            provincecode = scene.provincecode
+            provincename = scene.provincename
+            citycode = scene.citycode
+            cityname = scene.cityname
+            districtcode = scene.districtcode
+            districtname = scene.districtname
+            towncode = scene.towncode
+            townname = scene.townname
+            scensename = scene.name
+            scenseaddress = scene.location
+            evaluatetime = subTask?.planstarttime
+            evaluatorguid = userinfo.guid
+            evaluatorusername = userinfo.acountname
+            evaluatorrealname = userinfo.realname
+            resultscorebef = totalScore.toString()
+            createdate = subTask?.planstarttime
+            updatedate = Date()
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3