diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index c2994b01..6269d63d 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/upfile/web/UpfileWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/upfile/web/UpfileWeb.java index fa77eb9c..98ccfefd 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/upfile/web/UpfileWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/upfile/web/UpfileWeb.java @@ -509,28 +509,61 @@ 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()); - if (!targetFile.exists()) { - targetFile.createNewFile(); - } - OutputStream out = new FileOutputStream(targetFile); - InputStream in = DCUtil.decryptFile(dcContext); - if (in == null) { - String msg = "+ dcContext.getFileName() + "; - if (dcContext.getDCMessage() != null) { - msg = dcContext.getDCMessage().getMessage(); + + 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(); } - return ResponseObject.newErrResponse(msg).toString(); } - try { - IOUtils.copy(in, out); - in.close(); - out.close(); - } finally { - IOUtils.closeQuietly(in); - IOUtils.closeQuietly(out); + + 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(); + } + OutputStream out = new FileOutputStream(targetFile); + InputStream in = DCUtil.decryptFile(dcContext); + if (in == null) { + String msg = "+ dcContext.getFileName() + "; + if (dcContext.getDCMessage() != null) { + msg = dcContext.getDCMessage().getMessage(); + } + return ResponseObject.newErrResponse(msg).toString(); + } + try { + IOUtils.copy(in, out); + in.close(); + out.close(); + } finally { + 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 {