| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.dataanalysis.AopDataDeviceMap |
| | | import cn.flightfeather.supervision.common.exception.ResponseErrorException |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Scense |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Userinfo |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SceneRep |
| | |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper |
| | | import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep |
| | | import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep |
| | | import cn.flightfeather.supervision.lightshare.service.UserMapService |
| | | import cn.flightfeather.supervision.lightshare.service.UserinfoService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo |
| | | import org.springframework.stereotype.Service |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | @Service |
| | | class UserMapServiceImpl( |
| | |
| | | private val taskRep: TaskRep, |
| | | private val userInfoSVRep: UserInfoSVRep, |
| | | private val userInfoTZRep: UserInfoTZRep, |
| | | private val userMapRep: UserMapRep, |
| | | private val aopDataDeviceMap: AopDataDeviceMap, |
| | | ) : UserMapService { |
| | | |
| | | override fun getTZIdBySceneId(sceneId: String): UserMap { |
| | | val list = userInfoSVRep.findUser(sceneId) |
| | | if (list.isEmpty()) return UserMap() |
| | | val userId = list[0]?.guid |
| | | val user = userInfoSVRep.findUser(sceneId) |
| | | val userId = user?.guid |
| | | val result = userMapMapper.selectByExample(Example(UserMap::class.java).apply { |
| | | createCriteria().andEqualTo("svUserId", userId) |
| | | }) |
| | | return if (result.isNotEmpty()) result[0] else UserMap() |
| | | } |
| | | |
| | | override fun autoCreateMap() { |
| | | override fun getSceneByTZId(tzUserId: String): Scense? { |
| | | return userMapRep.findFromSupervision(tzUserId) |
| | | } |
| | | |
| | | override fun autoCreateMap(userList: List<Userinfo?>) { |
| | | // 选择需要处理的账户 |
| | | val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { |
| | | createCriteria().andEqualTo("remark", "静安区") |
| | | }) |
| | | // val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { |
| | | // createCriteria().andEqualTo("remark", "徐汇区") |
| | | // }) |
| | | userList.forEach { |
| | | it ?: return@forEach |
| | | // 查找是否已经有账户匹配记录 |
| | | val records = userMapMapper.selectByExample(Example(UserMap::class.java).apply { |
| | | createCriteria().andEqualTo("svUserId", it.guid) |
| | |
| | | tzUserName = tzU.realname |
| | | svUserId = it.guid |
| | | svUserName = it.realname |
| | | umCreateTime = Date() |
| | | }) |
| | | } |
| | | } |
| | |
| | | tzUserName = id |
| | | svUserId = it.guid |
| | | svUserName = it.realname |
| | | umCreateTime = Date() |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | //以飞羽监管系统中的用户为主体 |
| | | 2 -> { |
| | | val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("当前查询条件下未找到对应顶层任务") |
| | | val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("当前查询条件下未找到对应顶层任务") |
| | | val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | .map { it?.guid } |
| | | userInfoSVRep.findUser(scenes).map { it?.guid } |
| | | } |