InnerController.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package com.fdkankan.manage.inner.controller;
  2. import cn.hutool.log.Log;
  3. import com.fdkankan.common.util.SecurityUtil;
  4. import com.fdkankan.manage.common.ResultCode;
  5. import com.fdkankan.manage.common.ResultData;
  6. import com.fdkankan.manage.controller.BaseController;
  7. import com.fdkankan.manage.entity.RtkInfo;
  8. import com.fdkankan.manage.exception.BusinessException;
  9. import com.fdkankan.manage.service.ICommonService;
  10. import com.fdkankan.manage.service.IRtkInfoService;
  11. import com.fdkankan.manage.service.ISceneProService;
  12. import com.fdkankan.manage.service.IServiceUpTipService;
  13. import com.fdkankan.manage.util.RsaUtils;
  14. import com.fdkankan.manage.vo.request.SceneParam;
  15. import org.apache.commons.lang3.StringUtils;
  16. import org.springframework.beans.factory.annotation.Autowired;
  17. import org.springframework.web.bind.annotation.*;
  18. import org.springframework.web.multipart.MultipartFile;
  19. import java.util.Date;
  20. /**
  21. * <p>
  22. * TODO
  23. * </p>
  24. *
  25. * @author dengsixing
  26. * @since 2022/6/7
  27. **/
  28. @RestController
  29. @RequestMapping("/service/manage/inner")
  30. public class InnerController extends BaseController {
  31. @Autowired
  32. private ISceneProService sceneProService;
  33. @Autowired
  34. IServiceUpTipService serviceUpTipService;
  35. @PostMapping("/move")
  36. public ResultData move(@RequestBody SceneParam param){
  37. if(!checkSign()){
  38. return ResultData.error(-1,"签名错误");
  39. }
  40. if(StringUtils.isEmpty(param.getNum()) || StringUtils.isEmpty(param.getSnCode())){
  41. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  42. }
  43. sceneProService.move(param);
  44. return ResultData.ok();
  45. }
  46. @GetMapping("/copyScene")
  47. public ResultData copyScene(@RequestParam(required = false) String num){
  48. if(!checkSign()){
  49. return ResultData.error(-1,"签名错误");
  50. }
  51. if(StringUtils.isEmpty(num)){
  52. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  53. }
  54. sceneProService.copy(num);
  55. return ResultData.ok();
  56. }
  57. @GetMapping("/getServiceUpTip")
  58. public ResultData getServiceUpTip(@RequestParam(required = false) Integer type){
  59. return ResultData.ok( serviceUpTipService.getServiceUpTipByType(type));
  60. }
  61. @GetMapping("/rebuildScene")
  62. public ResultData rebuild(@RequestParam(required = false) String num,@RequestParam(required = false) String from){
  63. sceneProService.rebuildScene(num,from);
  64. return ResultData.ok( );
  65. }
  66. @Autowired
  67. IRtkInfoService rtkInfoService;
  68. /**
  69. *
  70. */
  71. @GetMapping("/info/{rtkSnCode}")
  72. public ResultData info(@PathVariable String rtkSnCode){
  73. if(StringUtils.isBlank(rtkSnCode)){
  74. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  75. }
  76. // String token = getSign();
  77. // if(StringUtils.isBlank(token)){
  78. // throw new BusinessException(ResultCode.RTK_TOKEN_NOT_EXIT);
  79. // }
  80. // try {
  81. // String deTxt = RsaUtils.decipher(token, RsaUtils.privateKey);
  82. // if(!deTxt.equals(rtkSnCode)){
  83. // throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
  84. // }
  85. // }catch (Exception e){
  86. // throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
  87. // }
  88. RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
  89. if(rtkInfo == null){
  90. throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
  91. }
  92. // if(rtkInfo.getStatus() == 0){
  93. // throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_AC);
  94. // }
  95. return ResultData.ok(rtkInfo);
  96. }
  97. }