实现带宽委托回收功能

pull/520/head
dorion 2024-05-18 00:10:33 +08:00
parent fe8ee67030
commit 8ae7cabda1
16 changed files with 335 additions and 330 deletions

View File

@ -147,7 +147,7 @@
</plugin> --> </plugin> -->
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<resources> <!-- <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<excludes> <excludes>
@ -155,7 +155,7 @@
<exclude>*.xml</exclude> <exclude>*.xml</exclude>
</excludes> </excludes>
</resource> </resource>
</resources> </resources>-->
</build> </build>

View File

@ -9,6 +9,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.TrxExchange; import com.ruoyi.system.domain.TrxExchange;
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
import com.ruoyi.system.service.IAccountAddressInfoService; import com.ruoyi.system.service.IAccountAddressInfoService;
import com.ruoyi.system.service.ITrxExchangeInfoService; import com.ruoyi.system.service.ITrxExchangeInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -53,7 +54,7 @@ public class TrxExchangeInfoController extends BaseController
public TableDataInfo list(TrxExchangeInfo trxExchangeInfo) public TableDataInfo list(TrxExchangeInfo trxExchangeInfo)
{ {
startPage(); startPage();
List<TrxExchangeInfo> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo); List<TrxExchangeInfoVO> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
return getDataTable(list); return getDataTable(list);
} }
@ -66,8 +67,8 @@ public class TrxExchangeInfoController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult export(TrxExchangeInfo trxExchangeInfo) public AjaxResult export(TrxExchangeInfo trxExchangeInfo)
{ {
List<TrxExchangeInfo> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo); List<TrxExchangeInfoVO> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
ExcelUtil<TrxExchangeInfo> util = new ExcelUtil<TrxExchangeInfo>(TrxExchangeInfo.class); ExcelUtil<TrxExchangeInfoVO> util = new ExcelUtil<TrxExchangeInfoVO>(TrxExchangeInfoVO.class);
return util.exportExcel(list, "trx兑能量记录数据"); return util.exportExcel(list, "trx兑能量记录数据");
} }

View File

@ -28,24 +28,14 @@
</select> </select>
</div> </div>
</div> </div>
<!-- <div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">单位</label> <label class="col-sm-3 control-label">资源类型</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="price" class="form-control" type="text"> <select name="resourceCode" class="form-control m-b" th:with="type=${@dict.getType('sys_trx_exchange')}">
</div> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</div>--> </select>
<!-- <div class="form-group">
<label class="col-sm-3 control-label">订单hash</label>
<div class="col-sm-8">
<input name="trxTxId" class="form-control" type="text">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">转入金额:</label>
<div class="col-sm-8">
<input name="trxAmount" class="form-control" type="text">
</div>
</div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">笔数:</label> <label class="col-sm-3 control-label">笔数:</label>
<div class="col-sm-8"> <div class="col-sm-8">

View File

@ -95,6 +95,8 @@
var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]]; var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]];
var sysEnergyBusiTypeDatas = [[${@dict.getType('sys_energy_busi_type')}]]; var sysEnergyBusiTypeDatas = [[${@dict.getType('sys_energy_busi_type')}]];
var lockPeriodDatas = [[${@dict.getType('sys_lock_period')}]]; var lockPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
var trxAmountUnitDatas = [[${@dict.getType('sys_monitor_type')}]];
var resourceCodeDatas = [[${@dict.getType('sys_trx_exchange')}]];
$(function () { $(function () {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
@ -161,12 +163,33 @@
}, },
{ {
field: 'trxAmount', field: 'trxAmount',
title: '转入TRX' title: '转入金额',
formatter: function (value, row, index) {
if (value == null) {
return value;
}
return value + ' ' + row['trxAmountUnit'];
}
},
{
field: 'trxAmountUnit',
title: '转入单位',
formatter: function(value, row, index) {
return $.table.selectDictLabel(trxAmountUnitDatas, value);
},
visible: false
}, },
{ {
field: 'delegateAmountTrx', field: 'delegateAmountTrx',
title: '支出TRX' title: '支出TRX'
}, },
{
field: 'resourceCode',
title: '资源类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(resourceCodeDatas, value);
}
},
{ {
field: 'delegateTxId', field: 'delegateTxId',
title: '能量交易订单', title: '能量交易订单',

View File

@ -34,8 +34,8 @@ public class TrxExchangeInfo extends BaseEntity
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS) @Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
private String toAddress; private String toAddress;
@Excel(name = "监听账户别名") /* @Excel(name = "监听账户别名")
private String monitorAddressName; private String monitorAddressName;*/
/** 实际出账账户 */ /** 实际出账账户 */
@Excel(name = "实际出账账户") @Excel(name = "实际出账账户")
@ -54,6 +54,8 @@ public class TrxExchangeInfo extends BaseEntity
@Excel(name = "笔数") @Excel(name = "笔数")
private Long tranferCount; private Long tranferCount;
/** 业务类型 */ /** 业务类型 */
@Excel(name = "业务类型") @Excel(name = "业务类型")
private String energyBusiType; private String energyBusiType;
@ -63,10 +65,19 @@ public class TrxExchangeInfo extends BaseEntity
@Excel(name = "转入金额") @Excel(name = "转入金额")
private Long trxAmount; private Long trxAmount;
/** 转入单位 */
@Excel(name = "转入单位")
private String trxAmountUnit;
/** 兑换支出能量 */ /** 兑换支出能量 */
@Excel(name = "兑换支出能量") @Excel(name = "兑换支出能量")
private Long delegateAmountTrx; private Long delegateAmountTrx;
/** 资源类型 */
@Excel(name = "资源类型")
private String resourceCode;
/** 能量交易订单hash */ /** 能量交易订单hash */
@Excel(name = "能量交易订单") @Excel(name = "能量交易订单")
private String delegateTxId; private String delegateTxId;
@ -102,164 +113,5 @@ public class TrxExchangeInfo extends BaseEntity
@Excel(name = "更新用户") @Excel(name = "更新用户")
private String lcu; private String lcu;
public void setIdTrxExchangeInfo(Long idTrxExchangeInfo)
{
this.idTrxExchangeInfo = idTrxExchangeInfo;
}
public Long getIdTrxExchangeInfo()
{
return idTrxExchangeInfo;
}
public void setFromAddress(String fromAddress)
{
this.fromAddress = fromAddress;
}
public String getFromAddress()
{
return fromAddress;
}
public void setToAddress(String toAddress)
{
this.toAddress = toAddress;
}
public String getToAddress()
{
return toAddress;
}
public void setAccountAddress(String accountAddress)
{
this.accountAddress = accountAddress;
}
public String getAccountAddress()
{
return accountAddress;
}
public void setPrice(Long price)
{
this.price = price;
}
public Long getPrice()
{
return price;
}
public void setTrxTxId(String trxTxId)
{
this.trxTxId = trxTxId;
}
public String getTrxTxId()
{
return trxTxId;
}
public void setTrxAmount(Long trxAmount)
{
this.trxAmount = trxAmount;
}
public Long getTrxAmount()
{
return trxAmount;
}
public void setDelegateAmountTrx(Long delegateAmountTrx)
{
this.delegateAmountTrx = delegateAmountTrx;
}
public Long getDelegateAmountTrx()
{
return delegateAmountTrx;
}
public void setDelegateTxId(String delegateTxId)
{
this.delegateTxId = delegateTxId;
}
public String getDelegateTxId()
{
return delegateTxId;
}
public void setLockPeriod(Long lockPeriod)
{
this.lockPeriod = lockPeriod;
}
public Long getLockPeriod()
{
return lockPeriod;
}
public void setDelegateStatus(String delegateStatus)
{
this.delegateStatus = delegateStatus;
}
public String getDelegateStatus()
{
return delegateStatus;
}
public void setUnDelegateTxId(String unDelegateTxId)
{
this.unDelegateTxId = unDelegateTxId;
}
public String getUnDelegateTxId()
{
return unDelegateTxId;
}
public void setFcd(Date fcd)
{
this.fcd = fcd;
}
public Date getFcd()
{
return fcd;
}
public void setFcu(String fcu)
{
this.fcu = fcu;
}
public String getFcu()
{
return fcu;
}
public void setLcd(Date lcd)
{
this.lcd = lcd;
}
public Date getLcd()
{
return lcd;
}
public void setLcu(String lcu)
{
this.lcu = lcu;
}
public String getLcu()
{
return lcu;
}
public Long getTranferCount() {
return tranferCount;
}
public void setTranferCount(Long tranferCount) {
this.tranferCount = tranferCount;
}
public String getEnergyBusiType() {
return energyBusiType;
}
public void setEnergyBusiType(String energyBusiType) {
this.energyBusiType = energyBusiType;
}
} }

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/** /**
@ -9,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author dorion * @author dorion
* @date 2024-04-13 * @date 2024-04-13
*/ */
@Data
public class TrxExchange extends BaseEntity public class TrxExchange extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -23,6 +24,8 @@ public class TrxExchange extends BaseEntity
private String monitorAddress; private String monitorAddress;
private String resourceCode;
private Long transferNumber; private Long transferNumber;
private Long lockNum; private Long lockNum;
@ -30,51 +33,7 @@ public class TrxExchange extends BaseEntity
private Long price; private Long price;
public String getMonitorAddress() {
return monitorAddress;
}
public void setMonitorAddress(String monitorAddress) {
this.monitorAddress = monitorAddress;
}
public Long getPrice() {
return price;
}
public void setPrice(Long price) {
this.price = price;
}
public String getFromAddress() {
return fromAddress;
}
public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress;
}
public String getAccountAddress() {
return accountAddress;
}
public void setAccountAddress(String accountAddress) {
this.accountAddress = accountAddress;
}
public Long getTransferNumber() {
return transferNumber;
}
public void setTransferNumber(Long transferNumber) {
this.transferNumber = transferNumber;
}
public Long getLockNum() {
return lockNum;
}
public void setLockNum(Long lockNum) {
this.lockNum = lockNum;
}
} }

View File

@ -41,6 +41,8 @@ public class TrxExchangeMonitorAccountInfo implements Serializable {
*/ */
private Long delegateAmountTrx; private Long delegateAmountTrx;
private String resourceCode;
/** /**
* *
*/ */

View File

@ -0,0 +1,113 @@
package com.ruoyi.system.domain.vo;
import lombok.Data;
import java.util.Date;
@Data
public class TrxExchangeInfoVO {
/**
*
*/
private String idTrxExchangeInfo;
/**
*
*/
private String fromAddress;
/**
*
*/
private String toAddress;
/**
*
*/
private String monitorAddressName;
/**
*
*/
private String accountAddress;
/**
*
*/
private Integer price;
/**
*
*/
private String trxTxId;
/**
*
*/
private String tranferCount;
/**
*
*/
private String energyBusiType;
/**
*
*/
private String trxAmount;
/**
*
*/
private String trxAmountUnit;
/**
*
*/
private String delegateAmountTrx;
/**
*
*/
private String resourceCode;
/**
*
*/
private String delegateTxId;
/**
*
*/
private String lockPeriod;
/**
*
*/
private String delegateStatus;
/**
*
*/
private String unDelegateTxId;
/**
*
*/
private Date fcd;
/**
*
*/
private String fcu;
/**
*
*/
private Date lcd;
/**
*
*/
private String lcu;
}

View File

@ -21,6 +21,8 @@ public class AccountResourceResponse implements Serializable {
private Long TotalEnergyLimit; private Long TotalEnergyLimit;
private Long TotalEnergyWeight; private Long TotalEnergyWeight;
private Integer NetUsed;
} }

View File

@ -270,7 +270,7 @@ public class TRX2EneryTransferHandler {
tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1); tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
//取包天的套餐锁定时间和交易笔数 //取包天的套餐锁定时间和交易笔数
lockPeriod = 24; lockPeriod = 24;
sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐"); sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
transferCount = tenantInfo.getTransferCount(); transferCount = tenantInfo.getTransferCount();
price = tenantInfo.getPrice(); price = tenantInfo.getPrice();
@ -316,7 +316,7 @@ public class TRX2EneryTransferHandler {
} }
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount, "system"); calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount,"TRX","system",Common.ResourceCode.ENERGY.name());
//持久化之后放redis //持久化之后放redis
redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS); redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS);
if (tenantInfo != null) { if (tenantInfo != null) {
@ -327,30 +327,32 @@ public class TRX2EneryTransferHandler {
/** /**
* @param txID * @param txID
* @param apiWrapper apiWrapper * @param apiWrapper apiWrapper
* @param accountAddress * @param accountAddress
* @param transferCount * @param transferCount
* @param ownerAddress * @param ownerAddress
* @param lockPeriod * @param lockPeriod
* @param toAddress * @param toAddress
* @param price * @param price
* @param sysEnergyBusiType * @param sysEnergyBusiType
* @param amount * @param amount
* @param currentUser * @param currentUser
* @throws Exception * @throws Exception
*/ */
public void calcBalanceAndDelegate(String txID, public void calcBalanceAndDelegate(String txID,
ApiWrapper apiWrapper, ApiWrapper apiWrapper,
String accountAddress, String accountAddress,
long transferCount, long transferCount,
String ownerAddress, String ownerAddress,
long lockPeriod, long lockPeriod,
String toAddress, String toAddress,
Long price, Long price,
String sysEnergyBusiType, String sysEnergyBusiType,
Long amount, Long amount,
String currentUser) throws Exception { String trxAmountUnit,
String currentUser,
String resourceCode) throws Exception {
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api"); String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
Long balance = null; Long balance = null;
@ -359,11 +361,11 @@ public class TRX2EneryTransferHandler {
Response.AccountResourceMessage accountResource = apiWrapper.getAccountResource(accountAddress); Response.AccountResourceMessage accountResource = apiWrapper.getAccountResource(accountAddress);
//总用于质押换取能量的trx上限 //总用于质押换取能量的trx上限
balance = getBalance(accountResource, transferCount); balance = getBalance(accountResource, transferCount, resourceCode);
/* lock_period: 锁定周期以区块时间3s为单位表示锁定多少个区块的时间当lock为true时该字段有效。如果代理锁定期为1天则lock_period为28800*/ /* lock_period: 锁定周期以区块时间3s为单位表示锁定多少个区块的时间当lock为true时该字段有效。如果代理锁定期为1天则lock_period为28800*/
delegateResourceTxid = getDelegateResourceTxid(apiWrapper, accountAddress, balance, ownerAddress, lockPeriod); delegateResourceTxid = getDelegateResourceTxid(apiWrapper, accountAddress, balance, ownerAddress, resourceCode);
} }
String fromAddress = AddressUtil.hexToBase58(ownerAddress); String fromAddress = AddressUtil.hexToBase58(ownerAddress);
@ -376,7 +378,9 @@ public class TRX2EneryTransferHandler {
.tranferCount(transferCount) .tranferCount(transferCount)
.energyBusiType(sysEnergyBusiType) .energyBusiType(sysEnergyBusiType)
.trxAmount(amount) .trxAmount(amount)
.trxAmountUnit(trxAmountUnit)
.delegateAmountTrx(balance) .delegateAmountTrx(balance)
.resourceCode(resourceCode)
.delegateTxId(delegateResourceTxid) .delegateTxId(delegateResourceTxid)
.lockPeriod(lockPeriod) .lockPeriod(lockPeriod)
.delegateStatus("0") .delegateStatus("0")
@ -387,7 +391,7 @@ public class TRX2EneryTransferHandler {
.build(); .build();
trxExchangeInfoMapper.insertTrxExchangeInfo(trxExchangeInfo); trxExchangeInfoMapper.insertTrxExchangeInfo(trxExchangeInfo);
String sysenTrxTransferNotice = configService.selectConfigByKey("sys.energy.transaction.notice"); String sysenTrxTransferNotice = configService.selectConfigByKey("sys.energy.transaction.notice");
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id"); String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
if (longPollingBot != null && StringUtils.isNotEmpty(sysenTrxTransferNotice) && StringUtils.isNotEmpty(sysTgGroupChatId)) { if (longPollingBot != null && StringUtils.isNotEmpty(sysenTrxTransferNotice) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
/* /*
@ -404,7 +408,7 @@ public class TRX2EneryTransferHandler {
arguments.put("transferCount", transferCount); arguments.put("transferCount", transferCount);
arguments.put("FromAddress", fromAddress.replaceAll("(.{6})(.*)(.{8})", "$1********$3")); arguments.put("FromAddress", fromAddress.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
arguments.put("txId", StringUtils.isEmpty(txID) ? "" : txID.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3")); arguments.put("txId", StringUtils.isEmpty(txID) ? "" : txID.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3"));
arguments.put("txTime", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss")); arguments.put("txTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
// String message = MessageFormat.format(sysUsdtTranferNotice, arguments); // String message = MessageFormat.format(sysUsdtTranferNotice, arguments);
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}"); StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
String message = substitutor.replace(sysenTrxTransferNotice); String message = substitutor.replace(sysenTrxTransferNotice);
@ -417,25 +421,32 @@ public class TRX2EneryTransferHandler {
} }
private long getBalance(Response.AccountResourceMessage accountResource, long energyNum) { private long getBalance(Response.AccountResourceMessage accountResource, long transferCount, String resourceCode) {
long totalEnergyLimit = accountResource.getTotalEnergyLimit(); Long balance = null;
//已经用于质押换取能量的trx if (resourceCode.equals(Common.ResourceCode.ENERGY.name())) {
long totalEnergyWeight = accountResource.getTotalEnergyWeight(); long totalEnergyLimit = accountResource.getTotalEnergyLimit();
//已经用于质押换取能量的trx
long totalEnergyWeight = accountResource.getTotalEnergyWeight();
//系数 保留一位或者保留2位,算出trx往上进一位 //系数 保留一位或者保留2位,算出trx往上进一位
BigDecimal trxToFreezeEnergyTimes = BigDecimal.valueOf(totalEnergyLimit).divide(BigDecimal.valueOf(totalEnergyWeight), 2, BigDecimal.ROUND_DOWN); BigDecimal trxToFreezeEnergyTimes = BigDecimal.valueOf(totalEnergyLimit).divide(BigDecimal.valueOf(totalEnergyWeight), 2, BigDecimal.ROUND_DOWN);
//计算代理的数量 //计算代理的数量
// long balance = energyNum * 32000 / 12; // long balance = energyNum * 32000 / 12;
long balance = BigDecimal.valueOf(energyNum * 32000).divide(trxToFreezeEnergyTimes, 0, BigDecimal.ROUND_UP).longValue(); balance = BigDecimal.valueOf(transferCount * 32000).divide(trxToFreezeEnergyTimes, 0, BigDecimal.ROUND_UP).longValue();
}else {
balance = transferCount * 350;
}
return balance; return balance;
} }
private String getDelegateResourceTxid(ApiWrapper apiWrapper, String accountAddress, long balance, String ownerAddress, long lockPeriod) throws IllegalException { private String getDelegateResourceTxid(ApiWrapper apiWrapper, String accountAddress, long balance, String ownerAddress, String resourceCode) throws IllegalException {
Response.TransactionExtention transactionExtention = apiWrapper.delegateResourceV2(accountAddress, balance * 1000000, Common.ResourceCode.ENERGY_VALUE, ownerAddress, false,0); Response.TransactionExtention transactionExtention = apiWrapper.delegateResourceV2(accountAddress, balance * 1000000, Common.ResourceCode.valueOf(resourceCode).getNumber(), ownerAddress, false, 0);
Chain.Transaction transaction = apiWrapper.signTransaction(transactionExtention); Chain.Transaction transaction = apiWrapper.signTransaction(transactionExtention);
String delegateResourceTxid = apiWrapper.broadcastTransaction(transaction); String delegateResourceTxid = apiWrapper.broadcastTransaction(transaction);
return delegateResourceTxid; return delegateResourceTxid;
} }
} }

View File

@ -86,14 +86,27 @@ public class UndelegateEnergyHandler {
if (accountResource == null){ if (accountResource == null){
return; return;
} }
Integer energyUsed = accountResource.getEnergyUsed();
if (energyUsed == null){
return;
}
long energyUsedCount = energyUsed / 30000; String resourceCode = trxExchangeMonitorAccountInfo.getResourceCode();
if (energyUsedCount < trxExchangeMonitorAccountInfo.getTranferCount()){ if (resourceCode.equals(Common.ResourceCode.ENERGY.name())) {
return; Integer energyUsed = accountResource.getEnergyUsed();
if (energyUsed == null){
return;
}
long energyUsedCount = energyUsed / 30000;
if (energyUsedCount < trxExchangeMonitorAccountInfo.getTranferCount()){
return;
}
}else {
Integer netUsed = accountResource.getNetUsed();
if (netUsed == null){
return;
}
int bandWidthUsedCount = netUsed / 250;
if (bandWidthUsedCount < trxExchangeMonitorAccountInfo.getTranferCount()){
return;
}
} }
} }
@ -223,7 +236,7 @@ public class UndelegateEnergyHandler {
long balance = trxExchangeMonitorAccountInfo.getDelegateAmountTrx() * 1000000; long balance = trxExchangeMonitorAccountInfo.getDelegateAmountTrx() * 1000000;
Response.TransactionExtention transactionExtention = apiWrapper.undelegateResource(accountAddress, Response.TransactionExtention transactionExtention = apiWrapper.undelegateResource(accountAddress,
balance, Common.ResourceCode.ENERGY_VALUE, fromAddress); balance, Common.ResourceCode.valueOf(trxExchangeMonitorAccountInfo.getResourceCode()).getNumber(), fromAddress);
Chain.Transaction transaction = apiWrapper.signTransaction(transactionExtention); Chain.Transaction transaction = apiWrapper.signTransaction(transactionExtention);

View File

@ -4,6 +4,7 @@ package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.TrxExchangeInfo; import com.ruoyi.common.core.domain.entity.TrxExchangeInfo;
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo; import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
import com.ruoyi.system.domain.vo.TransactionLogVO; import com.ruoyi.system.domain.vo.TransactionLogVO;
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
import java.util.List; import java.util.List;
@ -67,5 +68,5 @@ public interface TrxExchangeInfoMapper
List<TransactionLogVO> selectTransactionLogVO(); List<TransactionLogVO> selectTransactionLogVO();
List<TrxExchangeInfo> selectTrxExchangeInfoAndMonitorNameList(TrxExchangeInfo trxExchangeInfo); List<TrxExchangeInfoVO> selectTrxExchangeInfoAndMonitorNameList(TrxExchangeInfo trxExchangeInfo);
} }

View File

@ -4,6 +4,7 @@ package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.TrxExchangeInfo; import com.ruoyi.common.core.domain.entity.TrxExchangeInfo;
import com.ruoyi.system.domain.TrxExchange; import com.ruoyi.system.domain.TrxExchange;
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo; import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
import java.util.List; import java.util.List;
@ -25,11 +26,11 @@ public interface ITrxExchangeInfoService
/** /**
* trx * trx
* *
* @param trxExchangeInfo trx * @param trxExchangeInfo trx
* @return trx * @return trx
*/ */
public List<TrxExchangeInfo> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo); public List<TrxExchangeInfoVO> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo);
/** /**
* trx * trx

View File

@ -14,6 +14,7 @@ import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.TrxExchange; import com.ruoyi.system.domain.TrxExchange;
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
import com.ruoyi.system.mapper.AccountAddressInfoMapper; import com.ruoyi.system.mapper.AccountAddressInfoMapper;
import com.ruoyi.system.mapper.MonitorAddressInfoMapper; import com.ruoyi.system.mapper.MonitorAddressInfoMapper;
import com.ruoyi.system.mapper.TenantInfoMapper; import com.ruoyi.system.mapper.TenantInfoMapper;
@ -28,13 +29,12 @@ import java.util.List;
/** /**
* Service * Service
* *
* @author dorion * @author dorion
* @date 2024-04-14 * @date 2024-04-14
*/ */
@Service @Service
public class TenantInfoServiceImpl implements ITenantInfoService public class TenantInfoServiceImpl implements ITenantInfoService {
{
@Autowired @Autowired
private TenantInfoMapper tenantInfoMapper; private TenantInfoMapper tenantInfoMapper;
@ -44,46 +44,49 @@ public class TenantInfoServiceImpl implements ITenantInfoService
private MonitorAddressInfoMapper monitorAddressInfoMapper; private MonitorAddressInfoMapper monitorAddressInfoMapper;
@Autowired @Autowired
private AccountAddressInfoMapper accountAddressInfoMapper; private AccountAddressInfoMapper accountAddressInfoMapper;
/** /**
* *
* *
* @param idTenantInfo * @param idTenantInfo
* @return * @return
*/ */
@Override @Override
public TenantInfo selectTenantInfoByIdTenantInfo(Long idTenantInfo) public TenantInfo selectTenantInfoByIdTenantInfo(Long idTenantInfo) {
{
return tenantInfoMapper.selectTenantInfoByIdTenantInfo(idTenantInfo); return tenantInfoMapper.selectTenantInfoByIdTenantInfo(idTenantInfo);
} }
/** /**
* *
* *
* @param tenantInfo * @param tenantInfo
* @return * @return
*/ */
@Override @Override
@DataScope(userAlias = "u") @DataScope(userAlias = "u")
public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo) public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo) {
{
return tenantInfoMapper.selectTenantInfoList(tenantInfo); return tenantInfoMapper.selectTenantInfoList(tenantInfo);
} }
/** /**
* *
* *
* @param tenantInfo * @param tenantInfo
* @return * @return
*/ */
@Override @Override
public int insertTenantInfo(TenantInfo tenantInfo) public int insertTenantInfo(TenantInfo tenantInfo) {
{
TenantInfo tenantInfoExample = new TenantInfo(); TenantInfo tenantInfoExample = new TenantInfo();
tenantInfoExample.setReceiverAddress(tenantInfo.getReceiverAddress()); tenantInfoExample.setReceiverAddress(tenantInfo.getReceiverAddress());
List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample); List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample);
boolean exists = false;
Preconditions.checkState(CollectionUtil.isEmpty(tenantInfoList), "该接收能量地址已存在,请勿重复添加"); if (CollectionUtil.isEmpty(tenantInfoList)) {
exists = !tenantInfoList.stream().anyMatch(tenantInfo1 -> {
return tenantInfo1.getStatus().equals(DictUtils.getDictValue("sys_tenant_status", "生效中"));
});
}
Preconditions.checkState( !exists, "该接收能量地址已存在,请勿重复添加");
Long price = tenantInfo.getPrice(); Long price = tenantInfo.getPrice();
Long transferCount = tenantInfo.getTransferCount(); Long transferCount = tenantInfo.getTransferCount();
@ -113,13 +116,12 @@ public class TenantInfoServiceImpl implements ITenantInfoService
/** /**
* *
* *
* @param tenantInfo * @param tenantInfo
* @return * @return
*/ */
@Override @Override
public int updateTenantInfo(TenantInfo tenantInfo) public int updateTenantInfo(TenantInfo tenantInfo) {
{
Long price = tenantInfo.getPrice(); Long price = tenantInfo.getPrice();
Long transferCount = tenantInfo.getTransferCount(); Long transferCount = tenantInfo.getTransferCount();
Long period = tenantInfo.getPeriod(); Long period = tenantInfo.getPeriod();
@ -137,25 +139,23 @@ public class TenantInfoServiceImpl implements ITenantInfoService
/** /**
* *
* *
* @param idTenantInfos * @param idTenantInfos
* @return * @return
*/ */
@Override @Override
public int deleteTenantInfoByIdTenantInfos(String idTenantInfos) public int deleteTenantInfoByIdTenantInfos(String idTenantInfos) {
{
return tenantInfoMapper.deleteTenantInfoByIdTenantInfos(Convert.toStrArray(idTenantInfos)); return tenantInfoMapper.deleteTenantInfoByIdTenantInfos(Convert.toStrArray(idTenantInfos));
} }
/** /**
* *
* *
* @param idTenantInfo * @param idTenantInfo
* @return * @return
*/ */
@Override @Override
public int deleteTenantInfoByIdTenantInfo(Long idTenantInfo) public int deleteTenantInfoByIdTenantInfo(Long idTenantInfo) {
{
return tenantInfoMapper.deleteTenantInfoByIdTenantInfo(idTenantInfo); return tenantInfoMapper.deleteTenantInfoByIdTenantInfo(idTenantInfo);
} }
@ -169,18 +169,18 @@ public class TenantInfoServiceImpl implements ITenantInfoService
Preconditions.checkState(status.equals(tenantInfo.getStatus()), "该租户不是生效中状态,不能发起委托任务"); Preconditions.checkState(status.equals(tenantInfo.getStatus()), "该租户不是生效中状态,不能发起委托任务");
String dictValue = DictUtils.getDictValue("sys_delegate_status", "已委托"); String dictValue = DictUtils.getDictValue("sys_delegate_status", "已委托");
String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐"); String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
TrxExchangeInfo trxExchangeInfo = TrxExchangeInfo.builder().fromAddress(tenantInfo.getReceiverAddress()) TrxExchangeInfo trxExchangeInfo = TrxExchangeInfo.builder().fromAddress(tenantInfo.getReceiverAddress())
.delegateStatus(dictValue) .delegateStatus(dictValue)
.energyBusiType(sysEnergyBusiType) .energyBusiType(sysEnergyBusiType)
.build(); .build();
List<TrxExchangeInfo> trxExchangeInfos = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo); List<TrxExchangeInfoVO> trxExchangeInfos = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
Preconditions.checkState(CollectionUtil.isEmpty(trxExchangeInfos), "该接收能量地址已在任务中,请勿重复发起"); Preconditions.checkState(CollectionUtil.isEmpty(trxExchangeInfos), "该接收能量地址已在任务中,请勿重复发起");
doDelegateEnergy(tenantInfo,null); doDelegateEnergy(tenantInfo, null);
} }
return 1; return 1;
@ -190,7 +190,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
public void doDelegateEnergy(TenantInfo tenantInfo, String userName) throws Exception { public void doDelegateEnergy(TenantInfo tenantInfo, String userName) throws Exception {
String accountAddress = null; String accountAddress = null;
String monitorAddress = null; String monitorAddress = null;
if (StringUtils.isNotEmpty(tenantInfo.getMonitorAddress())){ if (StringUtils.isNotEmpty(tenantInfo.getMonitorAddress())) {
MonitorAddressInfo monitorAddressInfoExample = new MonitorAddressInfo(); MonitorAddressInfo monitorAddressInfoExample = new MonitorAddressInfo();
monitorAddressInfoExample.setMonitorAddress(tenantInfo.getMonitorAddress()); monitorAddressInfoExample.setMonitorAddress(tenantInfo.getMonitorAddress());
monitorAddressInfoExample.setIsValid(UserConstants.YES); monitorAddressInfoExample.setIsValid(UserConstants.YES);
@ -201,7 +201,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
accountAddress = monitorAddressInfo.getAccountAddress(); accountAddress = monitorAddressInfo.getAccountAddress();
monitorAddress = monitorAddressInfo.getMonitorAddress(); monitorAddress = monitorAddressInfo.getMonitorAddress();
}else { } else {
AccountAddressInfo accountAddressInfo = new AccountAddressInfo(); AccountAddressInfo accountAddressInfo = new AccountAddressInfo();
accountAddressInfo.setIsValid("Y"); accountAddressInfo.setIsValid("Y");
List<AccountAddressInfo> accountAddressInfoList = accountAddressInfoMapper.selectAccountAddressInfoList(accountAddressInfo); List<AccountAddressInfo> accountAddressInfoList = accountAddressInfoMapper.selectAccountAddressInfoList(accountAddressInfo);
@ -227,7 +227,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
userName = userName == null ? ShiroUtils.getLoginName() : userName; userName = userName == null ? ShiroUtils.getLoginName() : userName;
trxExchangeInfoService.delegate(trxExchange, true,userName); trxExchangeInfoService.delegate(trxExchange, true, userName);
tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1); tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
tenantInfo.setLcd(new Date()); tenantInfo.setLcd(new Date());

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.TrxExchange; import com.ruoyi.system.domain.TrxExchange;
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo; import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
import com.ruoyi.system.handler.TRX2EneryTransferHandler; import com.ruoyi.system.handler.TRX2EneryTransferHandler;
import com.ruoyi.system.mapper.ErrorLogMapper; import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.mapper.TenantInfoMapper; import com.ruoyi.system.mapper.TenantInfoMapper;
@ -67,7 +68,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
* @return trx * @return trx
*/ */
@Override @Override
public List<TrxExchangeInfo> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo) { public List<TrxExchangeInfoVO> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo) {
// return trxExchangeInfoMapper.selectTrxExchangeInfoList(trxExchangeInfo); // return trxExchangeInfoMapper.selectTrxExchangeInfoList(trxExchangeInfo);
return trxExchangeInfoMapper.selectTrxExchangeInfoAndMonitorNameList(trxExchangeInfo); return trxExchangeInfoMapper.selectTrxExchangeInfoAndMonitorNameList(trxExchangeInfo);
} }
@ -156,7 +157,9 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
trxExchange.getPrice(), trxExchange.getPrice(),
sysEnergyBusiType, sysEnergyBusiType,
null, null,
userName); null,
userName,
trxExchange.getResourceCode());
return 1; return 1;
} }

View File

@ -3,7 +3,30 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.TrxExchangeInfoMapper"> <mapper namespace="com.ruoyi.system.mapper.TrxExchangeInfoMapper">
<resultMap id="selectTrxExchangeInfoAndMonitorNameListResultMap"
type="com.ruoyi.system.domain.vo.TrxExchangeInfoVO">
<result column="idTrxExchangeInfo" property="idTrxExchangeInfo"/>
<result column="fromAddress" property="fromAddress"/>
<result column="toAddress" property="toAddress"/>
<result column="monitorAddressName" property="monitorAddressName"/>
<result column="accountAddress" property="accountAddress"/>
<result column="price" property="price"/>
<result column="trxTxId" property="trxTxId"/>
<result column="tranferCount" property="tranferCount"/>
<result column="energyBusiType" property="energyBusiType"/>
<result column="trxAmount" property="trxAmount"/>
<result column="trxAmountUnit" property="trxAmountUnit"/>
<result column="delegateAmountTrx" property="delegateAmountTrx"/>
<result column="resourceCode" property="resourceCode"/>
<result column="delegateTxId" property="delegateTxId"/>
<result column="lockPeriod" property="lockPeriod"/>
<result column="delegateStatus" property="delegateStatus"/>
<result column="unDelegateTxId" property="unDelegateTxId"/>
<result column="fcd" property="fcd"/>
<result column="fcu" property="fcu"/>
<result column="lcd" property="lcd"/>
<result column="lcu" property="lcu"/>
</resultMap>
<resultMap type="TrxExchangeInfo" id="TrxExchangeInfoResult"> <resultMap type="TrxExchangeInfo" id="TrxExchangeInfoResult">
<result property="idTrxExchangeInfo" column="id_trx_exchange_info" /> <result property="idTrxExchangeInfo" column="id_trx_exchange_info" />
<result property="fromAddress" column="from_address" /> <result property="fromAddress" column="from_address" />
@ -14,12 +37,13 @@
<result property="tranferCount" column="tranfer_count" /> <result property="tranferCount" column="tranfer_count" />
<result property="energyBusiType" column="energy_busi_type" /> <result property="energyBusiType" column="energy_busi_type" />
<result property="trxAmount" column="trx_amount" /> <result property="trxAmount" column="trx_amount" />
<result property="trxAmountUnit" column="trx_amount_unit" />
<result property="delegateAmountTrx" column="delegate_amount_trx" /> <result property="delegateAmountTrx" column="delegate_amount_trx" />
<result property="resourceCode" column="resource_code" />
<result property="delegateTxId" column="delegate_tx_id" /> <result property="delegateTxId" column="delegate_tx_id" />
<result property="lockPeriod" column="lock_period" /> <result property="lockPeriod" column="lock_period" />
<result property="delegateStatus" column="delegate_status" /> <result property="delegateStatus" column="delegate_status" />
<result property="unDelegateTxId" column="un_delegate_tx_id" /> <result property="unDelegateTxId" column="un_delegate_tx_id" />
<result property="fcd" column="fcd" /> <result property="fcd" column="fcd" />
<result property="fcu" column="fcu" /> <result property="fcu" column="fcu" />
<result property="lcd" column="lcd" /> <result property="lcd" column="lcd" />
@ -27,12 +51,12 @@
</resultMap> </resultMap>
<sql id="selectTrxExchangeInfoVo"> <sql id="selectTrxExchangeInfoVo">
select id_trx_exchange_info, from_address, to_address, account_address, price, trx_tx_id, tranfer_count, energy_busi_type, trx_amount, delegate_amount_trx, delegate_tx_id, lock_period, delegate_status, un_delegate_tx_id, fcd, fcu, lcd, lcu from trx_exchange_info select id_trx_exchange_info, from_address, to_address, account_address, price, trx_tx_id, tranfer_count, energy_busi_type, trx_amount, trx_amount_unit, delegate_amount_trx, resource_code, delegate_tx_id, lock_period, delegate_status, un_delegate_tx_id, fcd, fcu, lcd, lcu from trx_exchange_info
</sql> </sql>
<select id="selectTrxExchangeInfoList" parameterType="TrxExchangeInfo" resultMap="TrxExchangeInfoResult"> <select id="selectTrxExchangeInfoList" parameterType="TrxExchangeInfo" resultMap="TrxExchangeInfoResult">
<include refid="selectTrxExchangeInfoVo"/> <include refid="selectTrxExchangeInfoVo"/>
<where> 1=1 <where>
<if test="fromAddress != null and fromAddress != ''"> and from_address = #{fromAddress}</if> <if test="fromAddress != null and fromAddress != ''"> and from_address = #{fromAddress}</if>
<if test="toAddress != null and toAddress != ''"> and to_address = #{toAddress}</if> <if test="toAddress != null and toAddress != ''"> and to_address = #{toAddress}</if>
<if test="accountAddress != null and accountAddress != ''"> and account_address = #{accountAddress}</if> <if test="accountAddress != null and accountAddress != ''"> and account_address = #{accountAddress}</if>
@ -41,17 +65,17 @@
<if test="tranferCount != null "> and tranfer_count = #{tranferCount}</if> <if test="tranferCount != null "> and tranfer_count = #{tranferCount}</if>
<if test="energyBusiType != null and energyBusiType != ''"> and energy_busi_type = #{energyBusiType}</if> <if test="energyBusiType != null and energyBusiType != ''"> and energy_busi_type = #{energyBusiType}</if>
<if test="trxAmount != null "> and trx_amount = #{trxAmount}</if> <if test="trxAmount != null "> and trx_amount = #{trxAmount}</if>
<if test="trxAmountUnit != null and trxAmountUnit != ''"> and trx_amount_unit = #{trxAmountUnit}</if>
<if test="delegateAmountTrx != null "> and delegate_amount_trx = #{delegateAmountTrx}</if> <if test="delegateAmountTrx != null "> and delegate_amount_trx = #{delegateAmountTrx}</if>
<if test="resourceCode != null and resourceCode != ''"> and resource_code = #{resourceCode}</if>
<if test="delegateTxId != null and delegateTxId != ''"> and delegate_tx_id = #{delegateTxId}</if> <if test="delegateTxId != null and delegateTxId != ''"> and delegate_tx_id = #{delegateTxId}</if>
<if test="lockPeriod != null "> and lock_period = #{lockPeriod}</if> <if test="lockPeriod != null "> and lock_period = #{lockPeriod}</if>
<if test="delegateStatus != null and delegateStatus != ''"> and delegate_status = #{delegateStatus}</if> <if test="delegateStatus != null and delegateStatus != ''"> and delegate_status = #{delegateStatus}</if>
<if test="unDelegateTxId != null and unDelegateTxId != ''"> and un_delegate_tx_id = #{unDelegateTxId}</if> <if test="unDelegateTxId != null and unDelegateTxId != ''"> and un_delegate_tx_id = #{unDelegateTxId}</if>
<if test="fcd != null "> and fcd &gt;= #{fcd}</if>
<if test="params.beginFcd != null and params.beginFcd != '' and params.endFcd != null and params.endFcd != ''"> and fcd between #{params.beginFcd} and #{params.endFcd}</if> <if test="params.beginFcd != null and params.beginFcd != '' and params.endFcd != null and params.endFcd != ''"> and fcd between #{params.beginFcd} and #{params.endFcd}</if>
<if test="fcu != null and fcu != ''"> and fcu = #{fcu}</if> <if test="fcu != null and fcu != ''"> and fcu = #{fcu}</if>
<if test="lcd != null "> and lcd &lt;= #{lcd}</if> <if test="lcd != null "> and lcd = #{lcd}</if>
<if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if> <if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if>
order by fcd desc
</where> </where>
</select> </select>
@ -71,7 +95,9 @@
<if test="tranferCount != null">tranfer_count,</if> <if test="tranferCount != null">tranfer_count,</if>
<if test="energyBusiType != null">energy_busi_type,</if> <if test="energyBusiType != null">energy_busi_type,</if>
<if test="trxAmount != null">trx_amount,</if> <if test="trxAmount != null">trx_amount,</if>
<if test="trxAmountUnit != null">trx_amount_unit,</if>
<if test="delegateAmountTrx != null">delegate_amount_trx,</if> <if test="delegateAmountTrx != null">delegate_amount_trx,</if>
<if test="resourceCode != null">resource_code,</if>
<if test="delegateTxId != null">delegate_tx_id,</if> <if test="delegateTxId != null">delegate_tx_id,</if>
<if test="lockPeriod != null">lock_period,</if> <if test="lockPeriod != null">lock_period,</if>
<if test="delegateStatus != null">delegate_status,</if> <if test="delegateStatus != null">delegate_status,</if>
@ -90,12 +116,13 @@
<if test="tranferCount != null">#{tranferCount},</if> <if test="tranferCount != null">#{tranferCount},</if>
<if test="energyBusiType != null">#{energyBusiType},</if> <if test="energyBusiType != null">#{energyBusiType},</if>
<if test="trxAmount != null">#{trxAmount},</if> <if test="trxAmount != null">#{trxAmount},</if>
<if test="trxAmountUnit != null">#{trxAmountUnit},</if>
<if test="delegateAmountTrx != null">#{delegateAmountTrx},</if> <if test="delegateAmountTrx != null">#{delegateAmountTrx},</if>
<if test="resourceCode != null">#{resourceCode},</if>
<if test="delegateTxId != null">#{delegateTxId},</if> <if test="delegateTxId != null">#{delegateTxId},</if>
<if test="lockPeriod != null">#{lockPeriod},</if> <if test="lockPeriod != null">#{lockPeriod},</if>
<if test="delegateStatus != null">#{delegateStatus},</if> <if test="delegateStatus != null">#{delegateStatus},</if>
<if test="unDelegateTxId != null">#{unDelegateTxId},</if> <if test="unDelegateTxId != null">#{unDelegateTxId},</if>
<if test="fcd != null">#{fcd},</if> <if test="fcd != null">#{fcd},</if>
<if test="fcu != null">#{fcu},</if> <if test="fcu != null">#{fcu},</if>
<if test="lcd != null">#{lcd},</if> <if test="lcd != null">#{lcd},</if>
@ -114,7 +141,9 @@
<if test="tranferCount != null">tranfer_count = #{tranferCount},</if> <if test="tranferCount != null">tranfer_count = #{tranferCount},</if>
<if test="energyBusiType != null">energy_busi_type = #{energyBusiType},</if> <if test="energyBusiType != null">energy_busi_type = #{energyBusiType},</if>
<if test="trxAmount != null">trx_amount = #{trxAmount},</if> <if test="trxAmount != null">trx_amount = #{trxAmount},</if>
<if test="trxAmountUnit != null">trx_amount_unit = #{trxAmountUnit},</if>
<if test="delegateAmountTrx != null">delegate_amount_trx = #{delegateAmountTrx},</if> <if test="delegateAmountTrx != null">delegate_amount_trx = #{delegateAmountTrx},</if>
<if test="resourceCode != null">resource_code = #{resourceCode},</if>
<if test="delegateTxId != null">delegate_tx_id = #{delegateTxId},</if> <if test="delegateTxId != null">delegate_tx_id = #{delegateTxId},</if>
<if test="lockPeriod != null">lock_period = #{lockPeriod},</if> <if test="lockPeriod != null">lock_period = #{lockPeriod},</if>
<if test="delegateStatus != null">delegate_status = #{delegateStatus},</if> <if test="delegateStatus != null">delegate_status = #{delegateStatus},</if>
@ -147,6 +176,7 @@
<result column="tranfer_count" property="tranferCount"/> <result column="tranfer_count" property="tranferCount"/>
<result column="energy_busi_type" property="energyBusiType"/> <result column="energy_busi_type" property="energyBusiType"/>
<result column="delegate_amount_trx" property="delegateAmountTrx"/> <result column="delegate_amount_trx" property="delegateAmountTrx"/>
<result column="resource_code" property="resourceCode"/>
<result column="lock_period" property="lockPeriod"/> <result column="lock_period" property="lockPeriod"/>
<result column="delegate_status" property="delegateStatus"/> <result column="delegate_status" property="delegateStatus"/>
<result column="delegate_tx_id" property="delegateTxId"/> <result column="delegate_tx_id" property="delegateTxId"/>
@ -166,6 +196,7 @@
t.tranfer_count, t.tranfer_count,
t.energy_busi_type, t.energy_busi_type,
t.delegate_amount_trx, t.delegate_amount_trx,
t.resource_code,
t.lock_period, t.lock_period,
t.delegate_status, t.delegate_status,
t.delegate_tx_id, t.delegate_tx_id,
@ -190,23 +221,26 @@
</select> </select>
<select id="selectTrxExchangeInfoAndMonitorNameList" parameterType="TrxExchangeInfo" resultType="TrxExchangeInfo" > <select id="selectTrxExchangeInfoAndMonitorNameList" parameterType="TrxExchangeInfo"
resultMap="selectTrxExchangeInfoAndMonitorNameListResultMap">
SELECT SELECT
t.id_trx_exchange_info, t.id_trx_exchange_info idTrxExchangeInfo,
t.from_address, t.from_address fromAddress,
t.to_address, t.to_address toAddress,
m.monitor_address_name, m.monitor_address_name monitorAddressName,
t.account_address, t.account_address accountAddress,
t.price, t.price price,
t.trx_tx_id, t.trx_tx_id trxTxId,
t.tranfer_count, t.tranfer_count tranferCount,
t.energy_busi_type, t.energy_busi_type energyBusiType,
t.trx_amount, t.trx_amount trxAmount,
t.delegate_amount_trx, t.trx_amount_unit trxAmountUnit,
t.delegate_tx_id, t.delegate_amount_trx delegateAmountTrx,
t.lock_period, t.resource_code resourceCode,
t.delegate_status, t.delegate_tx_id delegateTxId,
t.un_delegate_tx_id, t.lock_period lockPeriod,
t.delegate_status delegateStatus,
t.un_delegate_tx_id unDelegateTxId,
t.fcd, t.fcd,
t.fcu, t.fcu,
t.lcd, t.lcd,