From 2eeeb70e4733e7fc41635c3aa2143f13cbc43d58 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 04 十一月 2026 17:11:34 +0800
Subject: [PATCH] feat(erp): 采购来票分摊合计改为不超过来票金额即可

---
 yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/purchase/ErpPurchaseInvoiceServiceImpl.java |  205 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 170 insertions(+), 35 deletions(-)

diff --git a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/purchase/ErpPurchaseInvoiceServiceImpl.java b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/purchase/ErpPurchaseInvoiceServiceImpl.java
index 727a59c..abfd6ff 100644
--- a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/purchase/ErpPurchaseInvoiceServiceImpl.java
+++ b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/purchase/ErpPurchaseInvoiceServiceImpl.java
@@ -3,15 +3,22 @@
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.invoice.ErpPurchaseInvoiceOrderReqVO;
 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.invoice.ErpPurchaseInvoicePageReqVO;
 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.invoice.ErpPurchaseInvoiceSaveReqVO;
 import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInvoiceDO;
+import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInvoiceOrderDO;
 import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseOrderDO;
 import cn.iocoder.yudao.module.erp.dal.mysql.finance.ErpFinancePaymentMapper;
 import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchaseInvoiceMapper;
+import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchaseInvoiceOrderMapper;
 import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO;
+import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi;
+import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO;
 import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
 import jakarta.annotation.Resource;
 import org.springframework.stereotype.Service;
@@ -19,11 +26,16 @@
 import org.springframework.validation.annotation.Validated;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
+
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
@@ -47,6 +59,9 @@
     private ErpPurchaseInvoiceMapper invoiceMapper;
 
     @Resource
+    private ErpPurchaseInvoiceOrderMapper invoiceOrderMapper;
+
+    @Resource
     private ErpFinancePaymentMapper financePaymentMapper;
 
     @Resource
@@ -56,55 +71,140 @@
     private ErpPurchaseOrderService purchaseOrderService;
 
     @Resource
+    private SrmSupplierApi srmSupplierApi;
+
+    @Resource
     private StorageAttachmentApi storageAttachmentApi;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Long createPurchaseInvoice(ErpPurchaseInvoiceSaveReqVO createReqVO) {
-        // 1.1 鏍¢獙鍏宠仈鏁版嵁瀛樺湪
-        validateRelationDataExists(createReqVO);
-        // 1.2 鏍¢獙鍙紑绁ㄩ噾棰濊秴杩囦笂闄�
-        validatePurchaseInvoicePriceExceedsLimit(createReqVO);
-        // 1.3 鐢熸垚鏉ョエ缂栧彿
-        String no = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_INVOICE_NO_PREFIX);
+        // 1.1 鏍¢獙閲囪喘璁㈠崟銆佸垎鎽婃槑缁嗭紙鍒嗘憡鍚堣 = 鏉ョエ閲戦锛�
+        List<ErpPurchaseOrderDO> orders = validateOrderAllocations(createReqVO);
+        // 1.2 鏍¢獙姣忓紶璁㈠崟鐨勫垎鎽婇噾棰濅笉瓒呰繃璇ヨ鍗曞墿浣欐湭寮�绁ㄩ噾棰�
+        validateAllocationPriceExceedsLimit(createReqVO, orders);
+        // 1.3 纭畾鏉ョエ缂栧彿锛堝墠绔~鍐欏垯鐢ㄨ嚜瀹氫箟鍗曞彿锛岀暀绌哄垯鑷姩鐢熸垚锛夛紝骞舵牎楠屽敮涓�鎬�
+        String customNo = StrUtil.trim(createReqVO.getNo());
+        String no = StrUtil.isNotBlank(customNo) ? customNo
+                : noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_INVOICE_NO_PREFIX);
         if (invoiceMapper.selectByNo(no) != null) {
             throw exception(PURCHASE_INVOICE_NO_EXISTS);
         }
 
-        // 2.1 鎻掑叆鏉ョエ锛堝垱寤哄悗鍗充负鏈夋晥鐘舵�侊紝鏃犻渶瀹℃牳锛�
+        // 2.1 鎻掑叆鏉ョエ锛堝垱寤哄悗鍗充负鏈夋晥鐘舵�侊紝鏃犻渶瀹℃牳锛夛紱涓昏鍗曘�佷緵搴斿晢鍙栧垎鎽婃槑缁嗙涓�寮�
         ErpPurchaseInvoiceDO invoice = BeanUtils.toBean(createReqVO, ErpPurchaseInvoiceDO.class).setNo(no);
         invoiceMapper.insert(invoice);
 
-        // 2.2 缁戝畾鍙戠エ闄勪欢
+        // 2.2 鎻掑叆閲囪喘璁㈠崟鍒嗘憡鏄庣粏
+        insertOrderAllocations(invoice.getId(), createReqVO);
+
+        // 2.3 缁戝畾鍙戠エ闄勪欢
         if (CollUtil.isNotEmpty(createReqVO.getBlobIds())) {
             storageAttachmentApi.bindAttachments("file", PURCHASE_INVOICE_RECORD_TYPE, invoice.getId(), createReqVO.getBlobIds());
         }
         return invoice.getId();
     }
 
-    private void validateRelationDataExists(ErpPurchaseInvoiceSaveReqVO reqVO) {
-        // 鏍¢獙閲囪喘璁㈠崟锛屽繀椤诲鏍搁�氳繃
-        ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.validatePurchaseOrder(reqVO.getPurchaseOrderId());
-        // 鏍¢獙渚涘簲鍟嗕笌閲囪喘璁㈠崟涓�鑷达紙闃插尽鑴忔暟鎹細鏉ョエ蹇呴』灞炰簬璇ラ噰璐鍗曠殑渚涘簲鍟嗭級
-        if (reqVO.getSupplierId() != null && ObjectUtil.notEqual(purchaseOrder.getSupplierId(), reqVO.getSupplierId())) {
-            throw exception(PURCHASE_INVOICE_CREATE_FAIL_SUPPLIER_MISMATCH);
+    /**
+     * 鏍¢獙閲囪喘璁㈠崟鍒嗘憡鏄庣粏锛屽苟鎶婁富璁㈠崟銆佷緵搴斿晢鍥炲啓鍒� reqVO 涓�
+     *
+     * @return 鍒嗘憡鏄庣粏涓殑閲囪喘璁㈠崟鍒楄〃锛堥『搴忎笌鏄庣粏涓�鑷达級
+     */
+    private List<ErpPurchaseOrderDO> validateOrderAllocations(ErpPurchaseInvoiceSaveReqVO reqVO) {
+        List<ErpPurchaseInvoiceOrderReqVO> allocations = reqVO.getOrderAllocations();
+        if (CollUtil.isEmpty(allocations)) {
+            throw exception(PURCHASE_INVOICE_ALLOCATION_EMPTY);
         }
-        reqVO.setSupplierId(purchaseOrder.getSupplierId()); // 渚涘簲鍟嗕互閲囪喘璁㈠崟涓哄噯
+        // 1. 鏍¢獙璁㈠崟涓嶉噸澶嶃�佸繀椤诲鏍搁�氳繃
+        Set<Long> orderIds = new HashSet<>();
+        List<ErpPurchaseOrderDO> orders = new ArrayList<>();
+        for (int i = 0; i < allocations.size(); i++) {
+            ErpPurchaseInvoiceOrderReqVO allocation = allocations.get(i);
+            if (!orderIds.add(allocation.getPurchaseOrderId())) {
+                throw new ServiceException(PURCHASE_INVOICE_ALLOCATION_ORDER_DUPLICATE.getCode(),
+                        StrUtil.format("绗� {} 琛岀殑閲囪喘璁㈠崟閲嶅閫夋嫨锛屽悓涓�寮犳潵绁ㄥ唴姣忓紶閲囪喘璁㈠崟鍙兘鍑虹幇涓�娆★紝璇峰垹闄ら噸澶嶈鍚庨噸璇�", i + 1));
+            }
+            if (allocation.getPrice() == null || allocation.getPrice().compareTo(BigDecimal.ZERO) < 0) {
+                throw new ServiceException(PURCHASE_INVOICE_ALLOCATION_PRICE_INVALID.getCode(),
+                        StrUtil.format("绗� {} 琛岀殑鍒嗘憡閲戦涓嶈兘涓虹┖涓斾笉鑳藉皬浜� 0锛岃濉啓璇ヨ鍗曟湰娆″垎鎽婂埌鐨勬潵绁ㄩ噾棰�", i + 1));
+            }
+            orders.add(purchaseOrderService.validatePurchaseOrder(allocation.getPurchaseOrderId()));
+        }
+        // 1.2 鏍¢獙鎵�鏈夐噰璐鍗曞繀椤绘槸鍚屼竴渚涘簲鍟嗭紙鏉ョエ瀵瑰簲涓�涓緵搴斿晢锛�
+        validateSameSupplier(orders);
+        // 2. 鏍¢獙鍒嗘憡鍚堣涓嶈兘澶т簬鏉ョエ閲戦锛堝厑璁稿皬浜庯細鏈垎鎽婇儴鍒嗗彲鍚庣画缂栬緫鏉ョエ鏃跺啀琛ュ厖閲囪喘璁㈠崟锛�
+        BigDecimal allocationTotal = allocations.stream().map(ErpPurchaseInvoiceOrderReqVO::getPrice)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        if (allocationTotal.compareTo(reqVO.getPrice()) > 0) {
+            throw new ServiceException(PURCHASE_INVOICE_ALLOCATION_SUM_MISMATCH.getCode(),
+                    StrUtil.format("鏉ョエ閲戦 {} 鍏冿紝鍚勮鍗曞垎鎽婂悎璁� {} 鍏冿紝鍒嗘憡鍚堣涓嶈兘澶т簬鏉ョエ閲戦锛堣秴鍑� {} 鍏冿級銆�"
+                                    + "璇峰噺灏戣鍗曠殑鍒嗘憡閲戦锛屾垨鎻愰珮鏉ョエ閲戦鍚庨噸璇曪紱鏈垎鎽婄殑閮ㄥ垎鍙互鐣欏緟浠ュ悗鍐嶇紪杈戞潵绁ㄨˉ鍏呴噰璐鍗曘��",
+                            reqVO.getPrice().stripTrailingZeros().toPlainString(),
+                            allocationTotal.stripTrailingZeros().toPlainString(),
+                            allocationTotal.subtract(reqVO.getPrice()).stripTrailingZeros().toPlainString()));
+        }
+        // 3. 涓昏鍗曘�佷緵搴斿晢鍙栧垎鎽婃槑缁嗙涓�寮狅紙涓�寮犳潵绁ㄦ秹鍙婂涓緵搴斿晢鏃讹紝鍒楄〃/浠樻娌跨敤绗竴瀹讹級
+        reqVO.setPurchaseOrderId(allocations.get(0).getPurchaseOrderId());
+        reqVO.setSupplierId(orders.get(0).getSupplierId());
+        return orders;
     }
 
-    private void validatePurchaseInvoicePriceExceedsLimit(ErpPurchaseInvoiceSaveReqVO reqVO) {
-        // 1. 璁$畻鍓╀綑鍙紑绁ㄩ噾棰濓紝涓嶅寘鎷� reqVO 鑷韩锛堟墍鏈夋湁鏁堟潵绁ㄩ兘鍗犵敤棰濆害锛岄槻姝㈢疮璁℃潵绁ㄨ秴杩囬噰璐鍗曢噾棰濓級
-        ErpPurchaseOrderDO purchaseOrder = purchaseOrderService.getPurchaseOrder(reqVO.getPurchaseOrderId());
-        List<ErpPurchaseInvoiceDO> invoices = invoiceMapper.selectListByOrderId(reqVO.getPurchaseOrderId());
-        if (reqVO.getId() != null) {
-            invoices.removeIf(invoice -> ObjectUtil.equal(invoice.getId(), reqVO.getId()));
+    /**
+     * 鏍¢獙鍒嗘憡鏄庣粏涓殑閲囪喘璁㈠崟鏄惁灞炰簬鍚屼竴渚涘簲鍟嗭細鏉ョエ鍙兘瀵瑰簲涓�涓緵搴斿晢
+     */
+    private void validateSameSupplier(List<ErpPurchaseOrderDO> orders) {
+        ErpPurchaseOrderDO firstOrder = orders.get(0);
+        for (int i = 1; i < orders.size(); i++) {
+            ErpPurchaseOrderDO order = orders.get(i);
+            if (ObjectUtil.notEqual(order.getSupplierId(), firstOrder.getSupplierId())) {
+                throw new ServiceException(PURCHASE_INVOICE_ALLOCATION_SUPPLIER_MISMATCH.getCode(),
+                        StrUtil.format("绗� {} 琛岀殑閲囪喘璁㈠崟[{}]渚涘簲鍟嗕负[{}]锛屼笌绗� 1 琛岄噰璐鍗昜{}]鐨勪緵搴斿晢[{}]涓嶄竴鑷淬��"
+                                        + "涓�寮犳潵绁ㄥ彧鑳藉叧鑱斿悓涓�渚涘簲鍟嗙殑閲囪喘璁㈠崟锛岃绉婚櫎璇ヨ鍗曪紝鎴栨敼閫夎渚涘簲鍟嗙殑鍏朵粬閲囪喘璁㈠崟鍚庨噸璇曘��",
+                                i + 1, order.getNo(), getSupplierName(order.getSupplierId()),
+                                firstOrder.getNo(), getSupplierName(firstOrder.getSupplierId())));
+            }
         }
-        BigDecimal remainPrice = purchaseOrder.getTotalPrice().subtract(
-                getSumValue(invoices, ErpPurchaseInvoiceDO::getPrice, BigDecimal::add, BigDecimal.ZERO));
-        // 2. 鏍¢獙閲戦鏄惁瓒呰繃
-        if (reqVO.getPrice().compareTo(remainPrice) > 0) {
-            throw exception(PURCHASE_INVOICE_CREATE_FAIL_PRICE_EXCEEDS_LIMIT, remainPrice);
+    }
+
+    private String getSupplierName(Long supplierId) {
+        SrmSupplierRespDTO supplier = srmSupplierApi.getSupplier(supplierId).getCheckedData();
+        return supplier == null ? "ID=" + supplierId : supplier.getName();
+    }
+
+    private void validateAllocationPriceExceedsLimit(ErpPurchaseInvoiceSaveReqVO reqVO, List<ErpPurchaseOrderDO> orders) {
+        List<ErpPurchaseInvoiceOrderReqVO> allocations = reqVO.getOrderAllocations();
+        for (int i = 0; i < allocations.size(); i++) {
+            ErpPurchaseInvoiceOrderReqVO allocation = allocations.get(i);
+            ErpPurchaseOrderDO order = orders.get(i);
+            // 1. 璇ヨ鍗曞叾浠栨潵绁ㄥ凡鍗犵敤鐨勯噾棰濓紙缂栬緫鏃舵帓闄ゆ湰寮犳潵绁ㄨ嚜韬殑鍒嗘憡锛�
+            List<ErpPurchaseInvoiceOrderDO> existed = invoiceOrderMapper.selectListByPurchaseOrderId(order.getId());
+            if (reqVO.getId() != null) {
+                existed.removeIf(row -> ObjectUtil.equal(row.getInvoiceId(), reqVO.getId()));
+            }
+            BigDecimal invoicedPrice = getSumValue(existed, ErpPurchaseInvoiceOrderDO::getPrice, BigDecimal::add, BigDecimal.ZERO);
+            BigDecimal remainPrice = order.getTotalPrice().subtract(invoicedPrice);
+            // 2. 鏍¢獙閲戦鏄惁瓒呰繃
+            if (allocation.getPrice().compareTo(remainPrice) > 0) {
+                throw new ServiceException(PURCHASE_INVOICE_CREATE_FAIL_PRICE_EXCEEDS_LIMIT.getCode(),
+                        StrUtil.format("閲囪喘璁㈠崟[{}]鐨勫垎鎽婇噾棰濊秴鍑鸿璁㈠崟鏈紑绁ㄩ噾棰濓細璁㈠崟閲戦 {} 鍏冿紝鍏朵粬鏉ョエ宸插崰鐢� {} 鍏冿紝"
+                                        + "鍓╀綑鏈紑绁� {} 鍏冿紝鏈鍒嗘憡 {} 鍏冦�傝璋冩暣璇ヨ鍗曠殑鍒嗘憡閲戦锛屾垨鏀归�夊叾浠栭噰璐鍗曞悗閲嶈瘯銆�",
+                                order.getNo(), order.getTotalPrice().stripTrailingZeros().toPlainString(),
+                                invoicedPrice.stripTrailingZeros().toPlainString(),
+                                remainPrice.stripTrailingZeros().toPlainString(),
+                                allocation.getPrice().stripTrailingZeros().toPlainString()));
+            }
         }
+    }
+
+    private void insertOrderAllocations(Long invoiceId, ErpPurchaseInvoiceSaveReqVO reqVO) {
+        List<ErpPurchaseInvoiceOrderDO> rows = new ArrayList<>();
+        for (int i = 0; i < reqVO.getOrderAllocations().size(); i++) {
+            ErpPurchaseInvoiceOrderReqVO allocation = reqVO.getOrderAllocations().get(i);
+            rows.add(ErpPurchaseInvoiceOrderDO.builder().invoiceId(invoiceId)
+                    .purchaseOrderId(allocation.getPurchaseOrderId())
+                    .price(allocation.getPrice()).sort(i).build());
+        }
+        rows.forEach(invoiceOrderMapper::insert);
     }
 
     @Override
@@ -113,15 +213,19 @@
         Assert.notNull(updateReqVO.getId(), "鏉ョエ缂栧彿涓嶈兘涓虹┖");
         // 1.1 鏍¢獙瀛樺湪
         validatePurchaseInvoiceExists(updateReqVO.getId());
-        // 1.2 鏍¢獙鍏宠仈鏁版嵁 + 鍙紑绁ㄩ噾棰�
-        validateRelationDataExists(updateReqVO);
-        validatePurchaseInvoicePriceExceedsLimit(updateReqVO);
+        // 1.2 鏍¢獙閲囪喘璁㈠崟銆佸垎鎽婃槑缁嗐�侀噾棰濅笂闄�
+        List<ErpPurchaseOrderDO> orders = validateOrderAllocations(updateReqVO);
+        validateAllocationPriceExceedsLimit(updateReqVO, orders);
 
         // 2. 鏇存柊鏉ョエ
         ErpPurchaseInvoiceDO updateObj = BeanUtils.toBean(updateReqVO, ErpPurchaseInvoiceDO.class);
         invoiceMapper.updateById(updateObj);
 
-        // 3. 澧為噺鏇存柊鍙戠エ闄勪欢
+        // 3. 閲嶅缓閲囪喘璁㈠崟鍒嗘憡鏄庣粏
+        invoiceOrderMapper.deleteByInvoiceId(updateReqVO.getId());
+        insertOrderAllocations(updateReqVO.getId(), updateReqVO);
+
+        // 4. 澧為噺鏇存柊鍙戠エ闄勪欢
         storageAttachmentApi.updateAttachments("file", PURCHASE_INVOICE_RECORD_TYPE, updateReqVO.getId(), updateReqVO.getBlobIds());
     }
 
@@ -140,6 +244,8 @@
         storageAttachmentApi.deleteAttachmentsByRecord(PURCHASE_INVOICE_RECORD_TYPE, id);
         // 2.2 鍒犻櫎鏉ョエ
         invoiceMapper.deleteById(id);
+        // 2.3 鍒犻櫎閲囪喘璁㈠崟鍒嗘憡鏄庣粏锛堥噴鏀捐鍗曠殑宸叉潵绁ㄩ噾棰濓級
+        invoiceOrderMapper.deleteByInvoiceId(id);
     }
 
     private ErpPurchaseInvoiceDO validatePurchaseInvoiceExists(Long id) {
@@ -170,7 +276,11 @@
 
     @Override
     public List<ErpPurchaseInvoiceDO> getPurchaseInvoiceListByOrderId(Long orderId) {
-        return invoiceMapper.selectListByOrderId(orderId);
+        List<ErpPurchaseInvoiceOrderDO> allocations = invoiceOrderMapper.selectListByPurchaseOrderId(orderId);
+        if (CollUtil.isEmpty(allocations)) {
+            return Collections.emptyList();
+        }
+        return invoiceMapper.selectByIds(convertSet(allocations, ErpPurchaseInvoiceOrderDO::getInvoiceId));
     }
 
     @Override
@@ -179,13 +289,38 @@
     }
 
     @Override
-    public Map<Long, BigDecimal> getPurchaseInvoicePriceSumMapByOrderIds(Collection<Long> orderIds) {
+    public Map<Long, BigDecimal> getPurchaseInvoicePriceSumMapByOrderIds(Collection<Long> orderIds, Long excludeInvoiceId) {
         if (CollUtil.isEmpty(orderIds)) {
             return Collections.emptyMap();
         }
-        List<ErpPurchaseInvoiceDO> invoices = invoiceMapper.selectListByOrderIds(orderIds);
-        return invoices.stream().collect(Collectors.groupingBy(ErpPurchaseInvoiceDO::getPurchaseOrderId,
-                Collectors.mapping(ErpPurchaseInvoiceDO::getPrice, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
+        List<ErpPurchaseInvoiceOrderDO> allocations = invoiceOrderMapper.selectListByPurchaseOrderIds(orderIds);
+        if (excludeInvoiceId != null) {
+            // 缂栬緫鏉ョエ鏃舵妸鏈紶鏉ョエ宸插垎鎽婄殑閲戦閫�鍥炶鍗�
+            allocations.removeIf(row -> ObjectUtil.equal(row.getInvoiceId(), excludeInvoiceId));
+        }
+        return allocations.stream().collect(Collectors.groupingBy(ErpPurchaseInvoiceOrderDO::getPurchaseOrderId,
+                Collectors.mapping(ErpPurchaseInvoiceOrderDO::getPrice, Collectors.reducing(BigDecimal.ZERO, BigDecimal::add))));
+    }
+
+    @Override
+    public List<ErpPurchaseInvoiceOrderDO> getPurchaseInvoiceOrderListByInvoiceId(Long invoiceId) {
+        return invoiceOrderMapper.selectListByInvoiceId(invoiceId);
+    }
+
+    @Override
+    public List<ErpPurchaseInvoiceOrderDO> getPurchaseInvoiceOrderListByInvoiceIds(Collection<Long> invoiceIds) {
+        if (CollUtil.isEmpty(invoiceIds)) {
+            return Collections.emptyList();
+        }
+        return invoiceOrderMapper.selectListByInvoiceIds(invoiceIds);
+    }
+
+    @Override
+    public List<ErpPurchaseInvoiceOrderDO> getPurchaseInvoiceOrderListByPurchaseOrderIds(Collection<Long> purchaseOrderIds) {
+        if (CollUtil.isEmpty(purchaseOrderIds)) {
+            return Collections.emptyList();
+        }
+        return invoiceOrderMapper.selectListByPurchaseOrderIds(purchaseOrderIds);
     }
 
 }

--
Gitblit v1.9.3