流程阅览下载功能

This commit is contained in:
zhal 2022-08-01 10:50:07 +08:00
parent b025ed00f0
commit 8caacd0000
4 changed files with 141 additions and 15 deletions

View File

@ -48,7 +48,6 @@ public class SynchronousOrgJob implements IJob {
String wsIdParams = SDK.getJobAPI().getJobParameter(jobExecutionContext);
wsId = wsIdParams;
//先执行新建操作产生plid
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
String parentId = "process";
@ -59,8 +58,14 @@ public class SynchronousOrgJob implements IJob {
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String modeldefaultId = Createfolder(orderIndex);
//判断如果methodID为角色图则创建到对应角色模型文件夹中
String modeldefaultId;
RowMap rowMaprole=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLNAME='岗位模型' and PLCATEGORY='org'");
if(rowMaprole==null){
modeldefaultId = Createfolder(orderIndex);
}else{
modeldefaultId=rowMaprole.getString("id");
}
Connection open = DBSql.open();
try {

View File

@ -23,6 +23,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.cache.Design
import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.DesignerShapeRelationModel;
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.coe.pal.util.HighSecurityUtil;
import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.org.model.UserModel;
import com.actionsoft.bpms.server.DispatcherRequest;
import com.alibaba.fastjson.JSON;
@ -418,26 +419,134 @@ public class UpfileWeb extends ActionWeb {
UserContext me = super.getContext();
ResponseObject ro = ResponseObject.newOkResponse();
UpFileDao upfileDao = new UpFileDao();
UpfileModel upfileModel = upfileDao.get(uuid);
//867f064e-de33-4dc6-bbe3-1180fcd389bd
//77cf13f0-8a71-43bb-bbda-fdaecb9af606
//a355e064-6d45-44a0-a24a-b90270ca9044
String uuids="867f064e-de33-4dc6-bbe3-1180fcd389bd,77cf13f0-8a71-43bb-bbda-fdaecb9af606,a355e064-6d45-44a0-a24a-b90270ca9044";
// 查找对应应用下模版
List<UtilFile> files = new ArrayList<>();
String[] uuidSpilt=uuids.split(",");
if(uuidSpilt.length>0){
for(String oneuuid:uuidSpilt){
UpfileModel upfileModel = upfileDao.get(oneuuid);
DCContext dcContext = getDCContext(upfileModel);
UtilFile file = new UtilFile(dcContext.getPath());
if (file.exists()) {
files.add(file);
}
}
}
DCUtil.getInstance();
String outputAppId = CoEConstant.APP_ID;
String groupValue = "outputZipFile";
String dirName = files.get(0).getName();
dirName = dirName.substring(0, dirName.lastIndexOf("."));
String fileValue = "download" + System.currentTimeMillis();
DCContext dcContext = DCUtil.createTempFileContext(outputAppId, groupValue, fileValue, null);
try {
for (UtilFile sourceFile : files) {
UtilFile.copyFile(sourceFile, new UtilFile(dcContext.getPath() + File.separator + sourceFile.getName()));
}
// 创建压缩包
DCContext dcContext2 = DCUtil.createTempFileContext(outputAppId, groupValue, fileValue + "_zip", "zip");
dcContext2.setFileName(dirName+ ".zip");
File ff = new File(dcContext2.getFilePath());
File f = new File(dcContext.getPath());
UtilFile.zipCompress(f.getPath(), ff);
dcContext2.setSession(_uc);
ro = ResponseObject.newOkResponse();
ro.put("url",dcContext2.getDownloadURL());
return ro.toString();
} catch (Exception e) {
e.printStackTrace();
}
/*DCUtil.getInstance();
dcContext = DCUtil.createTempFileContext("com.actionsoft.apps.coe.pal", "output", uuid, "zip");
dcContext.setFileName("xxx.zip");
File ff = new File(dcContext.getFilePath());
UtilFile.zipCompressExcludeName(file.getPath(), ff, "log,**/config.txt");
dcContext.setSession(_uc);
File ff = new File(dcContext.getFilePath());*/
//UtilFile.zipCompressExcludeName(file.getPath(), ff, "log,**/config.txt");
/*dcContext.setSession(_uc);*/
String downUrl=SDK.getConfAPI().getPortalUrl() + "/r/" + dcContext.getDownloadURL().replace("./", "");
/*String downUrl=SDK.getConfAPI().getPortalUrl() + "/r/" + dcContext.getDownloadURL().replace("./", "");
ro.put("url",downUrl);
return ro.toString();
return ro.toString();*/
return ResponseObject.newErrResponse("下载失败").toString();
}
/**
* 流程报告模版下载
* @param appId
* @param templates
* @return
*/
/*public String downloadOutPutReportTemplates(String appId, String templates) {
ResponseObject checkRo = checkAppStatus(appId);
if (checkRo.isErr()) {
return checkRo.toString();
}
AppContext appContext = SDK.getAppAPI().getAppContext(appId);
String path = appContext.getPath();
String msg = "模型为空无法下载,请联系系统管理员";
if (UtilString.isEmpty(templates)) {
return ResponseObject.newErrResponse(msg).toString();
}
ResponseObject ro = null;
// 查找对应应用下模版
List<UtilFile> files = new ArrayList<>();
JSONArray templatesArr = JSONArray.parseArray(templates);
if (templatesArr == null || templatesArr.size() == 0) {
return ResponseObject.newErrResponse(msg).toString();
}
for (Object object : templatesArr) {
String template = (String) object;
if (UtilString.isEmpty(template)) {
return ResponseObject.newErrResponse(msg).toString();
}
UtilFile file = new UtilFile(path + File.separator + template);
if (file.exists()) {
files.add(file);
}
}
String outputAppId = CoEConstant.APP_ID;
String groupValue = "outputTemplate";
String dirName = files.get(0).getName();
dirName = dirName.substring(0, dirName.lastIndexOf("."));
String fileValue = "download" + System.currentTimeMillis();
DCContext dcContext = DCUtil.createTempFileContext(outputAppId, groupValue, fileValue, null);
try {
for (UtilFile sourceFile : files) {
UtilFile.copyFile(sourceFile, new UtilFile(dcContext.getPath() + File.separator + sourceFile.getName()));
}
// 创建压缩包
DCContext dcContext2 = DCUtil.createTempFileContext(outputAppId, groupValue, fileValue + "_zip", "zip");
dcContext2.setFileName(dirName+ ".zip");
File ff = new File(dcContext2.getFilePath());
File f = new File(dcContext.getPath());
UtilFile.zipCompress(f.getPath(), ff);
dcContext2.setSession(_uc);
ro = ResponseObject.newOkResponse();
JSONObject json = new JSONObject();
json.put("url", dcContext2.getDownloadURL());
ro.setData(json);
return ro.toString();
} catch (Exception e) {
e.printStackTrace();
}
return ResponseObject.newErrResponse("下载失败").toString();
}*/
/**
* 加载附件
*

View File

@ -814,6 +814,15 @@
.awsui-table-bordered td{border:0!important;}
.awsui-table-bordered{border:0!important;line-height: 20px;}
.tableContent{padding:5px 0!important; }
.tablefileContent{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
width:200px;
}
.tableleft{float:left; width:38%;}
.tableright{width:59%;padding-left:2%!important; float: left}
#designer_canvas{background: none!important;}

View File

@ -1584,7 +1584,7 @@ function ProcessManual(obj) {
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="tableContents"><a href="javascript:void(0);" onclick="openOutputFile(\''+ taskId +'\')">'+ fileName +'</a>';
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>';
t +='</button>';
@ -1684,12 +1684,15 @@ function initUpfileData(obj) {
t += '<div class="filetableHeader"><i class="awsui-iconfont" style="color: #999999;margin-top: 2px;">&#xe7cf;</i> 文件附件:</div>';
for(var i = 0; i < processFile.length; i++) {
var obj = processFile[i];
t += '<div class="tableContent"><a href="javascript:void(0);" onclick="readFile(\''+ obj.id +'\')">'+ obj.name +'</a></div>';
t += '<div class="tablefileContent"><a href="javascript:void(0);" onclick="readFile(\''+ obj.id +'\')">'+ obj.name +'</a>';
t +='<button id="ProcessManual" type="button" class="awsui-btn awsui-btn-blue awsui-btn-sm">';
t += '<i class="awsui-iconfont" onclick="downloadZipFile(\''+obj.id+'\')">&#xe653;</i>';
t +='</button>';
t +='</div>';
}
t += '</td></tr></table>';
}