|
@@ -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;
|
|
}
|
|
}
|