|
@@ -5,17 +5,20 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.openApi.common.PageInfo;
|
|
|
-import com.fdkankan.openApi.entity.system.UserAuthInfo;
|
|
|
+import com.fdkankan.openApi.controller.BaseController;
|
|
|
import com.fdkankan.openApi.entity.www.ScenePlus;
|
|
|
import com.fdkankan.openApi.service.laser.SceneService;
|
|
|
-import com.fdkankan.openApi.service.system.IUserAuthService;
|
|
|
-import com.fdkankan.openApi.service.www.IScenePlusExtService;
|
|
|
import com.fdkankan.openApi.service.www.IScenePlusService;
|
|
|
+import com.fdkankan.openApi.vo.BaseSceneParamVo;
|
|
|
import com.fdkankan.openApi.vo.www.SceneVO;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -27,33 +30,22 @@ import org.springframework.web.bind.annotation.*;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/scene")
|
|
|
-public class SceneController {
|
|
|
-
|
|
|
+public class SceneController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private IScenePlusService scenePlusService;
|
|
|
|
|
|
@Autowired
|
|
|
- private IScenePlusExtService scenePlusExtService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private SceneService sceneService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private IUserAuthService authService;
|
|
|
-
|
|
|
/**
|
|
|
* 根据用户名获取场景列表
|
|
|
* @return
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@PostMapping("/getScenesByUsername")
|
|
|
- public ResultData getScenesByUsername(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
- UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
- if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
- throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
- }
|
|
|
- PageInfo pageInfo = scenePlusService.getScenesByUserId(authInfo.getUserId(),sceneVO);
|
|
|
+ public ResultData getScenesByUsername(@RequestBody SceneVO sceneVO) {
|
|
|
+ PageInfo pageInfo = scenePlusService.getScenesByUserId(this.getUserId(),sceneVO);
|
|
|
return ResultData.ok(pageInfo);
|
|
|
}
|
|
|
|
|
@@ -64,23 +56,15 @@ public class SceneController {
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@PostMapping("/getScenePointInfo")
|
|
|
- public ResultData getScenePointInfo(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
- ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
+ public ResultData getScenePointInfo(@RequestBody @Validated BaseSceneParamVo param) {
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNumAndUserId(this.getUserId(), param.getSceneCode());
|
|
|
if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
- if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
- throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
- }
|
|
|
- if (authInfo.getUserId() != scenePlus.getUserId().intValue()) {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
- }
|
|
|
-
|
|
|
if (scenePlus.getSceneSource() == 4) {
|
|
|
- return ResultData.ok(sceneService.getPointInfo(sceneVO.getSceneCode()));
|
|
|
+ return ResultData.ok(sceneService.getPointInfo(param.getSceneCode()));
|
|
|
}
|
|
|
- return ResultData.ok(scenePlusService.getPointInfo(sceneVO.getSceneCode()));
|
|
|
+ return ResultData.ok(scenePlusService.getPointInfo(param.getSceneCode()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -89,19 +73,12 @@ public class SceneController {
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@PostMapping("/getSceneObjFiles")
|
|
|
- public ResultData getSceneObjFiles(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
- ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
+ public ResultData getSceneObjFiles(@RequestBody @Validated BaseSceneParamVo param) {
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNumAndUserId(this.getUserId(), param.getSceneCode());
|
|
|
if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
- if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
- throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
- }
|
|
|
- if (authInfo.getUserId() != scenePlus.getUserId().intValue()) {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
- }
|
|
|
- return ResultData.ok(scenePlusService.getSceneObjFilePaths(sceneVO.getSceneCode()));
|
|
|
+ return ResultData.ok(scenePlusService.getSceneObjFilePaths(param.getSceneCode()));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -110,19 +87,12 @@ public class SceneController {
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@PostMapping("/getScenePanoramicImageFiles")
|
|
|
- public ResultData getScenePanoramicImageFiles(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
- ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
+ public ResultData getScenePanoramicImageFiles(@RequestBody @Validated BaseSceneParamVo param) {
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNumAndUserId(this.getUserId(), param.getSceneCode());
|
|
|
if (ObjectUtils.isEmpty(scenePlus)) {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
- if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
- throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
- }
|
|
|
- if (authInfo.getUserId() != scenePlus.getUserId().intValue()) {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
- }
|
|
|
- return ResultData.ok(scenePlusService.getScenePanoramicImageFiles(sceneVO.getSceneCode()));
|
|
|
+ return ResultData.ok(scenePlusService.getScenePanoramicImageFiles(param.getSceneCode()));
|
|
|
}
|
|
|
}
|
|
|
|