mirror of https://gitee.com/y_project/RuoYi.git
实现带宽委托回收功能
parent
fe8ee67030
commit
8ae7cabda1
|
@ -147,7 +147,7 @@
|
|||
</plugin> -->
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
<!-- <resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
|
@ -155,7 +155,7 @@
|
|||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
</resources>-->
|
||||
</build>
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.TrxExchange;
|
||||
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
|
||||
import com.ruoyi.system.service.IAccountAddressInfoService;
|
||||
import com.ruoyi.system.service.ITrxExchangeInfoService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
@ -53,7 +54,7 @@ public class TrxExchangeInfoController extends BaseController
|
|||
public TableDataInfo list(TrxExchangeInfo trxExchangeInfo)
|
||||
{
|
||||
startPage();
|
||||
List<TrxExchangeInfo> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
List<TrxExchangeInfoVO> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -66,8 +67,8 @@ public class TrxExchangeInfoController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult export(TrxExchangeInfo trxExchangeInfo)
|
||||
{
|
||||
List<TrxExchangeInfo> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
ExcelUtil<TrxExchangeInfo> util = new ExcelUtil<TrxExchangeInfo>(TrxExchangeInfo.class);
|
||||
List<TrxExchangeInfoVO> list = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
ExcelUtil<TrxExchangeInfoVO> util = new ExcelUtil<TrxExchangeInfoVO>(TrxExchangeInfoVO.class);
|
||||
return util.exportExcel(list, "trx兑能量记录数据");
|
||||
}
|
||||
|
||||
|
|
|
@ -28,24 +28,14 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-3 control-label">单位:</label>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">资源类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="price" class="form-control" type="text">
|
||||
</div>
|
||||
</div>-->
|
||||
<!-- <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">
|
||||
<select name="resourceCode" class="form-control m-b" th:with="type=${@dict.getType('sys_trx_exchange')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</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">
|
||||
<label class="col-sm-3 control-label">笔数:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
@ -95,6 +95,8 @@
|
|||
var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]];
|
||||
var sysEnergyBusiTypeDatas = [[${@dict.getType('sys_energy_busi_type')}]];
|
||||
var lockPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
|
||||
var trxAmountUnitDatas = [[${@dict.getType('sys_monitor_type')}]];
|
||||
var resourceCodeDatas = [[${@dict.getType('sys_trx_exchange')}]];
|
||||
$(function () {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
|
@ -161,12 +163,33 @@
|
|||
},
|
||||
{
|
||||
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',
|
||||
title: '支出TRX'
|
||||
},
|
||||
{
|
||||
field: 'resourceCode',
|
||||
title: '资源类型',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(resourceCodeDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'delegateTxId',
|
||||
title: '能量交易订单',
|
||||
|
|
|
@ -34,8 +34,8 @@ public class TrxExchangeInfo extends BaseEntity
|
|||
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
|
||||
private String toAddress;
|
||||
|
||||
@Excel(name = "监听账户别名")
|
||||
private String monitorAddressName;
|
||||
/* @Excel(name = "监听账户别名")
|
||||
private String monitorAddressName;*/
|
||||
|
||||
/** 实际出账账户 */
|
||||
@Excel(name = "实际出账账户")
|
||||
|
@ -54,6 +54,8 @@ public class TrxExchangeInfo extends BaseEntity
|
|||
@Excel(name = "笔数")
|
||||
private Long tranferCount;
|
||||
|
||||
|
||||
|
||||
/** 业务类型 */
|
||||
@Excel(name = "业务类型")
|
||||
private String energyBusiType;
|
||||
|
@ -63,10 +65,19 @@ public class TrxExchangeInfo extends BaseEntity
|
|||
@Excel(name = "转入金额")
|
||||
private Long trxAmount;
|
||||
|
||||
/** 转入单位 */
|
||||
@Excel(name = "转入单位")
|
||||
private String trxAmountUnit;
|
||||
|
||||
/** 兑换支出能量 */
|
||||
@Excel(name = "兑换支出能量")
|
||||
private Long delegateAmountTrx;
|
||||
|
||||
/** 资源类型 */
|
||||
@Excel(name = "资源类型")
|
||||
private String resourceCode;
|
||||
|
||||
|
||||
/** 能量交易订单hash */
|
||||
@Excel(name = "能量交易订单")
|
||||
private String delegateTxId;
|
||||
|
@ -102,164 +113,5 @@ public class TrxExchangeInfo extends BaseEntity
|
|||
@Excel(name = "更新用户")
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -9,7 +10,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
* @author dorion
|
||||
* @date 2024-04-13
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class TrxExchange extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -23,6 +24,8 @@ public class TrxExchange extends BaseEntity
|
|||
|
||||
private String monitorAddress;
|
||||
|
||||
private String resourceCode;
|
||||
|
||||
private Long transferNumber;
|
||||
|
||||
private Long lockNum;
|
||||
|
@ -30,51 +33,7 @@ public class TrxExchange extends BaseEntity
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ public class TrxExchangeMonitorAccountInfo implements Serializable {
|
|||
*/
|
||||
private Long delegateAmountTrx;
|
||||
|
||||
private String resourceCode;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -21,6 +21,8 @@ public class AccountResourceResponse implements Serializable {
|
|||
private Long TotalEnergyLimit;
|
||||
private Long TotalEnergyWeight;
|
||||
|
||||
private Integer NetUsed;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ public class TRX2EneryTransferHandler {
|
|||
tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
|
||||
|
||||
//取包天的套餐锁定时间和交易笔数
|
||||
lockPeriod = 24;
|
||||
lockPeriod = 24;
|
||||
sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
|
||||
transferCount = tenantInfo.getTransferCount();
|
||||
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
|
||||
redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS);
|
||||
if (tenantInfo != null) {
|
||||
|
@ -327,30 +327,32 @@ public class TRX2EneryTransferHandler {
|
|||
|
||||
|
||||
/**
|
||||
* @param txID 转账交易订单号
|
||||
* @param apiWrapper apiWrapper
|
||||
* @param accountAddress 出账地址
|
||||
* @param transferCount 转账笔数
|
||||
* @param ownerAddress 转入地址
|
||||
* @param lockPeriod 锁定周期
|
||||
* @param toAddress 监听地址
|
||||
* @param price 单价
|
||||
* @param sysEnergyBusiType 业务类型
|
||||
* @param amount 转入金额
|
||||
* @param currentUser 当前处理人
|
||||
* @param txID 转账交易订单号
|
||||
* @param apiWrapper apiWrapper
|
||||
* @param accountAddress 出账地址
|
||||
* @param transferCount 转账笔数
|
||||
* @param ownerAddress 转入地址
|
||||
* @param lockPeriod 锁定周期
|
||||
* @param toAddress 监听地址
|
||||
* @param price 单价
|
||||
* @param sysEnergyBusiType 业务类型
|
||||
* @param amount 转入金额
|
||||
* @param currentUser 当前处理人
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void calcBalanceAndDelegate(String txID,
|
||||
ApiWrapper apiWrapper,
|
||||
String accountAddress,
|
||||
long transferCount,
|
||||
String ownerAddress,
|
||||
long lockPeriod,
|
||||
String toAddress,
|
||||
Long price,
|
||||
String sysEnergyBusiType,
|
||||
Long amount,
|
||||
String currentUser) throws Exception {
|
||||
ApiWrapper apiWrapper,
|
||||
String accountAddress,
|
||||
long transferCount,
|
||||
String ownerAddress,
|
||||
long lockPeriod,
|
||||
String toAddress,
|
||||
Long price,
|
||||
String sysEnergyBusiType,
|
||||
Long amount,
|
||||
String trxAmountUnit,
|
||||
String currentUser,
|
||||
String resourceCode) throws Exception {
|
||||
|
||||
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
|
||||
Long balance = null;
|
||||
|
@ -359,11 +361,11 @@ public class TRX2EneryTransferHandler {
|
|||
Response.AccountResourceMessage accountResource = apiWrapper.getAccountResource(accountAddress);
|
||||
|
||||
//总用于质押换取能量的trx上限
|
||||
balance = getBalance(accountResource, transferCount);
|
||||
balance = getBalance(accountResource, transferCount, resourceCode);
|
||||
|
||||
/* 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);
|
||||
|
@ -376,7 +378,9 @@ public class TRX2EneryTransferHandler {
|
|||
.tranferCount(transferCount)
|
||||
.energyBusiType(sysEnergyBusiType)
|
||||
.trxAmount(amount)
|
||||
.trxAmountUnit(trxAmountUnit)
|
||||
.delegateAmountTrx(balance)
|
||||
.resourceCode(resourceCode)
|
||||
.delegateTxId(delegateResourceTxid)
|
||||
.lockPeriod(lockPeriod)
|
||||
.delegateStatus("0")
|
||||
|
@ -387,7 +391,7 @@ public class TRX2EneryTransferHandler {
|
|||
.build();
|
||||
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");
|
||||
if (longPollingBot != null && StringUtils.isNotEmpty(sysenTrxTransferNotice) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
|
||||
/*
|
||||
|
@ -404,7 +408,7 @@ public class TRX2EneryTransferHandler {
|
|||
arguments.put("transferCount", transferCount);
|
||||
arguments.put("FromAddress", fromAddress.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);
|
||||
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
|
||||
String message = substitutor.replace(sysenTrxTransferNotice);
|
||||
|
@ -417,25 +421,32 @@ public class TRX2EneryTransferHandler {
|
|||
}
|
||||
|
||||
|
||||
private long getBalance(Response.AccountResourceMessage accountResource, long energyNum) {
|
||||
long totalEnergyLimit = accountResource.getTotalEnergyLimit();
|
||||
//已经用于质押换取能量的trx
|
||||
long totalEnergyWeight = accountResource.getTotalEnergyWeight();
|
||||
private long getBalance(Response.AccountResourceMessage accountResource, long transferCount, String resourceCode) {
|
||||
Long balance = null;
|
||||
if (resourceCode.equals(Common.ResourceCode.ENERGY.name())) {
|
||||
long totalEnergyLimit = accountResource.getTotalEnergyLimit();
|
||||
//已经用于质押换取能量的trx
|
||||
long totalEnergyWeight = accountResource.getTotalEnergyWeight();
|
||||
|
||||
//系数 保留一位或者保留2位,算出trx往上进一位
|
||||
BigDecimal trxToFreezeEnergyTimes = BigDecimal.valueOf(totalEnergyLimit).divide(BigDecimal.valueOf(totalEnergyWeight), 2, BigDecimal.ROUND_DOWN);
|
||||
//计算代理的数量
|
||||
//系数 保留一位或者保留2位,算出trx往上进一位
|
||||
BigDecimal trxToFreezeEnergyTimes = BigDecimal.valueOf(totalEnergyLimit).divide(BigDecimal.valueOf(totalEnergyWeight), 2, BigDecimal.ROUND_DOWN);
|
||||
//计算代理的数量
|
||||
// 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;
|
||||
}
|
||||
|
||||
private String getDelegateResourceTxid(ApiWrapper apiWrapper, String accountAddress, long balance, String ownerAddress, long lockPeriod) throws IllegalException {
|
||||
Response.TransactionExtention transactionExtention = apiWrapper.delegateResourceV2(accountAddress, balance * 1000000, Common.ResourceCode.ENERGY_VALUE, ownerAddress, false,0);
|
||||
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.valueOf(resourceCode).getNumber(), ownerAddress, false, 0);
|
||||
|
||||
Chain.Transaction transaction = apiWrapper.signTransaction(transactionExtention);
|
||||
|
||||
String delegateResourceTxid = apiWrapper.broadcastTransaction(transaction);
|
||||
return delegateResourceTxid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,14 +86,27 @@ public class UndelegateEnergyHandler {
|
|||
if (accountResource == null){
|
||||
return;
|
||||
}
|
||||
Integer energyUsed = accountResource.getEnergyUsed();
|
||||
if (energyUsed == null){
|
||||
return;
|
||||
}
|
||||
|
||||
long energyUsedCount = energyUsed / 30000;
|
||||
if (energyUsedCount < trxExchangeMonitorAccountInfo.getTranferCount()){
|
||||
return;
|
||||
String resourceCode = trxExchangeMonitorAccountInfo.getResourceCode();
|
||||
if (resourceCode.equals(Common.ResourceCode.ENERGY.name())) {
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.ruoyi.system.mapper;
|
|||
import com.ruoyi.common.core.domain.entity.TrxExchangeInfo;
|
||||
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
|
||||
import com.ruoyi.system.domain.vo.TransactionLogVO;
|
||||
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -67,5 +68,5 @@ public interface TrxExchangeInfoMapper
|
|||
|
||||
List<TransactionLogVO> selectTransactionLogVO();
|
||||
|
||||
List<TrxExchangeInfo> selectTrxExchangeInfoAndMonitorNameList(TrxExchangeInfo trxExchangeInfo);
|
||||
List<TrxExchangeInfoVO> selectTrxExchangeInfoAndMonitorNameList(TrxExchangeInfo trxExchangeInfo);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.ruoyi.system.service;
|
|||
import com.ruoyi.common.core.domain.entity.TrxExchangeInfo;
|
||||
import com.ruoyi.system.domain.TrxExchange;
|
||||
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
|
||||
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,11 +26,11 @@ public interface ITrxExchangeInfoService
|
|||
|
||||
/**
|
||||
* 查询trx兑能量记录列表
|
||||
*
|
||||
*
|
||||
* @param trxExchangeInfo trx兑能量记录
|
||||
* @return trx兑能量记录集合
|
||||
*/
|
||||
public List<TrxExchangeInfo> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo);
|
||||
public List<TrxExchangeInfoVO> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo);
|
||||
|
||||
/**
|
||||
* 新增trx兑能量记录
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.ruoyi.common.core.text.Convert;
|
|||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.system.domain.TrxExchange;
|
||||
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
|
||||
import com.ruoyi.system.mapper.AccountAddressInfoMapper;
|
||||
import com.ruoyi.system.mapper.MonitorAddressInfoMapper;
|
||||
import com.ruoyi.system.mapper.TenantInfoMapper;
|
||||
|
@ -28,13 +29,12 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 租户Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-04-14
|
||||
*/
|
||||
@Service
|
||||
public class TenantInfoServiceImpl implements ITenantInfoService
|
||||
{
|
||||
public class TenantInfoServiceImpl implements ITenantInfoService {
|
||||
@Autowired
|
||||
private TenantInfoMapper tenantInfoMapper;
|
||||
|
||||
|
@ -44,46 +44,49 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
private MonitorAddressInfoMapper monitorAddressInfoMapper;
|
||||
@Autowired
|
||||
private AccountAddressInfoMapper accountAddressInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询租户
|
||||
*
|
||||
*
|
||||
* @param idTenantInfo 租户主键
|
||||
* @return 租户
|
||||
*/
|
||||
@Override
|
||||
public TenantInfo selectTenantInfoByIdTenantInfo(Long idTenantInfo)
|
||||
{
|
||||
public TenantInfo selectTenantInfoByIdTenantInfo(Long idTenantInfo) {
|
||||
return tenantInfoMapper.selectTenantInfoByIdTenantInfo(idTenantInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询租户列表
|
||||
*
|
||||
*
|
||||
* @param tenantInfo 租户
|
||||
* @return 租户
|
||||
*/
|
||||
@Override
|
||||
@DataScope(userAlias = "u")
|
||||
public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo)
|
||||
{
|
||||
public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo) {
|
||||
return tenantInfoMapper.selectTenantInfoList(tenantInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户
|
||||
*
|
||||
*
|
||||
* @param tenantInfo 租户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTenantInfo(TenantInfo tenantInfo)
|
||||
{
|
||||
public int insertTenantInfo(TenantInfo tenantInfo) {
|
||||
|
||||
TenantInfo tenantInfoExample = new TenantInfo();
|
||||
tenantInfoExample.setReceiverAddress(tenantInfo.getReceiverAddress());
|
||||
List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample);
|
||||
|
||||
Preconditions.checkState(CollectionUtil.isEmpty(tenantInfoList), "该接收能量地址已存在,请勿重复添加");
|
||||
boolean exists = false;
|
||||
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 transferCount = tenantInfo.getTransferCount();
|
||||
|
@ -113,13 +116,12 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
|
||||
/**
|
||||
* 修改租户
|
||||
*
|
||||
*
|
||||
* @param tenantInfo 租户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTenantInfo(TenantInfo tenantInfo)
|
||||
{
|
||||
public int updateTenantInfo(TenantInfo tenantInfo) {
|
||||
Long price = tenantInfo.getPrice();
|
||||
Long transferCount = tenantInfo.getTransferCount();
|
||||
Long period = tenantInfo.getPeriod();
|
||||
|
@ -137,25 +139,23 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
|
||||
/**
|
||||
* 批量删除租户
|
||||
*
|
||||
*
|
||||
* @param idTenantInfos 需要删除的租户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTenantInfoByIdTenantInfos(String idTenantInfos)
|
||||
{
|
||||
public int deleteTenantInfoByIdTenantInfos(String idTenantInfos) {
|
||||
return tenantInfoMapper.deleteTenantInfoByIdTenantInfos(Convert.toStrArray(idTenantInfos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除租户信息
|
||||
*
|
||||
*
|
||||
* @param idTenantInfo 租户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTenantInfoByIdTenantInfo(Long idTenantInfo)
|
||||
{
|
||||
public int deleteTenantInfoByIdTenantInfo(Long idTenantInfo) {
|
||||
return tenantInfoMapper.deleteTenantInfoByIdTenantInfo(idTenantInfo);
|
||||
}
|
||||
|
||||
|
@ -169,18 +169,18 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
Preconditions.checkState(status.equals(tenantInfo.getStatus()), "该租户不是生效中状态,不能发起委托任务");
|
||||
|
||||
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())
|
||||
.delegateStatus(dictValue)
|
||||
.energyBusiType(sysEnergyBusiType)
|
||||
.build();
|
||||
|
||||
List<TrxExchangeInfo> trxExchangeInfos = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
List<TrxExchangeInfoVO> trxExchangeInfos = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
|
||||
|
||||
Preconditions.checkState(CollectionUtil.isEmpty(trxExchangeInfos), "该接收能量地址已在任务中,请勿重复发起");
|
||||
|
||||
doDelegateEnergy(tenantInfo,null);
|
||||
doDelegateEnergy(tenantInfo, null);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -190,7 +190,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
public void doDelegateEnergy(TenantInfo tenantInfo, String userName) throws Exception {
|
||||
String accountAddress = null;
|
||||
String monitorAddress = null;
|
||||
if (StringUtils.isNotEmpty(tenantInfo.getMonitorAddress())){
|
||||
if (StringUtils.isNotEmpty(tenantInfo.getMonitorAddress())) {
|
||||
MonitorAddressInfo monitorAddressInfoExample = new MonitorAddressInfo();
|
||||
monitorAddressInfoExample.setMonitorAddress(tenantInfo.getMonitorAddress());
|
||||
monitorAddressInfoExample.setIsValid(UserConstants.YES);
|
||||
|
@ -201,7 +201,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
accountAddress = monitorAddressInfo.getAccountAddress();
|
||||
|
||||
monitorAddress = monitorAddressInfo.getMonitorAddress();
|
||||
}else {
|
||||
} else {
|
||||
AccountAddressInfo accountAddressInfo = new AccountAddressInfo();
|
||||
accountAddressInfo.setIsValid("Y");
|
||||
List<AccountAddressInfo> accountAddressInfoList = accountAddressInfoMapper.selectAccountAddressInfoList(accountAddressInfo);
|
||||
|
@ -227,7 +227,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
|
|||
|
||||
userName = userName == null ? ShiroUtils.getLoginName() : userName;
|
||||
|
||||
trxExchangeInfoService.delegate(trxExchange, true,userName);
|
||||
trxExchangeInfoService.delegate(trxExchange, true, userName);
|
||||
|
||||
tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
|
||||
tenantInfo.setLcd(new Date());
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.utils.DictUtils;
|
|||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.system.domain.TrxExchange;
|
||||
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
|
||||
import com.ruoyi.system.domain.vo.TrxExchangeInfoVO;
|
||||
import com.ruoyi.system.handler.TRX2EneryTransferHandler;
|
||||
import com.ruoyi.system.mapper.ErrorLogMapper;
|
||||
import com.ruoyi.system.mapper.TenantInfoMapper;
|
||||
|
@ -67,7 +68,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
|
|||
* @return trx兑能量记录
|
||||
*/
|
||||
@Override
|
||||
public List<TrxExchangeInfo> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo) {
|
||||
public List<TrxExchangeInfoVO> selectTrxExchangeInfoList(TrxExchangeInfo trxExchangeInfo) {
|
||||
// return trxExchangeInfoMapper.selectTrxExchangeInfoList(trxExchangeInfo);
|
||||
return trxExchangeInfoMapper.selectTrxExchangeInfoAndMonitorNameList(trxExchangeInfo);
|
||||
}
|
||||
|
@ -156,7 +157,9 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
|
|||
trxExchange.getPrice(),
|
||||
sysEnergyBusiType,
|
||||
null,
|
||||
userName);
|
||||
null,
|
||||
userName,
|
||||
trxExchange.getResourceCode());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,30 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<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">
|
||||
<result property="idTrxExchangeInfo" column="id_trx_exchange_info" />
|
||||
<result property="fromAddress" column="from_address" />
|
||||
|
@ -14,12 +37,13 @@
|
|||
<result property="tranferCount" column="tranfer_count" />
|
||||
<result property="energyBusiType" column="energy_busi_type" />
|
||||
<result property="trxAmount" column="trx_amount" />
|
||||
<result property="trxAmountUnit" column="trx_amount_unit" />
|
||||
<result property="delegateAmountTrx" column="delegate_amount_trx" />
|
||||
<result property="resourceCode" column="resource_code" />
|
||||
<result property="delegateTxId" column="delegate_tx_id" />
|
||||
<result property="lockPeriod" column="lock_period" />
|
||||
<result property="delegateStatus" column="delegate_status" />
|
||||
<result property="unDelegateTxId" column="un_delegate_tx_id" />
|
||||
|
||||
<result property="fcd" column="fcd" />
|
||||
<result property="fcu" column="fcu" />
|
||||
<result property="lcd" column="lcd" />
|
||||
|
@ -27,12 +51,12 @@
|
|||
</resultMap>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="selectTrxExchangeInfoList" parameterType="TrxExchangeInfo" resultMap="TrxExchangeInfoResult">
|
||||
<include refid="selectTrxExchangeInfoVo"/>
|
||||
<where> 1=1
|
||||
<where>
|
||||
<if test="fromAddress != null and fromAddress != ''"> and from_address = #{fromAddress}</if>
|
||||
<if test="toAddress != null and toAddress != ''"> and to_address = #{toAddress}</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="energyBusiType != null and energyBusiType != ''"> and energy_busi_type = #{energyBusiType}</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="resourceCode != null and resourceCode != ''"> and resource_code = #{resourceCode}</if>
|
||||
<if test="delegateTxId != null and delegateTxId != ''"> and delegate_tx_id = #{delegateTxId}</if>
|
||||
<if test="lockPeriod != null "> and lock_period = #{lockPeriod}</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="fcd != null "> and fcd >= #{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="fcu != null and fcu != ''"> and fcu = #{fcu}</if>
|
||||
<if test="lcd != null "> and lcd <= #{lcd}</if>
|
||||
<if test="lcd != null "> and lcd = #{lcd}</if>
|
||||
<if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if>
|
||||
order by fcd desc
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -71,7 +95,9 @@
|
|||
<if test="tranferCount != null">tranfer_count,</if>
|
||||
<if test="energyBusiType != null">energy_busi_type,</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="resourceCode != null">resource_code,</if>
|
||||
<if test="delegateTxId != null">delegate_tx_id,</if>
|
||||
<if test="lockPeriod != null">lock_period,</if>
|
||||
<if test="delegateStatus != null">delegate_status,</if>
|
||||
|
@ -90,12 +116,13 @@
|
|||
<if test="tranferCount != null">#{tranferCount},</if>
|
||||
<if test="energyBusiType != null">#{energyBusiType},</if>
|
||||
<if test="trxAmount != null">#{trxAmount},</if>
|
||||
<if test="trxAmountUnit != null">#{trxAmountUnit},</if>
|
||||
<if test="delegateAmountTrx != null">#{delegateAmountTrx},</if>
|
||||
<if test="resourceCode != null">#{resourceCode},</if>
|
||||
<if test="delegateTxId != null">#{delegateTxId},</if>
|
||||
<if test="lockPeriod != null">#{lockPeriod},</if>
|
||||
<if test="delegateStatus != null">#{delegateStatus},</if>
|
||||
<if test="unDelegateTxId != null">#{unDelegateTxId},</if>
|
||||
|
||||
<if test="fcd != null">#{fcd},</if>
|
||||
<if test="fcu != null">#{fcu},</if>
|
||||
<if test="lcd != null">#{lcd},</if>
|
||||
|
@ -114,7 +141,9 @@
|
|||
<if test="tranferCount != null">tranfer_count = #{tranferCount},</if>
|
||||
<if test="energyBusiType != null">energy_busi_type = #{energyBusiType},</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="resourceCode != null">resource_code = #{resourceCode},</if>
|
||||
<if test="delegateTxId != null">delegate_tx_id = #{delegateTxId},</if>
|
||||
<if test="lockPeriod != null">lock_period = #{lockPeriod},</if>
|
||||
<if test="delegateStatus != null">delegate_status = #{delegateStatus},</if>
|
||||
|
@ -147,6 +176,7 @@
|
|||
<result column="tranfer_count" property="tranferCount"/>
|
||||
<result column="energy_busi_type" property="energyBusiType"/>
|
||||
<result column="delegate_amount_trx" property="delegateAmountTrx"/>
|
||||
<result column="resource_code" property="resourceCode"/>
|
||||
<result column="lock_period" property="lockPeriod"/>
|
||||
<result column="delegate_status" property="delegateStatus"/>
|
||||
<result column="delegate_tx_id" property="delegateTxId"/>
|
||||
|
@ -166,6 +196,7 @@
|
|||
t.tranfer_count,
|
||||
t.energy_busi_type,
|
||||
t.delegate_amount_trx,
|
||||
t.resource_code,
|
||||
t.lock_period,
|
||||
t.delegate_status,
|
||||
t.delegate_tx_id,
|
||||
|
@ -190,23 +221,26 @@
|
|||
</select>
|
||||
|
||||
|
||||
<select id="selectTrxExchangeInfoAndMonitorNameList" parameterType="TrxExchangeInfo" resultType="TrxExchangeInfo" >
|
||||
<select id="selectTrxExchangeInfoAndMonitorNameList" parameterType="TrxExchangeInfo"
|
||||
resultMap="selectTrxExchangeInfoAndMonitorNameListResultMap">
|
||||
SELECT
|
||||
t.id_trx_exchange_info,
|
||||
t.from_address,
|
||||
t.to_address,
|
||||
m.monitor_address_name,
|
||||
t.account_address,
|
||||
t.price,
|
||||
t.trx_tx_id,
|
||||
t.tranfer_count,
|
||||
t.energy_busi_type,
|
||||
t.trx_amount,
|
||||
t.delegate_amount_trx,
|
||||
t.delegate_tx_id,
|
||||
t.lock_period,
|
||||
t.delegate_status,
|
||||
t.un_delegate_tx_id,
|
||||
t.id_trx_exchange_info idTrxExchangeInfo,
|
||||
t.from_address fromAddress,
|
||||
t.to_address toAddress,
|
||||
m.monitor_address_name monitorAddressName,
|
||||
t.account_address accountAddress,
|
||||
t.price price,
|
||||
t.trx_tx_id trxTxId,
|
||||
t.tranfer_count tranferCount,
|
||||
t.energy_busi_type energyBusiType,
|
||||
t.trx_amount trxAmount,
|
||||
t.trx_amount_unit trxAmountUnit,
|
||||
t.delegate_amount_trx delegateAmountTrx,
|
||||
t.resource_code resourceCode,
|
||||
t.delegate_tx_id delegateTxId,
|
||||
t.lock_period lockPeriod,
|
||||
t.delegate_status delegateStatus,
|
||||
t.un_delegate_tx_id unDelegateTxId,
|
||||
t.fcd,
|
||||
t.fcu,
|
||||
t.lcd,
|
||||
|
|
Loading…
Reference in New Issue