From 8c65f898ed6e5b0c7a94c792c4562f6ec831dccd Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期六, 07 十一月 2026 08:50:53 +0800
Subject: [PATCH] feat: 完善质检、生产、销售、财务与人事模块并接入审批流程

---
 yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java
index 0389f65..a8781d5 100644
--- a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java
+++ b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/dal/mysql/finance/ErpFinancePaymentMapper.java
@@ -14,6 +14,7 @@
 import org.apache.ibatis.annotations.Mapper;
 
 import java.math.BigDecimal;
+import java.time.LocalDateTime;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -39,6 +40,8 @@
                 .likeIfPresent(ErpFinancePaymentDO::getAccountName, reqVO.getAccountName())
                 .eqIfPresent(ErpFinancePaymentDO::getStatus, reqVO.getStatus())
                 .likeIfPresent(ErpFinancePaymentDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(ErpFinancePaymentDO::getSourceType, reqVO.getSourceType())
+                .likeIfPresent(ErpFinancePaymentDO::getSourceNo, reqVO.getSourceNo())
                 .orderByDesc(ErpFinancePaymentDO::getId);
         if (reqVO.getBizNo() != null) {
             query.leftJoin(ErpFinancePaymentItemDO.class, ErpFinancePaymentItemDO::getPaymentId, ErpFinancePaymentDO::getId)
@@ -70,18 +73,52 @@
      * @return key 涓烘潵绁ㄧ紪鍙凤紝value 涓哄凡浠樻閲戦
      */
     default Map<Long, BigDecimal> selectPaymentPriceMapByInvoiceId(Collection<Long> invoiceIds) {
+        return selectPaymentPriceMapByInvoiceIdAndStatus(invoiceIds, List.of(
+                ErpAuditStatus.PROCESS.getStatus(), ErpAuditStatus.APPROVING.getStatus(),
+                ErpAuditStatus.APPROVE.getStatus()));
+    }
+
+    default Map<Long, BigDecimal> selectPaymentPriceMapByInvoiceIdAndStatus(
+            Collection<Long> invoiceIds, Collection<Integer> statuses) {
         if (CollUtil.isEmpty(invoiceIds)) {
             return Collections.emptyMap();
         }
         // SQL sum 鏌ヨ
         List<Map<String, Object>> result = selectMaps(new QueryWrapper<ErpFinancePaymentDO>()
                 .select("invoice_id, SUM(payment_price) AS total_payment_price")
-                .in("status", ErpAuditStatus.PROCESS.getStatus(), // 鏈鏍� + 瀹℃壒涓� + 宸插鏍�
-                        ErpAuditStatus.APPROVING.getStatus(), ErpAuditStatus.APPROVE.getStatus())
+                .in("status", statuses)
                 .groupBy("invoice_id")
                 .in("invoice_id", invoiceIds));
         // 鑾峰緱閲戦
         return convertMap(result, obj -> (Long) obj.get("invoice_id"), obj -> (BigDecimal) obj.get("total_payment_price"));
     }
 
-}
\ No newline at end of file
+    /**
+     * 鎸変緵搴斿晢涓庝粯娆炬椂闂磋寖鍥存煡璇粯娆惧崟锛堜緵搴斿晢寰�鏉ワ級
+     */
+    default List<ErpFinancePaymentDO> selectListBySupplierIdAndPaymentTimeBetween(Long supplierId,
+                                                                                 LocalDateTime beginTime,
+                                                                                 LocalDateTime endTime,
+                                                                                 Collection<Integer> statuses) {
+        return selectList(new LambdaQueryWrapperX<ErpFinancePaymentDO>()
+                .eq(ErpFinancePaymentDO::getSupplierId, supplierId)
+                .geIfPresent(ErpFinancePaymentDO::getPaymentTime, beginTime)
+                .leIfPresent(ErpFinancePaymentDO::getPaymentTime, endTime)
+                .inIfPresent(ErpFinancePaymentDO::getStatus, statuses)
+                .orderByAsc(ErpFinancePaymentDO::getPaymentTime)
+                .orderByAsc(ErpFinancePaymentDO::getId));
+    }
+
+    /**
+     * 鎸変粯娆炬椂闂磋寖鍥存煡璇㈠叏閮ㄤ緵搴斿晢鐨勪粯娆惧崟锛堜緵搴斿晢寰�鏉ユ眹鎬伙級
+     */
+    default List<ErpFinancePaymentDO> selectListByPaymentTimeBetween(LocalDateTime beginTime,
+                                                                     LocalDateTime endTime,
+                                                                     Collection<Integer> statuses) {
+        return selectList(new LambdaQueryWrapperX<ErpFinancePaymentDO>()
+                .geIfPresent(ErpFinancePaymentDO::getPaymentTime, beginTime)
+                .leIfPresent(ErpFinancePaymentDO::getPaymentTime, endTime)
+                .inIfPresent(ErpFinancePaymentDO::getStatus, statuses));
+    }
+
+}

--
Gitblit v1.9.3