From 83abd7b427e84f6813e1a017912cf61676103316 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 五月 2026 09:37:17 +0800
Subject: [PATCH] refactor(account): 移除AccountIncome相关代码和依赖
---
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java | 142 ++++++++++++++---------------------------------
1 files changed, 42 insertions(+), 100 deletions(-)
diff --git a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
index 628dfd5..e30f447 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -3,9 +3,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.ruoyi.account.mapper.AccountExpenseMapper;
-import com.ruoyi.account.mapper.AccountIncomeMapper;
-import com.ruoyi.account.pojo.AccountExpense;
+import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
+import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
import com.ruoyi.approve.mapper.ApproveProcessMapper;
import com.ruoyi.approve.pojo.ApproveProcess;
import com.ruoyi.basic.mapper.CustomerMapper;
@@ -47,8 +46,8 @@
import com.ruoyi.staff.mapper.StaffOnJobMapper;
import com.ruoyi.staff.pojo.StaffOnJob;
import com.ruoyi.stock.mapper.StockInventoryMapper;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -68,73 +67,55 @@
*/
@Service
@Slf4j
+@RequiredArgsConstructor
public class HomeServiceImpl implements HomeService {
- @Autowired
- private SalesLedgerMapper salesLedgerMapper;
+ private final SalesLedgerMapper salesLedgerMapper;
- @Autowired
- private PurchaseLedgerMapper purchaseLedgerMapper;
+ private final PurchaseLedgerMapper purchaseLedgerMapper;
- @Autowired
- private SalesLedgerProductMapper salesLedgerProductMapper;
+ private final SalesLedgerProductMapper salesLedgerProductMapper;
- @Autowired
- private StockInventoryMapper stockInventoryMapper;
+ private final StockInventoryMapper stockInventoryMapper;
- @Autowired
- private QualityInspectMapper qualityStatisticsMapper;
+ private final QualityInspectMapper qualityStatisticsMapper;
- @Autowired
- private ApproveProcessMapper approveProcessMapper;
+ private final ApproveProcessMapper approveProcessMapper;
- @Autowired
- private ReceiptPaymentMapper receiptPaymentMapper;
+ private final ReceiptPaymentMapper receiptPaymentMapper;
- @Autowired
- private PaymentRegistrationMapper paymentRegistrationMapper;
+ private final PaymentRegistrationMapper paymentRegistrationMapper;
- @Autowired
- private SysDeptMapper sysDeptMapper;
+ private final SysDeptMapper sysDeptMapper;
- @Autowired
- private NoticeMapper noticeMapper;
+ private final NoticeMapper noticeMapper;
- @Autowired
- private ProductionOrderMapper productionOrderMapper;
+ private final ProductionOrderMapper productionOrderMapper;
- @Autowired
- private ProductMapper productMapper;
+ private final ProductMapper productMapper;
- @Autowired
- private StaffOnJobMapper staffOnJobMapper;
+ private final StaffOnJobMapper staffOnJobMapper;
- @Autowired
- private CustomerMapper customerMapper;
+ private final CustomerMapper customerMapper;
- @Autowired
- private SupplierManageMapper supplierManageMapper;
+ private final SupplierManageMapper supplierManageMapper;
- @Autowired
- private HomeMapper homeMapper;
+ private final HomeMapper homeMapper;
- @Autowired
- private ProductionProductOutputMapper productionProductOutputMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
- @Autowired
- private QualityInspectMapper qualityInspectMapper;
+ private final QualityInspectMapper qualityInspectMapper;
- @Autowired
- private QualityUnqualifiedMapper qualityUnqualifiedMapper;
+ private final QualityUnqualifiedMapper qualityUnqualifiedMapper;
- @Autowired
- private ProductionOperationTaskMapper productionOperationTaskMapper;
-
- @Autowired
- private AccountExpenseMapper accountExpenseMapper;
+ private final ProductionOperationTaskMapper productionOperationTaskMapper;
- @Autowired
- private AccountIncomeMapper accountIncomeMapper;
+ private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
+ private final AccountSalesCollectionMapper accountSalesCollectionMapper;
+
+ private final ProductionAccountMapper productionAccountMapper;
+
+ private final ProductionProductInputMapper productionProductInputMapper;
@Override
public HomeBusinessDto business() {
@@ -511,7 +492,7 @@
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
- @Autowired
+
private DeviceRepairMapper deviceRepairMapper;
@Override
@@ -1181,13 +1162,9 @@
String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
// 2. 鏌ヨ鏁版嵁
- List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat);
- // List<IncomeExpenseAnalysisDto> purchaseList =
- // purchaseLedgerMapper.selectPurchaseStats(startStr, endStr, dateFormat);
-
- List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr,
- dateFormat);
// 3. 杞� Map锛堣嚜鍔ㄥ悎骞讹級
Map<String, BigDecimal> incomeMap = incomeList.stream()
@@ -1196,11 +1173,7 @@
IncomeExpenseAnalysisDto::getAmount,
BigDecimal::add));
- // Map<String, BigDecimal> purchaseMap = purchaseList.stream()
- // .collect(Collectors.toMap(
- // IncomeExpenseAnalysisDto::getDateStr,
- // IncomeExpenseAnalysisDto::getAmount,
- // BigDecimal::add));
+
Map<String, BigDecimal> expenseMap = expenseList.stream()
.collect(Collectors.toMap(
@@ -1214,18 +1187,12 @@
for (String dateStr : xAxis) {
Map<String, Object> item = new HashMap<>();
item.put("date", dateStr);
-
// 鏀跺叆
BigDecimal income = incomeMap.getOrDefault(dateStr, BigDecimal.ZERO);
item.put("income", income.setScale(2, RoundingMode.HALF_UP));
-
- // 鏀嚭 = 閲囪喘 + 璐㈠姟鏀嚭
- // BigDecimal purchase = purchaseMap.getOrDefault(dateStr, BigDecimal.ZERO);
+ // 鏀嚭
BigDecimal expense = expenseMap.getOrDefault(dateStr, BigDecimal.ZERO);
- // BigDecimal totalExpense = purchase.add(expense);
- BigDecimal totalExpense = expense;
-
- item.put("expense", totalExpense.setScale(2, RoundingMode.HALF_UP));
+ item.put("expense", expense.setScale(2, RoundingMode.HALF_UP));
result.add(item);
}
@@ -1252,8 +1219,8 @@
String startStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String endStr = endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
- List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.selectIncomeStats(startStr, endStr, dateFormat);
- List<IncomeExpenseAnalysisDto> expenseList = accountExpenseMapper.selectAccountExpenseStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> incomeList = accountSalesCollectionMapper.selectIncomeStats(startStr, endStr, dateFormat);
+ List<IncomeExpenseAnalysisDto> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat);
Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors
.toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add));
@@ -1289,11 +1256,6 @@
rawMaterialDto.setName("鍘熸潗鏂�");
rawMaterialDto.setValue(rawMaterialAmount != null ? rawMaterialAmount.toString() : "0");
result.add(rawMaterialDto);
-
- List<MapDto> expenseList = accountExpenseMapper.selectExpenseComposition(null, null);
- if (expenseList != null) {
- result.addAll(expenseList);
- }
}
BigDecimal total = BigDecimal.ZERO;
@@ -1415,26 +1377,10 @@
}
// 鍏朵粬璐圭敤
- LambdaQueryWrapper<AccountExpense> expenseWrapper = new LambdaQueryWrapper<>();
- expenseWrapper.ge(AccountExpense::getExpenseDate,
- java.sql.Date.valueOf(currentMonth.atDay(1)));
- expenseWrapper.le(AccountExpense::getExpenseDate,
- java.sql.Date.valueOf(currentMonth.atEndOfMonth()));
- List<AccountExpense> expenses = accountExpenseMapper.selectList(expenseWrapper);
-
- BigDecimal otherExpense = BigDecimal.ZERO;
- if (!CollectionUtils.isEmpty(expenses)) {
- for (AccountExpense e : expenses) {
- if (e.getExpenseMoney() != null) {
- otherExpense = otherExpense.add(e.getExpenseMoney());
- }
- }
- }
// 鏈堝害鎬绘敮鍑�
- // BigDecimal monthlyExpenditure = rawMaterialCost.add(otherExpense);
- BigDecimal monthlyExpenditure = otherExpense;
+ BigDecimal monthlyExpenditure = BigDecimal.ZERO;
dto.setMonthlyExpenditure(monthlyExpenditure);
// 宸蹭粯娆� 梅锛堝凡浠樻 + 寰呬粯娆撅級
@@ -1486,9 +1432,6 @@
return dto;
}
- @Autowired
- private ProductionProductInputMapper productionProductInputMapper;
-
@Override
public List<InputOutputAnalysisDto> inputOutputAnalysis(Integer type) {
LocalDate today = LocalDate.now();
@@ -1519,7 +1462,8 @@
String endStr = endDate.atStartOfDay()
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
- List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr);
+// List<Map<String, Object>> inputList = productionProductInputMapper.selectInputStats(startStr, endStr);
+ List<Map<String, Object>> inputList = null;
List<Map<String, Object>> outputList = productionProductOutputMapper.selectDailyOutputStats(startStr, endStr);
Map<String, InputOutputAnalysisDto> dateMap = new HashMap<>();
@@ -1745,8 +1689,6 @@
.collect(Collectors.toList());
}
- @Autowired
- private ProductionAccountMapper salesLedgerProductionAccountingMapper;
@Override
public List<ProductionAccountingDto> productionAccountingAnalysis(Integer type) {
@@ -1775,7 +1717,7 @@
String endStr = endDate.plusDays(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
- List<Map<String, Object>> wagesList = salesLedgerProductionAccountingMapper.selectDailyWagesStats(startStr,
+ List<Map<String, Object>> wagesList = productionAccountMapper.selectDailyWagesStats(startStr,
endStr);
if (CollectionUtils.isEmpty(wagesList)) {
--
Gitblit v1.9.3