From aa62bca380f5c1383100fd7fdb70c3c4dde4e2c2 Mon Sep 17 00:00:00 2001 From: syruan <15555146157@163.com> Date: Thu, 18 Dec 2025 18:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=B8=8D=E8=B6=B3=E6=97=B6?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ApprovalEngineServiceImpl.java | 6 ++++-- .../repair/service/impl/RepairServiceImpl.java | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/approval/service/impl/ApprovalEngineServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/approval/service/impl/ApprovalEngineServiceImpl.java index 26a6766..1f2a7f5 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/approval/service/impl/ApprovalEngineServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/approval/service/impl/ApprovalEngineServiceImpl.java @@ -98,8 +98,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService { instanceMapper.insertInstance(instance); - log.info("创建审批实例成功,实例编号:{},业务类型:{},业务ID:{}", - instance.getInstanceCode(), businessType, businessId); + log.info("创建审批实例成功,实例编号:{},业务类型:{},业务ID:{}", instance.getInstanceCode(), businessType, businessId); // 4. 检查第一个节点是否自动通过 if ("1".equals(firstNode.getAutoPass())) { @@ -329,6 +328,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService { /** * 执行审批回调 + * 注意:如果回调执行失败,会抛出异常,触发事务回滚 */ private void executeCallback(ApprovalInstance instance, String status) { try { @@ -343,6 +343,8 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService { } catch (Exception e) { log.error("执行审批回调失败,实例编号:{},业务类型:{}", instance.getInstanceCode(), instance.getBusinessType(), e); + // 重新抛出异常,触发事务回滚 + throw new RuntimeException("审批回调执行失败:" + e.getMessage(), e); } } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java index 21a11bc..ccf869a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/repair/service/impl/RepairServiceImpl.java @@ -352,12 +352,12 @@ public class RepairServiceImpl implements RepairService { if ("装备".equals(toBeRepair.getType())){ ToBeRepair bean1 = mapper.selectMaDevInfoByTypeIdAndCode(toBeRepair); if (bean1==null || !"5".equals(bean1.getStatus())){ - return AjaxResult.error(toBeRepair.getCode()+"编码设备已经处理过"); + throw new RuntimeException(toBeRepair.getCode()+"编码设备已经处理过"); } } else if ("工具".equals(toBeRepair.getType())){ ToBeRepair bean1 = mapper.selectByTypeIdAndCode(toBeRepair); if (bean1==null || !"2".equals(bean1.getStatus())){ - return AjaxResult.error(toBeRepair.getCode()+"编码设备已经处理过"); + throw new RuntimeException(toBeRepair.getCode()+"编码设备已经处理过"); } } } else if ("数量管理".equals(toBeRepair.getManageMode())){ @@ -365,7 +365,7 @@ public class RepairServiceImpl implements RepairService { //todo 目前数量管理的设备都是工具 ToBeRepair bean1 = mapper.selectByTypeIdAndCode(toBeRepair); if (bean1==null || bean1.getRepairNum().compareTo(toBeRepair.getRepairNum())<0){ - return AjaxResult.error(toBeRepair.getTypeModelName()+"剩余维修设备数量不足"); + throw new RuntimeException(toBeRepair.getTypeModelName()+"剩余维修设备数量不足"); } } if (!StringHelper.isNullOrEmptyString(toBeRepair.getAuditStatus())){ @@ -424,9 +424,7 @@ public class RepairServiceImpl implements RepairService { } return AjaxResult.success("审核成功"); } catch (Exception e) { - e.printStackTrace(); - TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); - return AjaxResult.error("审核失败"); + throw new RuntimeException("审批通过回调执行失败:" + e.getMessage()); } }