平台支付总览,应该加上全局配置,主账号的账户信息。
This commit is contained in:
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.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import com.ruoyi.system.domain.UsdtConfig;
|
||||||
|
|
||||||
/** 支付首页聚合查询,所有查询都接受服务端确定的用户数据范围。 */
|
/** 支付首页聚合查询,所有查询都接受服务端确定的用户数据范围。 */
|
||||||
public interface PaymentDashboardMapper {
|
public interface PaymentDashboardMapper {
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ public interface UsdtConfigMapper extends BaseMapper<UsdtConfigPlus>
|
|||||||
/** 锁定全局配置记录;空表时在 MySQL InnoDB 下同时锁定首记录间隙。 */
|
/** 锁定全局配置记录;空表时在 MySQL InnoDB 下同时锁定首记录间隙。 */
|
||||||
UsdtConfig selectFirstForUpdate();
|
UsdtConfig selectFirstForUpdate();
|
||||||
|
|
||||||
|
/** 查询当前全局配置,不加锁,用于只读首页展示。 */
|
||||||
|
UsdtConfig selectFirst();
|
||||||
|
|
||||||
/** 使用旧版本作为条件原子更新加密信封,防止并发轮换互相覆盖。 */
|
/** 使用旧版本作为条件原子更新加密信封,防止并发轮换互相覆盖。 */
|
||||||
int rotateEnvelope(@Param("config") UsdtConfig config, @Param("oldVersion") Long oldVersion);
|
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.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.system.mapper.PaymentDashboardMapper;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -13,12 +15,25 @@ import java.util.Map;
|
|||||||
public class PaymentDashboardService {
|
public class PaymentDashboardService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PaymentDashboardMapper mapper;
|
private PaymentDashboardMapper mapper;
|
||||||
|
@Autowired
|
||||||
|
private UsdtConfigMapper usdtConfigMapper;
|
||||||
|
|
||||||
public Map<String, Object> overview() {
|
public Map<String, Object> overview() {
|
||||||
Long currentUserId = SecurityUtils.getUserId();
|
Long currentUserId = SecurityUtils.getUserId();
|
||||||
Long scopedUserId = SecurityUtils.isAdmin(currentUserId) ? null : currentUserId;
|
Long scopedUserId = SecurityUtils.isAdmin(currentUserId) ? null : currentUserId;
|
||||||
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
Map<String, Object> result = new LinkedHashMap<String, Object>();
|
||||||
result.put("admin", scopedUserId == null);
|
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("apps", mapper.selectAppsSummary(scopedUserId));
|
||||||
result.put("wallets", mapper.selectWalletSummary(scopedUserId));
|
result.put("wallets", mapper.selectWalletSummary(scopedUserId));
|
||||||
result.put("payments", mapper.selectPaymentSummary(scopedUserId));
|
result.put("payments", mapper.selectPaymentSummary(scopedUserId));
|
||||||
|
|||||||
@@ -66,6 +66,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by id asc limit 1 for update
|
order by id asc limit 1 for update
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectFirst" resultMap="UsdtConfigResult">
|
||||||
|
<include refid="selectUsdtConfigVo"/>
|
||||||
|
order by id asc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="rotateEnvelope">
|
<update id="rotateEnvelope">
|
||||||
update usdt_config
|
update usdt_config
|
||||||
set version = #{config.version},
|
set version = #{config.version},
|
||||||
|
|||||||
Reference in new issue
Block a user