From f569e2257372a2f940aace9ad151fd758196eb9a Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 13 六月 2026 14:34:42 +0800
Subject: [PATCH] 修改客户,销售,协同,报价,质量
---
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java | 87 +++++++++++++++++++++++++++++++++++--------
1 files changed, 71 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..df4dd49 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -39,13 +39,18 @@
import com.ruoyi.project.system.service.ISysNoticeService;
import com.ruoyi.purchase.mapper.PurchaseLedgerMapper;
import com.ruoyi.purchase.pojo.PurchaseLedger;
+import com.ruoyi.production.mapper.ProductionPlanMapper;
+import com.ruoyi.production.pojo.ProductionPlan;
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;
+import com.ruoyi.sales.service.impl.SalesLedgerProductServiceImpl;
import com.ruoyi.staff.mapper.HolidayApplicationMapper;
import com.ruoyi.staff.pojo.HolidayApplication;
import lombok.RequiredArgsConstructor;
@@ -84,6 +89,9 @@
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final StockUtils stockUtils;
private final SalesQuotationMapper salesQuotationMapper;
+ private final SalesLedgerMapper salesLedgerMapper;
+ private final SalesLedgerProductServiceImpl salesLedgerProductService;
+ private final ProductionPlanMapper productionPlanMapper;
private final ShippingInfoMapper shippingInfoMapper;
private final QualityInspectHelper qualityInspectHelper;
private final EnterpriseNewsScopeUserMapper enterpriseNewsScopeUserMapper;
@@ -126,6 +134,12 @@
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.setQuotationNo(salesLedger.getSalesContractNo());
}
}
}
@@ -420,20 +434,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("瀹℃壒宸查┏鍥�");
}
@@ -562,6 +564,10 @@
}
if (TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode().equals(businessType)) {
handleNewsApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.SALES_LEDGER_APPROVAL.getCode().equals(businessType)) {
+ handleSalesLedgerApprovalFinished(instance, status);
}
}
@@ -679,10 +685,40 @@
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(2);
+ salesLedgerMapper.updateById(salesLedger);
+ // 瀹℃壒閫氳繃鍚庡垱寤虹敓浜т富璁″垝
+ createProductionPlansForApproved(salesLedger);
+ } else if ("REJECTED".equals(status)) {
+ salesLedger.setApprovalStatus(3);
+ salesLedgerMapper.updateById(salesLedger);
+ } else if ("PENDING".equals(status)) {
+ salesLedger.setApprovalStatus(1);
+ salesLedgerMapper.updateById(salesLedger);
+ }
+ }
+
+ private void createProductionPlansForApproved(SalesLedger salesLedger) {
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(
+ new LambdaQueryWrapper<SalesLedgerProduct>()
+ .eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId())
+ .eq(SalesLedgerProduct::getIsProduction, true)
+ );
+ for (SalesLedgerProduct product : products) {
+ salesLedgerProductService.addProductionDataForApproved(product, 2);
+ }
+ }
+
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 +793,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