puzhibing
2026-08-21 5fa94b3718b4a78a4fcea4c97652b0ef20b7de3a
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
package com.xw.yunwei.model
 
import com.google.gson.annotations.SerializedName
import com.xw.yunwei.extension.dateChangePattern
import kotlin.math.min
 
/**
 * 常规任务详情
 */
data class TaskNormalModel(
 
 
    /**
     * 操作人
     */
    @SerializedName("handleUserName")
    val handleUserName: String? = null,
 
    /**
     * 操作时间
     */
    @SerializedName("handleTime")
    val handleTime: String? = null,
 
    /**
     * 任务创建人
     */
    @SerializedName("createBy")
    val createBy: String? = null,
 
    /**
     * 任务创建时间
     */
    @SerializedName("createTime")
    val createTime: String? = null,
 
    /**
     * 车辆VIN码
     */
    @SerializedName("vehicleVin")
    val vehicleVin: String? = null,
 
    /**
     * 任务处理时限/结束时间
     */
    @SerializedName("endTime")
    val endTime: String? = null,
 
    /**
     * 任务ID
     */
    @SerializedName("id")
    val id: Long? = null,
 
    /**
     * 车牌号
     */
    @SerializedName("plateNumber")
    val plateNumber: String? = null,
 
    /**
     * 任务状态
     * 0 = 待到达
     * 1 = 待处理
     * 2 = 已完成
     * 3 = 已取消
     */
    @SerializedName("status")
    val status: Int? = null,
 
    /**
     * 任务类别
     * 1 = 常规任务
     * 2 = 事故任务
     */
    @SerializedName("taskCategory")
    val taskCategory: Int? = null,
 
    /**
     * 任务编号
     */
    @SerializedName("taskCode")
    val taskCode: String? = null,
 
    /**
     * 完成任务情况描述
     */
    @SerializedName("taskDescription")
    val taskDescription: String? = null,
 
    /**
     * 完成图片(URL或Base64)
     */
    @SerializedName("taskImage")
    val taskImage: String? = null,
 
    /**
     * 任务类型ID
     * 任务类别为2时:对应数据字典,多个逗号分割
     * 任务类别为1时:枚举值 1-9
     */
    @SerializedName("taskTypeId")
    val taskTypeId: String? = null,
 
    /**
     * 任务紧急程度
     * 0 = P0(最紧急)
     * 1 = P1
     * 2 = P2
     * 3 = P3(最不紧急)
     */
    @SerializedName("taskUrgencyLevel")
    val taskUrgencyLevel: Int? = null,
 
    /**
     * 车辆编码
     */
    @SerializedName("vehicleCode")
    val vehicleCode: String? = null,
 
    /**
     * 车辆颜色
     */
    @SerializedName("vehicleColor")
    val vehicleColor: String? = null,
 
    /**
     * 车辆ID
     */
    @SerializedName("vehicleId")
    val vehicleId: Long? = null,
 
    /**
     * 车辆纬度
     */
    @SerializedName("vehicleLat")
    val vehicleLat: Double? = null,
 
    /**
     * 车辆位置描述
     */
    @SerializedName("vehicleLocation")
    val vehicleLocation: String? = null,
 
    /**
     * 车辆经度
     */
    @SerializedName("vehicleLon")
    val vehicleLon: Double? = null,
){
    //是否能够改派
    fun couldReassignment(): Boolean {
        return status != 2 && taskCategory != 1
    }
 
    //获取显示创建事件
    fun getShowCreateTime(): String?{
        return createTime?.dateChangePattern("yyyy-MM-dd HH:mm:ss","yyyy/MM/dd HH:mm:ss")
    }
 
    //获取显示车身编码
    fun getShowVehicleCode(maxLength: Int): String {
        return vehicleCode?.let {
            if (it.isNotEmpty()) {
                it.substring(0, min(it.length, maxLength))
            } else {
                ""
            }
        } ?: ""
    }
 
    //获取显示操作时间
    fun getShowHandleTime(): String?{
        return handleTime?.dateChangePattern("yyyy-MM-dd HH:mm:ss","yyyy/MM/dd HH:mm:ss")
    }
}