gaoluyang
昨天 9cd4074a456fd5c422506279191b6015836347e5
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -105,6 +105,29 @@
        }
        records.forEach(vo -> {
            vo.setBusinessName(TypeEnums.getLabelByValue(vo.getBusinessType()));
            // 根据业务类型查询对应的单号
            if (vo.getBusinessType() != null && vo.getBusinessId() != null) {
                if (TypeEnums.PURCHASE_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 采购审批 - 查询采购单号
                    PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(vo.getBusinessId());
                    if (purchaseLedger != null) {
                        vo.setPurchaseContractNumber(purchaseLedger.getPurchaseContractNumber());
                    }
                } else if (TypeEnums.QUOTATION_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 报价审批 - 查询报价单号
                    SalesQuotation salesQuotation = salesQuotationMapper.selectById(vo.getBusinessId());
                    if (salesQuotation != null) {
                        vo.setQuotationNo(salesQuotation.getQuotationNo());
                    }
                } else if (TypeEnums.SHIPPING_APPROVAL.getCode().equals(vo.getBusinessType())) {
                    // 发货审批 - 查询发货单号
                    ShippingInfo shippingInfo = shippingInfoMapper.selectById(vo.getBusinessId());
                    if (shippingInfo != null) {
                        vo.setShippingNo(shippingInfo.getShippingNo());
                    }
                }
            }
        });
        Long currentUserId = SecurityUtils.getUserId();
@@ -126,10 +149,23 @@
                            .eq(ApprovalTask::getDeleted, 0)
            ).stream().collect(Collectors.groupingBy(ApprovalTask::getInstanceId));
            // 任务表本身不存审批方式,按节点实例回填会签/或签,避免前端统一显示为会签
            Map<Long, String> nodeApproveTypeMap = approvalInstanceNodeService.list(
                    Wrappers.<ApprovalInstanceNode>lambdaQuery()
                            .in(ApprovalInstanceNode::getInstanceId, instanceIds)
                            .eq(ApprovalInstanceNode::getDeleted, 0)
            ).stream().collect(Collectors.toMap(
                    ApprovalInstanceNode::getId,
                    node -> node.getApproveType() == null ? "" : node.getApproveType(),
                    (existing, replacement) -> existing
            ));
            for (ApprovalInstanceVo vo : records) {
                vo.setIsApprove(approveProcessConfigNodeUtils.isCurrentApprover(vo.getId(), currentUserId));
                vo.setRecords(recordMap.getOrDefault(vo.getId(), new ArrayList<>()));
                vo.setTasks(taskMap.getOrDefault(vo.getId(), new ArrayList<>()));
                List<ApprovalTask> instanceTasks = taskMap.getOrDefault(vo.getId(), new ArrayList<>());
                instanceTasks.forEach(task -> task.setApproveType(nodeApproveTypeMap.get(task.getNodeId())));
                vo.setTasks(instanceTasks);
                vo.setStorageBlobVOList(fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.APPROVAL_INSTANCE, vo.getId()));
            }
@@ -396,20 +432,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("审批已驳回");
    }
@@ -658,7 +682,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")
        );
@@ -733,10 +757,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) {