From 4237cf7ce201652d7df7069dca3f3aac8b438a0d Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 27 七月 2023 17:01:54 +0800
Subject: [PATCH] 代码修改
---
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/Nickname.java | 2 +
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 2
ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceFunddetailAssort.java | 11 +++--
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceFundController.java | 54 ++++++++++++++++++++-------
4 files changed, 49 insertions(+), 20 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 5596ef6..9c08f28 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
@@ -438,29 +438,37 @@
// }
List<ServiceFunddetail> serviceFunddetails = serviceFundVO.getServiceFunddetails();
// serviceFunddetails.forEach(item -> item.setFundid(id));
+
+ //taxBefore銆乼axAfter鐢ㄦ潵璁板綍绋庡墠绋庡悗鐨勬�婚噾棰濓紝涓嶇敤绠$◣鐜�
+ double taxBefore = 0.0;
+ double taxAfter = 0.0;
for (ServiceFunddetail serviceFunddetail : serviceFunddetails) {
serviceFunddetail.setFundid(id);
- if (!serviceFunddetail.getTaxedamount().equals(Double.NaN) && !serviceFunddetail.getAmount().equals(Double.NaN)) {
+ if (serviceFunddetail.getTaxedamount() != 0.0 && serviceFunddetail.getAmount() != 0.0 && serviceFunddetail.getTaxedamount() != null && serviceFunddetail.getTaxedamount() != null) {
// 绋庡墠绋庡悗閮戒笉涓虹┖
continue;
- } else if (!serviceFunddetail.getTaxedamount().equals(Double.NaN)) {
+ } else if (serviceFunddetail.getTaxedamount() != 0.0 && serviceFunddetail.getTaxedamount() != null) {
// 绋庡悗姹傜◣鍓�
Double taxationBefore = Double.valueOf(TaxtUtils.getTaxationBefore(BigDecimal.valueOf(serviceFunddetail.getTaxedamount())));
// 绋庨噾
String taxation = TaxtUtils.getTaxation(BigDecimal.valueOf(taxationBefore));
serviceFunddetail.setAmount(Double.valueOf(taxationBefore));
serviceFunddetail.setTaxamount(Double.parseDouble(taxation));
- } else if (!serviceFunddetail.getAmount().equals(Double.NaN)) {
+ } else if (serviceFunddetail.getAmount() != 0.0 && serviceFunddetail.getAmount() != null) {
// 绋庡墠姹傜◣鍚�
double tax = Double.parseDouble(TaxtUtils.getTaxation(BigDecimal.valueOf(serviceFunddetail.getAmount())));
BigDecimal taxAfterMoney = BigDecimal.valueOf(serviceFunddetail.getAmount()).subtract(BigDecimal.valueOf(tax));
serviceFunddetail.setTaxamount(tax);
serviceFunddetail.setTaxedamount(taxAfterMoney.doubleValue());
}
-
+ taxBefore = taxBefore + serviceFunddetail.getAmount();
+ taxAfter = taxAfter + serviceFunddetail.getTaxedamount();
}
-
-
+ //灏嗙◣鍓嶃�佺◣鍚庨噾棰濇洿鏂板埌fund琛ㄤ腑
+ serviceFundVO.setPretaxcost(taxBefore);
+ serviceFundVO.setTaxedcost(taxAfter);
+ serviceFundService.updateById(serviceFundVO);
+ //灏嗚绠楀ソ鐨勬暟鎹紝淇濆瓨鍒癲etail琛ㄤ腑
serviceFunddetailService.saveBatch(serviceFunddetails);
return AjaxResult.success(id);
}
@@ -765,16 +773,34 @@
List<Double> sqljList = new ArrayList<>();
List<Double> ksljList = new ArrayList<>();
List<Double> shljList = new ArrayList<>();
- Map<String, Optional<ServiceFunddetailAssort>> result = fd.stream().collect(Collectors.groupingBy(ServiceFunddetail::getSubjecttypename, Collectors.mapping(obj -> new ServiceFunddetailAssort(obj.getAmount(), obj.getTaxamount(), obj.getTaxedamount()), Collectors.reducing(ServiceFunddetailAssort::add))));
- result.forEach((FWFL, serviceFunddetailAssort) -> {
+
+ //鏍规嵁鈥濈鐩被鍨嬪悕绉扳�滐紝鏉ヨ绠楃◣鍓嶆�诲拰锛岀◣閲戞�诲拰,绋庡悗鎬诲拰
+ Map<String, ServiceFunddetailAssort> funddetailMap = new HashMap<>();
+ for (ServiceFunddetail serviceFunddetail : fd) {
+ boolean b = funddetailMap.containsKey(serviceFunddetail.getSubjecttypename());
+ if (b == true) {
+ ServiceFunddetailAssort serviceFunddetailAssort = funddetailMap.get(serviceFunddetail.getSubjecttypename());
+ serviceFunddetailAssort.setKSXJ(serviceFunddetailAssort.getKSXJ() + serviceFunddetail.getTaxamount());
+ serviceFunddetailAssort.setSQXJ(serviceFunddetailAssort.getSQXJ() + serviceFunddetail.getAmount());
+ serviceFunddetailAssort.setSHXJ(serviceFunddetailAssort.getSHXJ() + serviceFunddetail.getTaxedamount());
+ } else {
+ funddetailMap.put(serviceFunddetail.getSubjecttypename(), new ServiceFunddetailAssort());
+ ServiceFunddetailAssort serviceFunddetailAssort = funddetailMap.get(serviceFunddetail.getSubjecttypename());
+ serviceFunddetailAssort.setKSXJ(serviceFunddetailAssort.getKSXJ() + serviceFunddetail.getTaxamount());
+ serviceFunddetailAssort.setSQXJ(serviceFunddetailAssort.getSQXJ() + serviceFunddetail.getAmount());
+ serviceFunddetailAssort.setSHXJ(serviceFunddetailAssort.getSHXJ() + serviceFunddetail.getTaxedamount());
+ }
+ }
+
+ funddetailMap.forEach((FWFL, serviceFunddetailAssort) -> {
Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("FWFL", FWFL);
- map1.put("SQXJ", serviceFunddetailAssort.get().getSQXJ());
- map1.put("KSXJ", serviceFunddetailAssort.get().getKSXJ());
- map1.put("SHXJ", serviceFunddetailAssort.get().getSHXJ());
- sqljList.add(serviceFunddetailAssort.get().getSQXJ());
- ksljList.add(serviceFunddetailAssort.get().getKSXJ());
- shljList.add(serviceFunddetailAssort.get().getSHXJ());
+ map1.put("SQXJ", serviceFunddetailAssort.getSQXJ());
+ map1.put("KSXJ", serviceFunddetailAssort.getKSXJ());
+ map1.put("SHXJ", serviceFunddetailAssort.getSHXJ());
+ sqljList.add(serviceFunddetailAssort.getSQXJ());
+ ksljList.add(serviceFunddetailAssort.getKSXJ());
+ shljList.add(serviceFunddetailAssort.getSHXJ());
lists.add(map1);
});
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceFunddetailAssort.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceFunddetailAssort.java
index dbfd699..d67d613 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceFunddetailAssort.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceFunddetailAssort.java
@@ -22,12 +22,14 @@
private String FWFL;
- private Double SQXJ;
+ private Double SQXJ =0.0;
- private Double KSXJ;
+ private Double KSXJ =0.0;
- private Double SHXJ;
+ private Double SHXJ =0.0;
+ public ServiceFunddetailAssort() {
+ }
public ServiceFunddetailAssort(Double SQXJ, Double KSXJ, Double SHXJ) {
this.SQXJ = SQXJ;
@@ -36,9 +38,8 @@
}
-
public static ServiceFunddetailAssort add(ServiceFunddetailAssort a, ServiceFunddetailAssort b) {
- return new ServiceFunddetailAssort(a.SQXJ + b.SQXJ, a.KSXJ + b.KSXJ,a.SHXJ+b.KSXJ);
+ return new ServiceFunddetailAssort(a.SQXJ + b.SQXJ, a.KSXJ + b.KSXJ, a.SHXJ + b.KSXJ);
}
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/Nickname.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/Nickname.java
index 2fef52e..9db03aa 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/Nickname.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/Nickname.java
@@ -8,4 +8,6 @@
private String username;
private String nickname;
+
+ private String phonenumber;
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index dbc7c58..cc00d58 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -148,7 +148,7 @@
select user_id, email from sys_user where email = #{email} limit 1
</select>
<select id="getNickname" resultType="com.ruoyi.system.domain.vo.Nickname">
- select user_name, nick_name from sys_user
+ select user_name, nick_name,phonenumber from sys_user
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
--
Gitblit v1.9.3