package cn.flightfeather.supervision.business.autooutput.dataanalysis
|
|
import cn.flightfeather.supervision.common.utils.Constant
|
import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteMapRep
|
import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteMapRep
|
import cn.flightfeather.supervision.domain.ds3.repository.XHFumeSiteMapRep
|
import cn.flightfeather.supervision.lightshare.vo.AreaVo
|
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
|
import org.springframework.stereotype.Component
|
|
/**
|
* 监测数据和系统用户的映射管理
|
*/
|
@Component
|
class AopDataDeviceMap(
|
private val jaDustSiteMapRep: JADustSiteMapRep,
|
private val jsDustSiteMapRep: JSDustSiteMapRep,
|
private val xhFumeSiteMapRep: XHFumeSiteMapRep,
|
) {
|
|
/**
|
* 获取区域条件下的设备和用户的映射关系
|
*/
|
fun findMapSet(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> {
|
return when (areaVo.sourceType) {
|
//以飞羽环境系统中的用户为主体
|
1 -> find1(areaVo, userIdList)
|
//以飞羽监管系统中的用户为主体
|
2 -> find2(areaVo, userIdList)
|
else -> emptyList()
|
}
|
}
|
|
private fun find1(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> {
|
return when (areaVo.districtcode) {
|
//徐汇区
|
"310104" -> {
|
when (areaVo.scensetypeid) {
|
//汽修
|
Constant.SceneTypeTZ.VehicleRepair.value.toString() -> emptyList()
|
else -> emptyList()
|
}
|
}
|
else -> emptyList()
|
}
|
}
|
|
private fun find2(areaVo: AreaVo, userIdList: List<String?>): List<DeviceMapVo> {
|
return when (areaVo.districtcode) {
|
//静安区
|
"310106" -> when (areaVo.scensetypeid) {
|
//工地
|
Constant.SceneType.TYPE1.value -> jaDustSiteMapRep.findBySVUserId(userIdList)
|
else -> emptyList()
|
}
|
//金山区
|
"310116" -> when (areaVo.scensetypeid) {
|
//工地,码头水泥搅拌站
|
Constant.SceneType.TYPE1.value,
|
Constant.SceneType.TYPE2.value,
|
Constant.SceneType.TYPE3.value,
|
-> jsDustSiteMapRep.findBySVUserId(userIdList)
|
else -> emptyList()
|
}
|
//徐汇区
|
"310104" -> when (areaVo.scensetypeid) {
|
//餐饮
|
Constant.SceneType.TYPE5.value -> xhFumeSiteMapRep.findBySVUserId(userIdList)
|
else -> emptyList()
|
}
|
else -> emptyList()
|
|
}
|
}
|
}
|