平台支付总览,应该加上全局配置,主账号的账户信息。

This commit is contained in:
lu7213 committed 2026-10-18 02:06:32 -04:00
1 parent 705609282f
commit e987be3a03
4 files changed
+24

No files matched your search

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.domain.UsdtConfig;
/** 支付首页聚合查询,所有查询都接受服务端确定的用户数据范围。 */
public interface PaymentDashboardMapper {
@@ -19,6 +19,9 @@ public interface UsdtConfigMapper extends BaseMapper<UsdtConfigPlus>
/** 锁定全局配置记录;空表时在 MySQL InnoDB 下同时锁定首记录间隙。 */
UsdtConfig selectFirstForUpdate();
/** 查询当前全局配置,不加锁,用于只读首页展示。 */
UsdtConfig selectFirst();
/** 使用旧版本作为条件原子更新加密信封,防止并发轮换互相覆盖。 */
int rotateEnvelope(@Param("config") UsdtConfig config, @Param("oldVersion") Long oldVersion);
@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.PaymentDashboardMapper;
import com.ruoyi.system.domain.UsdtConfig;
import com.ruoyi.system.mapper.UsdtConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,12 +15,25 @@ import java.util.Map;
public class PaymentDashboardService {
@Autowired
private PaymentDashboardMapper mapper;
@Autowired
private UsdtConfigMapper usdtConfigMapper;
public Map<String, Object> overview() {
Long currentUserId = SecurityUtils.getUserId();
Long scopedUserId = SecurityUtils.isAdmin(currentUserId) ? null : currentUserId;
Map<String, Object> result = new LinkedHashMap<String, Object>();
result.put("admin", scopedUserId == null);
if (scopedUserId == null) {
UsdtConfig config = usdtConfigMapper.selectFirst();
Map<String, Object> mainWallet = new LinkedHashMap<String, Object>();
if (config != null) {
mainWallet.put("address", config.getTokenAddress());
mainWallet.put("usdtBalance", config.getUsdtBalance());
mainWallet.put("trxBalance", config.getTrxBalance());
mainWallet.put("network", config.getTronNetType());
}
result.put("mainWallet", mainWallet);
}
result.put("apps", mapper.selectAppsSummary(scopedUserId));
result.put("wallets", mapper.selectWalletSummary(scopedUserId));
result.put("payments", mapper.selectPaymentSummary(scopedUserId));