package com.fdkankan.manage.inner.controller; import cn.hutool.log.Log; import com.fdkankan.common.util.SecurityUtil; import com.fdkankan.manage.common.ResultCode; import com.fdkankan.manage.common.ResultData; import com.fdkankan.manage.controller.BaseController; import com.fdkankan.manage.entity.RtkInfo; import com.fdkankan.manage.exception.BusinessException; import com.fdkankan.manage.service.ICommonService; import com.fdkankan.manage.service.IRtkInfoService; import com.fdkankan.manage.service.ISceneProService; import com.fdkankan.manage.service.IServiceUpTipService; import com.fdkankan.manage.util.RsaUtils; import com.fdkankan.manage.vo.request.SceneParam; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.Date; /** *

* TODO *

* * @author dengsixing * @since 2022/6/7 **/ @RestController @RequestMapping("/service/manage/inner") public class InnerController extends BaseController { @Autowired private ISceneProService sceneProService; @Autowired IServiceUpTipService serviceUpTipService; @PostMapping("/move") public ResultData move(@RequestBody SceneParam param){ if(!checkSign()){ return ResultData.error(-1,"签名错误"); } if(StringUtils.isEmpty(param.getNum()) || StringUtils.isEmpty(param.getSnCode())){ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS); } sceneProService.move(param); return ResultData.ok(); } @GetMapping("/copyScene") public ResultData copyScene(@RequestParam(required = false) String num){ if(!checkSign()){ return ResultData.error(-1,"签名错误"); } if(StringUtils.isEmpty(num)){ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS); } sceneProService.copy(num); return ResultData.ok(); } @GetMapping("/getServiceUpTip") public ResultData getServiceUpTip(@RequestParam(required = false) Integer type){ return ResultData.ok( serviceUpTipService.getServiceUpTipByType(type)); } @GetMapping("/rebuildScene") public ResultData rebuild(@RequestParam(required = false) String num,@RequestParam(required = false) String from){ sceneProService.rebuildScene(num,from); return ResultData.ok( ); } @Autowired IRtkInfoService rtkInfoService; /** * */ @GetMapping("/info/{rtkSnCode}") public ResultData info(@PathVariable String rtkSnCode){ if(StringUtils.isBlank(rtkSnCode)){ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS); } // String token = getSign(); // if(StringUtils.isBlank(token)){ // throw new BusinessException(ResultCode.RTK_TOKEN_NOT_EXIT); // } // try { // String deTxt = RsaUtils.decipher(token, RsaUtils.privateKey); // if(!deTxt.equals(rtkSnCode)){ // throw new BusinessException(ResultCode.RTK_TOKEN_ERROR); // } // }catch (Exception e){ // throw new BusinessException(ResultCode.RTK_TOKEN_ERROR); // } RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode); if(rtkInfo == null){ throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT); } // if(rtkInfo.getStatus() == 0){ // throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_AC); // } return ResultData.ok(rtkInfo); } }