|
@@ -101,7 +101,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
|
|
throw new BusinessException(ResultCode.FILE_TYPE_ERROR2);
|
|
}
|
|
}
|
|
String format = extName.replace(".", "");
|
|
String format = extName.replace(".", "");
|
|
- CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId);
|
|
|
|
|
|
+ CommonUpload commonUpload = commonUploadService.add(originalFilename.replace(extName, ""), url, String.valueOf(file.getSize()), uuid, fileTypeEnum, format,format,1,null,dictId,null);
|
|
return ResultData.ok(commonUpload);
|
|
return ResultData.ok(commonUpload);
|
|
}catch ( BusinessException e){
|
|
}catch ( BusinessException e){
|
|
log.info("upload-file-error:{}",e);
|
|
log.info("upload-file-error:{}",e);
|
|
@@ -121,7 +121,10 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
try {
|
|
try {
|
|
Long fileSize = file.length();
|
|
Long fileSize = file.length();
|
|
String ossZipPath = String.format(OssPath.MANAGE_MODEL_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
|
|
String ossZipPath = String.format(OssPath.MANAGE_MODEL_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
|
|
|
|
+ String sourcePath = String.format(OssPath.MANAGE_SOURCE_FILE_PATH, UUID.randomUUID().toString().replace("-", ""));
|
|
String unzipPath = CacheUtil.basePath + ossZipPath;
|
|
String unzipPath = CacheUtil.basePath + ossZipPath;
|
|
|
|
+ ShellUtil.yunUpload(file.getPath(),sourcePath);
|
|
|
|
+
|
|
ShellUtil.unZip(file.getPath(),unzipPath);
|
|
ShellUtil.unZip(file.getPath(),unzipPath);
|
|
|
|
|
|
//FileUtil.copyContent(file,new File(unzipPath),true);
|
|
//FileUtil.copyContent(file,new File(unzipPath),true);
|
|
@@ -171,19 +174,20 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
case "b3dm" : url = uploadB3dm(unzipPath,modelFile); break;
|
|
case "b3dm" : url = uploadB3dm(unzipPath,modelFile); break;
|
|
case "las" :
|
|
case "las" :
|
|
case "ply" : url = uploadLasOrPly(unzipPath,modelFile);break;
|
|
case "ply" : url = uploadLasOrPly(unzipPath,modelFile);break;
|
|
- case "osgb":
|
|
|
|
- resultFormat = "b3dm";
|
|
|
|
|
|
+ case "osgb": resultFormat = "b3dm";
|
|
|
|
+
|
|
break;
|
|
break;
|
|
default: break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
|
|
Integer status = StringUtils.isNotBlank(url) ?1:-1;
|
|
Integer status = StringUtils.isNotBlank(url) ?1:-1;
|
|
url = StringUtils.isNotBlank(url) ?ossUrlPrefix + url:null;
|
|
url = StringUtils.isNotBlank(url) ?ossUrlPrefix + url:null;
|
|
|
|
+ sourcePath = StringUtils.isNotBlank(sourcePath) ?ossUrlPrefix + sourcePath:null;
|
|
CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(fileSize),
|
|
CommonUpload commonUpload = commonUploadService.add(oldName,url, String.valueOf(fileSize),
|
|
- null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId);
|
|
|
|
|
|
+ null, fileTypeEnum, modelFileFormat,resultFormat,status,unZipFile.getPath(),dictId,sourcePath);
|
|
if("osgb".equals(modelFileFormat)){
|
|
if("osgb".equals(modelFileFormat)){
|
|
- //commonUploadService.updateStatus(commonUpload.getId(),0);
|
|
|
|
uploadOsgb(commonUpload.getId()) ;
|
|
uploadOsgb(commonUpload.getId()) ;
|
|
|
|
+ commonUpload = commonUploadService.getById(commonUpload.getId());
|
|
}
|
|
}
|
|
return ResultData.ok(commonUpload);
|
|
return ResultData.ok(commonUpload);
|
|
} catch (BusinessException e){
|
|
} catch (BusinessException e){
|
|
@@ -264,7 +268,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public CommonUpload add(String fileName, String url, String fileSize, String uuid, FileTypeEnum fileTypeEnum, String resultFormat,String replace1, Integer status, String unzipPath, Integer dictId) {
|
|
|
|
|
|
+ public CommonUpload add(String fileName, String url, String fileSize, String uuid, FileTypeEnum fileTypeEnum, String resultFormat,String replace1, Integer status, String unzipPath, Integer dictId,String sourcePath) {
|
|
CommonUpload upload = new CommonUpload();
|
|
CommonUpload upload = new CommonUpload();
|
|
upload.setFileName(fileName);
|
|
upload.setFileName(fileName);
|
|
upload.setFileUrl(url);
|
|
upload.setFileUrl(url);
|
|
@@ -275,6 +279,7 @@ public class CommonUploadServiceImpl extends ServiceImpl<ICommonUploadMapper, Co
|
|
upload.setFileFormat(resultFormat);
|
|
upload.setFileFormat(resultFormat);
|
|
upload.setResultFileFormat(replace1);
|
|
upload.setResultFileFormat(replace1);
|
|
upload.setStatus(status);
|
|
upload.setStatus(status);
|
|
|
|
+ upload.setSourceFile(sourcePath);
|
|
upload.setUnzipPath(unzipPath);
|
|
upload.setUnzipPath(unzipPath);
|
|
if("osgb".equals(resultFormat)){
|
|
if("osgb".equals(resultFormat)){
|
|
upload.setConvertType(1);
|
|
upload.setConvertType(1);
|