全局usdt,trx账户

This commit is contained in:
lu7213 committed 2026-10-13 03:57:17 -04:00
1 parent 15a80de8a6
commit 2602897c23
5 files changed
+146 -1

No files matched your search

@@ -91,6 +91,14 @@ public class UsdtConfig extends BaseEntity
@Excel(name = "主账号地址")
private String tokenAddress;
/** 主账号 USDT 余额,由定时任务从链上刷新 */
@Excel(name = "USDT余额")
private BigDecimal usdtBalance;
/** 主账号 TRX 余额,由定时任务从链上刷新 */
@Excel(name = "TRX余额")
private BigDecimal trxBalance;
public void setId(Long id)
{
this.id = id;
@@ -254,6 +262,26 @@ public class UsdtConfig extends BaseEntity
return tokenAddress;
}
public void setUsdtBalance(BigDecimal usdtBalance)
{
this.usdtBalance = usdtBalance;
}
public BigDecimal getUsdtBalance()
{
return usdtBalance;
}
public void setTrxBalance(BigDecimal trxBalance)
{
this.trxBalance = trxBalance;
}
public BigDecimal getTrxBalance()
{
return trxBalance;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -269,6 +297,8 @@ public class UsdtConfig extends BaseEntity
.append("rotatedAt", getRotatedAt())
.append("trxNum", getTrxNum())
.append("tokenAddress", getTokenAddress())
.append("usdtBalance", getUsdtBalance())
.append("trxBalance", getTrxBalance())
.toString();
}
}
@@ -76,6 +76,12 @@ public class UsdtConfigPlus implements Serializable
/** 主账号地址 */
@Excel(name = "主账号地址")
private String tokenAddress;
/** 主账号 USDT 余额,由定时任务从链上刷新 */
@Excel(name = "USDT余额")
private BigDecimal usdtBalance;
/** 主账号 TRX 余额,由定时任务从链上刷新 */
@Excel(name = "TRX余额")
private BigDecimal trxBalance;
public void setId(Long id)
{
this.id = id;
@@ -239,6 +245,26 @@ public class UsdtConfigPlus implements Serializable
return tokenAddress;
}
public void setUsdtBalance(BigDecimal usdtBalance)
{
this.usdtBalance = usdtBalance;
}
public BigDecimal getUsdtBalance()
{
return usdtBalance;
}
public void setTrxBalance(BigDecimal trxBalance)
{
this.trxBalance = trxBalance;
}
public BigDecimal getTrxBalance()
{
return trxBalance;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -254,6 +280,8 @@ public class UsdtConfigPlus implements Serializable
.append("rotatedAt", getRotatedAt())
.append("trxNum", getTrxNum())
.append("tokenAddress", getTokenAddress())
.append("usdtBalance", getUsdtBalance())
.append("trxBalance", getTrxBalance())
.toString();
}
}
@@ -1,5 +1,6 @@
package com.ruoyi.system.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -20,6 +21,11 @@ public interface UsdtConfigMapper extends BaseMapper<UsdtConfigPlus>
/** 使用旧版本作为条件原子更新加密信封,防止并发轮换互相覆盖。 */
int rotateEnvelope(@Param("config") UsdtConfig config, @Param("oldVersion") Long oldVersion);
/** 仅更新主账号链上余额,避免定时任务覆盖其他全局配置。 */
int updateMainWalletBalances(@Param("id") Long id,
@Param("usdtBalance") BigDecimal usdtBalance,
@Param("trxBalance") BigDecimal trxBalance);
/**
* 查询全局配置
*
@@ -23,10 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="rotatedAt" column="rotated_at" />
<result property="trxNum" column="trx_num" />
<result property="tokenAddress" column="token_address" />
<result property="usdtBalance" column="usdt_balance" />
<result property="trxBalance" column="trx_balance" />
</resultMap>
<sql id="selectUsdtConfigVo">
select id, pay_usdt_num, receive_usdt_num, tron_net_type, version, encryption_algorithm, password_kdf, iterations, encrypted_mnemonic, mnemonic_nonce, encrypted_dek, dek_nonce, key_salt, password_salt, password_hash, rotated_at, trx_num, token_address from usdt_config
select id, pay_usdt_num, receive_usdt_num, tron_net_type, version, encryption_algorithm, password_kdf, iterations, encrypted_mnemonic, mnemonic_nonce, encrypted_dek, dek_nonce, key_salt, password_salt, password_hash, rotated_at, trx_num, token_address, usdt_balance, trx_balance from usdt_config
</sql>
<select id="selectUsdtConfigList" parameterType="UsdtConfig" resultMap="UsdtConfigResult">
@@ -49,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rotatedAt != null "> and rotated_at = #{rotatedAt}</if>
<if test="trxNum != null "> and trx_num = #{trxNum}</if>
<if test="tokenAddress != null and tokenAddress != ''"> and token_address = #{tokenAddress}</if>
<if test="usdtBalance != null "> and usdt_balance = #{usdtBalance}</if>
<if test="trxBalance != null "> and trx_balance = #{trxBalance}</if>
</where>
</select>
@@ -77,6 +81,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{config.id}
and version = #{oldVersion}
</update>
<update id="updateMainWalletBalances">
update usdt_config
set usdt_balance = #{usdtBalance},
trx_balance = #{trxBalance}
where id = #{id}
</update>
<insert id="insertUsdtConfig" parameterType="UsdtConfig" useGeneratedKeys="true" keyProperty="id">
insert into usdt_config
@@ -98,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rotatedAt != null">rotated_at,</if>
<if test="trxNum != null">trx_num,</if>
<if test="tokenAddress != null">token_address,</if>
<if test="usdtBalance != null">usdt_balance,</if>
<if test="trxBalance != null">trx_balance,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="payUsdtNum != null">#{payUsdtNum},</if>
@@ -117,6 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rotatedAt != null">#{rotatedAt},</if>
<if test="trxNum != null">#{trxNum},</if>
<if test="tokenAddress != null">#{tokenAddress},</if>
<if test="usdtBalance != null">#{usdtBalance},</if>
<if test="trxBalance != null">#{trxBalance},</if>
</trim>
</insert>
@@ -140,6 +155,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="rotatedAt != null">rotated_at = #{rotatedAt},</if>
<if test="trxNum != null">trx_num = #{trxNum},</if>
<if test="tokenAddress != null">token_address = #{tokenAddress},</if>
<if test="usdtBalance != null">usdt_balance = #{usdtBalance},</if>
<if test="trxBalance != null">trx_balance = #{trxBalance},</if>
</trim>
where id = #{id}
</update>