package com.ruoyi.web.controller.zhdd; /** * @Description: TODO * @Author: huangcheng * @Date: 2022/1/19 * @Version V1.0 */ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.RedisUtils; import com.ruoyi.zhdd.service.IDhService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @Validated @Api(value = "大华接口控制器", tags = {"大华接口控制器"}) @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController @RequestMapping("/zhdd/dh") public class DhController { private final IDhService dhService; @Value("${third.dhPCUserName}") private String dhAccount; @ApiOperation("查询设备列表") @GetMapping("/deviceList") public AjaxResult list() { return AjaxResult.success(dhService.getDeviceTree()); } @ApiOperation("获取大华token") @GetMapping("/getVideoToken") public AjaxResult getToken(@RequestParam(required = false) String account) { RedisUtils.publish(Constants.UPDATE_APP_PUSH, "hd"); return AjaxResult.success(dhService.getVideoToken(account)); } @ApiOperation("获取大华tokenV2.用于PC端业务") @GetMapping("/v2/getVideoToken") public AjaxResult getTokenV2() { RedisUtils.publish(Constants.UPDATE_APP_PUSH, "pc"); return AjaxResult.success(dhService.getVideoToken(dhAccount)); } @ApiOperation("video的token下线") @PostMapping("/offlineVideoToken") public AjaxResult offlineVideoToken() { dhService.offlineVideoToken(); return AjaxResult.success(); } }