feiyu02
2025-07-30 f75ff7a0fc566dc18b60987b3fa2e65cae4665da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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 : Evaluation() {
 
    /**
     * 更新得分
     */
    fun updateScore(score: Int) {
 
    }
 
    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()
        }
    }
}