From 70ea74cfb981f812bfa4e3ef91843c5ad93f7b27 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 04 十一月 2026 17:32:49 +0800
Subject: [PATCH] feat(erp): 采购台账改造与采购退货增强

---
 yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java
index e24d92f..e4a070c 100644
--- a/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java
+++ b/yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/controller/admin/finance/ErpFinancePaymentController.java
@@ -13,13 +13,12 @@
 import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment.ErpFinancePaymentRespVO;
 import cn.iocoder.yudao.module.erp.controller.admin.finance.vo.payment.ErpFinancePaymentSaveReqVO;
 import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.invoice.ErpPurchaseInvoiceRespVO;
-import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpAccountDO;
 import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentDO;
 import cn.iocoder.yudao.module.erp.dal.dataobject.finance.ErpFinancePaymentItemDO;
 import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInvoiceDO;
+import cn.iocoder.yudao.module.erp.enums.finance.ErpFinancePaymentSourceTypeEnum;
 import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi;
 import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO;
-import cn.iocoder.yudao.module.erp.service.finance.ErpAccountService;
 import cn.iocoder.yudao.module.erp.service.finance.ErpFinancePaymentService;
 import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchaseInvoiceService;
 import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
@@ -56,8 +55,6 @@
     @Resource
     private SrmSupplierApi srmSupplierApi;
     @Resource
-    private ErpAccountService accountService;
-    @Resource
     private ErpPurchaseInvoiceService invoiceService;
 
     @Resource
@@ -92,7 +89,6 @@
 
     @GetMapping("/approve-process-list")
     @Operation(summary = "鑾峰彇浠樻鍗曞鎵规祦绋嬪垪琛�")
-    @PreAuthorize("@ss.hasPermission('erp:finance-payment:query')")
     public CommonResult<List<Map<String, Object>>> getApproveProcessList() {
         return success(financePaymentService.getFinancePaymentApproveProcessDefinitionList());
     }
@@ -109,7 +105,6 @@
     @GetMapping("/get")
     @Operation(summary = "鑾峰緱浠樻鍗�")
     @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
-    @PreAuthorize("@ss.hasPermission('erp:finance-payment:query')")
     public CommonResult<ErpFinancePaymentRespVO> getFinancePayment(@RequestParam("id") Long id) {
         ErpFinancePaymentDO payment = financePaymentService.getFinancePayment(id);
         if (payment == null) {
@@ -131,13 +126,13 @@
         ErpPurchaseInvoiceRespVO invoiceFinal = invoiceVO;
         return BeanUtils.toBean(payment, ErpFinancePaymentRespVO.class, financePaymentVO ->
                 financePaymentVO.setInvoice(invoiceFinal)
+                .setSourceTypeName(resolveSourceTypeName(payment.getSourceType()))
                 .setItems(BeanUtils.toBean(paymentItemList, ErpFinancePaymentRespVO.Item.class))
                 .setAttachmentList(storageAttachmentApi.listAttachments("erp_finance_payment", payment.getId())));
     }
 
     @GetMapping("/page")
     @Operation(summary = "鑾峰緱浠樻鍗曞垎椤�")
-    @PreAuthorize("@ss.hasPermission('erp:finance-payment:query')")
     public CommonResult<PageResult<ErpFinancePaymentRespVO>> getFinancePaymentPage(@Valid ErpFinancePaymentPageReqVO pageReqVO) {
         PageResult<ErpFinancePaymentDO> pageResult = financePaymentService.getFinancePaymentPage(pageReqVO);
         return success(buildFinancePaymentVOPageResult(pageResult));
@@ -155,6 +150,11 @@
         ExcelUtils.write(response, "浠樻鍗�.xls", "鏁版嵁", ErpFinancePaymentRespVO.class, list);
     }
 
+    private String resolveSourceTypeName(Integer sourceType) {
+        ErpFinancePaymentSourceTypeEnum sourceTypeEnum = ErpFinancePaymentSourceTypeEnum.valueOf(sourceType);
+        return sourceTypeEnum != null ? sourceTypeEnum.getName() : null;
+    }
+
     private PageResult<ErpFinancePaymentRespVO> buildFinancePaymentVOPageResult(PageResult<ErpFinancePaymentDO> pageResult) {
         if (CollUtil.isEmpty(pageResult.getList())) {
             return PageResult.empty(pageResult.getTotal());
@@ -167,20 +167,17 @@
         Map<Long, SrmSupplierRespDTO> supplierMap = srmSupplierApi.getSupplierList(
                 convertSet(pageResult.getList(), ErpFinancePaymentDO::getSupplierId)).getCheckedData().stream()
                 .collect(java.util.stream.Collectors.toMap(SrmSupplierRespDTO::getId, v -> v, (a, b) -> a));
-        // 1.3 缁撶畻璐︽埛淇℃伅
-        Map<Long, ErpAccountDO> accountMap = accountService.getAccountMap(
-                convertSet(pageResult.getList(), ErpFinancePaymentDO::getAccountId));
-        // 1.4 绠$悊鍛樹俊鎭�
+        // 1.3 绠$悊鍛樹俊鎭�
         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(),
                 contact -> Stream.of(NumberUtils.parseLong(contact.getCreator()), contact.getFinanceUserId())));
-        // 1.5 鏉ョエ淇℃伅
+        // 1.4 鏉ョエ淇℃伅
         Map<Long, ErpPurchaseInvoiceDO> invoiceMap = invoiceService.getPurchaseInvoiceMap(
                 convertSet(pageResult.getList(), ErpFinancePaymentDO::getInvoiceId));
         // 2. 寮�濮嬫嫾鎺�
         return BeanUtils.toBean(pageResult, ErpFinancePaymentRespVO.class, payment -> {
             payment.setItems(BeanUtils.toBean(financePaymentItemMap.get(payment.getId()), ErpFinancePaymentRespVO.Item.class));
+            payment.setSourceTypeName(resolveSourceTypeName(payment.getSourceType()));
             MapUtils.findAndThen(supplierMap, payment.getSupplierId(), supplier -> payment.setSupplierName(supplier.getName()));
-            MapUtils.findAndThen(accountMap, payment.getAccountId(), account -> payment.setAccountName(account.getName()));
             MapUtils.findAndThen(userMap, Long.parseLong(payment.getCreator()), user -> payment.setCreatorName(user.getNickname()));
             MapUtils.findAndThen(userMap, payment.getFinanceUserId(), user -> payment.setFinanceUserName(user.getNickname()));
             MapUtils.findAndThen(invoiceMap, payment.getInvoiceId(), invoice ->

--
Gitblit v1.9.3