Bläddra i källkod

复制错误提示

lyhzzz 2 år sedan
förälder
incheckning
8401071749

+ 1 - 0
src/main/java/com/fdkankan/manage_jp/common/ResultCode.java

@@ -24,6 +24,7 @@ public enum ResultCode  {
     MAIL_SEND_ERROR(50007, "邮件发送失败"),
     MAIL_SEND_ERROR(50007, "邮件发送失败"),
     CAMERA_IN(50008, "相机已存在"),
     CAMERA_IN(50008, "相机已存在"),
     SCENE_ERROR(50009, "场景状态不对"),
     SCENE_ERROR(50009, "场景状态不对"),
+    SCENE_DATA_ERROR(5010, "复制失败,场景资源文件不对"),
 
 
 
 
     ;
     ;

+ 9 - 8
src/main/java/com/fdkankan/manage_jp/service/impl/SceneCommonService.java

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.fyun.face.FYunFileServiceInterface;
 import com.fdkankan.image.MatrixToImageWriterUtil;
 import com.fdkankan.image.MatrixToImageWriterUtil;
+import com.fdkankan.manage_jp.common.ResultCode;
 import com.fdkankan.manage_jp.exception.BusinessException;
 import com.fdkankan.manage_jp.exception.BusinessException;
 import com.fdkankan.manage_jp.util.SceneResourcePath;
 import com.fdkankan.manage_jp.util.SceneResourcePath;
 import com.fdkankan.manage_jp.util.SnowflakeIdGenerator;
 import com.fdkankan.manage_jp.util.SnowflakeIdGenerator;
@@ -30,32 +31,32 @@ public class SceneCommonService {
     public String getNewDataSource(String oldDataSource){
     public String getNewDataSource(String oldDataSource){
         String newDataSource = null;
         String newDataSource = null;
         if(StringUtils.isBlank(oldDataSource)){
         if(StringUtils.isBlank(oldDataSource)){
-            throw new BusinessException(-1,"场景资源文件缺失,无法复制");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
         File oldDataSouceFile = new File(oldDataSource);
         File oldDataSouceFile = new File(oldDataSource);
         if(!oldDataSouceFile.exists()){
         if(!oldDataSouceFile.exists()){
-            throw new BusinessException(-1,"场景资源文件缺失,无法复制");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
         if(!oldDataSource.contains("/")){
         if(!oldDataSource.contains("/")){
-            throw new BusinessException(-1,"场景dataSource格式错误");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
 
 
         String time = com.fdkankan.common.util.DateUtil.date2String(new Date(), com.fdkankan.common.util.DateUtil.YYYYMMDDHHMMSSSSS_DATA_FORMAT);
         String time = com.fdkankan.common.util.DateUtil.date2String(new Date(), com.fdkankan.common.util.DateUtil.YYYYMMDDHHMMSSSSS_DATA_FORMAT);
         String[] split = oldDataSource.split("/");
         String[] split = oldDataSource.split("/");
-        if(split.length == 7 ){
-            String oldFileId = split[5];
+        if(split.length == 6 ){
+            String oldFileId = split[4];
             Long fileId = SnowflakeIdGenerator.snowflakeIdGenerator.nextId();
             Long fileId = SnowflakeIdGenerator.snowflakeIdGenerator.nextId();
             newDataSource = oldDataSource.replace(oldFileId,fileId.toString());
             newDataSource = oldDataSource.replace(oldFileId,fileId.toString());
 
 
-            String snCodeTime = split[6];
+            String snCodeTime = split[5];
             if(!snCodeTime.contains("_") || snCodeTime.split("_").length <= 1){
             if(!snCodeTime.contains("_") || snCodeTime.split("_").length <= 1){
-                throw new BusinessException(-1,"场景dataSource格式错误");
+                throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
             }
             }
             newDataSource = newDataSource.replace(snCodeTime.split("_")[1],time);
             newDataSource = newDataSource.replace(snCodeTime.split("_")[1],time);
             this.copyFdage(oldDataSource,newDataSource,time);
             this.copyFdage(oldDataSource,newDataSource,time);
         }
         }
         if(newDataSource == null){
         if(newDataSource == null){
-            throw new BusinessException(-1,"场景dataSource格式错误");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
         return newDataSource;
         return newDataSource;
     }
     }

+ 1 - 1
src/main/java/com/fdkankan/manage_jp/service/impl/ScenePlusServiceImpl.java

@@ -169,7 +169,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
             log.error("复制场景失败-V4-sceneNum:{},error:{}",oldNum,e);
             log.error("复制场景失败-V4-sceneNum:{},error:{}",oldNum,e);
             scenePlus.setSceneStatus(-1);
             scenePlus.setSceneStatus(-1);
             this.updateById(scenePlus);
             this.updateById(scenePlus);
-            throw new BusinessException(-1,"复制失败");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
         return scenePlus;
         return scenePlus;
     }
     }

+ 1 - 1
src/main/java/com/fdkankan/manage_jp/service/impl/SceneProServiceImpl.java

@@ -281,7 +281,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             log.error("复制场景失败-sceneNum:{},error:{}",oldNum,e);
             log.error("复制场景失败-sceneNum:{},error:{}",oldNum,e);
             scenePro.setStatus(-1);
             scenePro.setStatus(-1);
             this.updateById(scenePro);
             this.updateById(scenePro);
-            throw new BusinessException(-1,"复制失败");
+            throw new BusinessException(ResultCode.SCENE_DATA_ERROR);
         }
         }
 
 
         return scenePro;
         return scenePro;