| | |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerMapper; |
| | | import com.ruoyi.purchase.pojo.PurchaseLedger; |
| | | import com.ruoyi.quality.utils.QualityInspectHelper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerMapper; |
| | | import com.ruoyi.sales.mapper.SalesLedgerProductMapper; |
| | | import com.ruoyi.sales.mapper.SalesQuotationMapper; |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.SalesQuotation; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final StockUtils stockUtils; |
| | | private final SalesQuotationMapper salesQuotationMapper; |
| | | private final SalesLedgerMapper salesLedgerMapper; |
| | | private final ShippingInfoMapper shippingInfoMapper; |
| | | private final QualityInspectHelper qualityInspectHelper; |
| | | private final EnterpriseNewsScopeUserMapper enterpriseNewsScopeUserMapper; |
| | |
| | | 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()); |
| | | } |
| | |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectById(vo.getBusinessId()); |
| | | if (shippingInfo != null) { |
| | | vo.setShippingNo(shippingInfo.getShippingNo()); |
| | | } |
| | | } else if (TypeEnums.SALES_LEDGER_APPROVAL.getCode().equals(vo.getBusinessType())) { |
| | | // 销售台账审批 - 查询销售合同号 |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(vo.getBusinessId()); |
| | | if (salesLedger != null) { |
| | | vo.setSalesContractNo(salesLedger.getSalesContractNo()); |
| | | } |
| | | } |
| | | } |
| | |
| | | handleShippingApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.SALES_LEDGER_APPROVAL.getCode().equals(businessType)) { |
| | | handleSalesLedgerApprovalFinished(instance, status); |
| | | return; |
| | | } |
| | | if (TypeEnums.TRAVEL_REIMBURSEMENT_APPROVAL.getCode().equals(businessType) |
| | | || TypeEnums.EXPENSE_APPROVAL.getCode().equals(businessType)) { |
| | | handleReimbursementApprovalFinished(instance, status); |
| | |
| | | salesQuotationMapper.updateById(salesQuote); |
| | | } |
| | | |
| | | /** |
| | | * 销售台账审批结束:只回写台账的审批状态,不锁定单据、不自动生成下游单据 |
| | | */ |
| | | private void handleSalesLedgerApprovalFinished(ApprovalInstance instance, String status) { |
| | | SalesLedger salesLedger = salesLedgerMapper.selectById(instance.getBusinessId()); |
| | | if (salesLedger == null) { |
| | | return; |
| | | } |
| | | |
| | | if ("APPROVED".equals(status)) { |
| | | salesLedger.setApprovalStatus(SalesQuotationStatusEnum.APPROVED.getCode()); |
| | | } else if ("REJECTED".equals(status)) { |
| | | salesLedger.setApprovalStatus(SalesQuotationStatusEnum.REJECTED.getCode()); |
| | | } else if ("PENDING".equals(status)) { |
| | | salesLedger.setApprovalStatus(SalesQuotationStatusEnum.IN_PROGRESS.getCode()); |
| | | } |
| | | salesLedgerMapper.updateById(salesLedger); |
| | | } |
| | | |
| | | private void handleShippingApprovalFinished(ApprovalInstance instance, String status) { |
| | | ShippingInfo shippingInfo = shippingInfoMapper.selectOne( |
| | | new LambdaQueryWrapper<ShippingInfo>() |
| | |
| | | |
| | | 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) { |