SceneController.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.fdkankan.scene.controller;
  2. import com.fdkankan.common.constant.ErrorCode;
  3. import com.fdkankan.common.constant.SceneInfoReqType;
  4. import com.fdkankan.common.exception.BusinessException;
  5. import com.fdkankan.scene.annotation.CheckPermit;
  6. import com.fdkankan.scene.service.ISceneService;
  7. import com.fdkankan.web.response.ResultData;
  8. import com.fdkankan.scene.service.ISceneEditInfoService;
  9. import com.fdkankan.scene.service.IScenePlusService;
  10. import com.fdkankan.scene.vo.BaseSceneParamVO;
  11. import com.fdkankan.scene.vo.SceneCheckKeyParamVO;
  12. import com.fdkankan.scene.vo.SceneInfoParamVO;
  13. import com.fdkankan.scene.vo.SceneInfoVO;
  14. import com.fdkankan.web.controller.BaseController;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.validation.annotation.Validated;
  17. import org.springframework.web.bind.annotation.*;
  18. import org.springframework.web.multipart.MultipartFile;
  19. /**
  20. * <p>
  21. * 场景表 前端控制器
  22. * </p>
  23. *
  24. * @author dengsixing
  25. * @since 2021-12-23
  26. */
  27. @RestController
  28. @RequestMapping("/service/scene")
  29. public class SceneController extends BaseController {
  30. @Autowired
  31. private ISceneEditInfoService sceneEditInfoService;
  32. @Autowired
  33. private IScenePlusService scenePlusService;
  34. @Autowired
  35. private ISceneService sceneService;
  36. /**
  37. * <p>
  38. 获取场景详情
  39. * </p>
  40. * @author dengsixing
  41. * @date 2022/8/1
  42. * @param param
  43. * @return com.fdkankan.scene.vo.SceneInfoVO
  44. **/
  45. @GetMapping(value = "/getInfo")
  46. public SceneInfoVO getInfo(@Validated SceneInfoParamVO param) throws Exception{
  47. String token = this.getToken();
  48. String sysCode = null;
  49. String acctId = null;
  50. String RSP = "0";
  51. // TODO: 2024/6/5 调用统一认证api,如果出参中返回的
  52. if(!RSP.equals("0")){
  53. throw new BusinessException(ErrorCode.AUTH_FAIL);
  54. }
  55. param.setReqType(SceneInfoReqType.VIEW.code());
  56. return sceneEditInfoService.getSceneInfo(param);
  57. }
  58. /**
  59. * <p>
  60. 根据场景密码打开场景
  61. * </p>
  62. * @author dengsixing
  63. * @date 2022/8/1
  64. * @param param
  65. * @return com.fdkankan.web.response.ResultData
  66. **/
  67. @PostMapping(value = "/check/key")
  68. public ResultData checkKey(@RequestBody @Validated SceneCheckKeyParamVO param) throws Exception {
  69. return sceneEditInfoService.checkKey(param);
  70. }
  71. /**
  72. * <p>
  73. 获取数据对接下载信息
  74. * </p>
  75. * @author dengsixing
  76. * @date 2022/8/1
  77. * @return com.fdkankan.web.response.ResultData
  78. **/
  79. @GetMapping(value = "/downLoadZSData")
  80. public ResultData downLoadZSData(String sceneNum) throws Exception{
  81. return scenePlusService.downLoadZSData(sceneNum);
  82. }
  83. /**
  84. * 上传人体抠图原图
  85. * @param num
  86. * @param file
  87. * @return
  88. * @throws Exception
  89. */
  90. @PostMapping(value = "/uploadBodySegment")
  91. public ResultData uploadBodySegment(@RequestParam("file") MultipartFile file,
  92. @RequestParam(value = "rotate", required = false) Integer rotate) throws Exception {
  93. return sceneService.uploadBodySegment(file, rotate);
  94. }
  95. /**
  96. * 获取人体抠图提取状态
  97. * @return ResultData
  98. * @throws Exception
  99. */
  100. @PostMapping(value = "/getBodySegmentStatus")
  101. public ResultData getBodySegmentStatus(@RequestParam(value = "serialNum") String uuid) throws Exception {
  102. return sceneService.getBodySegmentStatus(uuid);
  103. }
  104. }