From 2c16ba7f4cdfedf4ec05395e20caf9c87f2b5101 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 09 八月 2023 18:15:50 +0800
Subject: [PATCH] 修改funddetail文件上传
---
ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceFunddetailServiceImpl.java | 87 ++++++++++++++++++++++++++++++++++---------
1 files changed, 68 insertions(+), 19 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 32b0637..afcc2ca 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
@@ -6,9 +6,11 @@
import java.util.Date;
import java.util.List;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.ruoyi.common.tax.TaxtUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.TaxMoneyVO;
+import com.ruoyi.project.domain.vo.TaxedMoneyVO;
import com.ruoyi.project.mapper.ServiceFundMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,22 +95,69 @@
return dataBybeneficiaryNo;
}
+ /**
+ * 鏍规嵁鍙楃泭浜虹紪鍙疯幏鍙栫◣璐归噾棰�
+ *
+ * @param taxMoneyVo
+ * @return
+ */
@Override
- public Double getTaxBeforeByBeneFiciaryNo(TaxMoneyVO taxMoneyVo) {
+ public Double getTaxByBeneFiciaryNo(TaxMoneyVO taxMoneyVo) {
+ Double sum = 0.00;
+ Double totalScore = 0.00;
List<ServiceFunddetail> taxationByBeneFiciaryNo = serviceFunddetailMapper.getTaxBeforeByBeneFiciaryNo(taxMoneyVo);
- if (CollectionUtils.isEmpty(taxationByBeneFiciaryNo) && taxMoneyVo.getMoney() == 0) {
- //閮戒负0浜嗭紝灏辨病鏈夊繀瑕佸啀璁$畻浜�
- return 0.00;
+ if (CollectionUtils.isNotEmpty(taxationByBeneFiciaryNo)) {
+ //璁$畻鐢宠閲戦鎬诲拰锛屼笉鍖呮嫭褰撳墠浼犺繘鏉ョ殑
+ sum = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getAmount).sum();
+ //涓嶅姞鏈钖叕鐨勪釜绋�
+ totalScore = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getTaxamount).sum();
}
- double sum = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getAmount).sum();
+
sum = sum + new Double(taxMoneyVo.getMoney());
- //鍔犱笂鏈钖叕鐨勪釜绋�
+ //鍔犱笂鏈钖叕鐨勬�讳釜绋�
String taxation = TaxtUtils.getTaxation(new BigDecimal(sum));
- //涓嶅姞鏈钖叕鐨勪釜绋�
- Double totalScore = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getTaxamount).sum();
Double tax = Double.valueOf(taxation) - totalScore;
return tax;
+ }
+
+ /**
+ * 鏍规嵁绋庡悗宸ヨ祫锛岀畻鍑虹◣鍓嶅伐璧�
+ *
+ * @param taxMoneyVo
+ * @return
+ */
+ @Override
+ public TaxedMoneyVO getTaxBeforeByAfterMoney(TaxMoneyVO taxMoneyVo) {
+ TaxedMoneyVO taxedMoneyVO = new TaxedMoneyVO();
+ Double sum = 0.00;
+ Double totalScore = 0.00;
+ List<ServiceFunddetail> taxationByBeneFiciaryNo = serviceFunddetailMapper.getTaxBeforeByBeneFiciaryNo(taxMoneyVo);
+ if (CollectionUtils.isNotEmpty(taxationByBeneFiciaryNo)) {
+ //璁$畻鍑虹◣鍚庢�婚噾棰濓紙涓嶅寘鍚湰娆★級
+ sum = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getTaxedamount).sum();
+ //姹傚嚭涔嬪墠鐨勬�荤殑涓◣
+ totalScore = taxationByBeneFiciaryNo.stream().mapToDouble(ServiceFunddetail::getTaxamount).sum();
+ }
+ //璁$畻鍑烘�荤殑绋庡悗钖叕锛堝寘鍚湰娆★級
+ sum = sum + Double.valueOf(taxMoneyVo.getMoney());
+ //绋庡墠鎬婚噾棰�
+ String taxationBefore = TaxtUtils.getTaxationBefore(new BigDecimal(sum));
+ //鎬讳釜绋�
+ BigDecimal tax = new BigDecimal(taxationBefore).subtract(new BigDecimal(sum));
+
+ //鏈鐨勭◣鍓嶉噾棰�
+ String nowTaxMoney = TaxtUtils.getTaxationBefore(new BigDecimal(taxMoneyVo.getMoney()));
+ //鏈鐨勭◣璐�
+ BigDecimal subtract = new BigDecimal(nowTaxMoney).subtract(new BigDecimal(taxMoneyVo.getMoney()));
+
+ taxedMoneyVO.setAllTax(tax.toString());
+ taxedMoneyVO.setAllTaxbeforeMoney(taxationBefore);
+ taxedMoneyVO.setAllAaxAfterMoney(sum.toString());
+ taxedMoneyVO.setNowTaxBeforeMoney(nowTaxMoney);
+ taxedMoneyVO.setNowTax(subtract.toString());
+
+ return taxedMoneyVO;
}
@@ -152,18 +201,18 @@
ServiceFunddetail serviceFunddetail = serviceFunddetailMapper.selectById(id);
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;
- Double pretax = serviceFund.getPretaxcost();
- Double aftertax = serviceFund.getTaxedcost();
- pretax = pretax - serviceFunddetail.getAmount();
- aftertax = aftertax - serviceFunddetail.getTaxedamount();
- Double amount = pretax + aftertax;
-
- serviceFund.setPretaxcost(pretax);
- serviceFund.setTaxedcost(aftertax);
- serviceFund.setAmountrequested(amount);
- int updateAmount = serviceFundMapper.updateById(serviceFund);
-
+ serviceFund.setPretaxcost(pretax);
+ serviceFund.setTaxedcost(aftertax);
+ serviceFund.setAmountrequested(amount);
+ int updateAmount = serviceFundMapper.updateById(serviceFund);
+ }
return serviceFunddetailMapper.deleteById(id);
}
--
Gitblit v1.9.3