|
|
@@ -194,7 +194,8 @@ public class CaseDownService {
|
|
|
|
|
|
List<CaseFiles> files = caseFilesService.allList(caseId, 6);
|
|
|
for (CaseFiles file : files) {
|
|
|
- downResource(file.getFilesUrl(),casePath);
|
|
|
+ //downResource(file.getFilesUrl(),casePath);
|
|
|
+ downCaseFiles(file,casePath);
|
|
|
}
|
|
|
jsonObject.put(basePath+String.format(caseFileOtherUrl,caseId), ResultData.ok(files));
|
|
|
|
|
|
@@ -412,23 +413,22 @@ public class CaseDownService {
|
|
|
ShellUtil.yunDownload(url,desPath);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- public void downWordByTemplate(Integer caseId,XWPFTemplate template,String name){
|
|
|
- // 指定输出文件的路径
|
|
|
- String outputPath = String.format(FilePath.OFFLINE_RESOURCE_PACKAGE_PATH,caseId) + name;
|
|
|
- File file = new File(outputPath);
|
|
|
- if(!file.getParentFile().exists()){
|
|
|
- file.getParentFile().mkdirs();
|
|
|
+ public void downCaseFiles(CaseFiles caseFiles,String path){
|
|
|
+ if(StringUtils.isBlank(caseFiles.getFilesUrl()) ){
|
|
|
+ return;
|
|
|
}
|
|
|
- try {
|
|
|
- FileOutputStream out = new FileOutputStream(outputPath);
|
|
|
- template.write(out);
|
|
|
- out.close();
|
|
|
- log.info("文档已成功写入到: " + outputPath);
|
|
|
- } catch (Exception e) {
|
|
|
- log.info("写出文档失败:{},{}",caseId,name,e);
|
|
|
+ String url = caseFiles.getFilesUrl().replace(queryPath, "");
|
|
|
+ String desPath = path + "/" + url;
|
|
|
+ log.info("downResource:{}",url);
|
|
|
+ if(!desPath.contains(".")){
|
|
|
+ ShellUtil.yunDownload(url, new File(desPath).getParentFile().getPath());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String filePath = String.format(FilePath.File_OSS_PATH, environment, caseFiles.getFilesId() + "/");
|
|
|
+ if(url.contains(filePath)){
|
|
|
+ ShellUtil.yunDownload(filePath, path +"/" + filePath);
|
|
|
+ return;
|
|
|
}
|
|
|
+ ShellUtil.yunDownload(url,desPath);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|