Parcourir la source

上传场景时,场景归属用户改为拍摄账号

dsx il y a 2 ans
Parent
commit
1000124607

+ 25 - 1
src/main/java/com/fdkankan/contro/service/impl/SceneFileBuildServiceImpl.java

@@ -405,7 +405,7 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
 
         ScenePlusVO scenePlusVO = this.createScenePlus(sceneNum, cameraDetail.getCameraId(), jsonObject.getString("creator"),
                 jsonObject.getString("pwd"),cameraType, jsonObject.getJSONObject("cam").getIntValue("type"),
-                dataSource, icon,  cameraDetail.getUserId(), userName,algorithm,
+                dataSource, icon,  Long.valueOf(jsonObject.getString("account")), userName,algorithm,
                 jsonObject.getJSONArray("points").size(), jsonObject.getString("name"), jsonObject.getString("info"),
                 jsonObject.getInteger("scenetype"), jsonObject.getString("gps"), rebuild,
                 jsonObject.getInteger("resolution"), firmwareVersion.toString(), sceneUrl, buildType, cameraDetail.getCooperationUser());
@@ -619,6 +619,18 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             log.info("data.fdage文件为空!");
             throw new BusinessException(CameraConstant.FAILURE_6009);
         }
+
+        //校验用户id
+        String account = fdageJson.getString("account");
+        if(StrUtil.isEmpty(account)){
+            throw new BusinessException(ErrorCode.USER_NOT_EXIST);
+        }
+        Long userId = Long.valueOf(account);
+        User user = userService.getById(userId);
+        if(Objects.isNull(user)){
+            throw new BusinessException(ErrorCode.USER_NOT_EXIST);
+        }
+
         //根据videoVersion判断是V2还是V3版本的算法和页面
         if (fdageJson.containsKey("videoVersion") && StrUtil.isNotEmpty(fdageJson.getString("videoVersion"))) {
             if (fdageJson.getIntValue("videoVersion") >= 4) {
@@ -750,6 +762,18 @@ public class SceneFileBuildServiceImpl extends ServiceImpl<ISceneFileBuildMapper
             log.info("data.fdage文件为空");
             throw new BusinessException(CameraConstant.FAILURE_6009);
         }
+
+        //校验用户id
+        String account = fdageJson.getString("account");
+        if(StrUtil.isEmpty(account)){
+            throw new BusinessException(ErrorCode.USER_NOT_EXIST);
+        }
+        Long userId = Long.valueOf(account);
+        User user = userService.getById(userId);
+        if(Objects.isNull(user)){
+            throw new BusinessException(ErrorCode.USER_NOT_EXIST);
+        }
+
         String buildType = "V3";
         //13表示转台
         Long cameraType = 13L;