From ed6400380b7fec20beda54303047bfd4cde1e7c0 Mon Sep 17 00:00:00 2001 From: zhal <15900249928@163.com> Date: Sun, 14 Aug 2022 22:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=8F=91=E5=B8=83=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=8F=91=E5=B8=83=E8=A7=92=E8=89=B2/=E7=BB=A9?= =?UTF-8?q?=E6=95=88=E5=9B=BE/=E5=8F=91=E5=B8=83=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6/=E4=BC=B4=E9=9A=8F?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pal/publisher/PublisherController.java | 34 ++++- .../client/web/ProcessPublishWeb.java | 133 ++++++++++++++++++ .../event/PublishFormBeforeSaveEvent.java | 101 +++++++++++++ .../js/coe.pal.process.publish.multiple.js | 54 +++++-- 4 files changed, 313 insertions(+), 9 deletions(-) create mode 100644 com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishFormBeforeSaveEvent.java diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/PublisherController.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/PublisherController.java index 90b9eb16..a29e52ac 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/PublisherController.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/PublisherController.java @@ -552,7 +552,39 @@ public class PublisherController { ProcessPublishWeb web = new ProcessPublishWeb(me); return web.createOutputPrReports(wsId, teamId, uuids); } - + + + /** + * 查询发布流程中支持文件形状属性上传附件 + * @param me + * @param uuids + * @param teamId + * @param wsId + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal.publisher_get_publishFlow_files") + public String getPublishFlowFiles(UserContext me, String uuids, String teamId, String wsId) { + ProcessPublishWeb web = new ProcessPublishWeb(me); + return web.getPublishFlowFiles(wsId, teamId, uuids); + } + + + + /** + * 将关联未发布数据插入发布表中 + * @param me + * @param uuids + * @param teamId + * @param wsId + * @return + */ + @Mapping("com.actionsoft.apps.coe.pal.publisher_get_RelevancyPublish") + public String RelevancyPublish(UserContext me, String uuids, String teamId, String wsId,String bindid) { + ProcessPublishWeb web = new ProcessPublishWeb(me); + return web.RelevancyPublish(wsId, teamId, uuids,bindid); + } + + /** * 查询流程的其他版本并默认查询结果的第一条创建流程手册 * @param me diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index 65f5e313..6ff29907 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -36,9 +36,14 @@ import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel; import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager; import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; +import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; import com.actionsoft.apps.coe.pal.pal.repository.model.CoeProcessLevelAutoBean; import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel; import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; import com.actionsoft.apps.coe.pal.pal.repository.util.RepositoryTreeUtil; import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; import com.actionsoft.apps.coe.pal.publisher.client.dao.PublisherClientDao; @@ -90,6 +95,7 @@ import org.apache.commons.lang.StringUtils; public class ProcessPublishWeb extends ActionWeb { private UserContext _uc; + public ProcessPublishWeb() { } @@ -2573,6 +2579,133 @@ public class ProcessPublishWeb extends ActionWeb { return ro.toString(); } + + /** + * 获取流程节点文件进行判断 + * @param wsId + * @param teamId + * @param uuids + * @return + */ + public String getPublishFlowFiles(String wsId, String teamId, String uuids){ + StringBuilder sb = new StringBuilder(); + ResponseObject ro = ResponseObject.newOkResponse(); + StringBuilder sb1 = new StringBuilder(); + StringBuilder modelsb = new StringBuilder(); + JSONArray array = JSONArray.parseArray(uuids); + if(array.size()==0){ + ro.put("result","error"); + }else{ + for (int i = 0; i < array.size(); i++) { + String uuid = array.getString(i); + // 校验 + PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); + if (model == null) { + throw new AWSException("没有找到文件:" + uuid); + } + PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); + List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, ""); + if (oldPropertyList != null && oldPropertyList.size() > 0) { + for (PALRepositoryPropertyModel propertyModel : oldPropertyList) { + + //获取文件属性中支持文件 + if(propertyModel.getPropertyId().equals("support_files")){ + String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); + String[] splitRelationFileId; + if(relationFileId!=null){ + splitRelationFileId=relationFileId.split(","); + //获取关联表单模型id + List> fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]); + for (Map shape : fileElements) { + String tempShapeId = shape.get("id").toString(); + + UpFileDao dao = new UpFileDao(); + // 文件:根据relationFileId 和 文件类型 查询 + List list2 = dao.search(splitRelationFileId[0], tempShapeId, "s"); + if(list2.size()==0){ + sb.append("模型名称:").append(shape.get("plName")).append("中节点名称:").append("'"+shape.get("name")+"'").append("未上传附件,请检查").append(","); + } + + } + + } + } + + } + } + if (sb.length() > 0) { + sb1=sb.deleteCharAt(sb.length()-1); + ro.put("sb",sb1); + ro.put("result","error"); + } + + } + } + + return ro.toString(); + } + + + /** + * 获取关联表单模型插入流程发布中 + * @param wsId + * @param teamId + * @param uuids + * @return + */ + public String RelevancyPublish(String wsId, String teamId, String uuids,String bindId){ + ResponseObject ro = ResponseObject.newOkResponse(); + JSONArray array = JSONArray.parseArray(uuids); + if(array.size()==0){ + ro.put("result","error"); + }else{ + for (int i = 0; i < array.size(); i++) { + String uuid = array.getString(i); + // 校验 + PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); + if (model == null) { + throw new AWSException("没有找到文件:" + uuid); + } + PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); + List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, ""); + if (oldPropertyList != null && oldPropertyList.size() > 0) { + for (PALRepositoryPropertyModel propertyModel : oldPropertyList) { + + //获取文件属性中支持文件 + if(propertyModel.getPropertyId().equals("support_files")){ + String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); + String[] splitRelationFileId; + if(relationFileId!=null){ + splitRelationFileId=relationFileId.split(","); + RowMap rowMap=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",splitRelationFileId[0]); + String ispublish=rowMap.getString("ISPUBLISH"); + if(ispublish.equals("0")) { + BO bo=new BO(); + bo.set("PUBLISHFILEID", splitRelationFileId[0]); + bo.set("PUBLISHFILENAME", rowMap.getString("PLNAME")); + bo.set("PUBLISHDESC", ""); + bo.set("PROCESSDEFID", bindId); + bo.set("TASKID", ""); + i = SDK.getBOAPI().create("BO_ACT_COE_PUBLISH_N", bo, bindId, _uc.getUID()); + + } + + + } + + } + } + + } + } + + } + return ro.toString(); + } + + + + /** * 查询流程的其他版本并默认查询结果的第一条创建流程手册 * diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishFormBeforeSaveEvent.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishFormBeforeSaveEvent.java new file mode 100644 index 00000000..d5eb771f --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishFormBeforeSaveEvent.java @@ -0,0 +1,101 @@ +package com.actionsoft.apps.coe.pal.publisher.event; + +import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache; +import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao; +import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel; +import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.dao.UpFileDao; +import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel; +import com.actionsoft.apps.coe.pal.publisher.constant.PublisherConstant; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.listener.InterruptListener; +import com.actionsoft.bpms.bpmn.engine.listener.InterruptListenerInterface; +import com.actionsoft.bpms.bpmn.engine.listener.ListenerConst; +import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.exception.AWSException; +import com.actionsoft.exception.BPMNError; +import com.actionsoft.sdk.local.SDK; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.util.List; +import java.util.Map; + +public class PublishFormBeforeSaveEvent extends InterruptListener implements InterruptListenerInterface { + + + @Override + public String getDescription() { + return "发布表单保存前附件校验"; + } + + @Override + public String getVersion() { + return "1.0"; + } + + + @Override + public boolean execute(ProcessExecutionContext param) throws Exception { + + + + + List gridData=SDK.getBOAPI().query(PublisherConstant.BOSUBTABLE_N).bindId(param.getProcessInstance().getId()).list(); + + StringBuilder sb = new StringBuilder(); + StringBuilder sb1 = new StringBuilder(); + if (gridData.size() > 0) { + for (BO rowData : gridData) { + //下面一行示例代码,可以获取Ajax子表的每行记录的新建状态 + String publishfileid = String.valueOf(rowData.getString("PUBLISHFILEID"));//注意:isCreate并不是BO的一个字段,该字段是有接口上层赋值的 + + // 校验 + PALRepositoryModel model = PALRepositoryCache.getCache().get(publishfileid); + if (model == null) { + throw new AWSException("没有找到文件:" + publishfileid); + } + PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); + List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(publishfileid, ""); + if (oldPropertyList != null && oldPropertyList.size() > 0) { + for (PALRepositoryPropertyModel propertyModel : oldPropertyList) { + + //获取文件属性中支持文件 + if (propertyModel.getPropertyId().equals("support_files")) { + String relationFileId = JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); + String[] splitRelationFileId; + if (relationFileId != null) { + splitRelationFileId = relationFileId.split(","); + //获取关联表单模型id + List> fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]); + for (Map shape : fileElements) { + String tempShapeId = shape.get("id").toString(); + + UpFileDao dao = new UpFileDao(); + // 文件:根据relationFileId 和 文件类型 查询 + List list2 = dao.search(splitRelationFileId[0], tempShapeId, "s"); + if (list2.size() == 0) { + sb.append("模型名称:").append(shape.get("plName")).append("中节点名称:").append("'" + shape.get("name") + "'").append("未上传附件,请检查!!!").append(",").append("
"); + } + + } + + } + } + + } + } + if (sb.length() > 0) { + sb1 = sb.deleteCharAt(sb.length() - 1); + throw new BPMNError("0313", sb1.toString()); + } + + } + } + return true; + } + + +} diff --git a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js index 1f7b9ee5..7c972934 100644 --- a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js +++ b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js @@ -403,9 +403,38 @@ function initPublishData(data, type, pageNumber, start){ // 初始化数据 function selectPublishData(data, type, pageNumber, start) { - - //渲染到前台的流程架构L1,L2,L3 + var ids = []; + for (var i = 0; i < data.length; i++) { + var temp = data[i]; + if ((temp.methodId == 'control.policy' || temp.methodId == 'data.form' || temp.methodId.indexOf('process.') > -1) && temp.methodId != 'default') { + ids.push(temp.publishFileId); + } + } + + //校验模型中支持文件附件是否上传 + var param = { + sid : sid, + cmd : "com.actionsoft.apps.coe.pal.publisher_get_publishFlow_files", + wsId: wsId, + uuids: JSON.stringify(ids) + } + $.ajax({ + url : "./jd", + type : "POST", + data : param, + success : function(r) { + if (r.result == 'ok') { + if(r.data.result=='error'){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert(r.data.sb,"error",3000); + return; + } + + } + } + }); + var param = { cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', @@ -744,6 +773,8 @@ function addProcess(type) { $.simpleAlert('请选择创建流程手册的时间', 'info'); return; } + + disabledButton(); setTimeout(function() { // 获取说明内容 @@ -899,6 +930,10 @@ function initChangedData(changeFileId) { var selectedTaskId = ""; selectedTaskId = createReport(changeTemp[i].category, changeTemp[i].methodId, selectedId, selectedTaskId); + + + + // 更新数据 changeTemp[i].changedFileIdNew = selectedId; changeTemp[i].changedFileNameNew = changeTemp[i].targetFiles[j].text; @@ -1240,7 +1275,6 @@ function getStopBatchResult(type) { // 获取已有的流程手册 function queryBatchReport(data) { - debugger; var ids = []; for (var i = 0; i < data.length; i++) { var temp = data[i]; @@ -1302,6 +1336,11 @@ function createReport(category, method, uuid, taskId) { return taskId; } + + + + + // 批量创建流程手册 function createBatchReport(data, createTime) { var ids = []; @@ -1320,6 +1359,10 @@ function createBatchReport(data, createTime) { } return data; } + + + + var param = { sid : sid, cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_reports_create", @@ -1387,7 +1430,6 @@ function getOutputName(category, method) { //单个流程立即创建流程手册 function quickCreateReport(obj, object, type) { - debugger; var taskId; var category = obj.category; var method = obj.methodId; @@ -1414,7 +1456,6 @@ function quickCreateReport(obj, object, type) { $(object).text(targetFileName); } }else{ - debugger; //更新数据记录 if (type == 'new') { var fileName = obj.publishFileName + ' V' + obj.fileVersion + '-' + getOutputName(category, method); @@ -1845,7 +1886,6 @@ function formSave(isTransact){ $.simpleAlert('发布内容不能为空', 'info'); return false; } - debugger; var index = 0; if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) { index++; @@ -2269,9 +2309,7 @@ function downloadReport(uuid, taskId) { uuid: uuid }, success : function(r) { - debugger; if (r.result == "ok") { - debugger; window.open (r.data.url); } else {