| | |
| | | } |
| | | 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()); |
| | | System.out.println("业务类型:" + purchaseLedger.getPurchaseContractNumber()); |
| | | 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(); |
| | | |
| | |
| | | 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("审批已驳回"); |
| | | } |
| | | |
| | |
| | | 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") |
| | | ); |