|
@@ -2,19 +2,16 @@ package com.fdkankan.openApi.controller.www;
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
import com.fdkankan.openApi.common.PageInfo;
|
|
|
-import com.fdkankan.openApi.entity.system.User;
|
|
|
+import com.fdkankan.openApi.entity.system.UserAuthInfo;
|
|
|
import com.fdkankan.openApi.entity.www.ScenePlus;
|
|
|
-import com.fdkankan.openApi.entity.www.ScenePlusExt;
|
|
|
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.www.SceneVO;
|
|
|
-import com.fdkankan.redis.util.RedisUtil;
|
|
|
import com.fdkankan.web.response.ResultData;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -43,7 +40,7 @@ public class SceneController {
|
|
|
private SceneService sceneService;
|
|
|
|
|
|
@Autowired
|
|
|
- private RedisUtil redisUtil;
|
|
|
+ private IUserAuthService authService;
|
|
|
|
|
|
/**
|
|
|
* 根据用户名获取场景列表
|
|
@@ -51,9 +48,12 @@ public class SceneController {
|
|
|
*/
|
|
|
@SaIgnore
|
|
|
@PostMapping("/getScenesByUsername")
|
|
|
- public ResultData getScenesByUsername(@RequestBody SceneVO sceneVO,@RequestHeader("token") String token) {
|
|
|
- User user = JSONObject.parseObject(redisUtil.get("token#"+ StpUtil.getTokenInfo().tokenValue),User.class);
|
|
|
- PageInfo pageInfo = scenePlusService.getScenesByUserId(user.getId(),sceneVO.getPageNum(),sceneVO.getPageSize());
|
|
|
+ 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);
|
|
|
return ResultData.ok(pageInfo);
|
|
|
}
|
|
|
|
|
@@ -63,21 +63,21 @@ public class SceneController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/getScenePointInfo")
|
|
|
- public ResultData getScenePointInfo(@RequestBody SceneVO sceneVO, @RequestHeader("token") String token) {
|
|
|
+ public ResultData getScenePointInfo(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- User user = JSONObject.parseObject(redisUtil.get("token#"+ StpUtil.getTokenInfo().tokenValue),User.class);
|
|
|
- if (user.getId() != scenePlus.getUserId().intValue()) {
|
|
|
+ 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){
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
- if(scenePlusExt.getIsObj() == 0){
|
|
|
- return ResultData.ok(sceneService.getPointInfo(sceneVO.getSceneCode()));
|
|
|
- }
|
|
|
+ if (scenePlus.getSceneSource() == 4) {
|
|
|
+ return ResultData.ok(sceneService.getPointInfo(sceneVO.getSceneCode()));
|
|
|
}
|
|
|
return ResultData.ok(scenePlusService.getPointInfo(sceneVO.getSceneCode()));
|
|
|
}
|
|
@@ -87,20 +87,17 @@ public class SceneController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/getSceneObjFiles")
|
|
|
- public ResultData getSceneObjFiles(@RequestBody SceneVO sceneVO,@RequestHeader("token") String token) {
|
|
|
+ public ResultData getSceneObjFiles(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- User user = JSONObject.parseObject(redisUtil.get("token#"+ StpUtil.getTokenInfo().tokenValue),User.class);
|
|
|
- if (user.getId() != scenePlus.getUserId().intValue()) {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
+ UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
+ if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
+ throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
}
|
|
|
- if(scenePlus.getSceneSource()==4){
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
- if(scenePlusExt.getIsObj() == 0){
|
|
|
- return ResultData.ok(sceneService.getSceneObjFilePaths(sceneVO.getSceneCode()));
|
|
|
- }
|
|
|
+ if (authInfo.getUserId() != scenePlus.getUserId().intValue()) {
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
}
|
|
|
return ResultData.ok(scenePlusService.getSceneObjFilePaths(sceneVO.getSceneCode()));
|
|
|
}
|
|
@@ -110,20 +107,17 @@ public class SceneController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/getScenePanoramicImageFiles")
|
|
|
- public ResultData getScenePanoramicImageFiles(@RequestBody SceneVO sceneVO,@RequestHeader("token") String token) {
|
|
|
+ public ResultData getScenePanoramicImageFiles(@RequestBody SceneVO sceneVO,@RequestHeader("Authorization") String appKey) {
|
|
|
ScenePlus scenePlus = scenePlusService.getByNum(sceneVO.getSceneCode());
|
|
|
- if(ObjectUtils.isEmpty(scenePlus)){
|
|
|
+ if (ObjectUtils.isEmpty(scenePlus)) {
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
}
|
|
|
- User user = JSONObject.parseObject(redisUtil.get("token#"+ StpUtil.getTokenInfo().tokenValue),User.class);
|
|
|
- if (user.getId() != scenePlus.getUserId().intValue()) {
|
|
|
- throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
+ UserAuthInfo authInfo = authService.findByAppKey(appKey);
|
|
|
+ if (ObjectUtils.isEmpty(authInfo)) {
|
|
|
+ throw new BusinessException(ErrorCode.AUTH_FAIL);
|
|
|
}
|
|
|
- if(scenePlus.getSceneSource()==4){
|
|
|
- ScenePlusExt scenePlusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
|
|
|
- if(scenePlusExt.getIsObj() == 0){
|
|
|
- return ResultData.ok(sceneService.getScenePanoramicImageFiles(sceneVO.getSceneCode()));
|
|
|
- }
|
|
|
+ if (authInfo.getUserId() != scenePlus.getUserId().intValue()) {
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5015);
|
|
|
}
|
|
|
return ResultData.ok(scenePlusService.getScenePanoramicImageFiles(sceneVO.getSceneCode()));
|
|
|
}
|