From f8a1b2069044f16707eedaa22b57d542081d5e26 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 27 四月 2026 15:23:33 +0800
Subject: [PATCH] refactor(sales): 将依赖注入方式从构造函数改为字段注入

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java |   56 ++++++++++++++++++---------
 src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java       |   23 +++++++----
 src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java   |    5 ++
 src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java     |    5 ++
 4 files changed, 60 insertions(+), 29 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
index be2c03f..817bfc6 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -31,6 +31,7 @@
 import com.ruoyi.technology.mapper.TechnologyRoutingMapper;
 import com.ruoyi.technology.pojo.TechnologyRouting;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -55,27 +56,44 @@
  * @date 2025-05-08
  */
 @Service
-@RequiredArgsConstructor
 public class SalesLedgerProductServiceImpl extends ServiceImpl<SalesLedgerProductMapper, SalesLedgerProduct> implements ISalesLedgerProductService {
 
-    private final SalesLedgerProductMapper salesLedgerProductMapper;
-    private final ProductionAccountMapper productionAccountMapper;
-    private final SalesLedgerMapper salesLedgerMapper;
-    private final PurchaseLedgerMapper purchaseLedgerMapper;
-    private final ProductionPlanMapper productionPlanMapper;
-    private final ProductionOperationTaskMapper productionOperationTaskMapper;
-    private final ProductionOrderService productionOrderService;
-    private final TechnologyRoutingMapper technologyRoutingMapper;
-    private final TechnologyBomStructureMapper technologyBomStructureMapper;
-    private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
-    private final ProductionProductMainMapper productionProductMainMapper;
-    private final ProductionProductOutputMapper productionProductOutputMapper;
-    private final ProductionProductInputMapper productionProductInputMapper;
-    private final QualityInspectMapper qualityInspectMapper;
-    private final ShippingInfoMapper shippingInfoMapper;
-    private final ShippingInfoServiceImpl shippingInfoService;
-    private final StockUtils stockUtils;
-    private final StockInventoryMapper stockInventoryMapper;
+    @Autowired
+    private SalesLedgerProductMapper salesLedgerProductMapper;
+    @Autowired
+    private ProductionAccountMapper productionAccountMapper;
+    @Autowired
+    private SalesLedgerMapper salesLedgerMapper;
+    @Autowired
+    private PurchaseLedgerMapper purchaseLedgerMapper;
+    @Autowired
+    private ProductionPlanMapper productionPlanMapper;
+    @Autowired
+    private ProductionOperationTaskMapper productionOperationTaskMapper;
+    @Autowired
+    private ProductionOrderService productionOrderService;
+    @Autowired
+    private TechnologyRoutingMapper technologyRoutingMapper;
+    @Autowired
+    private TechnologyBomStructureMapper technologyBomStructureMapper;
+    @Autowired
+    private InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
+    @Autowired
+    private ProductionProductMainMapper productionProductMainMapper;
+    @Autowired
+    private ProductionProductOutputMapper productionProductOutputMapper;
+    @Autowired
+    private ProductionProductInputMapper productionProductInputMapper;
+    @Autowired
+    private QualityInspectMapper qualityInspectMapper;
+    @Autowired
+    private ShippingInfoMapper shippingInfoMapper;
+    @Autowired
+    private ShippingInfoServiceImpl shippingInfoService;
+    @Autowired
+    private StockUtils stockUtils;
+    @Autowired
+    private StockInventoryMapper stockInventoryMapper;
 
     @Override
     public SalesLedgerProduct selectSalesLedgerProductById(Long id) {
diff --git a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
index 9c51b3f..90193b2 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -23,6 +23,7 @@
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Collections;
@@ -34,16 +35,22 @@
  */
 @Service
 @Slf4j
-@RequiredArgsConstructor
 public class ShippingInfoServiceImpl extends ServiceImpl<ShippingInfoMapper, ShippingInfo> implements ShippingInfoService {
 
-    private final ShippingInfoMapper shippingInfoMapper;
-    private final TempFileServiceImpl tempFileService;
-    private final SalesLedgerProductMapper salesLedgerProductMapper;
-    private final StockUtils stockUtils;
-    private final CommonFileServiceImpl commonFileService;
-    private final ApproveProcessServiceImpl approveProcessService;
-    private final FileUtil fileUtil;
+    @Autowired
+    private ShippingInfoMapper shippingInfoMapper;
+    @Autowired
+    private TempFileServiceImpl tempFileService;
+    @Autowired
+    private SalesLedgerProductMapper salesLedgerProductMapper;
+    @Autowired
+    private StockUtils stockUtils;
+    @Autowired
+    private CommonFileServiceImpl commonFileService;
+    @Autowired
+    private ApproveProcessServiceImpl approveProcessService;
+    @Autowired
+    private FileUtil fileUtil;
 
     @Override
     public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) {
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
index 8919523..b1eceac 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
@@ -26,6 +26,7 @@
 import com.ruoyi.stock.pojo.StockUninventory;
 import com.ruoyi.stock.service.StockOutRecordService;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -42,10 +43,12 @@
  * @since 2026-01-21 05:27:04
  */
 @Service
-@AllArgsConstructor
 public class StockOutRecordServiceImpl extends ServiceImpl<StockOutRecordMapper, StockOutRecord> implements StockOutRecordService {
+    @Autowired
     private StockOutRecordMapper stockOutRecordMapper;
+    @Autowired
     private StockInventoryMapper stockInventoryMapper;
+    @Autowired
     private StockUninventoryMapper stockUninventoryMapper;
 
     @Override
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
index 4c92e39..5ed894f 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
@@ -21,6 +21,7 @@
 import com.ruoyi.stock.service.StockOutRecordService;
 import com.ruoyi.stock.service.StockUninventoryService;
 import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -38,11 +39,13 @@
  * @since 2026-01-22 10:17:45
  */
 @Service
-@AllArgsConstructor
 public class StockUninventoryServiceImpl extends ServiceImpl<StockUninventoryMapper, StockUninventory> implements StockUninventoryService {
 
+    @Autowired
     private StockUninventoryMapper stockUninventoryMapper;
+    @Autowired
     private StockOutRecordService stockOutRecordService;
+    @Autowired
     private StockInRecordService stockInRecordService;
 
     @Override

--
Gitblit v1.9.3