From 3d2fd3a3f7d0571721b0f894e07c80553fd1e26c Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 10 六月 2026 11:12:05 +0800
Subject: [PATCH] fix(approve): 修复审批流程中的SQL查询和跳转路径问题

---
 src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java |   39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
index 5da3984..64a2eb3 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -420,20 +420,8 @@
         instance.setStatus("REJECTED");
         instance.setFinishTime(now);
         this.updateById(instance);
-        // 椹冲洖瀵瑰簲鐨勪紒涓氭柊闂伙紝 宸梾鎶ラ攢
-        if (instance.getBusinessType().equals(TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode())) {
-            enterpriseNewsMapper.update(
-                    new LambdaUpdateWrapper<EnterpriseNews>()
-                            .eq(EnterpriseNews::getId, instance.getBusinessId())
-                            .set(EnterpriseNews::getStatus, "REJECTED")
-            );
-        }else if (instance.getBusinessType().equals(TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode())||instance.getBusinessType().equals(TypeEnums.EXPENSE_APPROVAL.getCode())) {
-            finReimbursementMapper.update(
-                    new LambdaUpdateWrapper<FinReimbursement>()
-                            .eq(FinReimbursement::getId, instance.getBusinessId())
-                            .set(FinReimbursement::getBillStatus, "REJECTED")
-            );
-        }
+        // 缁熶竴澶勭悊涓氬姟鐘舵�佹洿鏂�
+        handleBusinessAfterApprovalFinished(instance);
         return R.ok("瀹℃壒宸查┏鍥�");
     }
 
@@ -682,7 +670,7 @@
     private void handleShippingApprovalFinished(ApprovalInstance instance, String status) {
         ShippingInfo shippingInfo = shippingInfoMapper.selectOne(
                 new LambdaQueryWrapper<ShippingInfo>()
-                        .eq(ShippingInfo::getId, instance.getTitle())
+                        .eq(ShippingInfo::getShippingNo, instance.getTitle())
                         .orderByDesc(ShippingInfo::getCreateTime)
                         .last("limit 1")
         );
@@ -757,10 +745,29 @@
 
         String title = StringUtils.hasText(instance.getTemplateName()) ? instance.getTemplateName() : "瀹℃壒鎻愰啋";
         String message = "瀹℃壒鍗曞彿 " + instance.getInstanceNo() + " 闇�瑕佹偍瀹℃壒";
-        String jumpPath = "/officeProcessAutomation/ApproveManage/approve-list?id=" + instance.getId();
+        String jumpPath = getJumpPathByBusinessType(instance.getBusinessType(), instance.getId());
         sysNoticeService.simpleNoticeByUser(title, message, approverIds, jumpPath);
     }
 
+    private String getJumpPathByBusinessType(Long businessType, Long instanceId) {
+        if (businessType == null) {
+            return "/collaborativeApproval/approve-list?id=" + instanceId;
+        }
+        if (TypeEnums.LEAVE_APPROVAL.getCode().equals(businessType)) {
+            return "/collaborativeApproval/AttendManage/leave-apply?id=" + instanceId;
+        }
+        if (TypeEnums.OVERTIME_APPROVAL.getCode().equals(businessType)) {
+            return "/collaborativeApproval/AttendManage/overtime-apply?id=" + instanceId;
+        }
+        if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType)) {
+            return "/collaborativeApproval/ReimburseManage/travel-reimburse?id=" + instanceId;
+        }
+        if (TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) {
+            return "/collaborativeApproval/ReimburseManage/cost-reimburse?id=" + instanceId;
+        }
+        return "/collaborativeApproval/approve-list?id=" + instanceId;
+    }
+
     private void sendEnterpriseNewsNotice(Long newsId) {
         EnterpriseNews enterpriseNews = enterpriseNewsMapper.selectById(newsId);
         if (enterpriseNews == null) {

--
Gitblit v1.9.3