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/ReceivableFeeManagementController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableFeeManagementController.java b/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableFeeManagementController.java
index 1e53121..3ed912c 100644
--- a/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableFeeManagementController.java
+++ b/service/src/main/java/com/ruoyi/cwgl/controller/ReceivableFeeManagementController.java
@@ -1,6 +1,9 @@
 package com.ruoyi.cwgl.controller;
 
+import java.util.ArrayList;
 import java.util.List;
+
+import com.ruoyi.cwgl.domain.ReceivableFeeDetail;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,6 +14,7 @@
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 import com.ruoyi.common.utils.file.DownloadExportUtil;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
@@ -140,4 +144,51 @@
     {
         return toAjax(receivableFeeManagementService.voidReceivableFeeManagement(id));
     }
+
+    /**
+     * 瀵煎叆搴旀敹璐圭敤绠$悊鏁版嵁锛堟敮鎸佸Sheet锛歋heet1涓昏〃锛孲heet2鏄庣粏琛級
+     */
+    @Log(title = "搴旀敹璐圭敤绠$悊", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('cwgl:receivableFeeManagement:import')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+    {
+        // 瀵煎叆涓昏〃鏁版嵁锛圫heet1锛�
+        ExcelUtil<ReceivableFeeManagement> mainUtil = new ExcelUtil<ReceivableFeeManagement>(ReceivableFeeManagement.class);
+        List<ReceivableFeeManagement> receivableFeeList = mainUtil.importExcel("搴旀敹璐圭敤涓昏〃", file.getInputStream(),10000);
+        
+        // 瀵煎叆鏄庣粏琛ㄦ暟鎹紙Sheet2锛夊苟鍏宠仈鍒颁富琛�
+        ExcelUtil<ReceivableFeeDetail> detailUtil = new ExcelUtil<ReceivableFeeDetail>(ReceivableFeeDetail.class);
+        List<ReceivableFeeDetail> detailList = detailUtil.importExcel("搴旀敹璐圭敤鏄庣粏", file.getInputStream(),10000);
+        
+        // 灏嗘槑缁嗘暟鎹叧鑱斿埌瀵瑰簲鐨勪富琛ㄨ褰�
+        if (detailList != null && !detailList.isEmpty()) {
+            for (ReceivableFeeDetail detail : detailList) {
+                // 鏍规嵁搴忓彿瀛楁鎵惧埌瀵瑰簲鐨勪富琛ㄨ褰�
+                for (ReceivableFeeManagement mainRecord : receivableFeeList) {
+                    if (mainRecord.getSerialNumber() != null && 
+                        mainRecord.getSerialNumber().equals(detail.getSerialNumber())) {
+                        if (mainRecord.getReceivableFeeDetailList() == null) {
+                            mainRecord.setReceivableFeeDetailList(new ArrayList<>());
+                        }
+                        mainRecord.getReceivableFeeDetailList().add(detail);
+                        break;
+                    }
+                }
+            }
+        }
+        
+        String message = receivableFeeManagementService.importReceivableFee(receivableFeeList, getUsername());
+        return success(message);
+    }
+
+    /**
+     * 涓嬭浇瀵煎叆妯℃澘
+     */
+    @GetMapping("/importTemplate")
+    public AjaxResult importTemplate(String exportKey)
+    {
+        receivableFeeManagementService.importTemplate(exportKey);
+        return AjaxResult.success("瀵煎嚭璇锋眰鎴愬姛锛岃绋嶅悗鐐瑰嚮涓嬭浇...!");
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0