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