From d3a26acb38a0747c5df33db848e5fb80ae2e97b9 Mon Sep 17 00:00:00 2001
From: wujianwei <wjw@11.com>
Date: 星期五, 06 三月 2026 10:45:12 +0800
Subject: [PATCH] 修改配置

---
 service/src/main/java/com/ruoyi/cwgl/controller/ReceivableBillManagementController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableBillManagementController.java b/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableBillManagementController.java
index 1097f20..4cf492f 100644
--- a/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableBillManagementController.java
+++ b/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableBillManagementController.java
@@ -16,8 +16,15 @@
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Objects;
+import com.ruoyi.cwgl.domain.InvoiceManage;
 import com.ruoyi.cwgl.domain.ReceivableBillManagement;
+import com.ruoyi.cwgl.domain.ReceivableInvoiceBusiness;
+import com.ruoyi.cwgl.service.IInvoiceManageService;
 import com.ruoyi.cwgl.service.IReceivableBillManagementService;
+import com.ruoyi.cwgl.service.IReceivableInvoiceBusinessService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
 
@@ -33,6 +40,12 @@
 {
     @Autowired
     private IReceivableBillManagementService receivableBillManagementService;
+
+    @Autowired
+    private IInvoiceManageService invoiceManageService;
+
+    @Autowired
+    private IReceivableInvoiceBusinessService receivableInvoiceBusinessService;
 
 
 
@@ -116,4 +129,42 @@
     {
         return toAjax(receivableBillManagementService.voidReceivableBillManagement(id));
     }
+
+    /**
+     * 搴旀敹璐﹀崟鐢宠寮�绁�
+     * @param invoiceManage 鍙戠エ绠$悊瀵硅薄
+     * @param id 搴旀敹璐﹀崟ID
+     * @return 缁撴灉
+     */
+    @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:invoice')")
+    @Log(title = "搴旀敹璐﹀崟绠$悊", businessType = BusinessType.OTHER)
+    @PostMapping("/invoice/{id}")
+    public AjaxResult applyReceivableInvoice(@RequestBody InvoiceManage invoiceManage, @PathVariable("id") Integer id)
+    {
+        return invoiceManageService.applyReceivableInvoice(invoiceManage, id);
+    }
+
+    /**
+     * 鏌ヨ搴旀敹璐﹀崟宸插紑绁ㄩ噾棰�
+     * @param id 搴旀敹璐﹀崟ID
+     * @return 宸插紑绁ㄩ噾棰�
+     */
+    @PreAuthorize("@ss.hasPermi('cwgl:receivableBillManagement:query')")
+    @GetMapping("/invoice/amount/{id}")
+    public AjaxResult getReceivableInvoicedAmount(@PathVariable("id") Integer id)
+    {
+        // 鏌ヨreceivable_invoice_business琛ㄤ腑status涓�1鐨勮褰�
+        ReceivableInvoiceBusiness query = new ReceivableInvoiceBusiness();
+        query.setHeadId(id);
+        query.setStatus(1);
+        List<ReceivableInvoiceBusiness> invoices = receivableInvoiceBusinessService.selectReceivableInvoiceBusinessList(query);
+        
+        // 璁$畻宸插紑绁ㄩ噾棰�
+        BigDecimal invoicedAmount = invoices.stream()
+                .map(ReceivableInvoiceBusiness::getInvoicingAmount)
+                .filter(Objects::nonNull)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        
+        return AjaxResult.success(invoicedAmount);
+    }
 }

--
Gitblit v1.8.0