From 2ee9e158e3129070f6b1fd953da1540f05d4f2b0 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期五, 10 七月 2026 18:04:50 +0800
Subject: [PATCH] 修改报工
---
src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java | 91 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 75 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 5c5e540..13cad8b 100644
--- a/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
+++ b/src/main/java/com/ruoyi/approve/service/impl/ApprovalInstanceServiceImpl.java
@@ -31,6 +31,8 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.utils.StockUtils;
+import com.ruoyi.production.mapper.ProductionProductMainMapper;
+import com.ruoyi.production.pojo.ProductionProductMain;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysDeptMapper;
@@ -94,6 +96,7 @@
private final EnterpriseNewsMapper enterpriseNewsMapper;
private final EnterpriseNewsScopeDeptMapper enterpriseNewsScopeDeptMapper;
private final ApprovalTemplateNodeApproverMapper approvalTemplateNodeApproverMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
@Override
public R listPage(Page<ApprovalInstanceVo> page, ApprovalInstanceDto approvalInstanceDto) {
@@ -105,6 +108,30 @@
}
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();
@@ -396,20 +423,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("瀹℃壒宸查┏鍥�");
}
@@ -538,6 +553,10 @@
}
if (TypeEnums.ENTERPRISE_NEWS_APPROVAL.getCode().equals(businessType)) {
handleNewsApprovalFinished(instance, status);
+ return;
+ }
+ if (TypeEnums.PRODUCTION_REPORT_APPROVAL.getCode().equals(businessType)) {
+ handleProductionReportApprovalFinished(instance, status);
}
}
@@ -658,7 +677,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")
);
@@ -677,6 +696,27 @@
shippingInfo.setStatus(ShippingStatusEnum.IN_PROGRESS.getCode());
}
shippingInfoMapper.updateById(shippingInfo);
+ }
+
+ private void handleProductionReportApprovalFinished(ApprovalInstance instance, String status) {
+ if (instance == null || instance.getBusinessId() == null) {
+ return;
+ }
+ ProductionProductMain productionProductMain = productionProductMainMapper.selectById(instance.getBusinessId());
+ if (productionProductMain == null) {
+ return;
+ }
+
+ if ("APPROVED".equals(status)) {
+ productionProductMain.setAuditStatus(1);
+ } else if ("REJECTED".equals(status)) {
+ productionProductMain.setAuditStatus(2);
+ } else if ("PENDING".equals(status)) {
+ productionProductMain.setAuditStatus(0);
+ } else {
+ return;
+ }
+ productionProductMainMapper.updateById(productionProductMain);
}
private List<ApprovalTask> createNodeAndTasks(ApprovalInstance instance, ApprovalTemplateNode templateNode) {
@@ -733,10 +773,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