From ecdfee84b355d09b81275f2a7b8dad14e4cf3de8 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 29 九月 2026 18:20:48 +0800
Subject: [PATCH] 修改车队模块
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java
index 5dd5b40..4015c97 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java
@@ -68,7 +68,8 @@
if (fleetId == null) {
throw new ServiceException("车队ID不能为空");
}
- if (getById(fleetId) == null) {
+ TFleet fleet = getById(fleetId);
+ if (fleet == null) {
throw new ServiceException("车队不存在或已删除");
}
VinManagementQueryDTO query = new VinManagementQueryDTO();
@@ -79,9 +80,27 @@
if (response == null || !R.isSuccess(response) || response.getData() == null) {
throw new ServiceException("VIN码车辆查询失败:" + (response == null ? "服务无响应" : response.getMsg()));
}
+ fillAvailableBalance(fleet.getCompanyId(), response.getData());
return response.getData();
}
+ /**
+ * 填充VIN码车辆可用余额(车队详情弹窗展示):
+ * 公司账户模式 2=分配模式 → VIN码自身余额;其余(1=共享/历史null)→ 公司当前可用余额;
+ * 公司不存在或余额为空时保持 null,前端显示 '-'。
+ */
+ private void fillAvailableBalance(Integer companyId, Page<TVinManagement> page) {
+ if (page == null || page.getRecords() == null || page.getRecords().isEmpty()) {
+ return;
+ }
+ TGroupCompany company = companyId == null ? null : groupCompanyService.getById(companyId);
+ boolean allocation = company != null && Integer.valueOf(2).equals(company.getAccountMode());
+ BigDecimal companyBalance = company == null ? null : company.getAvailableBalance();
+ for (TVinManagement item : page.getRecords()) {
+ item.setAvailableBalance(allocation ? item.getBalance() : companyBalance);
+ }
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public String importFleets(List<FleetImportDTO> items) {
--
Gitblit v1.7.1