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
|
}
|