From 9347c9a4a91f9e0b6562fe72a25aa06a76a928e7 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 21 五月 2026 09:25:33 +0800
Subject: [PATCH] refactor(account): 移除AccountExpense相关代码

---
 src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java |   91 +++++++++++++--------------------------------
 1 files changed, 27 insertions(+), 64 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 395a414..4f4931a 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.approve.mapper.ApproveProcessMapper;
 import com.ruoyi.approve.pojo.ApproveProcess;
 import com.ruoyi.basic.mapper.CustomerMapper;
@@ -87,33 +86,36 @@
 
     private final PaymentRegistrationMapper paymentRegistrationMapper;
 
-    private  SysDeptMapper sysDeptMapper;
+    private final SysDeptMapper sysDeptMapper;
 
     private final NoticeMapper noticeMapper;
-    
+
     private final ProductionOrderMapper productionOrderMapper;
 
     private final ProductMapper productMapper;
-    
+
     private final StaffOnJobMapper staffOnJobMapper;
-    
+
     private final CustomerMapper customerMapper;
-    
+
     private final SupplierManageMapper supplierManageMapper;
-    
+
     private final HomeMapper homeMapper;
-    
+
     private final ProductionProductOutputMapper productionProductOutputMapper;
-    
+
     private final QualityInspectMapper qualityInspectMapper;
-    
+
     private final QualityUnqualifiedMapper qualityUnqualifiedMapper;
-    
+
     private final ProductionOperationTaskMapper productionOperationTaskMapper;
-    
-    private final AccountExpenseMapper accountExpenseMapper;
-    
+
+    private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
     private final AccountIncomeMapper accountIncomeMapper;
+
+    private final ProductionAccountMapper productionAccountMapper;
+
+    private final ProductionProductInputMapper productionProductInputMapper;
 
     @Override
     public HomeBusinessDto business() {
@@ -490,7 +492,7 @@
                 .reduce(BigDecimal.ZERO, BigDecimal::add);
     }
 
-    
+
     private DeviceRepairMapper deviceRepairMapper;
 
     @Override
@@ -1161,12 +1163,8 @@
 
         // 2. 鏌ヨ鏁版嵁
         List<IncomeExpenseAnalysisDto> incomeList = accountIncomeMapper.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()
@@ -1175,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(
@@ -1193,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);
         }
@@ -1232,7 +1220,7 @@
         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> expenseList = accountPurchasePaymentMapper.selectPayment(startStr, endStr, dateFormat);
 
         Map<String, BigDecimal> incomeMap = incomeList.stream().collect(Collectors
                 .toMap(IncomeExpenseAnalysisDto::getDateStr, IncomeExpenseAnalysisDto::getAmount, BigDecimal::add));
@@ -1268,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;
@@ -1394,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);
 
         // 宸蹭粯娆� 梅锛堝凡浠樻 + 寰呬粯娆撅級
@@ -1465,9 +1432,6 @@
         return dto;
     }
 
-    
-    private ProductionProductInputMapper productionProductInputMapper;
-
     @Override
     public List<InputOutputAnalysisDto> inputOutputAnalysis(Integer type) {
         LocalDate today = LocalDate.now();
@@ -1498,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<>();
@@ -1724,8 +1689,6 @@
                 .collect(Collectors.toList());
     }
 
-    
-    private ProductionAccountMapper salesLedgerProductionAccountingMapper;
 
     @Override
     public List<ProductionAccountingDto> productionAccountingAnalysis(Integer type) {
@@ -1754,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