feiyu02
2024-01-09 c1becf4cbd2e99601ce011c14b8742427249cfb4
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
package cn.flightfeather.supervision.domain.ds2.repository
 
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
import cn.flightfeather.supervision.domain.ds2.entity.UserMap
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
import org.springframework.stereotype.Repository
 
@Repository
class UserMapRep(
    private val userMapMapper: UserMapMapper,
    private val scenseMapper: ScenseMapper,
    private val userinfoMapper: UserinfoMapper
) {
 
    /**
     * 从飞羽监管系统中查找基本信息
     * @param userinfoTZ 飞羽环境中的用户信息
     * @return
     */
    fun findFromSupervision(userinfoTZ: UserinfoTZ?): Scense? {
        val userMap = UserMap().apply {
            tzUserId = userinfoTZ?.guid
        }
        // 找到两个系统用户的对应关系
        val uMap = userMapMapper.selectOne(userMap)
        if (uMap == null) {
            println("${userinfoTZ?.guid}, ${userinfoTZ?.realname}")
            return null
        }
        // 找到飞羽监管中的用户信息
        val userInfoSp = userinfoMapper.selectByPrimaryKey(uMap.svUserId)
        // 找到飞羽监管中的场景信息
        return scenseMapper.selectByPrimaryKey(userInfoSp.dGuid)
    }
}