From be9eaa59298523bb8eb644d8f38b507d24ca5fb7 Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 09 一月 2026 11:47:36 +0800
Subject: [PATCH] 1.固定资产核算接口、采购异常类-至军泰伟业 2.选择工艺路线项目后选择工序,点击提交报错,修改bug

---
 src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 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 276cfb4..5630e84 100644
--- a/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
+++ b/src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -3,6 +3,8 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.approve.mapper.ApproveProcessMapper;
 import com.ruoyi.approve.pojo.ApproveProcess;
+import com.ruoyi.collaborativeApproval.mapper.NoticeMapper;
+import com.ruoyi.collaborativeApproval.pojo.Notice;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.device.mapper.DeviceMaintenanceMapper;
 import com.ruoyi.device.mapper.DeviceRepairMapper;
@@ -93,6 +95,9 @@
 
     @Autowired
     private SysDeptMapper sysDeptMapper;
+
+    @Autowired
+    private NoticeMapper noticeMapper;
 
     @Override
     public HomeBusinessDto business() {
@@ -420,25 +425,29 @@
 //                .ge(SalesLedger::getEntryDate, startDate)
 //                .lt(SalesLedger::getEntryDate, endDate)
         );
-        BigDecimal receivableMoney = salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//        BigDecimal receivableMoney = salesLedgers.stream().map(SalesLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal receivableMoney = sumAmount(salesLedgers, SalesLedger::getContractAmount);
         // 搴斾粯
         List<PurchaseLedger> procurementRecords = purchaseLedgerMapper.selectList(new LambdaQueryWrapper<PurchaseLedger>()
 //                .ge(PurchaseLedger::getEntryDate, startDate)
 //                .lt(PurchaseLedger::getEntryDate, endDate)
         );
-        BigDecimal payableMoney = procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//        BigDecimal payableMoney = procurementRecords.stream().map(PurchaseLedger::getContractAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal payableMoney = sumAmount(procurementRecords, PurchaseLedger::getContractAmount);
         // 棰勬敹
         List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(new LambdaQueryWrapper<ReceiptPayment>()
 //                .ge(ReceiptPayment::getReceiptPaymentDate, startDate)
 //                .lt(ReceiptPayment::getReceiptPaymentDate, endDate)
         );
-        BigDecimal advanceMoney = receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//        BigDecimal advanceMoney = receiptPayments.stream().map(ReceiptPayment::getReceiptPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal advanceMoney = sumAmount(receiptPayments, ReceiptPayment::getReceiptPaymentAmount);
         // 棰勪粯
         List<PaymentRegistration> paymentRegistrations = paymentRegistrationMapper.selectList(new LambdaQueryWrapper<PaymentRegistration>()
 //                .ge(PaymentRegistration::getPaymentDate, startDate)
 //                .lt(PaymentRegistration::getPaymentDate, endDate)
         );
-        BigDecimal prepayMoney = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+//        BigDecimal prepayMoney = paymentRegistrations.stream().map(PaymentRegistration::getCurrentPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+        BigDecimal prepayMoney = sumAmount(paymentRegistrations, PaymentRegistration::getCurrentPaymentAmount);
         StatisticsReceivablePayableDto statisticsReceivablePayableDto = new StatisticsReceivablePayableDto();
         statisticsReceivablePayableDto.setPayableMoney(payableMoney.subtract(prepayMoney));
         statisticsReceivablePayableDto.setReceivableMoney(receivableMoney.subtract(advanceMoney));
@@ -447,7 +456,13 @@
 
         return statisticsReceivablePayableDto;
     }
-
+    public static <T> BigDecimal sumAmount(List<T> list, java.util.function.Function<T, BigDecimal> amountExtractor) {
+        return list.stream()
+                // 鎻愬彇閲戦鏃讹紝灏唍ull鏇挎崲涓築igDecimal.ZERO
+                .map(item -> Optional.ofNullable(amountExtractor.apply(item)).orElse(BigDecimal.ZERO))
+                // 绱姞锛屽垵濮嬪�间负0锛岄伩鍏嶇┖娴侀棶棰�
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+    }
     @Autowired
     private DeviceRepairMapper deviceRepairMapper;
 
@@ -467,4 +482,12 @@
             put("deviceRepairTodo", aLong1);
         }};
     }
+
+    @Override
+    public Long noticesCount() {
+        // 鏌ヨ鏈繃鏈熺殑閫氱煡鏁伴噺锛氱姸鎬佷负鍙戝竷涓旇繃鏈熸椂闂村ぇ浜庣瓑浜庡綋鍓嶆棩鏈�
+        return noticeMapper.selectCount(new LambdaQueryWrapper<Notice>()
+                .eq(Notice::getStatus, 1) // 1琛ㄧず鍙戝竷鐘舵��
+                .ge(Notice::getExpirationDate, new Date())); // 杩囨湡鏃堕棿澶т簬绛変簬褰撳墠鏃ユ湡
+    }
 }

--
Gitblit v1.9.3