From ee089a8ac4a9d99ef0a0491bbf1d80a2d4fbc393 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 10 十一月 2026 09:15:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java | 301 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 198 insertions(+), 103 deletions(-)
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 5a31d9d..6bf6c64 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
@@ -13,6 +13,7 @@
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.tax.PerformanceTaxtUtils;
import com.ruoyi.common.tax.TaxtUtils;
+import com.ruoyi.common.tax.VatTaxUtils;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.*;
@@ -253,15 +254,22 @@
Long fundid = serviceFunddetail.getFundid();
ServiceFund serviceFund = serviceFundMapper.selectById(fundid);
if (ObjectUtils.isNotEmpty(serviceFund)) {
- Double pretax = serviceFund.getPretaxcost();
- Double aftertax = serviceFund.getTaxedcost();
- pretax = pretax - serviceFunddetail.getAmount();
- aftertax = aftertax - serviceFunddetail.getTaxedamount();
- Double amount = pretax + aftertax;
+ // 閲戦涓�寰嬬敤 BigDecimal 绱姞/鎵e噺锛岄伩鍏嶆诞鐐瑰熬宸�
+ BigDecimal pretax = toMoney(serviceFund.getPretaxcost()).subtract(toMoney(serviceFunddetail.getAmount()));
+ BigDecimal aftertax = toMoney(serviceFund.getTaxedcost()).subtract(toMoney(serviceFunddetail.getTaxedamount()));
+ BigDecimal vat = toMoney(serviceFund.getVatCost()).subtract(toMoney(serviceFunddetail.getVatAmount()));
+ BigDecimal cityTax = toMoney(serviceFund.getCityTaxCost()).subtract(toMoney(serviceFunddetail.getCityTaxAmount()));
+ BigDecimal laborPretax = toMoney(serviceFund.getLaborPretaxCost()).subtract(toMoney(serviceFunddetail.getLaborPretaxAmount()));
+ BigDecimal tax = toMoney(serviceFund.getTaxcost()).subtract(toMoney(serviceFunddetail.getTaxamount()));
+ BigDecimal amount = pretax.add(aftertax);
- serviceFund.setPretaxcost(pretax);
- serviceFund.setTaxedcost(aftertax);
- serviceFund.setAmountrequested(amount);
+ serviceFund.setPretaxcost(pretax.doubleValue());
+ serviceFund.setTaxedcost(aftertax.doubleValue());
+ serviceFund.setVatCost(vat.doubleValue());
+ serviceFund.setCityTaxCost(cityTax.doubleValue());
+ serviceFund.setLaborPretaxCost(laborPretax.doubleValue());
+ serviceFund.setTaxcost(tax.doubleValue());
+ serviceFund.setAmountrequested(amount.doubleValue());
int updateAmount = serviceFundMapper.updateById(serviceFund);
}
return serviceFunddetailMapper.deleteById(id);
@@ -285,145 +293,228 @@
}
/**
- * 鎵归噺绠楃◣涓绘柟娉�
- * 1. 鏍¢獙鍙傛暟
- * 2. 鎺掑簭鏄庣粏锛屼繚璇佺◣鏃堕棿涓虹┖鐨勬帓鍦ㄥ悗闈�
- * 3. 閬嶅巻姣忔潯鏄庣粏锛屽垎韬唤璇佸彿涓虹┖鍜屼笉涓虹┖涓ょ鎯呭喌鍒嗗埆澶勭悊
- * - 韬唤璇佸彿涓虹┖锛氱洿鎺ユ寜瑙勫垯璧嬪�肩◣鍚庨噾棰濄�佺◣閲�
- * - 韬唤璇佸彿涓嶄负绌猴細
- * a. 鏌ヨ鏈湀绗竴澶╋紝鑾峰彇鏈�澶у簭鍙�
- * b. 鏌ヨ鏈湀绱绋庡墠銆佺◣閲戙�佺◣鍚庨噾棰�
- * c. 鏍规嵁"绋庡墠/绋庡悗"绫诲瀷鍒嗗埆璁$畻绋庨噾銆佺◣鍚庨噾棰�
- * d. 璁剧疆绠楃◣鏃堕棿銆佸簭鍙风瓑
- * 4. 绱鏈壒娆℃�荤◣鍓嶃�佺◣鍚庨噾棰�
- * 5. 鎵归噺鏇存柊鎵�鏈夋槑缁�
- * 6. 鏇存柊涓昏〃ServiceFund鐨勬�婚噾棰濄�佺畻绋庢椂闂淬�佺姸鎬�
+ * 鎵归噺绠楃◣涓绘柟娉曪紙鍔冲姟涓◣ + 澧炲�肩◣ + 鍩庡缓绋庯紝v2 鍙e緞锛�
+ * <p>
+ * 閲戦妯″瀷锛�
+ * <pre>
+ * 绋庡墠褰曞叆锛歏 = ceil(P 脳 1%)銆丆 = ceil(V 脳 3.5%)銆丩 = P - V - C銆�
+ * T = 鍔冲姟涓◣(褰撴湀绱 L) - 鍘熺疮璁� T銆丯 = L - T
+ * 绋庡悗褰曞叆锛歂绱 = 鍘熺疮璁� N + N銆丩绱 = getTaxationBefore(N绱)銆�
+ * L = L绱 - 鍘熺疮璁� L銆乀 = L - N銆丳/V/C = solveGross(L)
+ * 鏃犺韩浠借瘉锛歏 = C = T = 0锛孡 = N = P
+ * </pre>
*
* @param serviceFunddetails 璐圭敤鏄庣粏鍒楄〃
+ * @param tempTaxSumMap 鏈湀绱閲戦缂撳瓨锛堟寜韬唤璇佸彿锛�
* @return 鏄惁绠楃◣鎴愬姛
*/
@Override
public Boolean calculateTax(List<ServiceFunddetail> serviceFunddetails, Map<String, TaxMoneySumEO> tempTaxSumMap) {
+ return calculateTax(serviceFunddetails, tempTaxSumMap, new Date());
+ }
+
+ /**
+ * 鎵归噺绠楃◣锛堟寚瀹氭湰鎵圭畻绋庢椂闂达紝淇濊瘉鍚屾壒鏄庣粏 tax_time 涓�鑷达級
+ *
+ * @param serviceFunddetails 璐圭敤鏄庣粏鍒楄〃
+ * @param tempTaxSumMap 鏈湀绱閲戦缂撳瓨锛堟寜韬唤璇佸彿锛�
+ * @param taxTime 鏈绠楃◣鏃堕棿
+ * @return 鏄惁绠楃◣鎴愬姛
+ */
+ @Override
+ public Boolean calculateTax(List<ServiceFunddetail> serviceFunddetails, Map<String, TaxMoneySumEO> tempTaxSumMap, Date taxTime) {
// 1. 鏍¢獙鍙傛暟
if (CollectionUtils.isEmpty(serviceFunddetails)) {
throw new BaseException("绠楃◣鏉′欢涓虹┖锛岃妫�鏌ュ悗锛屽啀杩涜璁$畻");
}
- // 2. 鎺掑簭锛岀◣鏃堕棿涓虹┖鐨勬帓鍚庨潰
- serviceFunddetails.sort(Comparator.comparing(obj -> ObjectUtils.isEmpty(obj.getTaxTime()) ? 1 : 0));
+ // 2. 鎺掑簭锛氱◣鏃堕棿涓虹┖鐨勬帓鍚庨潰锛屽啀鎸� id 淇濊瘉鍚屾壒椤哄簭绋冲畾
+ serviceFunddetails.sort(Comparator
+ .comparing((ServiceFunddetail obj) -> ObjectUtils.isEmpty(obj.getTaxTime()) ? 1 : 0)
+ .thenComparing(obj -> obj.getId() == null ? Long.MAX_VALUE : obj.getId()));
- // 3. 鑾峰彇鏈壒娆undid鍙婁富琛ㄤ俊鎭�
+ // 3. 鑾峰彇鏈壒娆� fundid 鍙婁富琛ㄤ俊鎭�
Long fundid = serviceFunddetails.get(0).getFundid();
log.info("绠楃◣鐨刦undid鐨勫�间负锛歿}", fundid);
ServiceFund serviceFund1 = serviceFundMapper.selectById(fundid);
- log.info("fund琛ㄧ殑fundtextime鍊间负锛歿}", serviceFund1.getFundtaxtime());
- // 4. 鍒濆鍖栫疮璁¢噾棰濄�佸緟鏇存柊鏄庣粏鍒楄〃銆佸簭鍙风紦瀛樸�佺疮璁¢噾棰濈紦瀛�
- BigDecimal pretaxcost = BigDecimal.ZERO;
- BigDecimal taxedcost = BigDecimal.ZERO;
+ if (serviceFund1 == null) {
+ throw new BaseException("鏈壘鍒拌垂鐢ㄧ敵璇峰崟锛孖D=" + fundid);
+ }
+ // 鏄庣粏 tax_time 缁熶竴浣跨敤鏈绠楃◣鏃堕棿
+ if (taxTime == null) {
+ taxTime = new Date();
+ }
- //鍒涘缓涓�涓敤浜庡瓨鏀锯�滈渶瑕佹洿鏂板埌鏁版嵁搴撶殑ServiceFunddetail瀵硅薄鈥濈殑鍒楄〃
+ // 4. 鏈壒娆″悎璁★紙鍏ㄩ儴鐢� BigDecimal锛岀姝� double 绱姞锛�
+ BigDecimal pretaxTotal = BigDecimal.ZERO;
+ BigDecimal vatTotal = BigDecimal.ZERO;
+ BigDecimal cityTaxTotal = BigDecimal.ZERO;
+ BigDecimal laborPretaxTotal = BigDecimal.ZERO;
+ BigDecimal taxTotal = BigDecimal.ZERO;
+ BigDecimal taxedTotal = BigDecimal.ZERO;
+
List<ServiceFunddetail> updateList = new ArrayList<>();
- // 5. 閬嶅巻姣忔潯鏄庣粏锛屽垎鎯呭喌澶勭悊
+ // 5. 閬嶅巻姣忔潯鏄庣粏
for (ServiceFunddetail detail : serviceFunddetails) {
- // 5.1 韬唤璇佸彿涓虹┖锛岀洿鎺ヨ祴鍊硷紙涓�浜涗汉鎴栧叕鍙革紝涓嶉渶瑕佺畻绋庯級
+ if (detail.getAmount() == null) {
+ detail.setAmount(0.0);
+ }
+ if (detail.getTaxedamount() == null) {
+ detail.setTaxedamount(0.0);
+ }
+ // 鏈嶅姟璇存槑涓虹┖鎸夆�滈潪绋庡悗鈥濆鐞�
+ String scopeName = detail.getServicesscopename() == null ? "" : detail.getServicesscopename().trim();
+ boolean afterTax = scopeName.contains("绋庡悗");
+
+ // 5.1 韬唤璇佸彿涓虹┖锛氫笉鎵e鍊肩◣/鍩庡缓绋�/鍔冲姟涓◣
if (StringUtils.isEmpty(detail.getIdcardno())) {
- if (StringUtils.isEmpty(detail.getServicesscopename()) || !detail.getServicesscopename().contains("绋庡悗")) {
- // 鏅�氭槑缁嗭紝绋庡悗閲戦=鐢宠閲戦
- detail.setTaxedamount(detail.getAmount());
- } else {
- // 绋庡悗鏄庣粏锛岀敵璇烽噾棰�=绋庡悗閲戦
- detail.setAmount(detail.getTaxedamount());
- }
- // 绱鏈壒娆℃�婚噾棰�
- pretaxcost = pretaxcost.add(BigDecimal.valueOf(detail.getAmount()));
- taxedcost = taxedcost.add(BigDecimal.valueOf(detail.getTaxedamount()));
+ BigDecimal p = afterTax ? toMoney(detail.getTaxedamount()) : toMoney(detail.getAmount());
+ detail.setAmount(p.doubleValue());
+ detail.setVatAmount(0.0);
+ detail.setCityTaxAmount(0.0);
+ detail.setLaborPretaxAmount(p.doubleValue());
detail.setTaxamount(0.0);
+ detail.setTaxedamount(p.doubleValue());
+ detail.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+ detail.setTaxTime(taxTime);
updateList.add(detail);
+
+ pretaxTotal = pretaxTotal.add(p);
+ laborPretaxTotal = laborPretaxTotal.add(p);
+ taxedTotal = taxedTotal.add(p);
continue;
}
- // 5.2 韬唤璇佸彿涓嶄负绌猴紝闇�鏌ュ巻鍙茬疮璁¢噾棰濄�佸簭鍙�
+ // 5.2 韬唤璇佸彿涓嶄负绌猴細鏈湀绱 + 鍒嗘。绠楃◣
String idcard = detail.getIdcardno().trim();
- // 5.2.1 鏌ヨ鏈湀绱閲戦锛堢紦瀛橀伩鍏嶉噸澶嶆煡搴擄級
- TaxMoneySumEO taxSum = tempTaxSumMap.getOrDefault(idcard, null);
+ // 5.2.1 鍙栨湰鏈堢疮璁★紙缂撳瓨閬垮厤閲嶅鏌ュ簱锛�
+ TaxMoneySumEO taxSum = tempTaxSumMap.get(idcard);
if (taxSum == null) {
taxSum = new TaxMoneySumEO();
- taxSum.setXh(1L);
- detail.setXh(1L);
+ taxSum.setXh(0L);
tempTaxSumMap.put(idcard, taxSum);
- detail.setAllAmount(taxSum.getAmounts());
+ }
+ long xh = (taxSum.getXh() == null ? 0L : taxSum.getXh()) + 1;
+ taxSum.setXh(xh);
+ detail.setXh(xh);
+ // 绱绋庡墠閲戦锛堜笉鍚湰绗旓級锛岀敤浜庨〉闈㈠睍绀�
+ detail.setAllAmount(taxSum.getAmounts());
+
+ BigDecimal prevAmount = toMoney(taxSum.getAmounts());
+ BigDecimal prevLaborPretax = toMoney(taxSum.getLaborPretaxAmounts());
+ BigDecimal prevTax = toMoney(taxSum.getTaxAmounts());
+ BigDecimal prevTaxed = toMoney(taxSum.getTaxedAmounts());
+ BigDecimal prevVat = toMoney(taxSum.getVatAmounts());
+ BigDecimal prevCityTax = toMoney(taxSum.getCityTaxAmounts());
+
+ BigDecimal pretax;
+ BigDecimal vat;
+ BigDecimal cityTax;
+ BigDecimal laborPretax;
+ BigDecimal taxAmount;
+ BigDecimal taxedAmount;
+
+ if (afterTax) {
+ // 5.2.2 绋庡悗褰曞叆锛氬厛鍙嶇畻鍔冲姟绋庡墠锛屽啀寰幆鍙嶈В绋庡墠/澧炲�肩◣/鍩庡缓绋�
+ taxedAmount = toMoney(detail.getTaxedamount());
+ BigDecimal sumTaxed = prevTaxed.add(taxedAmount);
+ BigDecimal sumLaborPretax = new BigDecimal(TaxtUtils.getTaxationBefore(sumTaxed));
+ laborPretax = VatTaxUtils.roundMoney(sumLaborPretax.subtract(prevLaborPretax));
+ if (laborPretax.signum() < 0) {
+ // 閫愮瑪鍚戜笂鍙栨暣鍙兘甯︽潵鍑犲垎閽辩殑鍙嶇畻璇樊锛屽宸唴鎸� 0 澶勭悊锛涜秴鍑哄宸鏄庢暟鎹紓甯�
+ if (laborPretax.abs().compareTo(new BigDecimal("0.05")) <= 0) {
+ log.warn("绋庡悗閲戦鍙嶇畻鍔冲姟绋庡墠鍑虹幇璐熷熬宸紝宸叉寜 0 澶勭悊銆備汉鍛橈細{}锛屽弽绠楀姵鍔$◣鍓�={}锛屽師绱鍔冲姟绋庡墠={}",
+ safeName(detail), sumLaborPretax, prevLaborPretax);
+ laborPretax = BigDecimal.ZERO;
+ } else {
+ throw new BaseException("绋庡悗閲戦鍙嶇畻鍔冲姟绋庡墠澶辫触锛屼汉鍛橈細" + safeName(detail));
+ }
+ }
+ taxAmount = VatTaxUtils.roundMoney(laborPretax.subtract(taxedAmount));
+ if (taxAmount.signum() < 0) {
+ taxAmount = BigDecimal.ZERO;
+ }
+ VatTaxUtils.GrossAmount gross = VatTaxUtils.solveGross(laborPretax);
+ pretax = gross.getPretax();
+ vat = gross.getVat();
+ cityTax = gross.getCityTax();
} else {
- long xh = taxSum.getXh() + 1;
- taxSum.setXh(xh);
- tempTaxSumMap.put(idcard, taxSum);
- detail.setXh(xh);
- detail.setAllAmount(taxSum.getAmounts());
+ // 5.2.3 绋庡墠褰曞叆锛氬厛绠楀鍊肩◣/鍩庡缓绋�/鍔冲姟绋庡墠锛屽啀鎸夌疮璁″姵鍔$◣鍓嶇畻鍔冲姟涓◣
+ pretax = toMoney(detail.getAmount());
+ vat = VatTaxUtils.calcVat(pretax);
+ cityTax = VatTaxUtils.calcCityTax(vat);
+ laborPretax = VatTaxUtils.roundMoney(pretax.subtract(vat).subtract(cityTax));
+ BigDecimal sumLaborPretax = prevLaborPretax.add(laborPretax);
+ BigDecimal sumTax = new BigDecimal(TaxtUtils.getTaxation(sumLaborPretax));
+ taxAmount = VatTaxUtils.roundMoney(sumTax.subtract(prevTax));
+ if (taxAmount.signum() < 0) {
+ taxAmount = BigDecimal.ZERO;
+ }
+ taxedAmount = VatTaxUtils.roundMoney(laborPretax.subtract(taxAmount));
}
- // 5.2.3 绠楃◣閫昏緫
- if (detail.getServicesscopename().contains("绋庡悗")) {
- // 绋庡悗鏄庣粏锛氱疮璁$◣鍚庨噾棰濓紝鍙嶆帹绋庡墠閲戦鍜岀◣閲�
-// if (idcard.equals("362329199103224511")) {
-// log.info("鏈辩幃瀹�");
-// }
- BigDecimal newTaxedAmounts = BigDecimal.valueOf(taxSum.getTaxedAmounts()).add(BigDecimal.valueOf(detail.getTaxedamount()));
- String taxationBefore = TaxtUtils.getTaxationBefore(newTaxedAmounts);
- BigDecimal amountNow = new BigDecimal(taxationBefore).subtract(BigDecimal.valueOf(taxSum.getAmounts()));
- BigDecimal tax = amountNow.subtract(BigDecimal.valueOf(detail.getTaxedamount()));
- detail.setAmount(amountNow.doubleValue());
- detail.setTaxamount(tax.doubleValue());
- if (ObjectUtils.isEmpty(serviceFund1.getFundtaxtime())) {
- detail.setTaxTime(new Date());
- } else {
- detail.setTaxTime(serviceFund1.getFundtaxtime());
- }
- taxSum.setAmounts((BigDecimal.valueOf(taxSum.getAmounts()).add(amountNow)).doubleValue());
- taxSum.setTaxAmounts((BigDecimal.valueOf(taxSum.getTaxAmounts()).add(tax)).doubleValue());
- taxSum.setTaxedAmounts(newTaxedAmounts.doubleValue());
- } else {
- // 绋庡墠鏄庣粏锛氱疮璁$◣鍓嶉噾棰濓紝绠楁�荤◣閲戯紝鍐嶇畻鏈绋庨噾鍜岀◣鍚庨噾棰�
- BigDecimal newAmounts = BigDecimal.valueOf(taxSum.getAmounts()).add(BigDecimal.valueOf(detail.getAmount()));
-// if (idcard.equals("362329199103224511")) {
-// log.info("鏈辩幃瀹�");
-// }
- String taxation = TaxtUtils.getTaxation(newAmounts);
-
- BigDecimal taxAmountNow = new BigDecimal(taxation).subtract(new BigDecimal(String.valueOf(taxSum.getTaxAmounts())));
- BigDecimal texdAfterNow = BigDecimal.valueOf(detail.getAmount()).subtract(taxAmountNow);
- detail.setTaxamount(taxAmountNow.doubleValue());
- detail.setTaxedamount(texdAfterNow.doubleValue());
-
- if (ObjectUtils.isEmpty(serviceFund1.getFundtaxtime())) {
- detail.setTaxTime(new Date());
- } else {
- detail.setTaxTime(serviceFund1.getFundtaxtime());
- }
- taxSum.setAmounts(newAmounts.doubleValue());
- taxSum.setTaxAmounts((BigDecimal.valueOf(taxSum.getTaxAmounts()).add(taxAmountNow).doubleValue()));
- taxSum.setTaxedAmounts((BigDecimal.valueOf(taxSum.getTaxedAmounts()).add(texdAfterNow)).doubleValue());
- }
-
+ detail.setAmount(pretax.doubleValue());
+ detail.setVatAmount(vat.doubleValue());
+ detail.setCityTaxAmount(cityTax.doubleValue());
+ detail.setLaborPretaxAmount(laborPretax.doubleValue());
+ detail.setTaxamount(taxAmount.doubleValue());
+ detail.setTaxedamount(taxedAmount.doubleValue());
+ detail.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+ detail.setTaxTime(taxTime);
updateList.add(detail);
- pretaxcost = pretaxcost.add(BigDecimal.valueOf(detail.getAmount()));
- taxedcost = taxedcost.add(BigDecimal.valueOf(detail.getTaxedamount()));
+ // 5.2.4 鏇存柊鏈湀绱
+ taxSum.setAmounts(prevAmount.add(pretax).doubleValue());
+ taxSum.setVatAmounts(prevVat.add(vat).doubleValue());
+ taxSum.setCityTaxAmounts(prevCityTax.add(cityTax).doubleValue());
+ taxSum.setLaborPretaxAmounts(prevLaborPretax.add(laborPretax).doubleValue());
+ taxSum.setTaxAmounts(prevTax.add(taxAmount).doubleValue());
+ taxSum.setTaxedAmounts(prevTaxed.add(taxedAmount).doubleValue());
+ pretaxTotal = pretaxTotal.add(pretax);
+ vatTotal = vatTotal.add(vat);
+ cityTaxTotal = cityTaxTotal.add(cityTax);
+ laborPretaxTotal = laborPretaxTotal.add(laborPretax);
+ taxTotal = taxTotal.add(taxAmount);
+ taxedTotal = taxedTotal.add(taxedAmount);
}
+
// 6. 鎵归噺鏇存柊鎵�鏈夋槑缁�
for (ServiceFunddetail d : updateList) {
this.updateById(d);
}
- // 7. 鏇存柊涓昏〃ServiceFund
- ServiceFund serviceFund = new ServiceFund();
- serviceFund.setPretaxcost(pretaxcost.doubleValue());
- serviceFund.setTaxedcost(taxedcost.doubleValue());
- serviceFund.setId(serviceFunddetails.get(0).getFundid());
- serviceFund.setFundtaxtime(new Date());
+ // 7. 鏇存柊涓昏〃 service_fund 鐨� 6 涓噾棰濄�佺畻绋庢椂闂淬�佺姸鎬併�佺増鏈�
+ ServiceFund serviceFund = new ServiceFund();
+ serviceFund.setId(fundid);
+ serviceFund.setPretaxcost(pretaxTotal.doubleValue());
+ serviceFund.setVatCost(vatTotal.doubleValue());
+ serviceFund.setCityTaxCost(cityTaxTotal.doubleValue());
+ serviceFund.setLaborPretaxCost(laborPretaxTotal.doubleValue());
+ serviceFund.setTaxcost(taxTotal.doubleValue());
+ serviceFund.setTaxedcost(taxedTotal.doubleValue());
+ serviceFund.setTaxVersion(VatTaxUtils.TAX_VERSION_V2);
+ serviceFund.setFundtaxtime(taxTime);
serviceFund.setIstax(1);
serviceFundMapper.updateById(serviceFund);
return true;
+ }
+
+ /**
+ * null 瀹夊叏鐨勯噾棰濊浆鎹�
+ */
+ private static BigDecimal toMoney(Double value) {
+ return value == null ? BigDecimal.ZERO : BigDecimal.valueOf(value);
+ }
+
+ /**
+ * 鎶ラ敊鏃惰兘瀹氫綅鍒板叿浣撲汉鍛�
+ */
+ private static String safeName(ServiceFunddetail detail) {
+ String name = detail.getBeneficiaryname() == null ? "" : detail.getBeneficiaryname();
+ String idcard = detail.getIdcardno() == null ? "" : detail.getIdcardno();
+ return name + "(" + idcard + ")";
}
// @Override
@@ -493,6 +584,10 @@
//灏嗚绠楀嚭鏉ョ殑鏁版嵁鏀惧埌serviceFunddetail涓�
serviceFunddetail.setTaxamount(nowSingleTax.doubleValue());
serviceFunddetail.setTaxedamount(taxAfter.doubleValue());
+ // 缁╂晥涓嶅睘浜庝笓瀹惰垂锛氫笉璁$畻澧炲�肩◣/鍩庡缓绋庯紝鍔冲姟绋庡墠 = 绋庡墠閲戦
+ serviceFunddetail.setVatAmount(0.0);
+ serviceFunddetail.setCityTaxAmount(0.0);
+ serviceFunddetail.setLaborPretaxAmount(serviceFunddetail.getAmount());
serviceFunddetail.setJxrq(nowMonth);
save(serviceFunddetail);
--
Gitblit v1.9.3