修复5127问题

This commit is contained in:
zhal 2022-08-18 17:49:28 +08:00
parent 30ae2de3be
commit eb6d295f46
4 changed files with 96 additions and 6 deletions

View File

@ -1173,7 +1173,8 @@ public class CoEPALController {
UpfileWeb web = new UpfileWeb(me);
String splitId = params.get("splitId");
String toolbarname=params.get("toolbarname");
return web.readZipFileDownLoad(splitId,toolbarname);
String taskId=params.get("taskIdParams");
return web.readZipFileDownLoad(splitId,toolbarname,taskId);
}

View File

@ -415,7 +415,7 @@ public class UpfileWeb extends ActionWeb {
* @return
* @author zhaolei
*/
public String readZipFileDownLoad(String splitId,String toolbarname) throws Exception {
public String readZipFileDownLoad(String splitId,String toolbarname,String taskId) throws Exception {
UserContext me = super.getContext();
ResponseObject ro = ResponseObject.newOkResponse();
UpFileDao upfileDao = new UpFileDao();
@ -459,6 +459,72 @@ public class UpfileWeb extends ActionWeb {
}
}
if (UtilString.isNotEmpty(taskId)) {
OutputTaskModel model = new OutputTask().getTaskReportById(taskId);
if (model != null) {
try {
UtilFile file = OutputAPIManager.getInstance().getFilePath(model.getWsId(), taskId, model.getProfileId());
if (file.exists()) {
File[] fileList = file.listFiles();
if (fileList.length > 0) {
File docFile = null;
for (File file2 : fileList) {
if (file2.isFile() && "doc".equals((file2.getName().substring(file2.getName().lastIndexOf(".") + 1)))) {
docFile = file2;
break;
}
}
if (docFile == null) {
return ResponseObject.newErrResponse("没有找到文件").toString();
}
String sourceAppId = "com.awspaas.user.apps.coe.pal.output.bd";
String filename = docFile.getName();
DCContext sourceDc = new DCContext(_uc, DCProfileManager.getDCProfile(sourceAppId, "output"), sourceAppId, model.getWsId(), taskId, filename);
File targetFile = new File(targetDir + filename);
if (!targetFile.exists()) {
targetFile.createNewFile();
}
OutputStream out = new FileOutputStream(targetFile);
InputStream in = DCUtil.decryptFile(sourceDc);
if (in == null) {
String msg = "+ dcContext.getFileName() + ";
if (sourceDc.getDCMessage() != null) {
msg = sourceDc.getDCMessage().getMessage();
}
return ResponseObject.newErrResponse(msg).toString();
}
try {
IOUtils.copy(in, out);
in.close();
out.close();
} finally {
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
}
}
}
} catch (Exception e) {
e.printStackTrace();
return ResponseObject.newErrResponse().toString();
}
}
}
UtilFile.zipCompress(targetDir, new File(targetDir + zipName));
File[] files = targetFileDir.listFiles(new FilenameFilter()

View File

@ -1579,11 +1579,34 @@ function changeArributeByShape() {
}
function ProcessManual(obj) {
var manualName;
if(methodId=="data.form"){
manualName="表单手册 :";
}else if (methodId=="process.epc"){
manualName="EPC手册 :";
}else if (methodId=="process.bpmn2"){
manualName="BPMN手册 :";
}else if (methodId=="process.flowchart"){
manualName="泳道手册 :";
}else if (methodId=="process.evc"){
manualName="架构手册 :";
}else if (methodId=="org.normal"){
manualName="组织手册 :";
}else if (methodId=="itsystem.normal"){
manualName="IT系统手册 :";
}else if (methodId=="control.policy"){
manualName="制度手册 :";
}else if (methodId=="control.risk"){
manualName="风险控制手册 :";
}else if(methodId=="control.kpi"){
manualName="流程绩效手册 :";
}
$('#processFileDock').empty();
var t = '';
t += '<table class="awsui-table">';
t += '<tr><td>';
t += '<div class="filetableHeader"><i class="awsui-iconfont" style="color: #999999;margin-top: 2px;">&#xe7cf;</i> 流程手册:</div>';
t += '<div class="filetableHeader"><i class="awsui-iconfont" style="color: #999999;margin-top: 2px;">&#xe7cf;</i>'+manualName+'</div>';
t += '<div class="tablefileContent"><a href="javascript:void(0);" onclick="openOutputFile(\''+ taskId +'\')">'+ fileName +'</a>';
t +='<button id="ProcessManual" type="button" class="awsui-btn awsui-btn-blue awsui-btn-sm">';
t += '<i class="awsui-iconfont" onclick="downloadProcessFile(\''+taskId+'\')">&#xe653;</i>';
@ -1658,7 +1681,8 @@ function downloadZipFile(splitId,toolbarname) {
+ "&cmd=com.actionsoft.apps.coe.pal_outputreport_output_downloadZipfile",
data : {
splitId : splitId,
toolbarname:toolbarname
toolbarname:toolbarname,
taskIdParams:taskId
},
success : function(msg) {
if (msg.result == "ok") {
@ -1722,11 +1746,10 @@ function initUpfileData(obj) {
}
t += '</table>';
var toolbarname=$("#toolbarname").text();
if(splitId.length>0){
splitId=splitId.substring(0,splitId.length-1);
t +='<button id="ProcessManual" type="button" onclick="downloadZipFile(\''+splitId+'\',\''+toolbarname+'\')" class="awsui-btn awsui-btn-blue">';
t +='<button id="ProcessManual" type="button" onclick="downloadZipFile(\''+splitId+'\',\''+toolbarname+'\',\''+taskId+'\')" class="awsui-btn awsui-btn-blue">';
t +='打包下载';
t +='</button>';
}