From aad87bdfab3ef685a27b3540b1114b36059c8cc7 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 01 六月 2023 23:33:21 +0800
Subject: [PATCH] 提交数据库

---
 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 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..c33aa86 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,24 +143,25 @@
                 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);
                 accountChangeDetail.setUserId(driver.getId());
                 accountChangeDetail.setType(1);
                 accountChangeDetail.setChangeType(8);
-                accountChangeDetail.setOldData(driver.getBackgroundBalance());
-                d = 0;
+                accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                 driver.setBackgroundBalance(driver.getBackgroundBalance() - d);
-                accountChangeDetail.setNewData(driver.getBackgroundBalance());
+                accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                 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,24 +175,25 @@
                     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);
                     accountChangeDetail.setUserId(driver.getId());
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
-                    accountChangeDetail.setOldData(driver.getCouponBalance());
-                    d = 0;
+                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                     driver.setCouponBalance(driver.getCouponBalance() - d);
-                    accountChangeDetail.setNewData(driver.getCouponBalance());
+                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                     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,39 +207,41 @@
                     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);
                     accountChangeDetail.setUserId(driver.getId());
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
-                    accountChangeDetail.setOldData(driver.getCommission());
-                    d = 0;
+                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                     driver.setCommission(driver.getCommission() - d);
-                    accountChangeDetail.setNewData(driver.getCommission());
+                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + 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);
                     accountChangeDetail.setUserId(driver.getId());
                     accountChangeDetail.setType(1);
                     accountChangeDetail.setChangeType(8);
-                    accountChangeDetail.setOldData(driver.getBalance());
-                    d = 0;
+                    accountChangeDetail.setOldData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                     driver.setBalance(driver.getBalance() - d);
-                    accountChangeDetail.setNewData(driver.getBalance());
+                    accountChangeDetail.setNewData(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission());
                     accountChangeDetail.setExplain("收取保险费");
                     accountChangeDetail.setCreateTime(new Date());
                     this.insert(accountChangeDetail);
+                    d = 0;
                 }
             }
 

--
Gitblit v1.7.1