package cn.flightfeather.supervision.lightshare.service.impl
|
|
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
|
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
|
import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
|
import cn.flightfeather.supervision.domain.ds2.entity.Complaint
|
import cn.flightfeather.supervision.domain.ds2.entity.Punishment
|
import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper
|
import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper
|
import cn.flightfeather.supervision.domain.ds2.repository.ComplaintAndPunishmentRep
|
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
|
import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
|
import cn.flightfeather.supervision.lightshare.service.ComplaintService
|
import cn.flightfeather.supervision.lightshare.service.UserinfoService
|
import cn.flightfeather.supervision.lightshare.vo.AreaVo
|
import cn.flightfeather.supervision.lightshare.vo.ComplaintVo
|
import cn.flightfeather.supervision.lightshare.vo.PunishmentVo
|
import org.springframework.stereotype.Service
|
|
@Service
|
class ComplaintServiceImpl(
|
private val complaintAndPunishmentRep: ComplaintAndPunishmentRep,
|
private val sceneRep: SceneRep,
|
private val taskRep: TaskRep,
|
private val userInfoSVRep: UserInfoSVRep,
|
private val userInfoTZRep: UserInfoTZRep,
|
private val userMapRep: UserMapRep,
|
) : ComplaintService {
|
|
private fun getTZUserId(areaVo: AreaVo): List<String?> {
|
return when (areaVo.sourceType) {
|
//以飞羽环境系统中的用户为主体
|
1 -> {
|
val u = userInfoTZRep.findEnterpriseUser(areaVo.districtname, areaVo.scensetypeid?.toInt())
|
u.map { it?.guid }
|
}
|
//以飞羽监管系统中的用户为主体
|
2 -> {
|
val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("当前查询条件下未找到对应顶层任务")
|
val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
|
.map { it?.guid }
|
val idList = userInfoSVRep.findUser(scenes).map { it?.guid }
|
userMapRep.findBySVUserId(idList).map { it?.tzUserId }
|
}
|
else -> emptyList()
|
}
|
}
|
|
override fun findComplaints(areaVo: AreaVo): List<ComplaintVo?> {
|
val userIdList = getTZUserId(areaVo)
|
return complaintAndPunishmentRep.findComplaint(userIdList, areaVo.starttime, areaVo.endtime)
|
}
|
|
override fun findPunishment(areaVo: AreaVo): List<PunishmentVo?> {
|
val userIdList = getTZUserId(areaVo)
|
return complaintAndPunishmentRep.findPunishment(userIdList, areaVo.starttime, areaVo.endtime)
|
}
|
}
|