From edbfa6b1a3a45e79cb17b06f3798535c3b1ba395 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 18 十一月 2026 09:12:39 +0800
Subject: [PATCH] 修改了增值税城建税

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFunddetailController.java          |   37 ++
 ruoyi-project/src/main/resources/mapper/project/VExpertfeeDonorMapper.xml                            |    3 
 ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeExpert.java                           |   25 +
 ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundMapper.java                          |   17 +
 ruoyi-common/src/main/java/com/ruoyi/common/tax/TaxtUtils.java                                       |   18 
 ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeDonor.java                            |   19 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java                |   41 ++
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonorpaymentServiceImpl.java       |    3 
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java         |  208 +++++++++----
 ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneySumEO.java                           |   10 
 ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml                          |    5 
 ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java                                 |   15 
 ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml                                |   47 +++
 ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java                    |   78 ++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java |    6 
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java               |  301 +++++++++++++++++--
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java            |   13 
 ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneyByItemEO.java                        |    5 
 18 files changed, 713 insertions(+), 138 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
index b846a92..6f70343 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java
@@ -9,6 +9,7 @@
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
@@ -146,13 +147,49 @@
     @GetMapping("/list")
     public TableDataInfo list(ServiceFund serviceFund) {
         startPage();
-        //List<ServiceFund> list = serviceFundService.queryList(serviceFund);
         SysUser user = SecurityUtils.getLoginUser().getUser();
-        serviceFund.setUsername(user.getNickName());
+        // 2026-11-10锛氭寜瑙掕壊鍒掑垎鍙鑼冨洿锛堝師瀹炵幇涓�寰嬪彧鏌�"鐢宠浜�=鏈汉"锛岀鐞嗗憳/缁勯暱鐪嬩笉鍒板埆浜虹殑鍗曟嵁锛�
+        applyFundDataScope(serviceFund, user);
         List<ServiceFund> list = serviceFundService.selectServiceFundList(serviceFund);
         return getDataTable(list);
     }
 
+    /**
+     * 鎶ラ攢鍗曞垪琛ㄦ暟鎹寖鍥达細
+     * 瓒呯锛坲ser_id=1 鎴� role_id=1锛夆啋 鍏ㄩ儴锛�
+     * 涓氬姟缁勯暱锛坮ole_id=13锛夆啋 鏈粍锛圖eptmentNo = 鐧诲綍浜烘墍灞為儴闂級锛�
+     * 鍏朵粬锛堜笓鑱屼汉鍛樼瓑锛夆啋 鏈汉锛圲serName = 鐧诲綍浜烘樀绉帮級銆�
+     */
+    private void applyFundDataScope(ServiceFund serviceFund, SysUser user) {
+        if (user == null) {
+            return;
+        }
+        if (Long.valueOf(1L).equals(user.getUserId()) || hasRole(user, 1L)) {
+            // 瓒呯锛氫笉鍔犱换浣曡繃婊わ紝鐪嬪叏閮�
+            return;
+        }
+        if (hasRole(user, 13L) && user.getDeptId() != null) {
+            // 涓氬姟缁勯暱锛氱湅鏈粍
+            serviceFund.setDeptmentno(String.valueOf(user.getDeptId()));
+            return;
+        }
+        // 榛樿锛氬彧鐪嬫湰浜�
+        serviceFund.setUsername(user.getNickName());
+    }
+
+    /** 鍒ゆ柇鐧诲綍浜烘槸鍚︽嫢鏈夋寚瀹氳鑹� */
+    private boolean hasRole(SysUser user, Long roleId) {
+        if (user == null || user.getRoles() == null) {
+            return false;
+        }
+        for (SysRole role : user.getRoles()) {
+            if (role != null && roleId.equals(role.getRoleId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     @GetMapping("/listnew")
     public TableDataInfo listnew(FundVO fundVO) {
         startPage();
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFunddetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFunddetailController.java
index d03d66f..c550957 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFunddetailController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFunddetailController.java
@@ -10,6 +10,7 @@
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.project.domain.FunddetailReqVo;
+import com.ruoyi.project.domain.ServiceFund;
 import com.ruoyi.project.domain.ServiceFunddetail;
 import com.ruoyi.project.domain.SpStatBonus;
 import com.ruoyi.project.domain.SpStatBonusDept;
@@ -17,6 +18,7 @@
 import com.ruoyi.project.domain.vo.TaxMoneyByItemEO;
 import com.ruoyi.project.domain.vo.TaxMoneySumEO;
 import com.ruoyi.project.domain.vo.TaxMoneyVO;
+import com.ruoyi.project.service.IServiceFundService;
 import com.ruoyi.project.service.IServiceFunddetailService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -43,6 +45,34 @@
 public class ServiceFunddetailController extends BaseController {
     @Autowired
     private IServiceFunddetailService serviceFunddetailService;
+
+    @Autowired
+    private IServiceFundService serviceFundService;
+
+    /**
+     * 2026-11-17锛氳鏄庣粏鎵�灞炴姤閿�鍗曟槸鍚﹁姹傞檮浠跺悕鍚腑鏂囥��
+     * 鍙e緞锛氫笓瀹跺姵鍔¤垂(applytype=1)銆佷鸡鐞嗕笓瀹惰垂(2) 涓嶈姹傦紱鍖诲鎴愭湰(3)銆佸姙鍏垂鐢�(4) 绛夊叾浠栫被鍨嬪繀椤诲惈涓枃銆�
+     * 鎶ラ攢绫诲瀷鍙栫埗鍗� service_fund.ApplyType锛堟槑缁嗚鑷韩鐨� applytype 鏄垂鐢ㄩ」鐩被鍨嬶紝涓嶈兘鐢ㄤ簬姝ゅ垽鏂級銆�
+     *
+     * @return {@code true}=蹇呴』鍚腑鏂�
+     */
+    private boolean requireChineseName(ServiceFunddetail detail) {
+        if (detail == null || detail.getFundid() == null) {
+            return false;
+        }
+        try {
+            ServiceFund fund = serviceFundService.getById(detail.getFundid());
+            if (fund == null || fund.getApplytype() == null) {
+                return false;
+            }
+            String type = String.valueOf(fund.getApplytype()).trim();
+            return !("1".equals(type) || "2".equals(type));
+        } catch (Exception e) {
+            // 鍙栦笉鍒版姤閿�绫诲瀷鏃朵笉棰濆鎷︽埅锛岄伩鍏嶅洜璇诲彇寮傚父鎶婃甯镐繚瀛樺崱姝�
+            log.warn("闄勪欢鍚嶄腑鏂囨牎楠岃幏鍙栨姤閿�绫诲瀷澶辫触锛岃烦杩囦腑鏂囨牎楠岋細{}", e.getMessage());
+            return false;
+        }
+    }
 
 
     /**
@@ -93,7 +123,8 @@
         // 2026-10-15锛氶檮浠舵枃浠跺悕瑙勮寖浜屾鏍¢獙锛堜笌鍓嶇 opo-web/src/utils/fileNameCheck.js 鍚屽彛寰勶紝
         // 鐩殑鏄槻姝㈢粫杩囧墠绔洿鎺ヨ皟鎺ュ彛淇濆瓨涓嶅悎瑙勯檮浠跺悕锛夈�傛柊澧炲満鏅病鏈夊巻鍙查檮浠讹紝鐢ㄤ弗鏍兼ā寮忋��
         String nameError = com.ruoyi.project.common.AttachmentNameValidator
-                .checkJsonList(serviceFunddetail.getInvoicefiles(), serviceFunddetail.getAnnexfiles());
+                .checkJsonList(requireChineseName(serviceFunddetail),
+                        serviceFunddetail.getInvoicefiles(), serviceFunddetail.getAnnexfiles());
         if (nameError != null) {
             return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
         }
@@ -124,8 +155,8 @@
             }
         }
         String nameError = com.ruoyi.project.common.AttachmentNameValidator
-                .checkJsonListForUpdate(existingNames, serviceFunddetail.getInvoicefiles(),
-                        serviceFunddetail.getAnnexfiles());
+                .checkJsonListForUpdate(existingNames, requireChineseName(serviceFunddetail),
+                        serviceFunddetail.getInvoicefiles(), serviceFunddetail.getAnnexfiles());
         if (nameError != null) {
             return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
         }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
index ed619ef..3fb58b7 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceReimbursementdetailController.java
@@ -113,7 +113,7 @@
                 ? serviceReimbursementdetailVO.getAnnexfiles()
                 : JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList());
         String nameError = com.ruoyi.project.common.AttachmentNameValidator
-                .checkJsonList(invoiceJson, annexJson);
+                .checkJsonList(true, invoiceJson, annexJson);
         if (nameError != null) {
             return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
         }
@@ -151,7 +151,7 @@
                 }
             }
             String nameError = com.ruoyi.project.common.AttachmentNameValidator.checkJsonListForUpdate(
-                    existingNames, serviceReimbursementdetail.getInvoicefiles(),
+                    existingNames, true, serviceReimbursementdetail.getInvoicefiles(),
                     serviceReimbursementdetail.getAnnexfiles());
             if (nameError != null) {
                 return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
@@ -192,7 +192,7 @@
                 ? serviceReimbursementdetailVO.getAnnexfiles()
                 : JSON.toJSONString(serviceReimbursementdetailVO.getAnnexfilesList());
         String nameError = com.ruoyi.project.common.AttachmentNameValidator
-                .checkJsonListForUpdate(existingNames, invoiceJson, annexJson);
+                .checkJsonListForUpdate(existingNames, true, invoiceJson, annexJson);
         if (nameError != null) {
             return AjaxResult.error("闄勪欢鏂囦欢鍚嶄笉绗﹀悎瑕佹眰锛屾棤娉曚繚瀛橈細" + nameError);
         }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/tax/TaxtUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/tax/TaxtUtils.java
index a28381d..83aa66c 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/tax/TaxtUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/tax/TaxtUtils.java
@@ -57,8 +57,8 @@
             taxMoney = multiply.multiply(BigDecimal.valueOf(0.4)).subtract(BigDecimal.valueOf(7000));
         }
         DecimalFormat decimalFormat = new DecimalFormat("#0.00");
-        //杩涗竴娉�
-        decimalFormat.setRoundingMode(RoundingMode.CEILING);
+        // 绠楃◣缁熶竴鍥涜垗浜斿叆鍒板垎锛�2026-11-17 鐢扁�滆繘涓�娉曗�濊皟鏁翠负鍥涜垗浜斿叆锛�
+        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
         String format = decimalFormat.format(taxMoney);
         log.info("绋庨噾涓猴細{}", format);
         return format;
@@ -69,7 +69,7 @@
      * <p>
      * 娉ㄦ剰锛氶櫎鏁板繀椤荤敤瀛楃涓�/甯搁噺鏋勯�犵殑绮剧‘鍊笺�傚師鍏堝啓鎴� {@code new BigDecimal(0.84)} 绛夛紝
      * 浼氭妸 double 鐨勪簩杩涘埗璇樊甯﹁繘闄ゆ硶锛堝 8313.06 / 0.84 鍙樻垚 9896.500000鈥�001锛夛紝
-     * 鍐嶅彔鍔犲悜涓婂彇鏁村氨澶氬嚭 1 鍒嗛挶锛屽鑷粹�滅◣鍚庡弽绠楃◣鍓嶁�濇棤娉曡繕鍘燂紙8300.00 绫婚噾棰濆弽瑙e嚭 10000.03锛夈��
+     * 鍐嶅彔鍔犲彇鏁村氨澶氬嚭 1 鍒嗛挶锛屽鑷粹�滅◣鍚庡弽绠楃◣鍓嶁�濇棤娉曡繕鍘燂紙8300.00 绫婚噾棰濆弽瑙e嚭 10000.03锛夈��
      *
      * @param money
      * @return
@@ -82,27 +82,27 @@
         }
 //绗竴涓弬鏁版槸闄ゆ暟锛岀浜屼釜鍙傛暟浠h〃淇濈暀鍑犱綅灏忔暟锛岀涓変釜浠h〃鐨勬槸浣跨敤鐨勬ā寮�
         if (money.doubleValue() > 800 && money.doubleValue() <= 3360) {
-            taxMoney = money.subtract(new BigDecimal(160)).divide(new BigDecimal("0.8"), 2, BigDecimal.ROUND_CEILING);
+            taxMoney = money.subtract(new BigDecimal(160)).divide(new BigDecimal("0.8"), 2, BigDecimal.ROUND_HALF_UP);
         }
 
         if (money.doubleValue() > 3360 && money.doubleValue() <= 21000) {
-            taxMoney = money.divide(new BigDecimal("0.84"), 2, BigDecimal.ROUND_CEILING);
+            taxMoney = money.divide(new BigDecimal("0.84"), 2, BigDecimal.ROUND_HALF_UP);
         }
 
         if (money.doubleValue() > 21000 && money.doubleValue() <= 49500) {
             money = money.subtract(new BigDecimal(2000));
-            taxMoney = money.divide(new BigDecimal("0.76"), 2, BigDecimal.ROUND_CEILING);
+            taxMoney = money.divide(new BigDecimal("0.76"), 2, BigDecimal.ROUND_HALF_UP);
         }
 
         if (money.doubleValue() > 49500) {
             money = money.subtract(new BigDecimal(7000));
-            taxMoney = money.divide(new BigDecimal("0.68"), 2, BigDecimal.ROUND_CEILING);
+            taxMoney = money.divide(new BigDecimal("0.68"), 2, BigDecimal.ROUND_HALF_UP);
         }
 
 
         DecimalFormat decimalFormat = new DecimalFormat("#0.00");
-        //杩涗竴娉�
-        decimalFormat.setRoundingMode(RoundingMode.CEILING);
+        // 鍙嶇畻鍚屾牱鍥涜垗浜斿叆鍒板垎
+        decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
         String format = decimalFormat.format(taxMoney);
         log.info("绋庡墠閲戦涓猴細{}", format);
         return format;
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
index 0ff856e..4b30d42 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -8,6 +8,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -683,6 +684,14 @@
         style.setAlignment(HorizontalAlignment.RIGHT);
         styles.put("data3", style);
 
+        // 閲戦缁熶竴涓や綅灏忔暟銆佸彸瀵归綈
+        style = wb.createCellStyle();
+        style.cloneStyleFrom(styles.get("data"));
+        style.setAlignment(HorizontalAlignment.RIGHT);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        style.setDataFormat(wb.createDataFormat().getFormat("0.00"));
+        styles.put("money", style);
+
         return styles;
     }
 
@@ -826,9 +835,11 @@
                 {
                     cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator));
                 }
-                else if (value instanceof BigDecimal && -1 != attr.scale())
+                else if (value instanceof BigDecimal)
                 {
-                    cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
+                    // 閲戦缁熶竴涓や綅灏忔暟銆佸鍑轰负鏁板�硷紝渚夸簬 Excel 鍙冲榻愪笌璁$畻
+                    cell.setCellStyle(styles.get("money"));
+                    cell.setCellValue(((BigDecimal) value).setScale(2, RoundingMode.HALF_UP).doubleValue());
                 }
                 else if (!attr.handler().equals(ExcelHandlerAdapter.class))
                 {
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java b/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
index d3508f3..1dfdb42 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
@@ -39,11 +39,17 @@
     public static final String MSG_TOO_LONG = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢鍚嶅瓧闀垮害涓嶈兘瓒呰繃20涓瓧锛�";
     public static final String MSG_ILLEGAL = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢鍚嶄笉鑳藉寘鍚┖鏍煎強 / \\ : * ? \" < > | # % 绛夌壒娈婂瓧绗︼紒";
     public static final String MSG_DUPLICATE = "涓烘柟渚挎煡楠岄檮浠讹紝鍚屼竴琛屽唴涓嶈兘鏈夐噸鍚嶇殑闄勪欢锛�";
+    /** 2026-11-17锛氶潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪紝闄勪欢鍚嶅繀椤诲惈涓枃 */
+    public static final String MSG_NEED_CHINESE =
+            "闄勪欢鍚嶄笉绗﹀悎鍖婚櫌鎶ラ攢鍗曞鎵硅姹傦細鍚嶇О椤诲弽鏄犲彂绁ㄤ富瑕佸唴瀹癸紙闇�鍖呭惈涓枃锛夛紝濡俓"2026骞�10鏈堜綇闄㈣垂\"";
     /** 闄勪欢椤归噷鍙栦笉鍒颁换浣曟枃浠跺悕锛堟棦娌℃湁 name 涔熸病鏈� fileName锛夋椂鐨勬彁绀� */
     public static final String MSG_NO_NAME = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢蹇呴』甯︽枃浠跺悕锛岃閲嶆柊涓婁紶锛�";
 
     /** 闈炴硶瀛楃锛氱┖鏍硷紙鍚悇绫荤┖鐧斤級+ / \ : * ? " < > | # % */
     private static final Pattern ILLEGAL = Pattern.compile("[\\s/\\\\:*?\"<>|#%]");
+
+    /** 涓枃鍖归厤锛堜富骞叉槸鍚﹀惈涓枃锛� */
+    private static final Pattern CHINESE = Pattern.compile("[\\u4e00-\\u9fa5]");
 
     private static final ObjectMapper MAPPER = new ObjectMapper();
 
@@ -60,12 +66,23 @@
     }
 
     /**
-     * 鏍¢獙鍗曚釜鏂囦欢鍚嶃��
+     * 鏍¢獙鍗曚釜鏂囦欢鍚嶏紙涓嶈姹傚惈涓枃锛屽吋瀹规棫璋冪敤锛夈��
      *
      * @param fileName 鍘熷鏂囦欢鍚�
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
      */
     public static String checkName(String fileName) {
+        return checkName(fileName, false);
+    }
+
+    /**
+     * 鏍¢獙鍗曚釜鏂囦欢鍚嶃��
+     *
+     * @param fileName       鍘熷鏂囦欢鍚�
+     * @param requireChinese {@code true}=涓诲共蹇呴』鍚腑鏂囷紙闈炰笓瀹惰垂/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪級
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
+     */
+    public static String checkName(String fileName, boolean requireChinese) {
         String name = fileName == null ? "" : fileName.trim();
         if (name.isEmpty()) {
             return MSG_EMPTY_NAME;
@@ -74,7 +91,10 @@
             return MSG_ILLEGAL;
         }
         String main = mainName(name);
-        // 涓嶅啀寮哄埗瑕佹眰涓枃锛涘惈涓枃銆佺函鑻辨枃銆佹暟瀛楀潎鍙�
+        // 2026-11-17锛氶潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪紝闄勪欢鍚嶄富骞插繀椤诲惈涓枃
+        if (requireChinese && !CHINESE.matcher(main).find()) {
+            return MSG_NEED_CHINESE;
+        }
         // 鎸夊瓧绗︽暟璁★紙鐮佺偣璁℃暟锛氫腑鏂�/瀛楁瘝/鏁板瓧/鍏ㄨ鍚勮 1锛�
         if (main.codePointCount(0, main.length()) > MAX_MAIN_LENGTH) {
             return MSG_TOO_LONG;
@@ -89,7 +109,18 @@
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜锛堝惈鏂囦欢鍚嶏級
      */
     public static String checkJson(String json) {
-        return checkJson(json, null, true);
+        return checkJson(json, null, true, false);
+    }
+
+    /**
+     * 鏍¢獙涓�涓檮浠跺垪琛� JSON锛堝彲鎸囧畾鏄惁蹇呴』鍚腑鏂囷級銆�
+     *
+     * @param json           闄勪欢瀛楁鍐呭锛坅nnexfiles / invoicefiles锛夛紝鍙负绌�
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜锛堝惈鏂囦欢鍚嶏級
+     */
+    public static String checkJson(String json, boolean requireChinese) {
+        return checkJson(json, null, true, requireChinese);
     }
 
     /**
@@ -102,7 +133,14 @@
      *                      闇�涓哄皬鍐欏幓绌虹櫧褰㈠紡锛涗负绌�/涓� null 琛ㄧず鎸夊叏鏂板崟鎹鐞嗭級
      */
     public static String checkJsonForUpdate(String json, Set<String> existingNames) {
-        return checkJson(json, existingNames, false);
+        return checkJson(json, existingNames, false, false);
+    }
+
+    /**
+     * 淇敼淇濆瓨鏃朵娇鐢紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛紝蹇界暐"淇濆瓨鍓嶅凡瀛樺湪"鐨勫巻鍙查檮浠跺悕銆�
+     */
+    public static String checkJsonForUpdate(String json, Set<String> existingNames, boolean requireChinese) {
+        return checkJson(json, existingNames, false, requireChinese);
     }
 
     /**
@@ -135,8 +173,10 @@
     /**
      * @param existingNames 鍘嗗彶闄勪欢鍚嶏紙灏忓啓锛夛紝鍛戒腑鍒欒烦杩囨牎楠岋紱{@code null} 琛ㄧず涓嶅拷鐣ヤ换浣曞悕瀛�
      * @param strictNoName  {@code true}=鍙栦笉鍒版枃浠跺悕鏃舵嫤鎴紙鍏ㄦ柊淇濆瓨锛夛紱{@code false}=鏀捐锛堜慨鏀瑰巻鍙插崟鎹級
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃锛堥潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪級
      */
-    private static String checkJson(String json, Set<String> existingNames, boolean strictNoName) {
+    private static String checkJson(String json, Set<String> existingNames, boolean strictNoName,
+                                    boolean requireChinese) {
         if (json == null || json.trim().isEmpty()) {
             return null;
         }
@@ -175,7 +215,7 @@
                 // 鍘嗗彶闄勪欢锛堜繚瀛樺墠宸插瓨鍦級涓嶅弬涓庢牎楠岋細涓氬姟纭"鍙牎楠屾湰娆″彉鏇寸殑闄勪欢"锛岄伩鍏嶅崱浣忚�佸崟鎹�
                 continue;
             }
-            String reason = checkName(name);
+            String reason = checkName(name, requireChinese);
             if (reason != null) {
                 return "銆�" + name + "銆�" + reason;
             }
@@ -214,11 +254,24 @@
      * @param jsons 闄勪欢瀛楁鍐呭锛屽彲涓� null/绌�
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
      */
-    public static String checkJsonList(String... jsons) {        if (jsons == null) {
+    public static String checkJsonList(String... jsons) {
+        return checkJsonList(false, jsons);
+    }
+
+    /**
+     * 鏍¢獙鍚屼竴鏄庣粏琛屼笅鐨勫涓檮浠跺垪琛紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛紝閫愪釜鍒楄〃鐙珛鏍¢獙锛�
+     * 姣忎釜鍒楄〃鍐呴儴鏌ラ噸鍚嶏紙涓庡墠绔� checkDetails 鐨勫彛寰勪竴鑷达級銆�
+     *
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃
+     * @param jsons          闄勪欢瀛楁鍐呭锛屽彲涓� null/绌�
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
+     */
+    public static String checkJsonList(boolean requireChinese, String... jsons) {
+        if (jsons == null) {
             return null;
         }
         for (String json : jsons) {
-            String reason = checkJson(json);
+            String reason = checkJson(json, requireChinese);
             if (reason != null) {
                 return reason;
             }
@@ -228,11 +281,18 @@
 
     /** 淇敼淇濆瓨鏃朵娇鐢細蹇界暐鍘嗗彶闄勪欢鍚嶏紝閫愪釜鍒楄〃鏍¢獙锛堜緵"澶氫釜瀛楁涓�璧锋牎楠�"鐨勮皟鐢ㄧ偣锛� */
     public static String checkJsonListForUpdate(Set<String> existingNames, String... jsons) {
+        return checkJsonListForUpdate(existingNames, false, jsons);
+    }
+
+    /**
+     * 淇敼淇濆瓨鏃朵娇鐢紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛細蹇界暐鍘嗗彶闄勪欢鍚嶏紝閫愪釜鍒楄〃鏍¢獙銆�
+     */
+    public static String checkJsonListForUpdate(Set<String> existingNames, boolean requireChinese, String... jsons) {
         if (jsons == null) {
             return null;
         }
         for (String json : jsons) {
-            String reason = checkJsonForUpdate(json, existingNames);
+            String reason = checkJsonForUpdate(json, existingNames, requireChinese);
             if (reason != null) {
                 return reason;
             }
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeDonor.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeDonor.java
index c389504..f3c4c2c 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeDonor.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeDonor.java
@@ -41,14 +41,29 @@
     @Excel(name = "涓撳璐�-绋庡墠")
     private BigDecimal pretaxamount;
 
+    /** 澧炲�肩◣ */
+    @ApiModelProperty("澧炲�肩◣")
+    @Excel(name = "涓撳璐�-澧炲�肩◣")
+    private BigDecimal vatAmount;
+
+    /** 鍩庡缓绋� */
+    @ApiModelProperty("鍩庡缓绋�")
+    @Excel(name = "涓撳璐�-鍩庡缓绋�")
+    private BigDecimal cityTaxAmount;
+
+    /** 鍔冲姟绋庡墠 */
+    @ApiModelProperty("鍔冲姟绋庡墠")
+    @Excel(name = "涓撳璐�-鍔冲姟绋庡墠")
+    private BigDecimal laborPretaxAmount;
+
     /** $column.columnComment */
     @ApiModelProperty("$column.columnComment")
-    @Excel(name = "涓撳璐�-涓◣")
+    @Excel(name = "涓撳璐�-鍔冲姟涓◣")
     private BigDecimal taxamount;
 
     /** $column.columnComment */
     @ApiModelProperty("$column.columnComment")
-    @Excel(name = "涓撳璐�-绋庡悗")
+    @Excel(name = "涓撳璐�-鍔冲姟绋庡悗")
     private BigDecimal taxedamount;
 
     /** $column.columnComment */
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeExpert.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeExpert.java
index f5ac520..03dffec 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeExpert.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/VExpertfeeExpert.java
@@ -78,17 +78,38 @@
     private BigDecimal pretaxamount;
 
     /**
+     * 澧炲�肩◣
+     */
+    @ApiModelProperty("澧炲�肩◣")
+    @Excel(name = "澧炲�肩◣")
+    private BigDecimal vatAmount;
+
+    /**
+     * 鍩庡缓绋�
+     */
+    @ApiModelProperty("鍩庡缓绋�")
+    @Excel(name = "鍩庡缓绋�")
+    private BigDecimal cityTaxAmount;
+
+    /**
+     * 鍔冲姟绋庡墠
+     */
+    @ApiModelProperty("鍔冲姟绋庡墠")
+    @Excel(name = "鍔冲姟绋庡墠")
+    private BigDecimal laborPretaxAmount;
+
+    /**
      * $column.columnComment
      */
     @ApiModelProperty("$column.columnComment")
-    @Excel(name = "鎵g◣閲戦")
+    @Excel(name = "鍔冲姟涓◣")
     private BigDecimal taxamount;
 
     /**
      * $column.columnComment
      */
     @ApiModelProperty("$column.columnComment")
-    @Excel(name = "绋庡悗閲戦")
+    @Excel(name = "鍔冲姟绋庡悗")
     private BigDecimal taxedamount;
 
     /**
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneyByItemEO.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneyByItemEO.java
index 3beb534..9b8f7d7 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneyByItemEO.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneyByItemEO.java
@@ -47,4 +47,9 @@
      */
     private Long xh;
 
+    /**
+     * 褰撳墠绠楃◣鍙e緞鐗堟湰锛坴1/v2/v3锛夛紝鐢ㄤ簬缁熻鈥滃綋鏈堝叾瀹冨彛寰勨�濈殑璁板綍
+     */
+    private String taxVersion;
+
 }
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneySumEO.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneySumEO.java
index ef77183..4f0a5b2 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneySumEO.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/vo/TaxMoneySumEO.java
@@ -46,8 +46,14 @@
     private String IDCardNo;
 
     /**
-     * 褰撴湀宸插瓨鍦ㄧ殑鍘嗗彶鍙e緞锛坴1锛夋槑缁嗘潯鏁帮紝鐢ㄤ簬闃绘鍚屼竴鏈堜唤 v1/v2 娣风畻
+     * 褰撴湀宸插瓨鍦ㄧ殑鈥滃叾瀹冨彛寰勨�濇槑缁嗘潯鏁帮紙tax_version 涓嶄负绌轰笖涓嶇瓑浜庡綋鍓嶇増鏈級锛�
+     * 鐢ㄤ簬闃绘鍚屼竴鏈堜唤 v1/v2/v3 娣风畻
      */
-    private Long v1Count;
+    private Long otherVersionCount;
+
+    /**
+     * 褰撴湀宸插瓨鍦ㄧ殑鍏跺畠鍙e緞鐗堟湰鍙凤紙鐢ㄤ簬閿欒鎻愮ず锛屽彇鍏朵腑涓�涓嵆鍙級
+     */
+    private String otherVersion;
 
 }
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundMapper.java b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundMapper.java
index 5fe6e16..4699313 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundMapper.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceFundMapper.java
@@ -6,6 +6,7 @@
 import java.util.List;
 
 import com.ruoyi.project.domain.ServiceFund;
+import com.ruoyi.project.domain.vo.FundTaxAmountSum;
 import com.ruoyi.project.domain.vo.FundVO;
 import com.ruoyi.project.domain.vo.SpFinancialExpensesFundOut;
 import com.ruoyi.project.domain.vo.SpFinancialExpensesReimbursementOut;
@@ -41,4 +42,20 @@
     Boolean updateFundTaxIdById(@Param("id") Long id, @Param("fundTaxId") Long fundTaxId);
     Boolean updateFundIsTexById(@Param("id") Long id, @Param("isTax") Long isTax);
 
+    /**
+     * 涓撳璐规眹鎬诲崟鎵撳嵃鐢細鎸夈�屽彈鐩婁汉 + 璇佷欢鍙枫�嶆眹鎬诲鍊肩◣銆佸煄寤虹◣銆佸姵鍔$◣鍓嶃��
+     * 瑙嗗浘 v_expertfee_expert 涓嶅惈杩� 3 鍒楋紝瀵煎嚭鏃朵粠鏄庣粏琛ㄧ洿鎺ユ眹鎬汇��
+     *
+     * @param fundTaxId 姹囨�诲崟 ID锛坰ervice_fundtax.ID锛�
+     */
+    List<FundTaxAmountSum> selectTaxSumByBeneficiary(@Param("fundTaxId") Long fundTaxId);
+
+    /**
+     * 涓撳璐规眹鎬诲崟鎵撳嵃鐢細鎸夈�屾崘鐚�呫�嶆眹鎬诲鍊肩◣銆佸煄寤虹◣銆佸姵鍔$◣鍓嶃��
+     * 瑙嗗浘 v_expertfee_donor 涓嶅惈杩� 3 鍒楋紝瀵煎嚭鏃朵粠鏄庣粏琛ㄧ洿鎺ユ眹鎬汇��
+     *
+     * @param fundTaxId 姹囨�诲崟 ID锛坰ervice_fundtax.ID锛�
+     */
+    List<FundTaxAmountSum> selectTaxSumByDonor(@Param("fundTaxId") Long fundTaxId);
+
 }
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonorpaymentServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonorpaymentServiceImpl.java
index e8ca745..2523adf 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonorpaymentServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceDonorpaymentServiceImpl.java
@@ -89,6 +89,9 @@
         if (serviceDonorpayment.getReceivedtime() != null) {
             wrappers.eq(ServiceDonorpayment::getReceivedtime, serviceDonorpayment.getReceivedtime());
         }
+        // 鐢宠鏃ユ湡鍊掑簭锛涘悓涓�鏃堕棿鎸� id 鍊掑簭锛屼繚璇佸垎椤甸『搴忕ǔ瀹�
+        wrappers.orderByDesc(ServiceDonorpayment::getCreateTime)
+                .orderByDesc(ServiceDonorpayment::getId);
         return this.list(wrappers);
     }
 
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
index 2d362d4..b488cf0 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java
@@ -853,7 +853,9 @@
             }
             map.put("鍙戠エ璇嗗埆", null);
             map.put("璇嗗埆浜�", null);
-            map.put("绋庨", serviceFunddetailShared.getTaxamount());
+            // 鏄庣粏鈥滅◣棰濃�濇寜鈥滄墸绋庡悎璁♀�濆彛寰勶細鍔冲姟涓◣ + 澧炲�肩◣ + 鍩庡缓绋庯紝
+            // 涓庝富琛ㄢ�滅◣棰濆悎璁♀�濓紙PretaxCost 鈭� TaxedCost锛夊榻愶紱v1 鍘嗗彶鏁版嵁澧炲�肩◣/鍩庡缓绋庝负 0锛屽彇鍊间笌鏀归�犲墠涓�鑷淬��
+            map.put("绋庨", totalTaxOf(serviceFunddetailShared));
             long qtuuid = IdGeneratorUtils.nextId();
             map.put("鍏朵粬闄勪欢", "");
             if (StringUtils.isNotEmpty(annexfiles)) {
@@ -896,6 +898,23 @@
         allMap.put("formson_0832", list);
         allMap.put("annexfilesList", annexfilesList);
         return allMap;
+    }
+
+    /**
+     * 鏄庣粏涓婁紶鍗忓弸鐨勨�滅◣棰濃�� = 鍔冲姟涓◣ + 澧炲�肩◣ + 鍩庡缓绋庯紙鎵g◣鍚堣鍙e緞锛夈��
+     * <p>
+     * 鑳屾櫙锛�2026-11 鏂板澧炲�肩◣銆佸煄寤虹◣鍚庯紝涓昏〃鈥滅◣棰濆悎璁♀�濆彇 `PretaxCost 鈭� TaxedCost`锛�
+     * 澶╃劧鍖呭惈杩欎袱椤癸紱鑻ユ槑缁嗕粛鍙彂鍔冲姟涓◣锛岃嚧杩滈噷鈥滅◣棰濆悎璁� 鈮� 鏄庣粏绋庨涔嬪拰鈥濓紙宸鍊肩◣+鍩庡缓绋庯級銆�
+     * v1 鍘嗗彶鏁版嵁鐨勫鍊肩◣/鍩庡缓绋庡潎涓� 0锛屽彇鍊间笌鏀归�犲墠瀹屽叏涓�鑷淬��
+     */
+    private static BigDecimal totalTaxOf(ServiceFunddetailShared detail) {
+        if (detail == null) {
+            return BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP);
+        }
+        BigDecimal tax = detail.getTaxamount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(detail.getTaxamount());
+        BigDecimal vat = detail.getVatAmount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(detail.getVatAmount());
+        BigDecimal city = detail.getCityTaxAmount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(detail.getCityTaxAmount());
+        return tax.add(vat).add(city).setScale(2, BigDecimal.ROUND_HALF_UP);
     }
 
 
@@ -1817,10 +1836,13 @@
         String filePath = RuoYiConfig.getDownloadPath() + ajaxResult.get("msg");
 
         List<VExpertfeeDonor> list2 = vExpertfeeDonorMapper.selectVExpertfeeDonorList2(faxId);
+        // 鎵撳嵃妯℃澘瑙嗗浘涓嶅惈鈥滃鍊肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡墠鈥濓紝鎸� fund_tax_id 浠庢槑缁嗚〃姹囨�诲悗鍥炲~
+        fillDonorTaxAmounts(list2, faxId);
         ExcelUtil<VExpertfeeDonor> util2 = new ExcelUtil<VExpertfeeDonor>(VExpertfeeDonor.class);
         AjaxResult ajaxResult2 = util2.exportExcel(list2, "VExpertfeeDonor");
 
         List<VExpertfeeExpert> list3 = vExpertfeeExpertMapper.selectVExpertfeeExpertListByFaxId(faxId);
+        fillExpertTaxAmounts(list3, faxId);
         ExcelUtil<VExpertfeeExpert> util3 = new ExcelUtil<VExpertfeeExpert>(VExpertfeeExpert.class);
         AjaxResult ajaxResult3 = util3.exportExcel(list3, "vExpertfeeExpert");
 
@@ -1831,14 +1853,155 @@
 
 
         String name = "涓撳璐规眹鎬诲崟" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx";
+        // mergeExcel 鍐呴儴浼氬啓鏂囦欢銆佹牎楠岀粨鏋滐紝骞跺湪 finally 閲屾竻鐞� 3 涓复鏃� sheet 鏂囦欢
         mergeExcel(list1, RuoYiConfig.getDownloadPath() + name);
-        for (String path : list1) {
-            new File(RuoYiConfig.getDownloadPath() + path).delete();
-        }
         Map<String, Object> map = new HashMap<>();
         map.put("downloadUrl", "/profile/download/" + name);
         map.put("downloadName", name);
         return map;
+    }
+
+    /**
+     * 涓撳璐规眹鎬诲崟鎵撳嵃锛堜笓瀹舵槑缁� sheet锛夛細鍥炲~澧炲�肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡墠锛屽苟鎶婅鍥剧殑銆屾墸绋庨噾棰濄�嶆媶鍥炲姵鍔′釜绋庛��
+     * <p>
+     * 鍙e緞璇存槑锛�
+     * <ul>
+     *   <li>瑙嗗浘 {@code v_expertfee_expert} 鐨� {@code TaxAmount} 宸叉敼涓�
+     *       <b>澧炲�肩◣ + 鍩庡缓绋� + 鍔冲姟涓◣</b>锛�2026-11-12 涓氬姟鏂逛慨鏀癸級锛岃�屾墦鍗拌鍒嗗埆灞曠ず锛�
+     *       鍥犳 {@code 鍔冲姟涓◣ = TaxAmount 鈭� 澧炲�肩◣ 鈭� 鍩庡缓绋巬锛�</li>
+     *   <li>澧炲�肩◣/鍩庡缓绋�/鍔冲姟绋庡墠 瑙嗗浘鏈崟鐙彁渚涳紝鎸� <b>涓庤鍥剧浉鍚岀殑鍒嗙粍</b>
+     *       锛堝彈鐩婁汉 + 璇佷欢鍙� + 鍗″彿 + 寮�鎴疯 + 鍗曚綅锛変粠 {@code service_funddetail} 姹囨�诲悗鍖归厤鍥炲~锛�</li>
+     *   <li>銆屽悎璁°�嶈鎸夊悇琛岀殑鍊肩疮鍔狅紙涓嶄緷璧栬鍥� UNION 鐨勫悎璁″垪锛夈��</li>
+     * </ul>
+     */
+    private void fillExpertTaxAmounts(List<VExpertfeeExpert> rows, Integer fundTaxId) {
+        if (CollectionUtils.isEmpty(rows)) {
+            return;
+        }
+        Map<String, FundTaxAmountSum> sumMap = toSumMap(serviceFundMapper.selectTaxSumByBeneficiary(fundTaxId.longValue()));
+        BigDecimal vatTotal = BigDecimal.ZERO;
+        BigDecimal cityTotal = BigDecimal.ZERO;
+        BigDecimal laborTotal = BigDecimal.ZERO;
+        BigDecimal laborTaxTotal = BigDecimal.ZERO;
+        for (VExpertfeeExpert row : rows) {
+            if (isTotalRow(row.getBeneficiaryname())) {
+                continue;
+            }
+            FundTaxAmountSum s = sumMap.get(expertGroupKey(row));
+            BigDecimal vat = s == null ? BigDecimal.ZERO : nvl(s.getVatAmount());
+            BigDecimal city = s == null ? BigDecimal.ZERO : nvl(s.getCityTaxAmount());
+            BigDecimal labor = s == null ? BigDecimal.ZERO : nvl(s.getLaborPretaxAmount());
+            // 瑙嗗浘鐨勬墸绋庨噾棰濆惈澧炲�肩◣銆佸煄寤虹◣锛岃繖閲屾媶鍥炲姵鍔′釜绋�
+            BigDecimal laborTax = nvl(row.getTaxamount()).subtract(vat).subtract(city);
+            row.setVatAmount(vat);
+            row.setCityTaxAmount(city);
+            row.setLaborPretaxAmount(labor);
+            row.setTaxamount(laborTax);
+            vatTotal = vatTotal.add(vat);
+            cityTotal = cityTotal.add(city);
+            laborTotal = laborTotal.add(labor);
+            laborTaxTotal = laborTaxTotal.add(laborTax);
+        }
+        for (VExpertfeeExpert row : rows) {
+            if (isTotalRow(row.getBeneficiaryname())) {
+                row.setVatAmount(vatTotal);
+                row.setCityTaxAmount(cityTotal);
+                row.setLaborPretaxAmount(laborTotal);
+                row.setTaxamount(laborTaxTotal);
+            }
+        }
+    }
+
+    /**
+     * 涓撳璐规眹鎬诲崟鎵撳嵃锛堟崘鐚�� sheet锛夛細鍚� {@link #fillExpertTaxAmounts}锛屽垎缁勪负銆屾崘鐚�� + 妗堜緥ID銆嶃��
+     */
+    private void fillDonorTaxAmounts(List<VExpertfeeDonor> rows, Integer fundTaxId) {
+        if (CollectionUtils.isEmpty(rows)) {
+            return;
+        }
+        Map<String, FundTaxAmountSum> sumMap = toSumMap(serviceFundMapper.selectTaxSumByDonor(fundTaxId.longValue()));
+        BigDecimal vatTotal = BigDecimal.ZERO;
+        BigDecimal cityTotal = BigDecimal.ZERO;
+        BigDecimal laborTotal = BigDecimal.ZERO;
+        BigDecimal laborTaxTotal = BigDecimal.ZERO;
+        for (VExpertfeeDonor row : rows) {
+            if (isTotalRow(row.getDonorname())) {
+                continue;
+            }
+            FundTaxAmountSum s = sumMap.get(donorGroupKey(row.getDonorname(), row.getInfoid()));
+            BigDecimal vat = s == null ? BigDecimal.ZERO : nvl(s.getVatAmount());
+            BigDecimal city = s == null ? BigDecimal.ZERO : nvl(s.getCityTaxAmount());
+            BigDecimal labor = s == null ? BigDecimal.ZERO : nvl(s.getLaborPretaxAmount());
+            BigDecimal laborTax = nvl(row.getTaxamount()).subtract(vat).subtract(city);
+            row.setVatAmount(vat);
+            row.setCityTaxAmount(city);
+            row.setLaborPretaxAmount(labor);
+            row.setTaxamount(laborTax);
+            vatTotal = vatTotal.add(vat);
+            cityTotal = cityTotal.add(city);
+            laborTotal = laborTotal.add(labor);
+            laborTaxTotal = laborTaxTotal.add(laborTax);
+        }
+        for (VExpertfeeDonor row : rows) {
+            if (isTotalRow(row.getDonorname())) {
+                row.setVatAmount(vatTotal);
+                row.setCityTaxAmount(cityTotal);
+                row.setLaborPretaxAmount(laborTotal);
+                row.setTaxamount(laborTaxTotal);
+            }
+        }
+    }
+
+    private static Map<String, FundTaxAmountSum> toSumMap(List<FundTaxAmountSum> sums) {
+        Map<String, FundTaxAmountSum> map = new HashMap<>();
+        if (!CollectionUtils.isEmpty(sums)) {
+            for (FundTaxAmountSum s : sums) {
+                map.put(s.getGroupKey(), s);
+            }
+        }
+        return map;
+    }
+
+    /**
+     * 涓撳鏄庣粏鍒嗙粍閿紝蹇呴』涓庤鍥� {@code v_expertfee_expert} 鐨� GROUP BY 瀹屽叏涓�鑷达細
+     * BeneficiaryName + IDCardNo + BankCardNo + DepositBank + UnitName銆�
+     */
+    private static String expertGroupKey(VExpertfeeExpert row) {
+        return joinKey(row.getBeneficiaryname(), row.getIdcardno(), row.getBankcardno(),
+                row.getDepositbank(), row.getUnitname());
+    }
+
+    /**
+     * 鎹愮尞鑰呭垎缁勯敭锛屼笌瑙嗗浘 {@code v_expertfee_donor} 鐨� GROUP BY 涓�鑷达細DonorName + InfoID銆�
+     */
+    private static String donorGroupKey(String donorname, Long infoid) {
+        return joinKey(donorname, infoid == null ? "" : String.valueOf(infoid));
+    }
+
+    /**
+     * 鐢� "|" 鎷兼帴鍒嗙粍閿紱null 缁熶竴鎸夌┖涓插鐞嗭紙涓� SQL 鐨� IFNULL(x,'') 瀵归綈锛�
+     */
+    private static String joinKey(Object... parts) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < parts.length; i++) {
+            if (i > 0) {
+                sb.append('|');
+            }
+            Object p = parts[i];
+            sb.append(p == null ? "" : String.valueOf(p).trim());
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 鎵撳嵃閲岀殑銆屽悎璁°�嶈
+     */
+    private static boolean isTotalRow(String name) {
+        return name != null && "鍚堣".equals(name.trim());
+    }
+
+    private static BigDecimal nvl(BigDecimal value) {
+        return value == null ? BigDecimal.ZERO : value;
     }
 
 
@@ -1963,41 +2126,115 @@
         return id;
     }
 
+    /**
+     * 鎶� 3 涓� sheet 鐨勪复鏃跺鍑烘枃浠跺悎骞舵垚涓�涓�屼笓瀹惰垂姹囨�诲崟銆嶃��
+     * <p>
+     * 淇鐐癸紙2026-11-12锛夛細
+     * <ol>
+     *   <li>鍘熷疄鐜扮敤 {@code cell.getStringCellValue()} 澶嶅埗鍗曞厓鏍硷紝閬囧埌鏁板瓧鍗曞厓鏍间細鎶�
+     *       {@code IllegalStateException: Cannot get a STRING value from a NUMERIC cell}锛�
+     *       鑰屽灞� catch 鎶婂紓甯稿悶鎺� 鈫� 鎺ュ彛浠嶈繑鍥炰笅杞藉湴鍧�锛屼絾鍚堝苟鏂囦欢娌$敓鎴愶紝鍓嶇涓嬭浇 404锛�</li>
+     *   <li>鍘熷疄鐜版病鏈夊叧闂緭鍏�/杈撳嚭娴侊紝Windows 涓婁复鏃舵枃浠惰閿佸畾锛屽垹涓嶆帀锛堟畫鐣� *_vExpertfee*.xlsx锛夛紱</li>
+     *   <li>澶辫触鏃朵笉鍐嶉潤榛橈紝鎶涗笟鍔″紓甯歌鍓嶇鐪嬪埌鐪熷疄鍘熷洜銆�</li>
+     * </ol>
+     */
     public void mergeExcel(List<String> files, String outputFile) {
-        try {
-            Workbook resultWorkbook = new XSSFWorkbook();
+        File outFile = new File(outputFile);
+        try (Workbook resultWorkbook = new XSSFWorkbook()) {
+            // 琛ㄥご涓庢暟鎹袱绉嶆牱寮忥紝閬垮厤姣忎釜鍗曞厓鏍奸兘鏂板缓鏍峰紡锛堝師瀹炵幇姣忔牸涓�涓牱寮忥紝鏂囦欢浼氬彉澶э級
+            CellStyle headerStyle = createMergeCellStyle(resultWorkbook, true);
+            CellStyle bodyStyle = createMergeCellStyle(resultWorkbook, false);
             for (String file : files) {
-                InputStream is1 = new FileInputStream(RuoYiConfig.getDownloadPath() + file);
-                Workbook workbook1 = new XSSFWorkbook(is1);
-                Sheet sheet1 = workbook1.getSheetAt(0);
-                // 澶嶅埗绗竴涓枃浠剁殑Sheet
-                Sheet newSheet1 = resultWorkbook.createSheet(file.substring(0, file.indexOf(".")));
-                for (Row row : sheet1) {
-                    Row newRow = newSheet1.createRow(row.getRowNum());
-                    int columns = row.getLastCellNum();
-                    for (int i = 0; i < columns; i++) {
-                        newSheet1.setColumnWidth(i, 5000);
-                        Cell cell = row.getCell(i);
-                        Cell newCell = newRow.createCell(cell.getColumnIndex());
-                        newCell.setCellValue(cell.getStringCellValue());
-                        // 鍒涘缓鍗曞厓鏍兼牱寮�
-                        CellStyle style = resultWorkbook.createCellStyle();
-                        style.setAlignment(HorizontalAlignment.CENTER); // 姘村钩灞呬腑
-                        style.setVerticalAlignment(VerticalAlignment.CENTER); // 鍨傜洿灞呬腑
-                        if (row.getRowNum() == 0) {
-                            // 璁剧疆绗竴琛岃儗鏅壊
-                            style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
-                            style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+                File srcFile = new File(RuoYiConfig.getDownloadPath() + file);
+                try (InputStream is1 = new FileInputStream(srcFile);
+                     Workbook workbook1 = new XSSFWorkbook(is1)) {
+                    Sheet sheet1 = workbook1.getSheetAt(0);
+                    String sheetName = file.contains(".") ? file.substring(0, file.indexOf(".")) : file;
+                    Sheet newSheet = resultWorkbook.createSheet(sheetName);
+                    for (Row row : sheet1) {
+                        Row newRow = newSheet.createRow(row.getRowNum());
+                        short columns = row.getLastCellNum();
+                        for (int i = 0; i < columns; i++) {
+                            newSheet.setColumnWidth(i, 5000);
+                            Cell newCell = newRow.createCell(i);
+                            copyCellValue(row.getCell(i), newCell);
+                            newCell.setCellStyle(row.getRowNum() == 0 ? headerStyle : bodyStyle);
                         }
-
-                        newCell.setCellStyle(style);
                     }
                 }
             }
-            FileOutputStream out = new FileOutputStream(outputFile);
-            resultWorkbook.write(out);
+            // 鍏堝啓涓存椂鏂囦欢鍐嶆敼鍚嶏紝閬垮厤涓嬭浇鍒板啓浜嗕竴鍗婄殑鏂囦欢
+            File tmpFile = new File(outputFile + ".tmp");
+            try (FileOutputStream out = new FileOutputStream(tmpFile)) {
+                resultWorkbook.write(out);
+            }
+            if (!tmpFile.renameTo(outFile) && !tmpFile.equals(outFile)) {
+                // rename 澶辫触锛堢洰鏍囪鍗犵敤绛夛級鏃堕��鍖栦负鐩存帴鍐欑洰鏍囨枃浠�
+                try (FileOutputStream out = new FileOutputStream(outFile)) {
+                    resultWorkbook.write(out);
+                }
+                tmpFile.delete();
+            }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("鐢熸垚涓撳璐规眹鎬诲崟澶辫触锛宱utputFile={}", outputFile, e);
+            throw new ServiceException("鐢熸垚涓撳璐规眹鎬诲崟澶辫触锛�" + e.getMessage());
+        } finally {
+            // 鍚堝苟瀹屾垚鍚庢竻鐞嗕复鏃� sheet 鏂囦欢锛堝け璐ユ椂涔熷皾璇曟竻鐞嗭紝閬垮厤娈嬬暀锛�
+            for (String file : files) {
+                File tmp = new File(RuoYiConfig.getDownloadPath() + file);
+                if (tmp.exists() && !tmp.delete()) {
+                    log.warn("涓存椂瀵煎嚭鏂囦欢鏈兘鍒犻櫎锛歿}", tmp.getAbsolutePath());
+                }
+            }
+        }
+        if (!outFile.exists() || outFile.length() == 0) {
+            throw new ServiceException("鐢熸垚涓撳璐规眹鎬诲崟澶辫触锛氭枃浠舵湭鐢熸垚");
+        }
+    }
+
+    /**
+     * 鍚堝苟鐢ㄧ殑鍗曞厓鏍兼牱寮忥紙琛ㄥご鐏板簳銆佹鏂囩櫧搴曪級锛岀粺涓�灞呬腑
+     */
+    private static CellStyle createMergeCellStyle(Workbook workbook, boolean header) {
+        CellStyle style = workbook.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        if (header) {
+            style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
+            style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        }
+        return style;
+    }
+
+    /**
+     * 鎸夊崟鍏冩牸瀹為檯绫诲瀷澶嶅埗鍊硷細鏁板瓧鎸夋暟瀛椼�佹棩鏈熸寜鏃ユ湡銆佸叕寮忔寜鍏紡锛岀┖鍗曞厓鏍间繚鎸佷负绌恒��
+     * 鍘熷疄鐜板彧鏀寔瀛楃涓插崟鍏冩牸锛岄亣鍒伴噾棰濓紙鏁板瓧锛夊氨鎶涘紓甯搞��
+     */
+    private static void copyCellValue(Cell source, Cell target) {
+        if (source == null) {
+            target.setBlank();
+            return;
+        }
+        switch (source.getCellType()) {
+            case STRING:
+                target.setCellValue(source.getStringCellValue());
+                break;
+            case NUMERIC:
+                if (DateUtil.isCellDateFormatted(source)) {
+                    target.setCellValue(source.getDateCellValue());
+                } else {
+                    target.setCellValue(source.getNumericCellValue());
+                }
+                break;
+            case BOOLEAN:
+                target.setCellValue(source.getBooleanCellValue());
+                break;
+            case FORMULA:
+                target.setCellFormula(source.getCellFormula());
+                break;
+            default:
+                target.setBlank();
+                break;
         }
     }
 
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
index 6bf6c64..29d2ee9 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java
@@ -130,84 +130,132 @@
     }
 
     /**
-     * 鏍规嵁鍙楃泭浜鸿韩浠借瘉缂栧彿鑾峰彇绋庤垂閲戦
+     * 鏍规嵁鍙楃泭浜鸿韩浠借瘉缂栧彿鑾峰彇绋庤垂閲戦锛堝綍鍏ユ椂鐨勪釜绋庨瑙堬級
+     * <p>
+     * 2026-11-17锛堢疮璁″彛寰勶級锛氬悓涓�韬唤璇�**褰撴湀**鐨勫鍊肩◣銆佸煄寤虹◣銆佷釜绋庨兘鎸夌疮璁¤绠楋紝鏈瑪鍙栧樊棰濓細
+     * <pre>
+     * P绱� = 危褰撴湀绋庡墠 + 鏈锛沄绱� = calcVat(P绱�)锛堣捣寰佺偣鎸夌疮璁″垽鏂級锛汣绱� = calcCityTax(V绱�)
+     * 鏈瑪 V = V绱� 鈭� 危宸茬畻绋庡鍊肩◣锛涙湰绗� C 鍚岀悊锛涙湰绗� L = 鏈瑪 P 鈭� 鏈瑪 V 鈭� 鏈瑪 C
+     * 鏈瑪涓◣ = 涓◣(L绱) 鈭� 危宸茬畻绋庝釜绋�
+     * </pre>
      *
-     * @param taxMoneyVo
-     * @return
+     * @param taxMoneyVo 韬唤璇佸彿 + 鏈鍚◣閲戦
+     * @return 鏈鍔冲姟涓◣
      */
     @Override
     public Double getTaxByBeneFiciaryNo(TaxMoneyVO taxMoneyVo) {
         // 閲戦绱姞蹇呴』鐢� BigDecimal锛歞ouble 绱姞浼氬紩鍏ユ诞鐐瑰熬宸紝瀵艰嚧绠楀嚭鐨勪釜绋庡嚭鐜板垎浠ヤ笅璇樊
-        BigDecimal sum = BigDecimal.ZERO;
-        BigDecimal totalScore = BigDecimal.ZERO;
+        BigDecimal sumPretax = BigDecimal.ZERO;
+        BigDecimal sumVat = BigDecimal.ZERO;
+        BigDecimal sumCityTax = BigDecimal.ZERO;
+        BigDecimal sumLaborPretax = BigDecimal.ZERO;
+        BigDecimal sumTax = BigDecimal.ZERO;
         List<ServiceFunddetail> taxationByBeneFiciaryNo = serviceFunddetailMapper.getTaxBeforeByBeneFiciaryNo(taxMoneyVo);
         if (CollectionUtils.isNotEmpty(taxationByBeneFiciaryNo)) {
-            //璁$畻鐢宠閲戦鎬诲拰锛屼笉鍖呮嫭褰撳墠浼犺繘鏉ョ殑
-            sum = taxationByBeneFiciaryNo.stream()
-                    .map(ServiceFunddetail::getAmount)
-                    .filter(java.util.Objects::nonNull)
-                    .map(BigDecimal::valueOf)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-            //涓嶅姞鏈钖叕鐨勪釜绋�
-            totalScore = taxationByBeneFiciaryNo.stream()
-                    .map(ServiceFunddetail::getTaxamount)
-                    .filter(java.util.Objects::nonNull)
-                    .map(BigDecimal::valueOf)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            for (ServiceFunddetail detail : taxationByBeneFiciaryNo) {
+                sumPretax = sumPretax.add(toMoney(detail.getAmount()));
+                sumVat = sumVat.add(toMoney(detail.getVatAmount()));
+                sumCityTax = sumCityTax.add(toMoney(detail.getCityTaxAmount()));
+                sumLaborPretax = sumLaborPretax.add(laborPretaxOf(detail));
+                sumTax = sumTax.add(toMoney(detail.getTaxamount()));
+            }
         }
 
-        sum = sum.add(new BigDecimal(taxMoneyVo.getMoney()));
-        //鍔犱笂鏈钖叕鐨勬�讳釜绋�
-        String taxation = TaxtUtils.getTaxation(sum);
+        // 鏈鍚◣閲戦 + 绱锛氭寜绱鍙e緞绠楀鍊肩◣/鍩庡缓绋庯紝鏈瑪鍙栧樊棰�
+        BigDecimal nowPretax = new BigDecimal(taxMoneyVo.getMoney());
+        BigDecimal cumPretax = sumPretax.add(nowPretax);
+        BigDecimal cumVat = VatTaxUtils.calcVat(cumPretax);
+        BigDecimal cumCityTax = VatTaxUtils.calcCityTax(cumVat);
+        BigDecimal nowVat = VatTaxUtils.roundMoney(cumVat.subtract(sumVat));
+        BigDecimal nowCityTax = VatTaxUtils.roundMoney(cumCityTax.subtract(sumCityTax));
+        if (nowVat.signum() < 0) {
+            nowVat = BigDecimal.ZERO;
+        }
+        if (nowCityTax.signum() < 0) {
+            nowCityTax = BigDecimal.ZERO;
+        }
+        BigDecimal nowLaborPretax = VatTaxUtils.roundMoney(nowPretax.subtract(nowVat).subtract(nowCityTax));
+        if (nowLaborPretax.signum() < 0) {
+            // 涓庣畻绋庝竴鑷达細鏈瑪涓嶆墸绋庛�佸樊棰濋『寤�
+            nowVat = BigDecimal.ZERO;
+            nowCityTax = BigDecimal.ZERO;
+            nowLaborPretax = nowPretax;
+        }
 
-        Double tax = new BigDecimal(taxation).subtract(totalScore).doubleValue();
-        return tax;
+        BigDecimal cumLaborPretax = sumLaborPretax.add(nowLaborPretax);
+        String taxation = TaxtUtils.getTaxation(cumLaborPretax);
+        return new BigDecimal(taxation).subtract(sumTax).doubleValue();
     }
 
     /**
-     * 鏍规嵁绋庡悗宸ヨ祫锛岀畻鍑虹◣鍓嶅伐璧�
+     * 鏄庣粏鐨勫姵鍔$◣鍓嶏細浼樺厛鍙栬惤搴撶殑 labor_pretax_amount锛屼负绌烘椂鍥為��鍒扮◣鍓嶉噾棰濓紙鍏煎鏈洖濉幆澧冿級
+     */
+    private static BigDecimal laborPretaxOf(ServiceFunddetail detail) {
+        if (detail.getLaborPretaxAmount() != null) {
+            return BigDecimal.valueOf(detail.getLaborPretaxAmount());
+        }
+        // 娌℃湁鍔冲姟绋庡墠鏃舵寜鈥滃惈绋庨噾棰濆仛浠风◣鍒嗙鈥濆厹搴曪紝淇濊瘉涓庣畻绋庡彛寰勪竴鑷�
+        return detail.getAmount() == null ? BigDecimal.ZERO
+                : VatTaxUtils.calcLaborPretax(BigDecimal.valueOf(detail.getAmount()));
+    }
+
+    /**
+     * 鏍规嵁绋庡悗宸ヨ祫锛岀畻鍑虹◣鍓嶅伐璧勶紙褰曞叆鏃剁殑鈥滅◣鍚� 鈫� 绋庡墠鈥濋瑙堬級
+     * <p>
+     * 2026-11-17锛堢疮璁″彛寰勶級锛氫笌绠楃◣淇濇寔涓�鑷达紝鍏堢敱鈥滅疮璁$◣鍚庘�濆弽绠楃疮璁″姵鍔$◣鍓� L绱紝
+     * 鍐嶈В绱鍚◣绋庡墠 P绱紙P绱� = L绱� + V绱� + C绱紝璧峰緛鐐规寜绱鍒ゆ柇锛夛紝鏈瑪鍧囧彇宸銆�
      *
-     * @param taxMoneyVo
-     * @return
+     * @param taxMoneyVo 韬唤璇佸彿 + 鏈鍔冲姟绋庡悗閲戦
+     * @return 绋庡墠/涓◣绛夐瑙堝��
      */
     @Override
     public TaxedMoneyVO getTaxBeforeByAfterMoney(TaxMoneyVO taxMoneyVo) {
         TaxedMoneyVO taxedMoneyVO = new TaxedMoneyVO();
         // 閲戦绱姞蹇呴』鐢� BigDecimal锛岄伩鍏嶆诞鐐瑰熬宸奖鍝嶇◣鍓�/绋庨缁撴灉
-        BigDecimal sum = BigDecimal.ZERO;
-        BigDecimal totalScore = BigDecimal.ZERO;
+        BigDecimal sumTaxed = BigDecimal.ZERO;
+        BigDecimal sumPretax = BigDecimal.ZERO;
+        BigDecimal sumVat = BigDecimal.ZERO;
+        BigDecimal sumCityTax = BigDecimal.ZERO;
+        BigDecimal sumLaborPretax = BigDecimal.ZERO;
+        BigDecimal sumTax = BigDecimal.ZERO;
         List<ServiceFunddetail> taxationByBeneFiciaryNo = serviceFunddetailMapper.getTaxBeforeByBeneFiciaryNo(taxMoneyVo);
         if (CollectionUtils.isNotEmpty(taxationByBeneFiciaryNo)) {
-            //璁$畻鍑虹◣鍚庢�婚噾棰濓紙涓嶅寘鍚湰娆★級
-            sum = taxationByBeneFiciaryNo.stream()
-                    .map(ServiceFunddetail::getTaxedamount)
-                    .filter(java.util.Objects::nonNull)
-                    .map(BigDecimal::valueOf)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
-            //姹傚嚭涔嬪墠鐨勬�荤殑涓◣
-            totalScore = taxationByBeneFiciaryNo.stream()
-                    .map(ServiceFunddetail::getTaxamount)
-                    .filter(java.util.Objects::nonNull)
-                    .map(BigDecimal::valueOf)
-                    .reduce(BigDecimal.ZERO, BigDecimal::add);
+            for (ServiceFunddetail detail : taxationByBeneFiciaryNo) {
+                sumTaxed = sumTaxed.add(toMoney(detail.getTaxedamount()));
+                sumPretax = sumPretax.add(toMoney(detail.getAmount()));
+                sumVat = sumVat.add(toMoney(detail.getVatAmount()));
+                sumCityTax = sumCityTax.add(toMoney(detail.getCityTaxAmount()));
+                sumLaborPretax = sumLaborPretax.add(laborPretaxOf(detail));
+                sumTax = sumTax.add(toMoney(detail.getTaxamount()));
+            }
         }
-        //璁$畻鍑烘�荤殑绋庡悗钖叕锛堝寘鍚湰娆★級
-        sum = sum.add(new BigDecimal(taxMoneyVo.getMoney()));
-        //绋庡墠鎬婚噾棰�
-        String taxationBefore = TaxtUtils.getTaxationBefore(sum);
-        //鎬讳釜绋�
-        BigDecimal tax = new BigDecimal(taxationBefore).subtract(sum);
 
-        //鏈鐨勭◣鍓嶉噾棰�
-        String nowTaxMoney = TaxtUtils.getTaxationBefore(new BigDecimal(taxMoneyVo.getMoney()));
-        //鏈鐨勭◣璐�
-        BigDecimal subtract = new BigDecimal(nowTaxMoney).subtract(new BigDecimal(taxMoneyVo.getMoney()));
+        // 鍚湰娆$殑绱绋庡悗
+        BigDecimal nowTaxed = new BigDecimal(taxMoneyVo.getMoney());
+        BigDecimal cumTaxed = sumTaxed.add(nowTaxed);
+        // 绱鍔冲姟绋庡墠锛堢敱绱绋庡悗鍙嶇畻锛�
+        BigDecimal cumLaborPretax = new BigDecimal(TaxtUtils.getTaxationBefore(cumTaxed));
+        // 绱涓◣
+        BigDecimal cumTax = VatTaxUtils.roundMoney(cumLaborPretax.subtract(cumTaxed));
+        // 绱鍚◣绋庡墠閲戦锛堝唴閮ㄦ寜绱 P 鍒ゆ柇璧峰緛鐐癸級
+        VatTaxUtils.GrossAmount gross = VatTaxUtils.solveGross(cumLaborPretax);
 
-        taxedMoneyVO.setAllTax(tax.toString());
-        taxedMoneyVO.setAllTaxbeforeMoney(taxationBefore);
-        taxedMoneyVO.setAllAaxAfterMoney(sum.toString());
-        taxedMoneyVO.setNowTaxBeforeMoney(nowTaxMoney);
-        taxedMoneyVO.setNowTax(subtract.toString());
+        // 鏈瑪鍏ㄩ儴鍙栧樊棰濓紝涓� calculateTax 鐨勫垎鎽婂彛寰勪竴鑷�
+        BigDecimal nowPretax = VatTaxUtils.roundMoney(gross.getPretax().subtract(sumPretax));
+        BigDecimal nowLaborPretax = VatTaxUtils.roundMoney(cumLaborPretax.subtract(sumLaborPretax));
+        BigDecimal nowTax = VatTaxUtils.roundMoney(cumTax.subtract(sumTax));
+        if (nowTax.signum() < 0) {
+            nowTax = BigDecimal.ZERO;
+        }
+        if (nowPretax.signum() < 0) {
+            nowPretax = nowLaborPretax.add(gross.getVat().subtract(sumVat)).add(gross.getCityTax().subtract(sumCityTax));
+        }
+
+        taxedMoneyVO.setAllTax(cumTax.toString());
+        taxedMoneyVO.setAllTaxbeforeMoney(gross.getPretax().toString());
+        taxedMoneyVO.setAllAaxAfterMoney(cumTaxed.toString());
+        taxedMoneyVO.setNowTaxBeforeMoney(nowPretax.toString());
+        taxedMoneyVO.setNowTax(nowTax.toString());
 
         return taxedMoneyVO;
     }
@@ -375,7 +423,7 @@
                 detail.setLaborPretaxAmount(p.doubleValue());
                 detail.setTaxamount(0.0);
                 detail.setTaxedamount(p.doubleValue());
-                detail.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+                detail.setTaxVersion(VatTaxUtils.TAX_VERSION_CURRENT);
                 detail.setTaxTime(taxTime);
                 updateList.add(detail);
 
@@ -416,7 +464,7 @@
             BigDecimal taxedAmount;
 
             if (afterTax) {
-                // 5.2.2 绋庡悗褰曞叆锛氬厛鍙嶇畻鍔冲姟绋庡墠锛屽啀寰幆鍙嶈В绋庡墠/澧炲�肩◣/鍩庡缓绋�
+                // 5.2.2 绋庡悗褰曞叆锛氬厛鐢扁�滅疮璁$◣鍚庘�濆弽绠楃疮璁″姵鍔$◣鍓嶏紝鍐嶅弽瑙g疮璁″惈绋庣◣鍓嶏紝鏈�鍚庢寜宸寰楀嚭鏈瑪 V/C/P
                 taxedAmount = toMoney(detail.getTaxedamount());
                 BigDecimal sumTaxed = prevTaxed.add(taxedAmount);
                 BigDecimal sumLaborPretax = new BigDecimal(TaxtUtils.getTaxationBefore(sumTaxed));
@@ -434,17 +482,47 @@
                 taxAmount = VatTaxUtils.roundMoney(laborPretax.subtract(taxedAmount));
                 if (taxAmount.signum() < 0) {
                     taxAmount = BigDecimal.ZERO;
+                    taxedAmount = laborPretax;
                 }
-                VatTaxUtils.GrossAmount gross = VatTaxUtils.solveGross(laborPretax);
-                pretax = gross.getPretax();
-                vat = gross.getVat();
-                cityTax = gross.getCityTax();
+                // 绱鍙e緞锛歅绱� = L绱� + V绱� + C绱紙V绱� 鐨勮捣寰佺偣鎸夌疮璁$◣鍓嶅垽鏂級锛屾湰绗斿彇宸
+                VatTaxUtils.GrossAmount gross = VatTaxUtils.solveGross(sumLaborPretax);
+                pretax = VatTaxUtils.roundMoney(gross.getPretax().subtract(prevAmount));
+                vat = VatTaxUtils.roundMoney(gross.getVat().subtract(prevVat));
+                cityTax = VatTaxUtils.roundMoney(gross.getCityTax().subtract(prevCityTax));
+                if (pretax.signum() < 0) {
+                    pretax = laborPretax;
+                }
+                if (vat.signum() < 0) {
+                    vat = BigDecimal.ZERO;
+                }
+                if (cityTax.signum() < 0) {
+                    cityTax = BigDecimal.ZERO;
+                }
             } else {
-                // 5.2.3 绋庡墠褰曞叆锛氬厛绠楀鍊肩◣/鍩庡缓绋�/鍔冲姟绋庡墠锛屽啀鎸夌疮璁″姵鍔$◣鍓嶇畻鍔冲姟涓◣
+                // 5.2.3 绋庡墠褰曞叆锛氬厛鎸夌疮璁$◣鍓嶇畻绱澧炲�肩◣/鍩庡缓绋庯紝鍐嶆寜宸寰楁湰绗旓紝鏈�鍚庢寜绱鍔冲姟绋庡墠绠椾釜绋�
                 pretax = toMoney(detail.getAmount());
-                vat = VatTaxUtils.calcVat(pretax);
-                cityTax = VatTaxUtils.calcCityTax(vat);
+                BigDecimal cumPretax = prevAmount.add(pretax);
+                BigDecimal cumVat = VatTaxUtils.calcVat(cumPretax);
+                BigDecimal cumCityTax = VatTaxUtils.calcCityTax(cumVat);
+                vat = VatTaxUtils.roundMoney(cumVat.subtract(prevVat));
+                cityTax = VatTaxUtils.roundMoney(cumCityTax.subtract(prevCityTax));
+                if (vat.signum() < 0) {
+                    vat = BigDecimal.ZERO;
+                }
+                if (cityTax.signum() < 0) {
+                    cityTax = BigDecimal.ZERO;
+                }
                 laborPretax = VatTaxUtils.roundMoney(pretax.subtract(vat).subtract(cityTax));
+                if (laborPretax.signum() < 0) {
+                    // 鏋佺杈圭晫锛氱疮璁″垰璺ㄨ繃璧峰緛鐐广�佹湰绗旈噾棰濆皬浜庤烦鍙橀噺銆�
+                    // 鏈瑪涓嶆墸绋庛�佸樊棰濋『寤跺埌鍚庣画绗旓紙绱鍙帹杩涘疄闄呭垎鎽婂�硷紝涓嬩竴绗斿樊鍒嗘椂鑷姩琛ュ洖锛�
+                    log.warn("绱璺ㄨ捣寰佺偣瀵艰嚧鏈瑪鍔冲姟绋庡墠涓鸿礋锛屾湰绗斾笉鎵g◣銆佸樊棰濋『寤躲�備汉鍛橈細{}锛屾湰绗旂◣鍓�={}锛屾湰绗斿鍊肩◣={}锛�"
+                                    + "鏈瑪鍩庡缓绋�={}锛岀疮璁$◣鍓�={}",
+                            safeName(detail), pretax, vat, cityTax, cumPretax);
+                    vat = BigDecimal.ZERO;
+                    cityTax = BigDecimal.ZERO;
+                    laborPretax = pretax;
+                }
                 BigDecimal sumLaborPretax = prevLaborPretax.add(laborPretax);
                 BigDecimal sumTax = new BigDecimal(TaxtUtils.getTaxation(sumLaborPretax));
                 taxAmount = VatTaxUtils.roundMoney(sumTax.subtract(prevTax));
@@ -460,7 +538,7 @@
             detail.setLaborPretaxAmount(laborPretax.doubleValue());
             detail.setTaxamount(taxAmount.doubleValue());
             detail.setTaxedamount(taxedAmount.doubleValue());
-            detail.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+            detail.setTaxVersion(VatTaxUtils.TAX_VERSION_CURRENT);
             detail.setTaxTime(taxTime);
             updateList.add(detail);
 
@@ -494,7 +572,7 @@
         serviceFund.setLaborPretaxCost(laborPretaxTotal.doubleValue());
         serviceFund.setTaxcost(taxTotal.doubleValue());
         serviceFund.setTaxedcost(taxedTotal.doubleValue());
-        serviceFund.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+        serviceFund.setTaxVersion(VatTaxUtils.TAX_VERSION_CURRENT);
         serviceFund.setFundtaxtime(taxTime);
         serviceFund.setIstax(1);
         serviceFundMapper.updateById(serviceFund);
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java
index b9033a8..c2ac534 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundtaxServiceImpl.java
@@ -230,15 +230,18 @@
         TaxMoneyByItemEO taxMoneyVO = new TaxMoneyByItemEO();
         taxMoneyVO.setFirstDay(firstDay);
         taxMoneyVO.setTaxTime(taxTime);
+        // 褰撳墠鍙e緞鐗堟湰锛坴3锛夛細鐢ㄤ簬鎷︽埅鍚屼竴鏈堜唤鍐呯殑鍏跺畠鍙e緞璁板綍锛岄伩鍏嶆贩绠�
+        taxMoneyVO.setTaxVersion(VatTaxUtils.TAX_VERSION_CURRENT);
         Map<String, TaxMoneySumEO> tempTaxSumMap = new HashMap<>();
         List<TaxMoneySumEO> taxSum = serviceFunddetailMapper.getTaxSum(taxMoneyVO);
         if (CollectionUtils.isNotEmpty(taxSum)) {
             for (TaxMoneySumEO taxMoneySumEO : taxSum) {
                 tempTaxSumMap.put(taxMoneySumEO.getIDCardNo(), taxMoneySumEO);
-                // 6. 褰撴湀宸插瓨鍦ㄧ殑鍘嗗彶鍙e緞锛坴1锛夎褰曚細璁╃疮璁″熀鏁版柊鏃ф贩绠楋紝鐩存帴闃绘
-                if (taxMoneySumEO.getV1Count() != null && taxMoneySumEO.getV1Count() > 0) {
-                    throw new BaseException("褰撴湀宸插瓨鍦ㄦ棫鍙e緞锛坴1锛夌畻绋庤褰曪紝涓洪伩鍏嶆柊鏃у彛寰勬贩绠楋紝"
-                            + "鏈湀璇风户缁娇鐢ㄦ棫鍙e緞鎴栦粠涓嬩釜鏈堣捣鍐嶆寜鏂板彛寰勭畻绋庛�備汉鍛樿韩浠借瘉鍙凤細"
+                // 6. 褰撴湀宸插瓨鍦ㄥ叾瀹冨彛寰勶紙v1/v2鈥︼級鐨勮褰曚細璁╃疮璁″熀鏁版贩绠楋紝鐩存帴闃绘
+                if (taxMoneySumEO.getOtherVersionCount() != null && taxMoneySumEO.getOtherVersionCount() > 0) {
+                    throw new BaseException("褰撴湀宸插瓨鍦ㄥ叾瀹冨彛寰勶紙"
+                            + (taxMoneySumEO.getOtherVersion() == null ? "鏃х増鏈�" : taxMoneySumEO.getOtherVersion())
+                            + "锛夌殑绠楃◣璁板綍锛屼负閬垮厤鏂版棫鍙e緞娣风畻锛屾湰鏈堣缁х画浣跨敤鍘熷彛寰勬垨浠庝笅涓湀璧峰啀鎸夋柊鍙e緞绠楃◣銆備汉鍛樿韩浠借瘉鍙凤細"
                             + taxMoneySumEO.getIDCardNo());
                 }
             }
@@ -281,7 +284,7 @@
         updateFundtax.setTaxamount(VatTaxUtils.roundMoney(taxTotal));
         updateFundtax.setTaxMoney(VatTaxUtils.roundMoney(taxTotal));
         updateFundtax.setTaxedamount(VatTaxUtils.roundMoney(taxedTotal));
-        updateFundtax.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+        updateFundtax.setTaxVersion(VatTaxUtils.TAX_VERSION_CURRENT);
         updateFundtax.setIstax(1);
         updateFundtax.setTaxedtime(taxTime);
         serviceFundtaxMapper.updateById(updateFundtax);
diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml
index c5115cc..f9c8be8 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceFundMapper.xml
@@ -155,6 +155,8 @@
         <if test="fundTaxId != null ">and fund_tax_id = #{fundTaxId}</if>
         <if test="userno != null  and userno != ''">and UserNo = #{userno}</if>
         <if test="username != null  and username != ''">and UserName like concat('%', #{username}, '%')</if>
+        <!-- 2026-11-10锛氫笟鍔$粍闀跨湅鏈粍锛堢敵璇蜂汉鎵�灞炰笟鍔$粍缂栧彿 = 鐧诲綍浜洪儴闂↖D锛� -->
+        <if test="deptmentno != null  and deptmentno != ''">and DeptmentNo = #{deptmentno}</if>
         <if test="applytype != null  and applytype != ''">and ApplyType = #{applytype}</if>
         <if test="deptmentname != null  and deptmentname != ''">and DeptmentName like concat('%', #{deptmentname},
             '%')
@@ -304,4 +306,49 @@
         </set>
         where id = #{id}
     </update>
+
+    <!--
+      涓撳璐规眹鎬诲崟鎵撳嵃锛氭寜銆屼笌瑙嗗浘 v_expertfee_expert 瀹屽叏鐩稿悓鐨勫垎缁勩�嶆眹鎬诲鍊肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡墠銆�
+      瑙嗗浘鐨� TaxAmount 宸插惈澧炲�肩◣+鍩庡缓绋庯紙2026-11-12 涓氬姟鏂逛慨鏀癸級锛屼唬鐮侀噷鍐嶆媶鍑哄姵鍔′釜绋庛��
+      鍒嗙粍閿敤 CONCAT_WS 鐢熸垚锛屽繀椤讳笌 Java 鐨� expertGroupKey 椤哄簭涓�鑷达細
+      BeneficiaryName | IDCardNo | BankCardNo | DepositBank | UnitName
+    -->
+    <select id="selectTaxSumByBeneficiary" resultType="com.ruoyi.project.domain.vo.FundTaxAmountSum">
+        SELECT CONCAT_WS('|',
+                         IFNULL(d.BeneficiaryName, ''),
+                         IFNULL(d.IDCardNo, ''),
+                         IFNULL(d.BankCardNo, ''),
+                         IFNULL(d.DepositBank, ''),
+                         IFNULL(d.UnitName, ''))                                AS groupKey,
+               SUM(IFNULL(d.vat_amount, 0))                                     AS vatAmount,
+               SUM(IFNULL(d.city_tax_amount, 0))                                AS cityTaxAmount,
+               SUM(IFNULL(d.labor_pretax_amount, IFNULL(d.Amount, 0)))          AS laborPretaxAmount
+        FROM service_funddetail d,
+             service_fund f
+        WHERE f.ID = d.fundID
+          AND f.fund_tax_id = #{fundTaxId}
+          AND f.istax = 1
+          AND d.del_flag = 0
+        GROUP BY groupKey
+    </select>
+
+    <!--
+      涓撳璐规眹鎬诲崟鎵撳嵃锛氭寜銆屼笌瑙嗗浘 v_expertfee_donor 瀹屽叏鐩稿悓鐨勫垎缁勩�嶆眹鎬汇��
+      娉ㄦ剰锛氳鍥鹃噷鐨� DonorName / InfoID 鍙栬嚜 service_fund锛堜笉鏄槑缁嗚〃锛夛紝
+            鍒嗙粍閿� = f.DonorName | f.InfoID锛屼笌 Java 鐨� donorGroupKey 涓�鑷�
+    -->
+    <select id="selectTaxSumByDonor" resultType="com.ruoyi.project.domain.vo.FundTaxAmountSum">
+        SELECT CONCAT_WS('|', IFNULL(f.DonorName, ''), IFNULL(f.InfoID, ''))    AS groupKey,
+               SUM(IFNULL(d.vat_amount, 0))                                     AS vatAmount,
+               SUM(IFNULL(d.city_tax_amount, 0))                                AS cityTaxAmount,
+               SUM(IFNULL(d.labor_pretax_amount, IFNULL(d.Amount, 0)))          AS laborPretaxAmount
+        FROM service_funddetail d,
+             service_fund f
+        WHERE f.ID = d.fundID
+          AND f.fund_tax_id = #{fundTaxId}
+          AND f.istax = 1
+          AND d.del_flag = 0
+        GROUP BY groupKey
+    </select>
+
 </mapper>
diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml
index 8070f25..4e7286f 100644
--- a/ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceFunddetailMapper.xml
@@ -299,7 +299,10 @@
                sum(COALESCE(a.TaxedAmount, 0))                                    taxedAmounts,
                sum(COALESCE(a.vat_amount, 0))                                     vatAmounts,
                sum(COALESCE(a.city_tax_amount, 0))                                cityTaxAmounts,
-               sum(CASE WHEN a.tax_version = 'v1' THEN 1 ELSE 0 END)              v1Count,
+               sum(CASE WHEN a.tax_version IS NOT NULL AND a.tax_version &lt;&gt; #{taxVersion}
+                        THEN 1 ELSE 0 END)                                        otherVersionCount,
+               max(CASE WHEN a.tax_version IS NOT NULL AND a.tax_version &lt;&gt; #{taxVersion}
+                        THEN a.tax_version END)                                   otherVersion,
                max(a.xh)                                                          xh,
                a.IDCardNo
         FROM service_funddetail a,
diff --git a/ruoyi-project/src/main/resources/mapper/project/VExpertfeeDonorMapper.xml b/ruoyi-project/src/main/resources/mapper/project/VExpertfeeDonorMapper.xml
index fdc8cf1..fad4920 100644
--- a/ruoyi-project/src/main/resources/mapper/project/VExpertfeeDonorMapper.xml
+++ b/ruoyi-project/src/main/resources/mapper/project/VExpertfeeDonorMapper.xml
@@ -40,11 +40,12 @@
     </select>
 
     <select id="selectVExpertfeeDonorList2" parameterType="com.ruoyi.project.domain.VExpertfeeDonor" resultMap="VExpertfeeDonorResult">
-        select  DonorName, PretaxAmount, TaxAmount, TaxedAmount, DonorMedicalCost, DonorBodyCost, OrganGainCost, OrganMedicalCost, DonorCost from v_expertfee_donor
+        select  DonorName, InfoID, PretaxAmount, TaxAmount, TaxedAmount, DonorMedicalCost, DonorBodyCost, OrganGainCost, OrganMedicalCost, DonorCost from v_expertfee_donor
         where fund_tax_id = #{taxId}
         UNION
         SELECT
                '鍚堣'                  as DonorName,
+               null                    as InfoID,
                SUM(PretaxAmount) as PretaxAmount,
                SUM(TaxAmount)    as TaxAmount,
                SUM(TaxedAmount)    as TaxedAmount,

--
Gitblit v1.9.3