From fea2d693c33fdbcb4c8304a96a4e584829cb437b Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期四, 29 一月 2026 17:25:30 +0800
Subject: [PATCH] 申请开票和开票记录,科目管理界面

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

diff --git a/service/src/main/java/com/ruoyi/cwgl/controller/PayableBillManagementController.java b/service/src/main/java/com/ruoyi/cwgl/controller/PayableBillManagementController.java
index 2916ee3..0db2612 100644
--- a/service/src/main/java/com/ruoyi/cwgl/controller/PayableBillManagementController.java
+++ b/service/src/main/java/com/ruoyi/cwgl/controller/PayableBillManagementController.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.PayableBillManagement;
+import com.ruoyi.cwgl.domain.PayableInvoiceBusiness;
+import com.ruoyi.cwgl.service.IInvoiceManageService;
 import com.ruoyi.cwgl.service.IPayableBillManagementService;
+import com.ruoyi.cwgl.service.IPayableInvoiceBusinessService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
 
@@ -33,6 +40,12 @@
 {
     @Autowired
     private IPayableBillManagementService payableBillManagementService;
+
+    @Autowired
+    private IInvoiceManageService invoiceManageService;
+
+    @Autowired
+    private IPayableInvoiceBusinessService payableInvoiceBusinessService;
 
 
 
@@ -105,4 +118,53 @@
     {
         return toAjax(payableBillManagementService.deletePayableBillManagementByIds(ids));
     }
+    
+    /**
+     * 浣滃簾搴斾粯璐﹀崟绠$悊璁板綍
+     */
+    @PreAuthorize("@ss.hasPermi('cwgl:payableBillManagement:void')")
+    @Log(title = "搴斾粯璐﹀崟绠$悊", businessType = BusinessType.UPDATE)
+    @PutMapping("/void/{id}")
+    public AjaxResult voidPayableBill(@PathVariable("id") Integer id)
+    {
+        return toAjax(payableBillManagementService.voidPayableBillManagement(id));
+    }
+
+    /**
+     * 搴斾粯璐﹀崟鐢宠寮�绁�
+     * @param invoiceManage 鍙戠エ绠$悊瀵硅薄
+     * @param id 搴斾粯璐﹀崟ID
+     * @return 缁撴灉
+     */
+    @PreAuthorize("@ss.hasPermi('cwgl:payableBillManagement:invoice')")
+    @Log(title = "搴斾粯璐﹀崟绠$悊", businessType = BusinessType.OTHER)
+    @PostMapping("/invoice/{id}")
+    public AjaxResult applyPayableInvoice(@RequestBody InvoiceManage invoiceManage, @PathVariable("id") Integer id)
+    {
+        return invoiceManageService.applyPayableInvoice(invoiceManage, id);
+    }
+
+    /**
+     * 鏌ヨ搴斾粯璐﹀崟宸插紑绁ㄩ噾棰�
+     * @param id 搴斾粯璐﹀崟ID
+     * @return 宸插紑绁ㄩ噾棰�
+     */
+    @PreAuthorize("@ss.hasPermi('cwgl:payableBillManagement:query')")
+    @GetMapping("/invoice/amount/{id}")
+    public AjaxResult getPayableInvoicedAmount(@PathVariable("id") Integer id)
+    {
+        // 鏌ヨpayable_invoice_business琛ㄤ腑status涓�1鐨勮褰�
+        PayableInvoiceBusiness query = new PayableInvoiceBusiness();
+        query.setHeadId(id);
+        query.setStatus(1);
+        List<PayableInvoiceBusiness> invoices = payableInvoiceBusinessService.selectPayableInvoiceBusinessList(query);
+        
+        // 璁$畻宸插紑绁ㄩ噾棰�
+        BigDecimal invoicedAmount = invoices.stream()
+                .map(PayableInvoiceBusiness::getInvoicingAmount)
+                .filter(Objects::nonNull)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        
+        return AjaxResult.success(invoicedAmount);
+    }
 }

--
Gitblit v1.8.0