feiyu02
2025-09-18 baf2cc2ce3dfd1235c012a3750132769fcd9ad2f
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.web
 
import cn.flightfeather.supervision.lightshare.service.UserMapService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
 
@Api(tags = ["UserMapController"], description = "用户id对应API接口")
@RestController
@RequestMapping("/usermap")
class UserMapController(val userMapService: UserMapService) {
 
    @ApiOperation(value = "根据飞羽监管系统中的场景id,获取与飞羽环境系统中的关联用户")
    @GetMapping
    fun getTZId(@RequestParam sceneId: String) = userMapService.getTZIdBySceneId(sceneId)
 
    @ApiOperation(value = "根据飞羽环境系统中的用户id,获取与飞羽监管系统中的关联用户")
    @GetMapping("/scene")
    fun getSceneByTzId(@RequestParam tzUserId: String) = userMapService.getSceneByTZId(tzUserId)
 
    @ApiOperation(value = "获取区域用户的监测设备和飞羽监管系统、飞羽环境系统的匹配记录")
    @PostMapping("/device")
    fun fetchDeviceMap(
        @ApiParam("查询页码", defaultValue = "1", required = false) @RequestParam("page", required = false)
        page: Int?,
        @ApiParam("单页数据量", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
        perPage: Int?,
        @ApiParam("区域条件信息") @RequestBody
        areaVo: AreaVo
    ) = resPack { userMapService.fetchDeviceMap(page, perPage, areaVo) }
 
    @ApiOperation(value = "新增或更新用户监测设备映射关系")
    @PostMapping("/insertOrUpdate")
    fun insertOrUpdate(
        @ApiParam("用户监测设备映射关系") @RequestBody
        param: Pair<AreaVo, DeviceMapVo>,
    ) = resPack { userMapService.insertOrUpdate(param) }
 
    @ApiOperation(value = "搜索第三方设备")
    @PostMapping("/searchThirdPartyDevice")
    fun searchThirdPartyDevice(
        @ApiParam("区域条件信息") @RequestBody
        areaVo: AreaVo,
        @ApiParam("搜索关键字,匹配设备名") @RequestParam
        keyword: String,
        @ApiParam("查询页码", defaultValue = "1", required = false) @RequestParam("page", required = false)
        page: Int?,
        @ApiParam("单页数据量", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
        perPage: Int?,
    ) = resPack { userMapService.searchThirdPartyDevice(areaVo, keyword, page, perPage) }
}