|
@@ -89,42 +89,14 @@ public class DictFileController extends BaseController{
|
|
|
if(dictFile == null){
|
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(dictFile.getDownUrl())){
|
|
|
- return ResultData.ok(dictFile.getDownUrl());
|
|
|
- }
|
|
|
CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
|
|
|
if(commonUpload == null){
|
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
|
}
|
|
|
-
|
|
|
- if(StringUtils.isBlank(commonUpload.getFileUrl())){
|
|
|
+ if(StringUtils.isBlank(commonUpload.getSourceFile())){
|
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
|
}
|
|
|
- String sceneObjPath = commonUpload.getFileUrl().replace(queryPath,"");
|
|
|
- String foName = new File(sceneObjPath).getName();
|
|
|
-
|
|
|
- if(!"las".equals(commonUpload.getFileFormat()) && !"laz".equals(commonUpload.getFileFormat()) && !"ply".equals(commonUpload.getFileFormat())
|
|
|
- && !"obj".equals(commonUpload.getFileFormat()) && !"osgb".equals(commonUpload.getFileFormat()) && !"b3dm".equals(commonUpload.getFileFormat())){
|
|
|
- dictFileService.setDownUrl(dictFileId,commonUpload.getFileUrl(),0);
|
|
|
- return ResultData.ok(commonUpload.getFileUrl());
|
|
|
- }
|
|
|
- if("obj".equals(commonUpload.getFileFormat()) || "osgb".equals(commonUpload.getFileFormat()) || "b3dm".equals(commonUpload.getFileFormat())){
|
|
|
- File parentFile = new File(sceneObjPath).getParentFile();
|
|
|
- sceneObjPath = parentFile.getPath();
|
|
|
- foName = parentFile.getName();
|
|
|
- }
|
|
|
-
|
|
|
- String filePath = String.format(CacheUtil.basePath+OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId) ;
|
|
|
- String ossPath = String.format(OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId +"/"+dictFileId +".zip") ;
|
|
|
- ShellUtil.yunDownload(sceneObjPath,filePath);
|
|
|
- ShellUtil.zip(dictFileId+".zip",filePath+"/"+foName);
|
|
|
- ShellUtil.yunUpload(filePath +"/"+foName +"/"+dictFileId +".zip",ossPath);
|
|
|
- FileUtil.del(filePath);
|
|
|
-
|
|
|
- String downUrl = queryPath + ossPath;
|
|
|
- dictFileService.setDownUrl(dictFileId,downUrl,0);
|
|
|
-
|
|
|
- return ResultData.ok(downUrl);
|
|
|
+ return ResultData.ok(commonUpload.getSourceFile());
|
|
|
}
|
|
|
|
|
|
@GetMapping("/downHash")
|