添加业务类型字段

pull/520/head
dorion 2024-04-19 00:39:20 +08:00
parent 9de7a8d240
commit adad055a9d
18 changed files with 163 additions and 36 deletions

View File

@ -135,7 +135,7 @@
</plugin> -->
</plugins>
<finalName>${project.artifactId}</finalName>
<!-- <resources>
<!-- <resources>
<resource>
<directory>src/main/resources</directory>
<excludes>

View File

@ -7,6 +7,14 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-monitor-add">
<div class="form-group">
<label class="col-sm-3 control-label">业务类型:</label>
<div class="col-sm-8">
<select name="busiType" class="form-control m-b" th:with="type=${@dict.getType('sys_busi_type')}">
<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">

View File

@ -8,6 +8,14 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-monitor-edit" th:object="${monitorAddressInfo}">
<input name="idMonitorAddress" th:field="*{idMonitorAddress}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">业务类型:</label>
<div class="col-sm-8">
<select name="busiType" class="form-control m-b" th:with="type=${@dict.getType('sys_busi_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{busiType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">监听地址:</label>
<div class="col-sm-8">

View File

@ -76,6 +76,7 @@
var datas = [[${@dict.getType('sys_yes_no')}]];
var monitorTypeDatas = [[${@dict.getType('sys_monitor_type')}]];
var apiKeyDatas = [[${@dict.getType('sys_tron_api_key')}]];
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
$(function() {
var options = {
url: prefix + "/list",
@ -95,7 +96,13 @@
{
field: 'monitorAddress',
title: '监听地址'
},
}, {
field: 'busiType',
title: '业务类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(busiTypeDatas, value);
}
},
{
field: 'accountAddress',
title: '出账地址'

View File

@ -7,6 +7,14 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-transfer-add">
<div class="form-group">
<label class="col-sm-3 control-label">业务类型:</label>
<div class="col-sm-8">
<select name="busiType" class="form-control m-b" th:with="type=${@dict.getType('sys_busi_type')}">
<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">

View File

@ -8,6 +8,14 @@
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-transfer-edit" th:object="${accountAddressInfo}">
<input name="idAccoutAddressInfo" th:field="*{idAccoutAddressInfo}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">业务类型:</label>
<div class="col-sm-8">
<select name="busiType" class="form-control m-b" th:with="type=${@dict.getType('sys_busi_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{busiType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">地址:</label>
<div class="col-sm-8">

View File

@ -68,6 +68,7 @@
var removeFlag = [[${@permission.hasPermi('account:transfer:remove')}]];
var prefix = ctx + "account/transfer";
var datas = [[${@dict.getType('sys_yes_no')}]];
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
$(function() {
var options = {
url: prefix + "/list",
@ -87,7 +88,13 @@
{
field: 'address',
title: '地址'
},
}, {
field: 'busiType',
title: '业务类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(busiTypeDatas, value);
}
},
/* {
field: 'encryptPrivateKey',
title: '秘钥'

View File

@ -85,7 +85,7 @@
var prefix = ctx + "exchange/trx";
var datas = [[${@dict.getType('sys_delegate_status')}]];
var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]];
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
var sysEnergyBusiTypeDatas = [[${@dict.getType('sys_energy_busi_type')}]];
var lockPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
$(function() {
var options = {
@ -131,10 +131,10 @@
}
},
{
field: 'busiType',
field: 'energyBusiType',
title: '业务类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(busiTypeDatas, value);
return $.table.selectDictLabel(sysEnergyBusiTypeDatas, value);
}
},
{

View File

@ -22,6 +22,10 @@ public class AccountAddressInfo extends BaseEntity
/** 主键 */
private Long idAccoutAddressInfo;
/** 业务类型 */
@Excel(name = "业务类型")
private String busiType;
/** 地址 */
@Excel(name = "地址")
private String address;
@ -78,4 +82,5 @@ public class AccountAddressInfo extends BaseEntity
}

View File

@ -21,6 +21,10 @@ public class MonitorAddressInfo extends BaseEntity
/** 主键 */
private Long idMonitorAddress;
/** 业务类型 */
@Excel(name = "业务类型")
private String busiType;
/** 监听地址 */
@Excel(name = "监听地址")
private String monitorAddress;
@ -63,6 +67,14 @@ public class MonitorAddressInfo extends BaseEntity
@Excel(name = "更新用户")
private String lcu;
public String getBusiType() {
return busiType;
}
public void setBusiType(String busiType) {
this.busiType = busiType;
}
public void setIdMonitorAddress(Long idMonitorAddress)
{
this.idMonitorAddress = idMonitorAddress;

View File

@ -53,7 +53,7 @@ public class TrxExchangeInfo extends BaseEntity
/** 业务类型 */
@Excel(name = "业务类型")
private String busiType;
private String energyBusiType;
/** 转入金额 */
@ -251,11 +251,11 @@ public class TrxExchangeInfo extends BaseEntity
this.tranferCount = tranferCount;
}
public String getBusiType() {
return busiType;
public String getEnergyBusiType() {
return energyBusiType;
}
public void setBusiType(String busiType) {
this.busiType = busiType;
public void setEnergyBusiType(String energyBusiType) {
this.energyBusiType = energyBusiType;
}
}

View File

@ -16,4 +16,14 @@ public class Data {
private int energy_usage_total;
private Raw_data raw_data;
private List<String> internal_transactions;
private String transaction_id;
private Token_info token_info;
private String from;
private String to;
private String type;
private String value;
}

View File

@ -0,0 +1,43 @@
package com.ruoyi.system.dto;
/**
* Auto-generated: 2024-04-19 0:7:5
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Token_info {
private String symbol;
private String address;
private int decimals;
private String name;
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public String getSymbol() {
return symbol;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress() {
return address;
}
public void setDecimals(int decimals) {
this.decimals = decimals;
}
public int getDecimals() {
return decimals;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View File

@ -168,10 +168,10 @@ public class TenantInfoServiceImpl implements ITenantInfoService
Preconditions.checkState(status.equals(tenantInfo.getStatus()), "该租户不是生效中状态,不能发起委托任务");
String dictValue = DictUtils.getDictValue("sys_delegate_status", "已委托");
String busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
TrxExchangeInfo trxExchangeInfo = TrxExchangeInfo.builder().fromAddress(tenantInfo.getReceiverAddress())
.delegateStatus(dictValue)
.busiType(busiType)
.energyBusiType(sysEnergyBusiType)
.build();
List<TrxExchangeInfo> trxExchangeInfos = trxExchangeInfoService.selectTrxExchangeInfoList(trxExchangeInfo);

View File

@ -163,11 +163,11 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
// TrxExchangeInfo trxExchangeInfo = null;
String userName = ShiroUtils.getLoginName();
String busiType = DictUtils.getDictValue("sys_busi_type", "闪兑套餐");
String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "闪兑套餐");
if (isTenant) {
busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
} else if (lockPeriod > 1200 && lockPeriod <= 24 * 1200) {
busiType = DictUtils.getDictValue("sys_busi_type", "笔数套餐");
sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "笔数套餐");
}
// if (UserConstants.YES.equals(systronApiSwitch)) {
String accountAddress = trxExchange.getAccountAddress();
@ -185,7 +185,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
lockPeriod,
trxExchange.getMonitorAddress(),
trxExchange.getPrice(),
busiType,
sysEnergyBusiType,
null,
userName);
return 1;
@ -359,7 +359,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
long lockPeriod = 1200L;
long transferCount = 0L;
Long price = null;
String busiType = DictUtils.getDictValue("sys_busi_type", "闪兑套餐");
String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "闪兑套餐");
//查询是否是按天支付的租户
TenantInfo tenantInfoExample = new TenantInfo();
@ -392,7 +392,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
//取包天的套餐锁定时间和交易笔数
lockPeriod = 1200L * 24;
busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
transferCount = tenantInfo.getTransferCount();
price = tenantInfo.getPrice();
@ -415,7 +415,8 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
String decryptPrivateKey = Dt.decrypt(encryptPrivateKey, encryptKey);
ApiWrapper apiWrapper = ApiWrapper.ofMainnet(decryptPrivateKey, apiKey);
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, busiType, amount, "system");
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount, "system");
//持久化之后放redis
redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS);
if (tenantInfo != null) {
@ -433,7 +434,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
* @param lockPeriod
* @param toAddress
* @param price
* @param busiType
* @param sysEnergyBusiType
* @param amount
* @param currentUser
* @throws Exception
@ -446,7 +447,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
long lockPeriod,
String toAddress,
Long price,
String busiType,
String sysEnergyBusiType,
Long amount,
String currentUser) throws Exception {
@ -470,7 +471,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
.price(price)
.trxTxId(txID)
.tranferCount(transferCount)
.busiType(busiType)
.energyBusiType(sysEnergyBusiType)
.trxAmount(amount)
.delegateAmountTrx(balance)
.delegateTxId(delegateResourceTxid)
@ -535,9 +536,9 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
//回收能量
doUndelegateEnergy(trxExchangeInfo, apiWrapper);
String busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
String trxExchangeInfoBusiType = trxExchangeInfo.getBusiType();
if (!busiType.equals(trxExchangeInfoBusiType)) {
String sysEnergyBusiType = DictUtils.getDictValue("sys_energy_busi_type", "天数套餐");
String trxExchangeInfoBusiType = trxExchangeInfo.getEnergyBusiType();
if (!sysEnergyBusiType.equals(trxExchangeInfoBusiType)) {
return;
}
@ -593,7 +594,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
newLockPeriod,
monitorAddress,
tenantInfo.getPrice(),
busiType,
sysEnergyBusiType,
null,
"system");
/* long balance = getBalance(accountResource, transferCount);
@ -610,7 +611,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
.price(tenantInfo.getPrice())
.trxTxId(tenantInfo.getTxId())
.tranferCount(transferCount)
.busiType(DictUtils.getDictValue("sys_busi_type", "天数套餐"))
.busiType(DictUtils.getDictValue("sys_energy_busi_type", "天数套餐"))
.trxAmount(null)
.delegateAmountTrx(balance)
.delegateTxId(delegateResourceTxid)

View File

@ -7,6 +7,7 @@
<resultMap type="AccountAddressInfo" id="AccountAddressInfoResult">
<result property="idAccoutAddressInfo" column="id_accout_address_info" />
<result property="address" column="address" />
<result property="busiType" column="busi_type" />
<result property="encryptPrivateKey" column="encrypt_private_key" />
<result property="encryptKey" column="encrypt_key" />
<result property="isValid" column="is_valid" />
@ -17,13 +18,14 @@
</resultMap>
<sql id="selectAccountAddressInfoVo">
select id_accout_address_info, address, encrypt_private_key, encrypt_key, is_valid, fcd, fcu, lcd, lcu from account_address_info
select id_accout_address_info, address, busi_type, encrypt_private_key, encrypt_key, is_valid, fcd, fcu, lcd, lcu from account_address_info
</sql>
<select id="selectAccountAddressInfoList" parameterType="AccountAddressInfo" resultMap="AccountAddressInfoResult">
<include refid="selectAccountAddressInfoVo"/>
<where>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="busiType != null and busiType != ''"> and busi_type = #{busiType}</if>
<if test="encryptPrivateKey != null and encryptPrivateKey != ''"> and encrypt_private_key = #{encryptPrivateKey}</if>
<if test="encryptKey != null and encryptKey != ''"> and encrypt_key = #{encryptKey}</if>
<if test="isValid != null and isValid != ''"> and is_valid = #{isValid}</if>
@ -43,6 +45,7 @@
insert into account_address_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="address != null">address,</if>
<if test="busiType != null">busi_type,</if>
<if test="encryptPrivateKey != null">encrypt_private_key,</if>
<if test="encryptKey != null">encrypt_key,</if>
<if test="isValid != null">is_valid,</if>
@ -53,6 +56,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="address != null">#{address},</if>
<if test="busiType != null">#{busiType},</if>
<if test="encryptPrivateKey != null">#{encryptPrivateKey},</if>
<if test="encryptKey != null">#{encryptKey},</if>
<if test="isValid != null">#{isValid},</if>
@ -67,6 +71,7 @@
update account_address_info
<trim prefix="SET" suffixOverrides=",">
<if test="address != null">address = #{address},</if>
<if test="busiType != null">busi_type = #{busiType},</if>
<if test="encryptPrivateKey != null">encrypt_private_key = #{encryptPrivateKey},</if>
<if test="encryptKey != null">encrypt_key = #{encryptKey},</if>
<if test="isValid != null">is_valid = #{isValid},</if>

View File

@ -6,6 +6,7 @@
<resultMap type="MonitorAddressInfo" id="MonitorAddressInfoResult">
<result property="idMonitorAddress" column="id_monitor_address" />
<result property="busiType" column="busi_type" />
<result property="monitorAddress" column="monitor_address" />
<result property="accountAddress" column="account_address" />
<result property="price" column="price" />
@ -19,12 +20,13 @@
</resultMap>
<sql id="selectMonitorAddressInfoVo">
select id_monitor_address, monitor_address, account_address, price, monitor_type, api_key, is_valid, fcd, fcu, lcd, lcu from monitor_address_info
select id_monitor_address, busi_type, monitor_address, account_address, price, monitor_type, api_key, is_valid, fcd, fcu, lcd, lcu from monitor_address_info
</sql>
<select id="selectMonitorAddressInfoList" parameterType="MonitorAddressInfo" resultMap="MonitorAddressInfoResult">
<include refid="selectMonitorAddressInfoVo"/>
<where>
<if test="busiType != null and busiType != ''"> and busi_type = #{busiType}</if>
<if test="monitorAddress != null and monitorAddress != ''"> and monitor_address = #{monitorAddress}</if>
<if test="accountAddress != null and accountAddress != ''"> and account_address = #{accountAddress}</if>
<if test="price != null "> and price = #{price}</if>
@ -46,6 +48,7 @@
<insert id="insertMonitorAddressInfo" parameterType="MonitorAddressInfo" useGeneratedKeys="true" keyProperty="idMonitorAddress">
insert into monitor_address_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="busiType != null">busi_type,</if>
<if test="monitorAddress != null">monitor_address,</if>
<if test="accountAddress != null">account_address,</if>
<if test="price != null">price,</if>
@ -58,6 +61,7 @@
<if test="lcu != null">lcu,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="busiType != null">#{busiType},</if>
<if test="monitorAddress != null">#{monitorAddress},</if>
<if test="accountAddress != null">#{accountAddress},</if>
<if test="price != null">#{price},</if>
@ -74,6 +78,7 @@
<update id="updateMonitorAddressInfo" parameterType="MonitorAddressInfo">
update monitor_address_info
<trim prefix="SET" suffixOverrides=",">
<if test="busiType != null">busi_type = #{busiType},</if>
<if test="monitorAddress != null">monitor_address = #{monitorAddress},</if>
<if test="accountAddress != null">account_address = #{accountAddress},</if>
<if test="price != null">price = #{price},</if>

View File

@ -12,7 +12,7 @@
<result property="price" column="price" />
<result property="trxTxId" column="trx_tx_id" />
<result property="tranferCount" column="tranfer_count" />
<result property="busiType" column="busi_type" />
<result property="energyBusiType" column="energy_busi_type" />
<result property="trxAmount" column="trx_amount" />
<result property="delegateAmountTrx" column="delegate_amount_trx" />
<result property="delegateTxId" column="delegate_tx_id" />
@ -26,7 +26,7 @@
</resultMap>
<sql id="selectTrxExchangeInfoVo">
select id_trx_exchange_info, from_address, to_address, account_address, price, trx_tx_id, tranfer_count, 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, delegate_amount_trx, 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">
@ -38,7 +38,7 @@
<if test="price != null "> and price = #{price}</if>
<if test="trxTxId != null and trxTxId != ''"> and trx_tx_id = #{trxTxId}</if>
<if test="tranferCount != null "> and tranfer_count = #{tranferCount}</if>
<if test="busiType != null and busiType != ''"> and busi_type = #{busiType}</if>
<if test="energyBusiType != null and energyBusiType != ''"> and energy_busi_type = #{energyBusiType}</if>
<if test="trxAmount != null "> and trx_amount = #{trxAmount}</if>
<if test="delegateAmountTrx != null "> and delegate_amount_trx = #{delegateAmountTrx}</if>
<if test="delegateTxId != null and delegateTxId != ''"> and delegate_tx_id = #{delegateTxId}</if>
@ -67,7 +67,7 @@
<if test="price != null">price,</if>
<if test="trxTxId != null">trx_tx_id,</if>
<if test="tranferCount != null">tranfer_count,</if>
<if test="busiType != null">busi_type,</if>
<if test="energyBusiType != null">energy_busi_type,</if>
<if test="trxAmount != null">trx_amount,</if>
<if test="delegateAmountTrx != null">delegate_amount_trx,</if>
<if test="delegateTxId != null">delegate_tx_id,</if>
@ -86,7 +86,7 @@
<if test="price != null">#{price},</if>
<if test="trxTxId != null">#{trxTxId},</if>
<if test="tranferCount != null">#{tranferCount},</if>
<if test="busiType != null">#{busiType},</if>
<if test="energyBusiType != null">#{energyBusiType},</if>
<if test="trxAmount != null">#{trxAmount},</if>
<if test="delegateAmountTrx != null">#{delegateAmountTrx},</if>
<if test="delegateTxId != null">#{delegateTxId},</if>
@ -109,7 +109,7 @@
<if test="price != null">price = #{price},</if>
<if test="trxTxId != null">trx_tx_id = #{trxTxId},</if>
<if test="tranferCount != null">tranfer_count = #{tranferCount},</if>
<if test="busiType != null">busi_type = #{busiType},</if>
<if test="energyBusiType != null">energy_busi_type = #{energyBusiType},</if>
<if test="trxAmount != null">trx_amount = #{trxAmount},</if>
<if test="delegateAmountTrx != null">delegate_amount_trx = #{delegateAmountTrx},</if>
<if test="delegateTxId != null">delegate_tx_id = #{delegateTxId},</if>