SceneController.java 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package com.fdkankan.scene.controller;
  2. import cn.hutool.http.HttpResponse;
  3. import cn.hutool.http.HttpUtil;
  4. import com.fdkankan.common.constant.SceneInfoReqType;
  5. import com.fdkankan.scene.annotation.InitEditInfo;
  6. import com.fdkankan.scene.annotation.VrLog;
  7. import com.fdkankan.scene.bean.ResultData;
  8. import com.fdkankan.scene.httpclient.CustomHttpClient;
  9. import com.fdkankan.scene.service.SceneEditInfoService;
  10. import com.fdkankan.scene.service.SceneFileMappingService;
  11. import com.fdkankan.scene.service.SceneService;
  12. import com.fdkankan.scene.vo.SceneCheckKeyParamVO;
  13. import com.fdkankan.scene.vo.SceneInfoParamVO;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.core.io.Resource;
  16. import org.springframework.http.ResponseEntity;
  17. import org.springframework.validation.annotation.Validated;
  18. import org.springframework.web.bind.annotation.*;
  19. import javax.servlet.http.Cookie;
  20. import javax.servlet.http.HttpServletRequest;
  21. import javax.servlet.http.HttpServletResponse;
  22. import javax.websocket.server.PathParam;
  23. import java.io.IOException;
  24. /**
  25. * <p>
  26. * 场景表 前端控制器
  27. * </p>
  28. *
  29. * @author dengsixing
  30. * @since 2021-12-23
  31. */
  32. @RestController
  33. @RequestMapping("/service/scene")
  34. public class SceneController extends BaseController{
  35. @Autowired
  36. private SceneService sceneService;
  37. @Autowired
  38. private SceneEditInfoService sceneEditInfoService;
  39. /**
  40. * <p>
  41. 获取场景详情
  42. * </p>
  43. * @author dengsixing
  44. * @date 2022/8/1
  45. * @param param
  46. * @return com.fdkankan.scene.vo.SceneInfoVO
  47. **/
  48. @InitEditInfo
  49. // @VrLog
  50. @GetMapping(value = "/getInfo")
  51. public ResultData getInfo(@Validated SceneInfoParamVO param) throws Exception{
  52. param.setReqType(SceneInfoReqType.VIEW.code());
  53. // param.setSubgroup(this.getSubgroup());
  54. return ResultData.ok(sceneEditInfoService.getSceneInfo(param));
  55. }
  56. // @GetMapping("/file")
  57. // public ResponseEntity<Resource> outFileByKey(String key, HttpServletResponse response) throws IOException {
  58. // return sceneService.outFileByKey(key, response);
  59. // }
  60. @GetMapping("/file")
  61. public void outFileByKey2(String key, HttpServletResponse response) throws IOException {
  62. sceneService.outFileByKey2(key, null, response);
  63. }
  64. @GetMapping(value = "/ping")
  65. public ResultData ping(){
  66. return ResultData.ok();
  67. }
  68. @PostMapping(value = "/check/key")
  69. public ResultData checkKey(@RequestBody @Validated SceneCheckKeyParamVO param) throws Exception {
  70. param.setSubgroup(this.getSubgroup());
  71. return sceneEditInfoService.checkKey(param);
  72. }
  73. }