lyhzzz 1 هفته پیش
والد
کامیت
74c4ba9fe1
1فایلهای تغییر یافته به همراه17 افزوده شده و 25 حذف شده
  1. 17 25
      src/main/java/com/fdkankan/manage_jp/service/impl/SceneCommonService.java

+ 17 - 25
src/main/java/com/fdkankan/manage_jp/service/impl/SceneCommonService.java

@@ -460,38 +460,30 @@ public class SceneCommonService {
             log.info("复制失败:{}",newNum);
             return;
         }
-        Long cameraId = scenePro == null ? scenePlus.getCameraId() : scenePro.getCameraId();
-        CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
-        String laserTitle = null;
-        if((cameraDetail.getType() == 10 || cameraDetail.getType() == 11) && scenePlus != null){
-            List<SceneCopyLog> sceneCopyLogs = sceneCopyLogService.getByNewNum(newNum);
-            if(!sceneCopyLogs.isEmpty()){
-                SceneCopyLog sceneCopyLog = sceneCopyLogs.get(0);
-                ScenePlus scenePlus1 = scenePlusService.getByNum(sceneCopyLog.getOldNum());
-                laserTitle = scenePlus1.getLaserTitle()+"(copy)";
-            }
+        List<SceneCopyLog> sceneCopyLogs = sceneCopyLogService.getByNewNum(newNum);
+        if(sceneCopyLogs == null || sceneCopyLogs.isEmpty()){
+            log.info("复制失败:{}",newNum);
+            return;
+        }
+        if(scenePlus != null){
+            ScenePlus scenePlus1 = scenePlusService.getByNum(sceneCopyLogs.get(0).getOldNum());
             LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
             wrapper.eq(ScenePlus::getId,scenePlus.getId());
             wrapper.set(ScenePlus::getSceneStatus,-2);
-            if(StringUtils.isNotBlank(laserTitle)){
-                wrapper.set(ScenePlus::getLaserTitle,laserTitle);
+            if(scenePlus1 != null && StringUtils.isNotBlank(scenePlus1.getLaserTitle())){
+                wrapper.set(ScenePlus::getLaserTitle,scenePlus1.getLaserTitle() +"(copy)");
             }
             scenePlusService.update(wrapper);
         }
-        if((cameraDetail.getType() == 10 || cameraDetail.getType() == 11) && scenePro != null){
-            List<SceneCopyLog> sceneCopyLogs = sceneCopyLogService.getByNewNum(newNum);
-            if(!sceneCopyLogs.isEmpty()){
-                SceneCopyLog sceneCopyLog = sceneCopyLogs.get(0);
-                ScenePro scenePro1 = sceneProService.getByNum(sceneCopyLog.getOldNum());
-                laserTitle = scenePro1.getLaserTitle()+"(copy)";
-            }
-            LambdaUpdateWrapper<ScenePro> wrapper = new LambdaUpdateWrapper<>();
-            wrapper.eq(ScenePro::getId,scenePro.getId());
-            wrapper.set(ScenePro::getStatus,-2);
-            if(StringUtils.isNotBlank(laserTitle)){
-                wrapper.set(ScenePro::getLaserTitle,laserTitle);
+        if(scenePro != null){
+            ScenePro scenePro1 = sceneProService.getByNum(sceneCopyLogs.get(0).getOldNum());
+            LambdaUpdateWrapper<ScenePro> wrapper2 = new LambdaUpdateWrapper<>();
+            wrapper2.eq(ScenePro::getId,scenePro.getId());
+            wrapper2.set(ScenePro::getStatus,-2);
+            if(scenePro1 != null && StringUtils.isNotBlank(scenePro1.getLaserTitle())){
+                wrapper2.set(ScenePro::getLaserTitle,scenePro1.getLaserTitle() +"(copy)");
             }
-            sceneProService.update(wrapper);
+            sceneProService.update(wrapper2);
         }
     }
 }