|
|
@@ -235,25 +235,33 @@ public class CadastreManageServiceImpl implements CadastreManageService {
|
|
|
//解压成功文件保存
|
|
|
if (StringUtils.isNotBlank(extractRes)) {
|
|
|
String unZipPath = extractRes;
|
|
|
- String innerExtractFileName = FileExtractUtil.getInnerFileByDirName(unZipPath);
|
|
|
- // 如果解压后的文件夹名称不为空,则使用解压后的文件夹名称作为文件名
|
|
|
- if(StringUtils.isNotBlank(innerExtractFileName)){
|
|
|
- theFileName = innerExtractFileName;
|
|
|
- }else {
|
|
|
-
|
|
|
- String suffix = ".gdb"; //需要后缀为.gdb才能被jar包识别为矢量数据进行读取
|
|
|
- //这里解压文件名称作为文件名
|
|
|
- String fileName = currentFilePath.getFileName().toString();
|
|
|
- theFileName = fileName.substring(0, fileName.lastIndexOf('.'));
|
|
|
- theFileName += suffix;
|
|
|
-
|
|
|
- //如果当前压缩文件为gdb文件,则解压后的文件夹名称需要修改为.gdb结尾
|
|
|
- FileExtractUtil.modifyDirName(unZipPath,unZipPath + suffix);
|
|
|
- unZipPath += suffix;
|
|
|
- unZipPath = unZipPath.replace(theFileName, "");
|
|
|
- if(StringUtils.isNotBlank(unZipPath) && (unZipPath.endsWith("/")||unZipPath.endsWith("\\"))){
|
|
|
- unZipPath = unZipPath.substring(0, unZipPath.length() - 1);
|
|
|
+ if("1".equals(fileType)){ //gdb格式
|
|
|
+ String innerExtractFileName = FileExtractUtil.getInnerFolderByDirName(unZipPath);
|
|
|
+ // 如果解压后的文件夹名称不为空,则使用解压后的文件夹名称作为文件名
|
|
|
+ if(StringUtils.isNotBlank(innerExtractFileName)){
|
|
|
+ theFileName = innerExtractFileName;
|
|
|
+ }else {
|
|
|
+ String suffix = ".gdb"; //需要后缀为.gdb才能被jar包识别为矢量数据进行读取
|
|
|
+ //这里解压文件名称作为文件名
|
|
|
+ String fileName = currentFilePath.getFileName().toString();
|
|
|
+ theFileName = fileName.substring(0, fileName.lastIndexOf('.'));
|
|
|
+ theFileName += suffix;
|
|
|
+
|
|
|
+ //如果当前压缩文件为gdb文件,则解压后的文件夹名称需要修改为.gdb结尾
|
|
|
+ FileExtractUtil.modifyDirName(unZipPath,unZipPath + suffix);
|
|
|
+ unZipPath += suffix;
|
|
|
+ unZipPath = unZipPath.replace(theFileName, "");
|
|
|
+ if(StringUtils.isNotBlank(unZipPath) && (unZipPath.endsWith("/")||unZipPath.endsWith("\\"))){
|
|
|
+ unZipPath = unZipPath.substring(0, unZipPath.length() - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if ("2".equals(fileType)) {//如果是mdb文件
|
|
|
+ String innerExtractFileName = FileExtractUtil.getInnerFileByDirName(unZipPath);
|
|
|
+ if(StringUtils.isBlank(innerExtractFileName)) {
|
|
|
+ throw new ServiceException("可能入库失败或没有历史版本,无法回退");
|
|
|
}
|
|
|
+ theFileName = innerExtractFileName;
|
|
|
}
|
|
|
|
|
|
CadastreFile cadastreFile = new CadastreFile();
|
|
|
@@ -287,7 +295,6 @@ public class CadastreManageServiceImpl implements CadastreManageService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* //1.文件进行解压
|
|
|
* //1.先获取相关信息,进行入库
|