From 8caacd000099dfa6fccc30990b5ee3d9d06dc297 Mon Sep 17 00:00:00 2001 From: zhal <15900249928@163.com> Date: Mon, 1 Aug 2022 10:50:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=98=85=E8=A7=88=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pal/repository/job/SynchronousOrgJob.java | 11 +- .../pal/repository/upfile/web/UpfileWeb.java | 127 ++++++++++++++++-- ...al.pl.repository.designer.view.portal.html | 9 ++ .../js/designer.extend.link.view.portal.js | 9 +- 4 files changed, 141 insertions(+), 15 deletions(-) diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java index 39bbc04b..6347e45d 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java @@ -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 { 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 1550ac69..808bbaf4 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 @@ -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); - DCContext dcContext = getDCContext(upfileModel); - UtilFile file = new UtilFile(dcContext.getPath()); + //867f064e-de33-4dc6-bbe3-1180fcd389bd + //77cf13f0-8a71-43bb-bbda-fdaecb9af606 + //a355e064-6d45-44a0-a24a-b90270ca9044 - DCUtil.getInstance(); + String uuids="867f064e-de33-4dc6-bbe3-1180fcd389bd,77cf13f0-8a71-43bb-bbda-fdaecb9af606,a355e064-6d45-44a0-a24a-b90270ca9044"; + // 查找对应应用下模版 + List 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); + } + } + } + + 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 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(); + }*/ + + /** * 加载附件 * diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html index 51409c24..ef9f665e 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.view.portal.html @@ -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;} diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js index ec7db182..146ad9f7 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.view.portal.js @@ -1584,7 +1584,7 @@ function ProcessManual(obj) { t += ''; t += '
'; t += '
流程手册:
'; - t += '
'+ fileName +''; + t += '
'+ fileName +''; t +=''; @@ -1684,12 +1684,15 @@ function initUpfileData(obj) { t += '
文件附件:
'; for(var i = 0; i < processFile.length; i++) { var obj = processFile[i]; - t += ''; + t += '
'+ obj.name +''; t +=''; - + t +='
'; } + + + t += '
'; }