Ver código fonte

删除场景校验场景计算状态

lyhzzz 1 ano atrás
pai
commit
28c9ba3e18

+ 2 - 0
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -91,6 +91,8 @@ public enum ResultCode  {
     RTK_TOKEN_NOT_EXIT(50071, "缺少签名验证信息"),
     RTK_TOKEN_ERROR(50072, "签名校验失败"),
 
+    CAN_NOT_DEL_MODELING_SCENE(50073, "计算中的场景无法删除"),
+
 
     ;
 

+ 27 - 4
src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java

@@ -599,19 +599,42 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         Integer sceneSource = null;
         Long cameraId = null;
         ScenePro scenePro = this.getByNum(num);
+        Scene scene = sceneService.getByNum(num);
+        ScenePlus scenePlus = scenePlusService.getByNum(num);
+        Integer status = null;
+
         if(scenePro!=null){
             cameraId = scenePro.getCameraId();
             sceneSource = scenePro.getSceneSource();
-            this.removeById(scenePro.getId());
+            status = scenePro.getStatus();
         }
-        Scene scene = sceneService.getByNum(num);
         if(scene!=null){
-            sceneService.removeById(scene.getId());
+            cameraId = scene.getCameraId();
+            status = scene.getStatus();
         }
-        ScenePlus scenePlus = scenePlusService.getByNum(num);
         if(scenePlus!=null){
             cameraId = scenePlus.getCameraId();
             sceneSource = scenePlus.getSceneSource();
+            status = scenePlus.getSceneStatus();
+        }
+        HashMap<String, MqSendLog> mqSendLogHashMap = mqSendLogService.getByNumList(Arrays.asList(num));
+        if(!mqSendLogHashMap.isEmpty()){
+            for (String key : mqSendLogHashMap.keySet()) {
+                mqSendLogService.removeById(mqSendLogHashMap.get(key).getId());
+                status = -1;
+            }
+        }
+        if(status != null && status == 0){
+            throw new BusinessException(ResultCode.CAN_NOT_DEL_MODELING_SCENE);
+        }
+
+        if(scenePro!=null){
+            this.removeById(scenePro.getId());
+        }
+        if(scene!=null){
+            sceneService.removeById(scene.getId());
+        }
+        if(scenePlus!=null){
             ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
             if(plusExt != null){
                 scenePlusExtService.delByPlus(scenePlus.getId());