From a6354b57ab2614b6211fbb89e24c5c8bec76ce86 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 16 五月 2023 10:23:44 +0800
Subject: [PATCH] 修改bug

---
 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java
index 0b1b322..ad5147d 100644
--- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java
+++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java
@@ -129,7 +129,7 @@
             }
 
             double d = num1.doubleValue();
-            if(backgroundBalance < d){
+            if(backgroundBalance > 0 && backgroundBalance < d){
                 AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                 accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                 accountChangeDetail.setUserType(2);
@@ -143,7 +143,8 @@
                 this.insert(accountChangeDetail);
                 d -= backgroundBalance;
                 driver.setBackgroundBalance(0D);
-            }else{
+            }
+            if(backgroundBalance > 0 && backgroundBalance >= d){
                 AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                 accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                 accountChangeDetail.setUserType(2);
@@ -151,16 +152,16 @@
                 accountChangeDetail.setType(1);
                 accountChangeDetail.setChangeType(8);
                 accountChangeDetail.setOldData(driver.getBackgroundBalance());
-                d = 0;
                 driver.setBackgroundBalance(driver.getBackgroundBalance() - d);
                 accountChangeDetail.setNewData(driver.getBackgroundBalance());
                 accountChangeDetail.setExplain("收取保险费");
                 accountChangeDetail.setCreateTime(new Date());
                 this.insert(accountChangeDetail);
+                d = 0;
             }
 
             if(d > 0){
-                if(couponBalance < d){
+                if(couponBalance > 0 && couponBalance < d){
                     AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                     accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                     accountChangeDetail.setUserType(2);
@@ -174,7 +175,8 @@
                     this.insert(accountChangeDetail);
                     d -= couponBalance;
                     driver.setCouponBalance(0D);
-                }else{
+                }
+                if(couponBalance > 0 && couponBalance >= d){
                     AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                     accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                     accountChangeDetail.setUserType(2);
@@ -182,16 +184,16 @@
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
                     accountChangeDetail.setOldData(driver.getCouponBalance());
-                    d = 0;
                     driver.setCouponBalance(driver.getCouponBalance() - d);
                     accountChangeDetail.setNewData(driver.getCouponBalance());
                     accountChangeDetail.setExplain("收取保险费");
                     accountChangeDetail.setCreateTime(new Date());
                     this.insert(accountChangeDetail);
+                    d = 0;
                 }
             }
             if(d > 0){
-                if(commission < d){
+                if(commission > 0 && commission < d){
                     AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                     accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                     accountChangeDetail.setUserType(2);
@@ -205,7 +207,8 @@
                     this.insert(accountChangeDetail);
                     d -= commission;
                     driver.setCommission(0D);
-                }else{
+                }
+                if(commission > 0 && commission >= d){
                     AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                     accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                     accountChangeDetail.setUserType(2);
@@ -213,18 +216,19 @@
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
                     accountChangeDetail.setOldData(driver.getCommission());
-                    d = 0;
                     driver.setCommission(driver.getCommission() - d);
                     accountChangeDetail.setNewData(driver.getCommission());
                     accountChangeDetail.setExplain("收取保险费");
                     accountChangeDetail.setCreateTime(new Date());
                     this.insert(accountChangeDetail);
+                    d = 0;
                 }
             }
             if(d > 0){
-                if(balance < d){
+                if(balance > 0 && balance < d){
                     continue;
-                }else{
+                }
+                if(balance > 0 && balance >= d){
                     AccountChangeDetail accountChangeDetail = new AccountChangeDetail();
                     accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3));
                     accountChangeDetail.setUserType(2);
@@ -232,12 +236,12 @@
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
                     accountChangeDetail.setOldData(driver.getBalance());
-                    d = 0;
                     driver.setBalance(driver.getBalance() - d);
                     accountChangeDetail.setNewData(driver.getBalance());
                     accountChangeDetail.setExplain("收取保险费");
                     accountChangeDetail.setCreateTime(new Date());
                     this.insert(accountChangeDetail);
+                    d = 0;
                 }
             }
 

--
Gitblit v1.7.1