|
@@ -79,6 +79,9 @@ public class DictFileController extends BaseController{
|
|
if(dictFile == null){
|
|
if(dictFile == null){
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
}
|
|
}
|
|
|
|
+ if(StringUtils.isNotBlank(dictFile.getDownUrl())){
|
|
|
|
+ return ResultData.ok(dictFile.getDownUrl());
|
|
|
|
+ }
|
|
CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
|
|
CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
|
|
if(commonUpload == null){
|
|
if(commonUpload == null){
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
@@ -102,11 +105,15 @@ public class DictFileController extends BaseController{
|
|
ShellUtil.zip(dictFileId+".zip",filePath);
|
|
ShellUtil.zip(dictFileId+".zip",filePath);
|
|
ShellUtil.yunDownload(filePath +"/"+dictFileId +"zip",ossPath);
|
|
ShellUtil.yunDownload(filePath +"/"+dictFileId +"zip",ossPath);
|
|
FileUtil.del(filePath);
|
|
FileUtil.del(filePath);
|
|
- return ResultData.ok(queryPath + ossPath);
|
|
|
|
|
|
+
|
|
|
|
+ String downUrl = queryPath + ossPath;
|
|
|
|
+ dictFileService.setDownUrl(dictFileId,downUrl,0);
|
|
|
|
+
|
|
|
|
+ return ResultData.ok(downUrl);
|
|
}
|
|
}
|
|
|
|
|
|
- @GetMapping("/downMD5")
|
|
|
|
- public ResultData downMD5(@RequestParam(required = false) Integer dictFileId) {
|
|
|
|
|
|
+ @GetMapping("/downHash")
|
|
|
|
+ public ResultData downHash(@RequestParam(required = false) Integer dictFileId) {
|
|
if(dictFileId == null){
|
|
if(dictFileId == null){
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
@@ -114,6 +121,9 @@ public class DictFileController extends BaseController{
|
|
if(dictFile == null){
|
|
if(dictFile == null){
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
}
|
|
}
|
|
|
|
+ if(StringUtils.isNotBlank(dictFile.getHashUrl())){
|
|
|
|
+ return ResultData.ok(dictFile.getHashUrl());
|
|
|
|
+ }
|
|
CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
|
|
CommonUpload commonUpload = commonUploadService.getById(dictFile.getUploadId());
|
|
if(commonUpload == null){
|
|
if(commonUpload == null){
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
throw new BusinessException(ResultCode.FILE_NOT_EXIST);
|
|
@@ -132,7 +142,7 @@ public class DictFileController extends BaseController{
|
|
}
|
|
}
|
|
fileInfo.setSize(Long.valueOf(commonUpload.getFileSize()));
|
|
fileInfo.setSize(Long.valueOf(commonUpload.getFileSize()));
|
|
String filePath = String.format(CacheUtil.basePath+"/" +OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId) ;
|
|
String filePath = String.format(CacheUtil.basePath+"/" +OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId) ;
|
|
- String ossPath = String.format(OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId) ;
|
|
|
|
|
|
+ String ossPath = String.format(OssPath.MANAGE_FILE_DOWN_PATH ,dictFileId +"/"+ dictFileId + "_hash.txt") ;
|
|
|
|
|
|
File file = new File(filePath +"/"+dictFileId + "_hash.txt");
|
|
File file = new File(filePath +"/"+dictFileId + "_hash.txt");
|
|
|
|
|
|
@@ -142,7 +152,10 @@ public class DictFileController extends BaseController{
|
|
|
|
|
|
FileUtil.del(file);
|
|
FileUtil.del(file);
|
|
|
|
|
|
- return ResultData.ok(queryPath + ossPath);
|
|
|
|
|
|
+ String downUrl = queryPath + ossPath;
|
|
|
|
+ dictFileService.setDownUrl(dictFileId,downUrl,0);
|
|
|
|
+
|
|
|
|
+ return ResultData.ok(downUrl);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|