package cn.flightfeather.supervision.lightshare.vo
|
|
import cn.flightfeather.supervision.domain.ds1.entity.Scense
|
|
/**
|
* 场景和对应监测点位信息
|
*/
|
class SceneDeviceVo {
|
var scene: Scense? = null
|
var deviceList: MutableList<DeviceSiteVo?> = mutableListOf()
|
}
|
|
fun List<SceneDeviceVo>.tableHeadScene(): List<Array<Any>> {
|
return listOf(arrayOf(
|
"场景编号", "名称", "类型", "地址", "区县", "街镇", "联系人", "电话", "创建时间",
|
))
|
}
|
|
fun List<SceneDeviceVo>.tableHeadDevice(): List<Array<Any>> {
|
return listOf(arrayOf(
|
"监测点编号", "MN编码", "点位名称", "地址", "开工时间", "运维商", "区县",
|
))
|
}
|
|
fun List<SceneDeviceVo>.tableHead(): List<Array<Any>> {
|
val a = this.tableHeadScene()[0].toMutableList()
|
val b = this.tableHeadDevice()[0].toList()
|
a.addAll(b)
|
return listOf(a.toTypedArray())
|
}
|
|
fun List<SceneDeviceVo>.tableContent(): MutableList<Array<Any>> {
|
val contents = mutableListOf<Array<Any>>()
|
this.forEach { s ->
|
val deviceList = s.deviceList
|
val scene = s.scene
|
deviceList.forEach each@ {
|
it ?: return@each
|
val content = mutableListOf<Any>()
|
content.addAll(listOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "",
|
scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "",
|
scene?.createdate ?: ""))
|
content.addAll(listOf(it.id ?: "", it.mnCode ?: "", it.name ?: "", it.address ?: "", it.beginDate ?: "", it
|
.dutyCompany ?: "", it.groupName ?: ""))
|
contents.add(content.toTypedArray())
|
}
|
if (contents.isEmpty()) {
|
contents.add(arrayOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "",
|
scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "",
|
scene?.createdate ?: ""))
|
}
|
}
|
return contents
|
}
|