feiyu02
2025-09-17 8c15c9cc0d6474ed77e313258f9b09f7f2d6366e
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
package cn.flightfeather.supervision.lightshare.vo
 
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteInfo
import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo
import java.util.*
 
/**
 * 监测设备信息
 */
class DeviceSiteVo {
 
    var id: Int? = null
    var mnCode: String? = null
    var address: String? = null
    var name: String? = null
    var code: String? = null
    var beginDate: Date? = null
    var endDate: Date? = null
    var dutyCompanyId: String? = null
    var dutyCompany: String? = null
    var engineeringStage: String? = null
    var groupId: String? = null
    var groupName: String? = null
    var isOnline: Boolean? = null
    var isTrouble: Boolean? = null
    var kindex: Double? = null
    var longitude: Double? = null
    var latitude: Double? = null
    var linkman: String? = null
    var phone: String? = null
    var province: String? = null
    var ringId: String? = null
    var ringName: String? = null
    var typeId: String? = null
    var typename: String? = null
    var buildArea: String? = null
 
    companion object {
        /**
         * 通过静安区监测点位信息转换
         */
        fun fromJADustSiteInfo(list: List<DustSiteInfo?>): List<DeviceSiteVo> {
            val res = mutableListOf<DeviceSiteVo>()
            list.forEach {
                it ?: return@forEach
                res.add(DeviceSiteVo().apply {
                    id                  = it.id?.toIntOrNull()
                    mnCode              = it.mnCode
                    address             = it.address
                    name                = it.name
                    code                = it.code
                    beginDate           = it.beginDate
                    endDate             = it.endDate
                    dutyCompanyId       = it.dutyCompanyId
                    dutyCompany         = it.dutyCompany
                    engineeringStage    = it.engineeringStage
                    groupId             = it.groupId
                    groupName           = it.groupName
                    isOnline            = it.isOnline?.toBoolean()
                    isTrouble           = it.isTrouble?.toBoolean()
                    kindex              = it.kindex?.toDoubleOrNull()
                    longitude           = it.longitude?.toDoubleOrNull()
                    latitude            = it.latitude?.toDoubleOrNull()
                    linkman             = it.linkman
                    phone               = it.phone
                    province            = it.province
                    ringId              = it.ringId
//                    ringName            = it.ringName
                    typeId              = it.typeId
                    typename            = it.typename
                    buildArea           = it.buildArea
                })
            }
            return res
        }
 
        /**
         * 通过金山区监测点位信息转换
         */
        fun fromJSDustSiteInfo(list: List<JSDustSiteInfo?>): List<DeviceSiteVo> {
            val res = mutableListOf<DeviceSiteVo>()
            list.forEach {
                it ?: return@forEach
                res.add(DeviceSiteVo().apply {
                    id                  = it.id
                    mnCode              = it.mnCode
                    address             = it.address
                    name                = it.name
                    code                = it.code
                    beginDate           = it.beginDate
                    endDate             = it.endDate
                    dutyCompanyId       = it.dutyCompanyId
                    dutyCompany         = it.dutyCompany
                    engineeringStage    = it.engineeringStage
                    groupId             = it.groupId
                    groupName           = it.groupName
                    isOnline            = it.isOnline?.toBoolean()
                    isTrouble           = it.isTrouble?.toBoolean()
                    kindex              = it.kindex?.toDoubleOrNull()
                    longitude           = it.longitude?.toDoubleOrNull()
                    latitude            = it.latitude?.toDoubleOrNull()
                    linkman             = it.linkman
                    phone               = it.phone
                    province            = it.province
                    ringId              = it.ringId
                    ringName            = it.ringName
                    typeId              = it.typeId
                    typename            = it.typename
                    buildArea           = it.buildArea
                })
            }
            return res
        }
    }
}
 
/**
 * 根据设备mn编码找到设备信息
 */
fun List<DeviceSiteVo>.findByMNCode(mnCode: String?): DeviceSiteVo? {
    this.forEach {
        if (it.mnCode == mnCode) {
            return it
        }
    }
    return null
}