DhController.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.ruoyi.web.controller.zhdd;
  2. /**
  3. * @Description: TODO
  4. * @Author: huangcheng
  5. * @Date: 2022/1/19
  6. * @Version V1.0
  7. */
  8. import com.ruoyi.common.constant.Constants;
  9. import com.ruoyi.common.core.domain.AjaxResult;
  10. import com.ruoyi.common.utils.RedisUtils;
  11. import com.ruoyi.zhdd.service.IDhService;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import lombok.RequiredArgsConstructor;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.beans.factory.annotation.Value;
  17. import org.springframework.validation.annotation.Validated;
  18. import org.springframework.web.bind.annotation.GetMapping;
  19. import org.springframework.web.bind.annotation.PostMapping;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestParam;
  22. import org.springframework.web.bind.annotation.RestController;
  23. @Validated
  24. @Api(value = "大华接口控制器", tags = {"大华接口控制器"})
  25. @RequiredArgsConstructor(onConstructor_ = @Autowired)
  26. @RestController
  27. @RequestMapping("/zhdd/dh")
  28. public class DhController {
  29. private final IDhService dhService;
  30. @Value("${third.dhPCUserName}")
  31. private String dhAccount;
  32. @ApiOperation("查询设备列表")
  33. @GetMapping("/deviceList")
  34. public AjaxResult list() {
  35. return AjaxResult.success(dhService.getDeviceTree());
  36. }
  37. @ApiOperation("获取大华token")
  38. @GetMapping("/getVideoToken")
  39. public AjaxResult getToken(@RequestParam(required = false) String account) {
  40. RedisUtils.publish(Constants.UPDATE_APP_PUSH, "hd");
  41. return AjaxResult.success(dhService.getVideoToken(account));
  42. }
  43. @ApiOperation("获取大华tokenV2.用于PC端业务")
  44. @GetMapping("/v2/getVideoToken")
  45. public AjaxResult getTokenV2() {
  46. RedisUtils.publish(Constants.UPDATE_APP_PUSH, "pc");
  47. return AjaxResult.success(dhService.getVideoToken(dhAccount));
  48. }
  49. @ApiOperation("video的token下线")
  50. @PostMapping("/offlineVideoToken")
  51. public AjaxResult offlineVideoToken() {
  52. dhService.offlineVideoToken();
  53. return AjaxResult.success();
  54. }
  55. }