mirror of https://gitee.com/y_project/RuoYi.git
实现转指定trx数量功能
parent
ac9c0a7f03
commit
dabd9aefb6
|
@ -26,7 +26,7 @@
|
||||||
<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">
|
||||||
<select name="energyBusiType" class="form-control m-b" th:with="type=${@dict.getType('sys_energy_busi_type')}">
|
<select name="energyBusiType" class="form-control m-b" th:with="type=${@dict.getType('sys_energy_busi_type')}">
|
||||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
<option th:each="dict : ${type}" th:unless="${dict.dictValue == '1' || dict.dictValue == '2'}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<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="fromAddress" class="form-control" type="text">
|
<input name="fromAddress" class="form-control" type="text" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -22,6 +22,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">转出金额TRX:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="trxAmount" class="form-control" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
|
|
|
@ -107,11 +107,23 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'usdtAmount',
|
field: 'usdtAmount',
|
||||||
title: '转入金额'
|
title: '转入金额',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
if (value == null) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return value + ' USDT' ;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'trxAmount',
|
field: 'trxAmount',
|
||||||
title: '转出金额'
|
title: '转出金额',
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
if (value == null) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return value + ' TRX' ;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'exchangeRate',
|
field: 'exchangeRate',
|
||||||
|
@ -119,7 +131,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'trxTxId',
|
field: 'trxTxId',
|
||||||
title: 'TRX订单'
|
title: 'TRX订单',
|
||||||
|
visible: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'orginalExchangeRate',
|
field: 'orginalExchangeRate',
|
||||||
|
@ -136,7 +149,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'lcd',
|
field: 'lcd',
|
||||||
title: '更新时间'
|
title: '更新时间',
|
||||||
|
visible: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'lcu',
|
field: 'lcu',
|
||||||
|
|
|
@ -193,8 +193,8 @@ public class Usdt2TrxTransferHandler {
|
||||||
.setUsdtTxId(transactionId)
|
.setUsdtTxId(transactionId)
|
||||||
.setUsdtAmount(transferValue)
|
.setUsdtAmount(transferValue)
|
||||||
.setTrxAmount(trxValue)
|
.setTrxAmount(trxValue)
|
||||||
.setExchangeRate(oneUsdtToTrxPair.getFirst())
|
.setExchangeRate(oneUsdtToTrxPair == null ? null : oneUsdtToTrxPair.getFirst())
|
||||||
.setOrginalExchangeRate(oneUsdtToTrxPair.getSecond())
|
.setOrginalExchangeRate(oneUsdtToTrxPair == null ? null :oneUsdtToTrxPair.getSecond())
|
||||||
.setTrxTxId(txId)
|
.setTrxTxId(txId)
|
||||||
.setFcu("system")
|
.setFcu("system")
|
||||||
.setLcu("system");
|
.setLcu("system");
|
||||||
|
|
|
@ -70,20 +70,27 @@ public class UsdtExchangeInfoServiceImpl implements IUsdtExchangeInfoService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertUsdtExchangeInfo(UsdtExchangeInfo usdtExchangeInfo) throws Exception {
|
public int insertUsdtExchangeInfo(UsdtExchangeInfo usdtExchangeInfo) throws Exception {
|
||||||
BigDecimal oneUsdtToTrx;
|
|
||||||
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
|
BigDecimal usdtAmount = usdtExchangeInfo.getUsdtAmount();
|
||||||
|
BigDecimal trxAmount = usdtExchangeInfo.getTrxAmount();
|
||||||
|
Preconditions.checkState(usdtAmount != null ^ trxAmount != null, "转入USDT和转出TR数量不能同时录入,也不能同时为空");
|
||||||
Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair = null;
|
Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair = null;
|
||||||
if (UserConstants.YES.equals(systronApiSwitch)) {
|
BigDecimal trxValue = null;
|
||||||
|
if (usdtAmount != null) {
|
||||||
|
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
|
||||||
|
|
||||||
|
if (UserConstants.YES.equals(systronApiSwitch)) {
|
||||||
// oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().getFirst();
|
// oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().getFirst();
|
||||||
oneUsdtToTrxPair = usdt2TrxTransferHandler.getOneUsdtToTrx();
|
oneUsdtToTrxPair = usdt2TrxTransferHandler.getOneUsdtToTrx();
|
||||||
|
} else {
|
||||||
|
oneUsdtToTrxPair = Pair.of(BigDecimal.TEN, BigDecimal.TEN);
|
||||||
|
}
|
||||||
|
trxValue = usdtAmount.multiply(oneUsdtToTrxPair.getFirst());
|
||||||
} else {
|
} else {
|
||||||
oneUsdtToTrxPair=Pair.of(BigDecimal.TEN,BigDecimal.TEN);
|
trxValue = trxAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BigDecimal usdtAmount = usdtExchangeInfo.getUsdtAmount();
|
|
||||||
|
|
||||||
BigDecimal trxValue = usdtAmount.multiply(oneUsdtToTrxPair.getFirst());
|
|
||||||
String accountAddress = usdtExchangeInfo.getAccountAddress();
|
String accountAddress = usdtExchangeInfo.getAccountAddress();
|
||||||
if (StringUtils.isEmpty(accountAddress)) {
|
if (StringUtils.isEmpty(accountAddress)) {
|
||||||
AccountAddressInfo accountAddressInfoExample = new AccountAddressInfo();
|
AccountAddressInfo accountAddressInfoExample = new AccountAddressInfo();
|
||||||
|
|
Loading…
Reference in New Issue