浏览代码

Merge remote-tracking branch 'origin/fusion-1.5.0'

lyhzzz 1 年之前
父节点
当前提交
70660b2691

+ 1 - 1
src/main/java/com/fdkankan/ucenter/constant/CameraConstant.java

@@ -18,7 +18,7 @@ public class CameraConstant {
     public static final String FAILURE_MSG_6004 = "表示相机的点数超过了10万";
 
     public static final int FAILURE_CODE_6005 = 6005;
-    public static final String FAILURE_MSG_6005 = "无权操作该相机";
+    public static final String FAILURE_MSG_6005 = "设备SN码不符合使用范围";
 
     public static final int FAILURE_CODE_6006 = 6006;
     public static final String FAILURE_MSG_6006 = "不支持重复绑定";

+ 7 - 3
src/main/java/com/fdkankan/ucenter/controller/fire/FdUserCameraController.java

@@ -51,6 +51,7 @@ public class FdUserCameraController extends BaseController {
         }
         String snCode = param.getString("snCode");
         String userName = param.getString("userName");
+        String platform = param.getString("platform");
         if(StringUtils.isEmpty(userName)){
             userName = JwtUtil.getUsername(getToken());
         }
@@ -62,9 +63,12 @@ public class FdUserCameraController extends BaseController {
         if(ObjectUtils.isEmpty(cameraDetailEntity)){
             throw new BusinessException(CameraConstant.FAILURE_CODE_6020,CameraConstant.FAILURE_MSG_6020);
         }
-//        if (ObjectUtils.isEmpty(cameraDetailEntity.getCompanyId())) {
-//            throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
-//        }
+        if (ObjectUtils.isEmpty(cameraDetailEntity.getCompanyId()) ) {
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
+        }
+        if(!StringUtils.isEmpty(platform) && "fusion".equals(platform) && !cameraDetailEntity.getCompanyId().equals(25L)){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6005, CameraConstant.FAILURE_MSG_6005);
+        }
 
         if(cameraDetailEntity.getUserId() != null){
             throw new BusinessException(AppConstant.FAILURE_CODE_4011, AppConstant.FAILURE_MSG_4011);

+ 3 - 1
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -3,6 +3,7 @@ package com.fdkankan.ucenter.httpClient.service;
 import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.http.client.NacosAsyncRestTemplate;
+import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.rabbitmq.util.RabbitMqProducer;
@@ -284,10 +285,11 @@ public class LaserService {
             params.put("status", -1);
             Result result = laserClient.saveOrEdit(num, params);
             if(result.getCode() != HttpStatus.OK.value()){
-                log.error("激光场景状态同步失败!");
+                throw new BusinessException(-1,"激光场景状态同步失败");
             }
         }catch (Exception e){
             log.error("激光场景状态同步失败!",e);
+            throw new BusinessException(-1,e.getMessage());
         }
 
     }

+ 4 - 0
src/main/java/com/fdkankan/ucenter/service/impl/FusionService.java

@@ -79,6 +79,10 @@ public class FusionService implements IFusionService {
             resourceList = Collections.singletonList(3);
         }else if(param.getType()!=null && param.getType() == 4){
             resourceList = Collections.singletonList(4);
+        }else if(param.getType() !=null && param.getType() == 6){
+            resourceList = Collections.singletonList(5);
+        }
+        if(param.getType() !=null &&  (param.getType() == 4 || param.getType() == 6 )){
             List<ScenePlusExt> plusExtList = scenePlusExtService.getSsObj();
             List<Long> plusIds = plusExtList.stream().map(ScenePlusExt::getPlusId).collect(Collectors.toList());
             if(plusIds.size() >0){

+ 9 - 2
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -862,6 +862,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             for (ScenePro scenePro : proList) {
                 cameraMap.merge(scenePro.getCameraId(), scenePro.getSpace(), Long::sum);
                 sceneDelLogService.saveLog(scenePro.getNum(),userId);
+                if(scenePro.getSceneSource() == 4 || scenePro.getSceneSource() == 5){
+                    laserService.delete(scenePro.getNum());
+                }
             }
             List<Long> proIds = proList.parallelStream().map(ScenePro::getId).collect(Collectors.toList());
             this.removeByIds(proIds);
@@ -873,14 +876,18 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 
             for (ScenePlus scenePlus : plusList) {
                 if(scenePlus.getCameraId()!= null && plusMap.get(scenePlus.getId())!=null){
-                    cameraMap.merge(scenePlus.getCameraId(), plusMap.get(scenePlus.getId()).getSpace(), Long::sum);
+                    Long space = plusMap.get(scenePlus.getId()).getSpace() == null ? 0 :plusMap.get(scenePlus.getId()).getSpace();
+                    cameraMap.merge(scenePlus.getCameraId(), space, Long::sum);
+
                 }
                 sceneDelLogService.saveLog(scenePlus.getNum(),userId);
+                if(scenePlus.getSceneSource() == 4 || scenePlus.getSceneSource() == 5){
+                    laserService.delete(scenePlus.getNum());
+                }
             }
             scenePlusService.removeByIds(plusIds);
             scenePlusExtService.removeByPlusIds(plusIds);
             folderSceneService.delBySceneId(plusIds);
-
         }
         //恢复相机使用容量
         if(cameraMap.size() >0){