fix(bpm): 修正业务监听器的流程 key 匹配与空单号防护
- 报工监听器流程 key 由 mes-pro-feedback-audit 改为实际的 mes_pro_feedback_audit
- 请假/调岗/离职/采购入库/发货监听器增加流程 key 或分类过滤,避免其它模块相同 businessKey 误触发状态回写
- 加班/废料销售监听器增加 businessKey 空值保护,避免空单号触发 NumberFormatException
Co-Authored-By: Claude Code <noreply@anthropic.com>
| | |
| | | package cn.iocoder.yudao.module.hrm.service.approval.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.approval.HrmLeaveApplicationDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.mysql.approval.HrmLeaveApplicationMapper; |
| | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // 只处理请假审批分类/流程 key 的事件,避免其它模块相同 businessKey 误触发 |
| | | String approveCode = HrmLeaveApplicationService.APPROVE_CATEGORY_CODE; |
| | | if (!StrUtil.equals(event.getProcessDefinitionKey(), approveCode) |
| | | && !StrUtil.equals(event.getProcessDefinitionCategory(), approveCode)) { |
| | | return; |
| | | } |
| | | // 通过 businessKey 查询请假申请 |
| | | Long applicationId; |
| | | try { |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.approval.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener; |
| | | import cn.iocoder.yudao.module.hrm.enums.HrmAuditStatusEnum; |
| | |
| | | @Resource private HrmOvertimeApplicationService service; |
| | | @Override protected String getProcessDefinitionKey() { return HrmOvertimeApplicationService.BPM_PROCESS_DEFINITION_KEY; } |
| | | @Override protected void onEvent(BpmProcessInstanceStatusEvent event) { |
| | | if (StrUtil.isBlank(event.getBusinessKey())) { |
| | | return; |
| | | } |
| | | Integer status = HrmAuditStatusUtils.convertBpmResultToAuditStatus(event.getStatus()); |
| | | if (status == null) status = HrmAuditStatusEnum.PROCESS.getStatus(); |
| | | service.updateAuditStatus(Long.valueOf(event.getBusinessKey()), status); |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.approval.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.approval.HrmResignationApplicationDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.mysql.approval.HrmResignationApplicationMapper; |
| | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // 只处理离职审批流程/分类的事件,避免其它模块相同 businessKey 误触发 |
| | | if (!StrUtil.equals(event.getProcessDefinitionKey(), HrmResignationApplicationService.BPM_PROCESS_DEFINITION_KEY) |
| | | && !StrUtil.equals(event.getProcessDefinitionCategory(), HrmResignationApplicationService.APPROVE_CATEGORY_CODE)) { |
| | | return; |
| | | } |
| | | // 通过 businessKey 查询离职申请 |
| | | Long applicationId; |
| | | try { |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.approval.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.approval.HrmTransferApplicationDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.mysql.approval.HrmTransferApplicationMapper; |
| | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // 只处理调岗审批分类/流程 key 的事件,避免其它模块相同 businessKey 误触发 |
| | | String approveCode = HrmTransferApplicationService.APPROVE_CATEGORY_CODE; |
| | | if (!StrUtil.equals(event.getProcessDefinitionKey(), approveCode) |
| | | && !StrUtil.equals(event.getProcessDefinitionCategory(), approveCode)) { |
| | | return; |
| | | } |
| | | // 通过 businessKey 查询调岗申请 |
| | | Long applicationId; |
| | | try { |
| | |
| | | /** |
| | | * BPM 生产报工审批流程定义 key |
| | | */ |
| | | private static final String BPM_PROCESS_DEFINITION_KEY = "mes-pro-feedback-audit"; |
| | | private static final String BPM_PROCESS_DEFINITION_KEY = "mes_pro_feedback_audit"; |
| | | |
| | | @Resource |
| | | private MesProFeedbackService feedbackService; |
| | |
| | | package cn.iocoder.yudao.module.mes.service.wm.itemreceipt.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt.MesWmItemReceiptDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.itemreceipt.MesWmItemReceiptMapper; |
| | |
| | | |
| | | @EventListener |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // 只处理采购入库审批分类/流程 key 的事件,避免其它模块相同 businessKey 误触发 |
| | | if (!StrUtil.equals(event.getProcessDefinitionKey(), ITEM_RECEIPT_APPROVE_CATEGORY_CODE) |
| | | && !StrUtil.equals(event.getProcessDefinitionCategory(), ITEM_RECEIPT_APPROVE_CATEGORY_CODE)) { |
| | | return; |
| | | } |
| | | // 1. 解析业务主键 |
| | | Long receiptId; |
| | | try { |
| | |
| | | package cn.iocoder.yudao.module.mes.service.wm.salesnotice.listener; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.salesnotice.MesWmSalesNoticeMapper; |
| | |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // 只处理发货审批分类/流程 key 的事件,避免其它模块相同 businessKey 误触发 |
| | | if (!StrUtil.equals(event.getProcessDefinitionKey(), "sales_delivery_approve") |
| | | && !StrUtil.equals(event.getProcessDefinitionCategory(), "sales_delivery_approve")) { |
| | | return; |
| | | } |
| | | Long noticeId; |
| | | try { |
| | | noticeId = Long.parseLong(event.getBusinessKey()); |
| | |
| | | @Resource private MesWmScrapSaleService service; |
| | | @Override protected String getProcessDefinitionKey() { return MesWmScrapSaleService.PROCESS_KEY; } |
| | | @Override protected void onEvent(BpmProcessInstanceStatusEvent event) { |
| | | if (cn.hutool.core.util.StrUtil.isBlank(event.getBusinessKey())) { |
| | | return; |
| | | } |
| | | service.onApproval(Long.valueOf(event.getBusinessKey()), event.getId(), event.getStatus()); |
| | | } |
| | | } |