diff --git a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar index 6e52c121..f75de4b6 100644 Binary files a/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar and b/com.actionsoft.apps.coe.pal.publisher/lib/com.actionsoft.apps.coe.pal.publisher.jar differ 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 c811c82a..3f07891e 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 @@ -17,6 +17,7 @@ import com.actionsoft.bpms.server.bind.annotation.Controller; import com.actionsoft.bpms.server.bind.annotation.Mapping; import com.actionsoft.bpms.server.conf.server.AWSServerConf; import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.PlatformAPI; import com.actionsoft.sdk.local.api.PortalAPI; import java.util.HashMap; @@ -978,4 +979,11 @@ public class PublisherController { ProcessPublishWeb web = new ProcessPublishWeb(me); return web.getHistoryRelatedName(plId); } + + @Mapping("com.actionsoft.apps.coe.pal.publisher.updatePublishBOData") + public String updatePublishBOData(UserContext me,String processInstId) { + ProcessPublishWeb web = new ProcessPublishWeb(me); + return web.updatePublishBOData(me,processInstId); + } + } \ No newline at end of file diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/BoCopyUtil.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/BoCopyUtil.java new file mode 100644 index 00000000..ed2a575f --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/util/BoCopyUtil.java @@ -0,0 +1,77 @@ +package com.actionsoft.apps.coe.pal.publisher.client.util; + +import com.actionsoft.bpms.bo.design.cache.BOCache; +import com.actionsoft.bpms.bo.design.model.BOItemModel; +import com.actionsoft.bpms.bo.design.model.BOModel; +import com.actionsoft.bpms.bo.engine.BO; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import java.util.List; + +/** + * @Author: yujh + * @Date: 2023/12/12/10:42 + * @Description: 数据复制工具类 + */ +public class BoCopyUtil { + + /** + * + * @param fromBo 源BO数据 + * @param toBo 目标BO + * @param fromBoName 源BO表名称 + */ + public static void copy(BO fromBo, BO toBo, String fromBoName) { + BOModel boModel = BOCache.getInstance().getModelByEntityName(fromBoName); + List items = boModel.getBoItems(); + for(BOItemModel item : items) { + String itemName = item.getName(); + Object fromItem = fromBo.get(itemName); + if(null != fromItem) { + toBo.set(itemName, fromItem); + } + } + } + + /** + * + * @param fromJson 源BO数据JSON + * @param toBo 目标BO + * @param fromBoName 源BO表名称 + */ + public static void copy(JSONObject fromJson, BO toBo, String fromBoName) { + BOModel boModel = BOCache.getInstance().getModelByEntityName(fromBoName); + List items = boModel.getBoItems(); + for(BOItemModel item : items) { + String itemName = item.getName(); + Object fromItem = fromJson.get(itemName); + if(null != fromItem) { + toBo.set(itemName, fromItem); + } + } + } + + /** + * 批量copy + * @param fromArray + * @param toBoList + * @param fromBoName + */ + public static void copy(JSONArray fromArray, List toBoList, String fromBoName) { + BOModel boModel = BOCache.getInstance().getModelByEntityName(fromBoName); + List items = boModel.getBoItems(); + for (Object o : fromArray) { + BO toBo =new BO(); + JSONObject fromJson = JSONObject.parseObject(o.toString()); + for(BOItemModel item : items) { + String itemName = item.getName(); + Object fromItem = fromJson.get(itemName); + if(null != fromItem) { + toBo.set(itemName, fromItem); + } + } + toBoList.add(toBo); + } + + } +} 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 77fa5149..69927eea 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 @@ -17,6 +17,8 @@ import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory import com.actionsoft.apps.coe.pal.publisher.constant.FilePermConstant; import com.actionsoft.bpms.commons.login.constant.LoginConst; import com.actionsoft.bpms.server.SSOUtil; +import com.actionsoft.sdk.local.api.BOCopyAPI; +import com.actionsoft.sdk.local.api.BOQueryAPI; import org.apache.commons.lang.StringUtils; import com.actionsoft.apps.coe.pal.constant.CoEConstant; @@ -5358,4 +5360,33 @@ public class ProcessPublishWeb extends ActionWeb { return ro.toString(); } + + /** + * 修改发布流程数据 + * @param me + * @param processInstId + * @return + */ + public String updatePublishBOData(UserContext me,String processInstId){ + + ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_e2c34a123cbb413cae82b0ce1e637088", me.getUID(), "发起的发布流程数据修改流程"); + SDK.getProcessAPI().start(processInstance); + // 首先查询源表的数据,查询条件请自行定义 + BOQueryAPI query = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH", true).addQuery("BINDID=", processInstId); + // 指定将要复制到新的bo表以及流程实例ID + BOCopyAPI copyAPI = query.copyTo("BO_ACT_PUBLISH_DATA", processInstance.getId()); + + copyAPI.addNewData("PUBLISHBINDID", processInstId); + + // 执行复制操作 + copyAPI.exec(); + + String portalUrl = SDK.getPortalAPI().getPortalUrl(); + + return SDK.getFormAPI().getFormURL(portalUrl,me.getSessionId(),processInstance.getId(),"",1,"ef5eccc9-fc7c-4a64-85e5-cb51bb4ae148","",""); + + } + + + } \ No newline at end of file diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishUpdateDataProcessAfterCompleteEvent.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishUpdateDataProcessAfterCompleteEvent.java new file mode 100644 index 00000000..1644f986 --- /dev/null +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/PublishUpdateDataProcessAfterCompleteEvent.java @@ -0,0 +1,36 @@ +package com.actionsoft.apps.coe.pal.publisher.event; + +import com.actionsoft.apps.coe.pal.publisher.client.util.BoCopyUtil; +import com.actionsoft.bpms.bo.engine.BO; +import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext; +import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener; +import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListenerInterface; +import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance; +import com.actionsoft.sdk.local.SDK; +import com.actionsoft.sdk.local.api.BOCopyAPI; +import com.actionsoft.sdk.local.api.BOQueryAPI; + +public class PublishUpdateDataProcessAfterCompleteEvent extends ExecuteListener implements ExecuteListenerInterface { + + public String getDescription() { + return "修改表单流程结束后更新到发布申请流程"; + } + + + @Override + public void execute(ProcessExecutionContext pro) throws Exception { + + + BO publishData=pro.getBO("BO_ACT_PUBLISH_DATA"); + + String bindid=pro.getProcessInstance().getId(); + + BO publishBo=SDK.getBOAPI().query("BO_ACT_COE_PUBLISH",true).addQuery("BINDID=",publishData.getString("PUBLISHBINDID")).detail(); + + BO publish_data=SDK.getBOAPI().query("BO_ACT_PUBLISH_DATA",true).addQuery("BINDID=",bindid).detail(); + + BoCopyUtil.copy(publish_data,publishBo,"BO_ACT_PUBLISH_DATA"); + + SDK.getBOAPI().update("BO_ACT_COE_PUBLISH",publishBo); + } +} diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java index 3a07fe6e..be1a9a58 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/event/SubFormAfterSave.java @@ -216,7 +216,7 @@ public class SubFormAfterSave extends ExecuteListener { } //保存发布文件的类型到主表 - if ((arr.contains("表单模板") || arr.contains("操作指导") || arr.contains("方案图")) && !arr.contains("制度模型") && !arr.contains("EPC模型") && !arr.contains("泳道图") ) { + if ((arr.contains("表单模板") || arr.contains("操作指导") ) && !arr.contains("制度模型") && !arr.contains("EPC模型") && !arr.contains("泳道图") ) { int coumt=DBSql.update("UPDATE BO_ACT_COE_PUBLISH SET RELEASE_THE_TITLE='操作指导/表单模板',SECONDARY_AUDIT_REQUIRED='N',LEVEL_1_AUDIT_REQUIRED='N' WHERE BINDID='" + processInstId + "'"); //SDK.getBOAPI().updateByBindId("BO_ACT_COE_PUBLISH", processInstId, "RELEASE_THE_TITLE", "操作指导/表单模板"); } else {