From d798d1df3345332fbd8dc1db5a4109b7c0cf46f0 Mon Sep 17 00:00:00 2001 From: weiyunlong Date: Sun, 24 Nov 2024 11:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E7=9C=BC=E6=9F=A5=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E5=8F=98=E6=9B=B4=E4=BC=98=E5=8C=96,=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repc/recon/formplugin/TestFormPlugin.java | 24 +++++++ .../repc/recon/opplugin/TestOPPlugin.java | 2 + .../formplugin/SupplierChangeFormPlugin.java | 62 +++++++++++++++++++ .../todotask/todoZyTaskServiceHandler.java | 29 +++++---- main/java/shkd/utils/OAUtils.java | 12 ++-- 5 files changed, 111 insertions(+), 18 deletions(-) create mode 100644 main/java/shkd/repc/recon/formplugin/TestFormPlugin.java create mode 100644 main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java diff --git a/main/java/shkd/repc/recon/formplugin/TestFormPlugin.java b/main/java/shkd/repc/recon/formplugin/TestFormPlugin.java new file mode 100644 index 0000000..8bc94e1 --- /dev/null +++ b/main/java/shkd/repc/recon/formplugin/TestFormPlugin.java @@ -0,0 +1,24 @@ +package shkd.repc.recon.formplugin; + +import kd.bos.bill.BillShowParameter; +import kd.bos.form.ShowType; +import kd.bos.form.events.AfterDoOperationEventArgs; +import kd.bos.form.plugin.AbstractFormPlugin; + +public class TestFormPlugin extends AbstractFormPlugin { + + @Override + public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { + super.afterDoOperation(afterDoOperationEventArgs); + + String operateKey = afterDoOperationEventArgs.getOperateKey(); + if ("testoperate".equals(operateKey)) { + BillShowParameter billShowParameter = new BillShowParameter(); + billShowParameter.setFormId("recos_conplan");// 合约规划 + billShowParameter.getOpenStyle().setShowType(ShowType.Modal); + billShowParameter.getOpenStyle().setTargetKey("tabap"); + this.getView().showForm(billShowParameter); + } + + } +} diff --git a/main/java/shkd/repc/recon/opplugin/TestOPPlugin.java b/main/java/shkd/repc/recon/opplugin/TestOPPlugin.java index db6660f..9ad9b36 100644 --- a/main/java/shkd/repc/recon/opplugin/TestOPPlugin.java +++ b/main/java/shkd/repc/recon/opplugin/TestOPPlugin.java @@ -2,10 +2,12 @@ package shkd.repc.recon.opplugin; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import kd.bos.bill.BillShowParameter; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.form.ShowType; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; diff --git a/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java b/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java new file mode 100644 index 0000000..fa14bf9 --- /dev/null +++ b/main/java/shkd/repc/resm/formplugin/SupplierChangeFormPlugin.java @@ -0,0 +1,62 @@ +package shkd.repc.resm.formplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; + +import java.util.EventObject; + +/** + * 供应商变更 + * qeug_resm_change_supp_ext + */ +public class SupplierChangeFormPlugin extends AbstractFormPlugin { + + @Override + public void afterCreateNewData(EventObject e) { + super.afterCreateNewData(e); + + + } + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + + DynamicObject dataEntity = this.getView().getModel().getDataEntity(); + DynamicObject supplier = dataEntity.getDynamicObject("supplier"); + if (supplier == null || dataEntity.getBoolean("qeug_iscarry")) { + return; + } + QFilter q1 = new QFilter("id", QCP.equals, supplier.getLong("id")); + supplier = BusinessDataServiceHelper.loadSingle("resm_official_supplier", new QFilter[]{q1}); + //正式供应商 + if (null != supplier) { + /** + * 基本信息核对 qeug_infocheckentry + */ + DynamicObjectCollection qeugInfocheckentry = supplier.getDynamicObjectCollection("qeug_infocheckentry"); + DynamicObjectCollection qeugInfocheckentry1 = dataEntity.getDynamicObjectCollection("qeug_infocheckentry"); + qeugInfocheckentry1.clear(); + if (null != qeugInfocheckentry) { + for (int i = 0; i < qeugInfocheckentry.size(); i++) { + DynamicObject qeugInfocheckentry_item = qeugInfocheckentry.get(i); + DynamicObject add = qeugInfocheckentry1.addNew(); + getModel().setValue("qeug_bsfieldname", qeugInfocheckentry_item.getString("qeug_bsfieldname"),i); + getModel().setValue("qeug_bsfield", qeugInfocheckentry_item.getString("qeug_bsfield"),i); + getModel().setValue("qeug_apifield", qeugInfocheckentry_item.getString("qeug_apifield"),i); + getModel().setValue("qeug_bsinput", qeugInfocheckentry_item.getString("qeug_bsinput"),i); + getModel().setValue("qeug_queryresult", qeugInfocheckentry_item.getString("qeug_queryresult"),i); + getModel().setValue("qeug_issame", qeugInfocheckentry_item.getString("qeug_issame"),i); + } + getModel().setValue("qeug_iscarry",true);//是否携带过比对字段 + this.getView().updateView("qeug_iscarry"); + this.getView().updateView("qeug_infocheckentry"); + } + + } + } +} diff --git a/main/java/shkd/todotask/todoZyTaskServiceHandler.java b/main/java/shkd/todotask/todoZyTaskServiceHandler.java index 4ffcafc..c33266d 100644 --- a/main/java/shkd/todotask/todoZyTaskServiceHandler.java +++ b/main/java/shkd/todotask/todoZyTaskServiceHandler.java @@ -5,6 +5,7 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.util.StringUtils; import kd.bos.workflow.engine.impl.persistence.entity.operationlog.OperationLogEntity; import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler; @@ -217,6 +218,10 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler { //JSONObject.parseObject(String.valueOf(message.getParams().get("messageContext"))); Map params = message.getParams(); + + Long userId = UserServiceHelper.getCurrentUserId(); + DynamicObject bos_user = BusinessDataServiceHelper.loadSingle(userId, "bos_user"); + String username = bos_user.getString("username"); String billNo = ""; Long taskId = 0L; if (params != null) { @@ -241,23 +246,23 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler { List approvers = new ArrayList<>(); List userIds = message.getUserIds(); // 审批人ID集合 List approversLists = getApprovers(userIds, approvers); - //获取任务创建人 // 信息发送人 + //获取任务创建人 // 信息发送人 消息推送不需要创建人 // ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getDecisionType(); - Long startUserId = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getOwnerId(); +// Long startUserId = ServiceFactory.getService(WorkflowService.class).getTaskService().getOperationLogByTaskId(taskId).get(0).getOwnerId(); // Long startUserId = message.getSenderId(); // Long startUserId = messageContext.getStartUserId(); // 审批实例发起人id String startNumber = ""; String startName = ""; - if (null != startUserId) { - DynamicObject startUser = BusinessDataServiceHelper.loadSingle(startUserId, "bos_user"); - if (null != startUser) { - startNumber = startUser.getString("number"); - startName = startUser.getString("name"); - if (!userIds.contains(startUserId)) { - approversLists.add(startUser);//添加发起人到审批人集合_便于后续接口调用(用户绑定接口) - } - } - } +// if (null != startUserId) { +// DynamicObject startUser = BusinessDataServiceHelper.loadSingle(startUserId, "bos_user"); +// if (null != startUser) { +// startNumber = startUser.getString("number"); +// startName = startUser.getString("name"); +// if (!userIds.contains(startUserId)) { +// approversLists.add(startUser);//添加发起人到审批人集合_便于后续接口调用(用户绑定接口) +// } +// } +// } //获取Url String url = message.getContentUrl(); // 链接 String url1 = message.getContentUrl(); // 链接 diff --git a/main/java/shkd/utils/OAUtils.java b/main/java/shkd/utils/OAUtils.java index cbfc203..8c09008 100644 --- a/main/java/shkd/utils/OAUtils.java +++ b/main/java/shkd/utils/OAUtils.java @@ -318,14 +318,14 @@ public class OAUtils { List approversLists = (List)thirdPartyMap.get("approversLists"); for (DynamicObject approver :approversLists ) { JSONObject jsonObject = new JSONObject(); - jsonObject.put("thirdpartyMessageId", String.valueOf(thirdPartyMap.get("taskId")));//第三方待办主键(保证唯一) + jsonObject.put("thirdpartyMessageId", String.valueOf(thirdPartyMap.get("taskId")));//待办主键(保证唯一) jsonObject.put("thirdpartyRegisterCode", "3004");//系统注册编码 jsonObject.put("messageContent", String.valueOf(thirdPartyMap.get("content")) );//消息内容 - jsonObject.put("thirdpartySenderId", String.valueOf(thirdPartyMap.get("startNumber")));//第三方待办发起人主键 -// jsonObject.put("thirdpartySenderId", "jdtest");//todo 第三方待办发起人主键 - jsonObject.put("thirdpartyReceiverId", approver.getString("number"));//第三方待办接收人主键(保证唯一) -// jsonObject.put("thirdpartyReceiverId", "jdtest");//todo 第三方待办接收人主键(保证唯一) - jsonObject.put("creation_date", String.valueOf(thirdPartyMap.get("createDateStr")));//待办创建时间(格式:yyyy-MM-dd HH:mm:ss) + jsonObject.put("thirdpartySenderId", String.valueOf(thirdPartyMap.get("startNumber")));//发起人主键 +// jsonObject.put("thirdpartySenderId", "jdtest");//todo 发起人主键 + jsonObject.put("thirdpartyReceiverId", approver.getString("number"));//接收人主键(保证唯一) +// jsonObject.put("thirdpartyReceiverId", "jdtest");//todo 接收人主键(保证唯一) + jsonObject.put("creation_date", String.valueOf(thirdPartyMap.get("createDateStr")));//创建时间(格式:yyyy-MM-dd HH:mm:ss) jsonObject.put("messageURL", String.valueOf(thirdPartyMap.get("url")));//PC端穿透链接 jsonObject.put("messageH5URL", "test");//移动端穿透链接 messageList.add(jsonObject);