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) }
|
}
|