From 5a6781cad342b0b7e8d5c62048582b9479540a35 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 18 十一月 2026 14:54:12 +0800
Subject: [PATCH] 修改了增值税城建税
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFundServiceImpl.java | 95 ++++++++++-------------------------------------
1 files changed, 20 insertions(+), 75 deletions(-)
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 b488cf0..69d1acb 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
@@ -18,6 +18,7 @@
import com.ruoyi.common.enums.ApplyTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.tax.VatTaxUtils;
import com.ruoyi.common.utils.HttpClientKit;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
@@ -1837,12 +1838,12 @@
List<VExpertfeeDonor> list2 = vExpertfeeDonorMapper.selectVExpertfeeDonorList2(faxId);
// 鎵撳嵃妯℃澘瑙嗗浘涓嶅惈鈥滃鍊肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡墠鈥濓紝鎸� fund_tax_id 浠庢槑缁嗚〃姹囨�诲悗鍥炲~
- fillDonorTaxAmounts(list2, faxId);
+ fillDonorTaxAmounts(list2);
ExcelUtil<VExpertfeeDonor> util2 = new ExcelUtil<VExpertfeeDonor>(VExpertfeeDonor.class);
AjaxResult ajaxResult2 = util2.exportExcel(list2, "VExpertfeeDonor");
List<VExpertfeeExpert> list3 = vExpertfeeExpertMapper.selectVExpertfeeExpertListByFaxId(faxId);
- fillExpertTaxAmounts(list3, faxId);
+ fillExpertTaxAmounts(list3);
ExcelUtil<VExpertfeeExpert> util3 = new ExcelUtil<VExpertfeeExpert>(VExpertfeeExpert.class);
AjaxResult ajaxResult3 = util3.exportExcel(list3, "vExpertfeeExpert");
@@ -1862,135 +1863,79 @@
}
/**
- * 涓撳璐规眹鎬诲崟鎵撳嵃锛堜笓瀹舵槑缁� sheet锛夛細鍥炲~澧炲�肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡墠锛屽苟鎶婅鍥剧殑銆屾墸绋庨噾棰濄�嶆媶鍥炲姵鍔′釜绋庛��
+ * 涓撳璐规眹鎬诲崟鎵撳嵃锛堜笓瀹舵槑缁� sheet锛夛細澧炲�肩◣銆佸煄寤虹◣鐩存帴鍙栬鍥惧垪锛屽姵鍔$◣鍓嶆寜宸璁$畻銆�
* <p>
- * 鍙e緞璇存槑锛�
+ * 2026-11-18锛氳鍥� {@code v_expertfee_expert} 宸茬嫭绔嬫彁渚� {@code vat_amount}銆亄@code city_tax_amount}锛�
+ * 涓� {@code TaxAmount} 鎭㈠涓�<b>绾姵鍔′釜绋�</b>锛屽洜姝わ細
* <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>
+ * <li>澧炲�肩◣ / 鍩庡缓绋� / 鍔冲姟绋庡悗 鐩存帴鐢ㄨ鍥惧�硷紝涓嶅啀浠庢槑缁嗚〃浜屾姹囨�伙紱</li>
+ * <li>鍔冲姟绋庡墠 = 绋庡墠閲戦 鈭� 澧炲�肩◣ 鈭� 鍩庡缓绋庯紱</li>
+ * <li>銆屽悎璁°�嶈鎸夊悇琛岀疮鍔犮��</li>
* </ul>
*/
- private void fillExpertTaxAmounts(List<VExpertfeeExpert> rows, Integer fundTaxId) {
+ private void fillExpertTaxAmounts(List<VExpertfeeExpert> rows) {
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);
+ BigDecimal vat = nvl(row.getVatAmount());
+ BigDecimal city = nvl(row.getCityTaxAmount());
+ BigDecimal labor = VatTaxUtils.roundMoney(
+ nvl(row.getPretaxamount()).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銆嶃��
+ * 涓撳璐规眹鎬诲崟鎵撳嵃锛堟崘鐚�� sheet锛夛細鍙e緞鍚� {@link #fillExpertTaxAmounts}锛屽悎璁¤鎸夈�屾崘鐚�呫�嶈鐨勫�肩疮鍔犮��
*/
- private void fillDonorTaxAmounts(List<VExpertfeeDonor> rows, Integer fundTaxId) {
+ private void fillDonorTaxAmounts(List<VExpertfeeDonor> rows) {
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);
+ BigDecimal vat = nvl(row.getVatAmount());
+ BigDecimal city = nvl(row.getCityTaxAmount());
+ BigDecimal labor = VatTaxUtils.roundMoney(
+ nvl(row.getPretaxamount()).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();
}
/**
--
Gitblit v1.9.3