From 1baa21c114f634b8ecc3af64efcfaab6a57a571e Mon Sep 17 00:00:00 2001
From: yanderong <307678080@qq.com>
Date: 星期六, 11 七月 2026 14:33:25 +0800
Subject: [PATCH] feat: 增加余额变更记录

---
 UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java b/UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
index ff87ce8..e4bdb5d 100644
--- a/UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
+++ b/UserYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -5,6 +5,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.stylefeng.guns.core.common.constant.state.BalanceChangeType;
 import com.stylefeng.guns.core.util.ToolUtil;
 import com.stylefeng.guns.modular.account.controller.AppOrderController;
 import com.stylefeng.guns.modular.crossCity.dao.OrderCrossCityMapper;
@@ -671,7 +672,7 @@
             if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
                 return ResultUtil.error("余额不足,无法完成支付", "");
             }
-
+            userInfo.setBalanceChangeType(BalanceChangeType.CONSUME.getCode());
             userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
     
             OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
@@ -801,6 +802,7 @@
 //                    return ResultUtil.error("电子余额不足,无法完成支付");
 //                }
 //            }
+            userInfo.setBalanceChangeType(BalanceChangeType.CONSUME.getCode());
             userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
     
             OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
@@ -896,7 +898,7 @@
 //            if(resultUtil.getCode()==500){
 //                return ResultUtil.error("电子余额不足,无法完成支付");
 //            }
-    
+            userInfo.setBalanceChangeType(BalanceChangeType.CONSUME.getCode());
             userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
     
             OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());
@@ -1189,6 +1191,7 @@
         if(null != orderLogistics.getPayType() && null != orderLogistics.getPayMoney()) {//已支付
             if(orderLogistics.getPayType() == 3){//余额支付
                 UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+                userInfo.setBalanceChangeType(BalanceChangeType.REFUND.getCode());
                 userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney());
                 userInfoService.updateById(userInfo);
                 appOrderController.createAllocationReqUser(1, orderLogistics.getUserId(), 1,orderLogistics.getPayMoney());
@@ -1211,6 +1214,7 @@
                 }
                 if(query.getPayType()==4){
                     UserInfo userInfo = userInfoService.selectById(orderLogistics.getUserId());
+                    userInfo.setBalanceChangeType(BalanceChangeType.REFUND.getCode());
                     userInfo.setBalance(userInfo.getBalance() + orderLogistics.getPayMoney());
                     userInfoService.updateById(userInfo);
                     appOrderController.createAllocationReqUser(1, orderLogistics.getUserId(), 1,orderLogistics.getPayMoney());
@@ -1656,7 +1660,7 @@
 //            if(resultUtil.getCode()==500){
 //                return ResultUtil.error("电子余额不足,无法完成支付");
 //            }
-    
+            userInfo.setBalanceChangeType(BalanceChangeType.CONSUME.getCode());
             userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
     
             OpenCity openCity = openCityService.openCity1(orderLogistics.getStartLon().toString(), orderLogistics.getStartLat().toString());

--
Gitblit v1.7.1