|
@@ -80,7 +80,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
}
|
|
|
//localToOssUtil.uploadOss(tempFile.getPath(), ossPath);
|
|
|
//String url = this.ossUrlPrefix + ossPath;
|
|
|
- String url = tempFile.getPath();
|
|
|
+ String url = CacheUtil.mapping + ossPath;
|
|
|
|
|
|
FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(extName.replace(".", ""));
|
|
|
if(fileTypeEnum == null){
|
|
@@ -134,14 +134,14 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
String resultFormat = modelFileFormat;
|
|
|
switch (modelFileFormat){
|
|
|
case "obj" : resultFormat = "glb";
|
|
|
- url = uploadObjOss(unZipFile.getPath(),modelFile);break;
|
|
|
- case "laz" : url = uploadLazOss(unZipFile.getPath(),modelFile); break;
|
|
|
- case "shp" : url = uploadOss(unZipFile.getPath(),modelFile); break;
|
|
|
- case "b3dm" : url = uploadB3dm(unZipFile.getPath(),modelFile); break;
|
|
|
+ url = uploadObjOss(ossZipPath,modelFile);break;
|
|
|
+ case "laz" : url = uploadLazOss(ossZipPath,modelFile); break;
|
|
|
+ case "shp" : url = uploadOss(ossZipPath,modelFile); break;
|
|
|
+ case "b3dm" : url = uploadB3dm(ossZipPath,modelFile); break;
|
|
|
case "las" :
|
|
|
- case "ply" : url = uploadLasOrPly(unZipFile.getPath(),modelFile);break;
|
|
|
+ case "ply" : url = uploadLasOrPly(ossZipPath,modelFile);break;
|
|
|
case "osgb": resultFormat = "b3dm";
|
|
|
- uploadOsgb(unZipFile.getPath(),modelFile) ;break;
|
|
|
+ uploadOsgb(ossZipPath,modelFile) ;break;
|
|
|
default: break;
|
|
|
}
|
|
|
FileTypeEnum fileTypeEnum = FileTypeEnum.getByType(modelFileFormat);
|
|
@@ -149,6 +149,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
|
|
|
}
|
|
|
Integer status = StringUtils.isNotBlank(url) ?1:-1;
|
|
|
+ url = StringUtils.isNotBlank(url) ?CacheUtil.mapping + url:null;
|
|
|
CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(getDirectorySize(unZipFile)),
|
|
|
null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId);
|
|
|
return ResultData.ok(commonUpload);
|
|
@@ -158,16 +159,11 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
OBJToGLBUtil.checkObj(modelFile.getPath());
|
|
|
String localGlbPath = modelFile.getPath().replace(".obj",".glb");
|
|
|
OBJToGLBUtil.objToGlb2(modelFile.getPath(),localGlbPath);
|
|
|
- //String ossPath = unzipPath.replace(OssPath.localPath,"");
|
|
|
- //localToOssUtil.uploadOss(unzipPath,ossPath);
|
|
|
-// if(!localToOssUtil.existKey(localGlbPath.replace(OssPath.localPath,""))){
|
|
|
-// throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
-// }
|
|
|
File file = new File(localGlbPath);
|
|
|
if(!file.exists()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
}
|
|
|
- return ossUrlPrefix + unzipPath +File.separator+file.getName();
|
|
|
+ return unzipPath +File.separator+file.getName();
|
|
|
}
|
|
|
|
|
|
private String uploadB3dm(String unzipPath, File modelFile) {
|
|
@@ -180,7 +176,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
if(!file.exists()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
}
|
|
|
- return ossUrlPrefix +unzipPath +File.separator +file.getName();
|
|
|
+ return unzipPath +File.separator +file.getName();
|
|
|
}
|
|
|
|
|
|
@Autowired
|
|
@@ -195,16 +191,16 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
if(!modelFile.exists()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
}
|
|
|
- // return ossUrlPrefix +unzipPath +File.separator +modelFile.getParentFile().getName();
|
|
|
- return modelFile.getParentFile().getPath();
|
|
|
+ return unzipPath +File.separator +modelFile.getParentFile().getName();
|
|
|
+ // return modelFile.getParentFile().getPath();
|
|
|
}
|
|
|
|
|
|
private String uploadOss(String unzipPath,File modelFile) {
|
|
|
if(!modelFile.exists()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
}
|
|
|
- // return ossUrlPrefix + unzipPath+File.separator +modelFile.getName();
|
|
|
- return modelFile.getPath();
|
|
|
+ return unzipPath+File.separator +modelFile.getName();
|
|
|
+ // return modelFile.getPath();
|
|
|
}
|
|
|
|
|
|
private String uploadLasOrPly(String unzipPath ,File modelFile) {
|
|
@@ -213,8 +209,8 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
if(!file.exists()){
|
|
|
throw new BusinessException(ResultCode.UPLOAD_FILE_ERROR);
|
|
|
}
|
|
|
- // return ossUrlPrefix +unzipPath+File.separator +mntFile.getName() + File.separator +"webcloud";
|
|
|
- return mntFile.getPath()+ File.separator +"webcloud";
|
|
|
+ return unzipPath+File.separator +mntFile.getName() + File.separator +"webcloud";
|
|
|
+ // return mntFile.getPath()+ File.separator +"webcloud";
|
|
|
|
|
|
}
|
|
|
|