From 5421b8af862890dcf187c2ad5ece55423959ba85 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 23 十月 2026 19:27:14 +0800
Subject: [PATCH] feat(bpm): 全部业务审批流改回 BPM,审批统一进入协同办公
---
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/refund/CrmRefundServiceImpl.java | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/refund/CrmRefundServiceImpl.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/refund/CrmRefundServiceImpl.java
index 2d23a94..be2568c 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/refund/CrmRefundServiceImpl.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/refund/CrmRefundServiceImpl.java
@@ -14,6 +14,9 @@
import cn.iocoder.yudao.module.crm.dal.mysql.refund.CrmRefundMapper;
import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum;
+import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
+import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
+import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
import cn.iocoder.yudao.module.system.api.approval.ApprovalConfigApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
@@ -44,6 +47,11 @@
*/
private static final String REFUND_APPROVE_BIZ_TYPE = "refund_approve";
+ /**
+ * CRM 閫�璐瑰崟瀹℃壒鐨� BPM 娴佺▼瀹氫箟 Key
+ */
+ private static final String REFUND_APPROVE_PROCESS_KEY = "refund_approve";
+
@Resource
private CrmRefundMapper refundMapper;
@Resource
@@ -52,6 +60,8 @@
private AdminUserApi adminUserApi;
@Resource
private ApprovalConfigApi approvalConfigApi;
+ @Resource
+ private BpmProcessInstanceApi bpmProcessInstanceApi;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -146,6 +156,12 @@
if (refundMapper.submitAndResetAuditInfo(id, CrmAuditStatusEnum.PROCESS.getStatus()) != 1) {
throw exception(ErrorCodeConstants.CRM_REFUND_SUBMIT_FAIL_NOT_EDITABLE);
}
+
+ // 4. 鍒涘缓 BPM 娴佺▼瀹炰緥锛屼娇瀹℃壒鍑虹幇鍦ㄣ�屽崗鍚屽姙鍏� - 鎴戠殑娴佺▼銆�
+ bpmProcessInstanceApi.createProcessInstance(getLoginUserId(),
+ new BpmProcessInstanceCreateReqDTO()
+ .setProcessDefinitionKey(REFUND_APPROVE_PROCESS_KEY)
+ .setBusinessKey(String.valueOf(id)));
}
@Override
@@ -183,6 +199,25 @@
}
}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void updateRefundAuditStatus(Long id, Integer bpmStatus, String reason) {
+ // BPM 瀹℃壒缁撴灉鏄犲皠涓洪��璐瑰崟瀹℃牳鐘舵�侊細閫氳繃=20 / 涓嶉�氳繃=30 / 鍙栨秷=40
+ Integer auditStatus;
+ if (BpmTaskStatusEnum.APPROVE.getStatus().equals(bpmStatus)) {
+ auditStatus = CrmAuditStatusEnum.APPROVE.getStatus();
+ } else if (BpmTaskStatusEnum.REJECT.getStatus().equals(bpmStatus)) {
+ auditStatus = CrmAuditStatusEnum.REJECT.getStatus();
+ } else if (BpmTaskStatusEnum.CANCEL.getStatus().equals(bpmStatus)) {
+ auditStatus = CrmAuditStatusEnum.CANCEL.getStatus();
+ } else {
+ return;
+ }
+ if (refundMapper.updateAuditStatusByBpm(id, auditStatus, reason) != 1) {
+ log.warn("[updateRefundAuditStatus] 閫�璐瑰崟({}) 涓嶅浜庡鎵逛腑鐘舵�侊紝蹇界暐 BPM 缁撴灉({})", id, bpmStatus);
+ }
+ }
+
private CrmRefundDO validateRefundExists(Long id) {
CrmRefundDO refund = refundMapper.selectById(id);
if (refund == null) {
--
Gitblit v1.9.3