From 4ed693f48d1435de7a6333df17c2b34154731429 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期三, 05 七月 2023 22:26:27 +0800
Subject: [PATCH] Merge branch 'master' of http://git.homecommunity.cn/supervip/MicroCommunity

---
 service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java |   39 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 38 insertions(+), 1 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
index d09db06..ad00a50 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeePreCmd.java
@@ -32,6 +32,7 @@
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -280,8 +281,44 @@
             reqJson.put("deductionAmount", 0.0);
             return 0.0;
         }
-
         BigDecimal money = new BigDecimal(0);
+        BigDecimal totalAccountAmount = new BigDecimal(0);
+        for (AccountDto tmpAccountDto : accountDtos) {
+             if (AccountDto.ACCT_TYPE_CASH.equals(tmpAccountDto.getAcctType())) { //鐜伴噾璐︽埛
+                //璐︽埛閲戦
+                BigDecimal amount = new BigDecimal(tmpAccountDto.getAmount());
+                //鑾峰彇搴旀敹閲戦
+                BigDecimal dedAmount = new BigDecimal("0.00");
+                if (reqJson.containsKey("receivedMoney") && !StringUtil.isEmpty(reqJson.getString("receivedMoney"))) {
+                    dedAmount = new BigDecimal(reqJson.getString("receivedMoney"));
+                } else {
+                    dedAmount = new BigDecimal(reqJson.getString("deductionAmount"));
+                }
+                int flag = amount.compareTo(dedAmount);
+                BigDecimal redepositAmount = new BigDecimal("0.00");
+                BigDecimal integralAmount = new BigDecimal("0.00");
+                if (flag == 1) { //鐜伴噾璐︽埛澶т簬搴旀敹閲戦锛屽氨鐢ㄥ簲鏀堕噾棰濇姷鎵�
+                    redepositAmount = dedAmount;
+                    integralAmount = amount.subtract(dedAmount);
+                }
+                if (flag > -1) { //鐜伴噾璐︽埛澶т簬绛変簬搴旀敹閲戦锛屽氨鐢ㄥ簲鏀堕噾棰濇姷鎵�
+                    redepositAmount = dedAmount;
+                    integralAmount = amount.subtract(dedAmount);
+                }
+                if (flag == -1) { //鐜伴噾璐︽埛灏忎簬瀹炴敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴锋姷鎵�
+                    redepositAmount = amount;
+                }
+                if (flag < 1) { //鐜伴噾璐︽埛灏忎簬绛変簬搴旀敹閲戦锛屽氨鐢ㄧ幇閲戣处鎴锋姷鎵�
+                    redepositAmount = amount;
+                }
+                if (flag == 0) { //鐜伴噾璐︽埛绛変簬搴旀敹閲戦
+                    redepositAmount = amount;
+                }
+                money = money.add(redepositAmount);
+            }
+//            totalAccountAmount = totalAccountAmount.add(new BigDecimal(tmpAccountDto.getAmount()));
+        }
+
 
         reqJson.put("deductionAmount", money.doubleValue());
         reqJson.put("selectUserAccount", BeanConvertUtil.beanCovertJSONArray(accountDtos));

--
Gitblit v1.8.0