lyhzzz 1 month ago
parent
commit
92c214e700
1 changed files with 13 additions and 13 deletions
  1. 13 13
      src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

+ 13 - 13
src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

@@ -76,17 +76,14 @@ public class AppSceneService extends BaseController {
     private String ossHost;
 
     public PageInfo pageList(AppSceneParam param) {
-
-        String username = JwtUtil.getUsername(getToken());
-        if(StringUtils.isBlank(username)){
-            throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
-        }
-        Camera camera = cameraService.getByChildName(username);
-        User user = userService.getByUserName(param.getPhoneNum());
-        if(camera == null && user == null){
-            throw new BusinessException(LoginConstant.FAILURE_CODE_3004, LoginConstant.FAILURE_MSG_3004);
+        if(StringUtils.isEmpty(param.getAppUserName()) || StringUtils.isEmpty(param.getPhoneNum())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
         }
-        if(camera != null){
+        if(!StringUtils.isEmpty(param.getAppUserName())){
+            Camera camera = cameraService.getByChildName(param.getAppUserName());
+            if(camera == null){
+                throw new BusinessException(LoginConstant.FAILURE_CODE_3014, LoginConstant.FAILURE_MSG_3014);
+            }
             CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
             if(cameraDetail == null){
                 throw new BusinessException(LoginConstant.FAILURE_CODE_3014, LoginConstant.FAILURE_MSG_3014);
@@ -95,15 +92,18 @@ public class AppSceneService extends BaseController {
             param.setCameraId(camera.getId());
         }
 
-        if(user != null){
-            List<String> cooperationNumList = new ArrayList<>();
+        List<String> cooperationNumList = new ArrayList<>();
+        if(StringUtils.isNotBlank(param.getPhoneNum())){
+            User user = userService.getByUserName(param.getPhoneNum());
+            if(user == null){
+                throw new BusinessException(LoginConstant.FAILURE_CODE_3015, LoginConstant.FAILURE_MSG_3015);
+            }
             cooperationNumList = sceneCooperationService.getNumByUserIds(Arrays.asList(user.getId()));
             if(cooperationNumList.size() >0){
                 param.setCooperationNumList(cooperationNumList );
             }
             param.setUserId(user.getId());
         }
-
         //云端场景不展示复制场景
         Set<String> copyNumSet = sceneCopyLogService.getCopyNumSet();
         param.setCopyNumSet(copyNumSet);