打包下载增加一层文件夹
This commit is contained in:
parent
40f34e1e1a
commit
de06841ea4
Binary file not shown.
@ -509,7 +509,36 @@ public class UpfileWeb extends ActionWeb {
|
||||
for(String oneuuid:uuidSpilt){
|
||||
UpfileModel upfileModel = upfileDao.get(oneuuid);
|
||||
DCContext dcContext = getDCContext(upfileModel);
|
||||
File targetFile = new File(targetDir + dcContext.getFileName());
|
||||
|
||||
String filemodelName=null;
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId());
|
||||
if (file.exists()) {
|
||||
File[] fileList = file.listFiles();
|
||||
if (fileList.length > 0) {
|
||||
File docFile1 = null;
|
||||
for (File file2 : fileList) {
|
||||
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
|
||||
docFile1 = file2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (docFile1 == null) {
|
||||
return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
filemodelName= docFile1.getName();
|
||||
}
|
||||
}
|
||||
|
||||
if(UtilString.isNotEmpty(filemodelName)){
|
||||
filemodelName=filemodelName.substring(0, filemodelName.lastIndexOf("."));
|
||||
//判断文件目录是否存在,不存在则创建
|
||||
String bdir=targetDir + File.separator+filemodelName+"_file"+File.separator;
|
||||
File targetFile1 = new File(bdir);
|
||||
if (!targetFile1.exists()) {
|
||||
targetFile1.mkdirs();
|
||||
}
|
||||
File targetFile = new File(bdir + dcContext.getFileName());
|
||||
if (!targetFile.exists()) {
|
||||
targetFile.createNewFile();
|
||||
}
|
||||
@ -530,6 +559,10 @@ public class UpfileWeb extends ActionWeb {
|
||||
IOUtils.closeQuietly(in);
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
}else{
|
||||
return ResponseObject.newErrResponse("没有找到文件").toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -538,7 +571,6 @@ public class UpfileWeb extends ActionWeb {
|
||||
|
||||
//流程手册打包
|
||||
if (UtilString.isNotEmpty(taskId)) {
|
||||
|
||||
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
|
||||
if (model != null) {
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user