From d4bde58ab669a434bb0c96f391153ec66eedd5b7 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 28 九月 2026 18:43:46 +0800
Subject: [PATCH] 修改余额字段及相关代码修改

---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TVinManagementServiceImpl.java |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TVinManagementServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TVinManagementServiceImpl.java
index b7ac4ff..537ba4c 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TVinManagementServiceImpl.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/TVinManagementServiceImpl.java
@@ -82,7 +82,7 @@
         validate(dto, false);
         TVinManagement item = from(dto);
         applyRelation(item, dto, null);
-        BigDecimal quota = normalizeQuota(dto.getInitQuota());
+        BigDecimal quota = normalizeQuota(dto.getBalance());
         List<Runnable> compensations = new ArrayList<>();
         try {
             if (quota.signum() > 0) {
@@ -90,7 +90,7 @@
                 deductBalance(item.getCompanyId(), quota);
                 compensations.add(() -> refundQuietly(item.getCompanyId(), quota));
             }
-            item.setInitQuota(quota.signum() > 0 ? quota : null);
+            item.setBalance(quota.signum() > 0 ? quota : null);
             item.setDelFlag(0);
             item.setCreateTime(LocalDateTime.now());
             item.setCreateBy(SecurityUtils.getUserId());
@@ -114,14 +114,14 @@
         item.setUpdateTime(LocalDateTime.now());
         item.setUpdateBy(SecurityUtils.getUserId());
         applyRelation(item, dto, old);
-        BigDecimal newQuota = normalizeQuota(dto.getInitQuota());
-        BigDecimal oldQuota = normalizeQuota(old.getInitQuota());
+        BigDecimal newQuota = normalizeQuota(dto.getBalance());
+        BigDecimal oldQuota = normalizeQuota(old.getBalance());
         if (newQuota.signum() > 0) {
             requireAllocationCompany(item.getCompanyId());
         }
         Integer oldCompanyId = old.getCompanyId();
         Integer newCompanyId = item.getCompanyId();
-        item.setInitQuota(newQuota.signum() > 0 ? newQuota : null);
+        item.setBalance(newQuota.signum() > 0 ? newQuota : null);
         List<Runnable> compensations = new ArrayList<>();
         try {
             if (Objects.equals(oldCompanyId, newCompanyId)) {
@@ -291,7 +291,7 @@
                 if (!Integer.valueOf(ENABLED).equals(vehicle.getStatus())) {
                     throw new ServiceException("VIN码【" + vehicle.getVin() + "】已禁用,禁止分配额度");
                 }
-                BigDecimal quota = normalizeQuota(vehicle.getInitQuota());
+                BigDecimal quota = normalizeQuota(vehicle.getBalance());
                 if (quota.add(amount).compareTo(MAX_INIT_QUOTA) > 0) {
                     throw new ServiceException("VIN码【" + vehicle.getVin() + "】分配后初始分配额度超过上限"
                             + MAX_INIT_QUOTA.toPlainString());
@@ -306,7 +306,7 @@
                 Long operator = SecurityUtils.getUserId();
                 for (TVinManagement vehicle : vehicles) {
                     BigDecimal amount = amounts.get(vehicle.getId());
-                    if (baseMapper.addInitQuota(vehicle.getId(), amount, operator) != 1) {
+                    if (baseMapper.addBalance(vehicle.getId(), amount, operator) != 1) {
                         throw new ServiceException("VIN码【" + vehicle.getVin() + "】额度分配失败,请重试");
                     }
                 }
@@ -627,7 +627,7 @@
                 .set(TVinManagement::getCompanyName, item.getCompanyName())
                 .set(TVinManagement::getCompanyId, item.getCompanyId())
                 .set(TVinManagement::getFleetId, item.getFleetId())
-                .set(TVinManagement::getInitQuota, item.getInitQuota())
+                .set(TVinManagement::getBalance, item.getBalance())
                 .set(TVinManagement::getRemark, item.getRemark())
                 .set(TVinManagement::getStatus, item.getStatus())
                 .set(TVinManagement::getUpdateTime, item.getUpdateTime())

--
Gitblit v1.7.1