菜单显示值调整以及通知markdown格式

pull/520/head
dorion 2024-07-18 01:43:05 +08:00
parent d173c4f29f
commit 369b4d0a6e
10 changed files with 142 additions and 96 deletions

View File

@ -18,10 +18,7 @@
<label>转入账户:</label>
<input type="text" name="toAddress"/>
</li>
<!-- <li>
<label>实际出账账户:</label>
<input type="text" name="accountAddress"/>
</li>-->
<li>
<label>TRX订单</label>
@ -41,12 +38,7 @@
th:value="${dict.dictValue}"></option>
</select>
</li>
<!-- <br/> <br/> <br/>-->
<!--
<li>
<label>回收资源交易:</label>
<input type="text" name="unDelegateTxId"/>
</li>-->
<li class="select-time">
<label>创建时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginFcd]"/>
@ -118,16 +110,20 @@
field: 'fromAddress',
title: '付款账户',
formatter: function (value, row, index) {
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
// return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
// 生成链接
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + maskedValue + "</a>";
}
},
{
field: 'toAddress',
title: '收款账户',
title: '收款账户地址',
visible: false
}, {
field: 'monitorAddressName',
title: '收款账户别名',
title: '收款账户',
formatter: function (value, row, index) {
if (value == null) {
return value;
@ -135,10 +131,6 @@
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + row['toAddress'] + "' target='_blank'>" + value + "</a>";
}
},
/* {
field: 'accountAddress',
title: '实际出账账户'
},*/
{
field: 'price',
title: '单价'
@ -212,7 +204,7 @@
},
{
field: 'calcRule',
title: '笔数计算规则',
title: '能量规则',
formatter: function(value, row, index) {
return $.table.selectDictLabel(calcRuleDatas, value);
}
@ -226,19 +218,21 @@
field: 'fcd',
title: '创建时间'
},
/* {
{
field: 'fcu',
title: '创建用户'
},*/
title: '创建用户',
visible: false
},
{
field: 'lcd',
title: '更新时间',
visible: false
},
/*{
{
field: 'lcu',
title: '更新用户'
},*/
title: '更新用户',
visible: false
},
{
title: '操作',
align: 'center',

View File

@ -116,16 +116,37 @@
if (value == null) {
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + maskedValue + "</a>";
}
},
{
field: 'trxBalance',
title: 'TRX余额'
title: 'TRX余额',
formatter: function (value, row, index) {
// 确保值是一个数字
if (!isNaN(value)) {
// 保留两位小数
return parseFloat(value).toFixed(2);
} else {
// 如果值不是数字,直接返回原值
return value;
}
}
},
{
field: 'usdtBalance',
title: 'USDT余额'
title: 'USDT余额',
formatter: function (value, row, index) {
// 确保值是一个数字
if (!isNaN(value)) {
// 保留两位小数
return parseFloat(value).toFixed(2);
} else {
// 如果值不是数字,直接返回原值
return value;
}
}
}, {
field: 'busiType',
title: '业务类型',
@ -142,11 +163,12 @@
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
}
},
visible: false
},
{
field: 'trxPrice',
title: 'TRX兑换单价',
title: 'TRX价',
formatter: function (value, row, index) {
if (value == null) {
return value;
@ -156,12 +178,12 @@
},
{
field: 'usdtPrice',
title: 'USDT兑换单价',
title: 'USDT价',
formatter: function (value, row, index) {
if (value == null) {
return value;
}
return value + ' USDT';
return value + ' U';
},
},
@ -180,7 +202,7 @@
}
},{
field: 'idTgMessageInfo',
title: '通知消息模版',
title: '消息模版',
formatter: function(value, row, index) {
if ($.common.isEmpty(topicTgmessageInfoList) || $.common.isEmpty(value)) {
return '';

View File

@ -98,12 +98,13 @@
},
{
field: 'receiverAddress',
title: '接收能量地址',
title: '委托地址',
formatter: function (value, row, index) {
if (value == null) {
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + maskedValue + "</a>";
}
},
{
@ -119,16 +120,7 @@
return $.table.selectDictLabel(energyBusiTypeDatas, value);
}
} ,
{
field: 'price',
title: '单价',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' ' + row['exchangeUnit'];
}
},
{
field: 'transferCount',
title: '笔数',
@ -176,11 +168,11 @@
},
{
field: 'delegatedDays',
title: '已经委托天数'
title: '委托天数'
},
{
field: 'totalCountUsed',
title: '已使用笔数'
title: '已用笔数'
},
{
field: 'calcRule',
@ -191,6 +183,15 @@
}, {
field: 'remark',
title: '备注'
},{
field: 'price',
title: '单价',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' ' + (row['exchangeUnit'] == 'USDT' ? 'U' : 'TRX');
}
},
{
field: 'fcd',

View File

@ -84,26 +84,32 @@
field: 'fromAddress',
title: '付款账户',
formatter:function(value, row, index) {
return "<a href='https://www.oklink.com/zh-hans/trx/address/"+value+"' target='_blank'>" + value + "</a>";
if (value == null) {
return value;
}
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
return "<a href='https://www.oklink.com/zh-hans/trx/address/"+value+"' target='_blank'>" + maskedValue + "</a>";
}
},
{
field: 'toAddress',
title: '收款账户',
title: '收款账户地址',
visible: false
}, {
field: 'monitorAddressName',
title: '收款账户别名',
title: '收款账户',
formatter: function (value, row, index) {
if (value == null) {
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + row['toAddress'] + "' target='_blank'>" + value + "</a>";
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + row['toAddress'] + "' target='_blank'>" + maskedValue + "</a>";
}
},
{
field: 'usdtTxId',
title: '交易订单'
title: '交易订单',
visible: false
},
{
field: 'usdtAmount',
@ -112,7 +118,7 @@
if (value == null) {
return value;
}
return value + ' USDT' ;
return value + ' U' ;
}
},
{

View File

@ -18,10 +18,7 @@
<label>出账地址:</label>
<input type="text" name="accountAddress"/>
</li>
<!-- <li>
<label>单位:</label>
<input type="text" name="price"/>
</li>-->
<li>
<label>是否有效:</label>
<select class="form-control" name="isValid" th:with="type=${@dict.getType('sys_yes_no')}">
@ -106,22 +103,44 @@
if (value == null) {
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
const maskedValue = value.replace(/^(.{6}).*(.{8})$/, '$1***$2');
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + maskedValue + "</a>";
}
},
{
field: 'trxBalance',
title: 'TRX余额'
title: 'TRX余额',
formatter: function (value, row, index) {
// 确保值是一个数字
if (!isNaN(value)) {
// 保留两位小数
return parseFloat(value).toFixed(2);
} else {
// 如果值不是数字,直接返回原值
return value;
}
}
},
{
field: 'usdtBalance',
title: 'USDT余额'
title: 'USDT余额',
formatter: function (value, row, index) {
// 确保值是一个数字
if (!isNaN(value)) {
// 保留两位小数
return parseFloat(value).toFixed(2);
} else {
// 如果值不是数字,直接返回原值
return value;
}
}
}, {
field: 'busiType',
title: '业务类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(busiTypeDatas, value);
},visible: false
},
visible: false
},
{
field: 'accountAddress',
@ -131,7 +150,8 @@
return value;
}
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
}
},
visible: false
},
{
field: 'isValid',
@ -141,7 +161,7 @@
}
},{
field: 'idTgMessageInfo',
title: '通知消息模版',
title: '消息模版',
formatter: function(value, row, index) {
if ($.common.isEmpty(topicTgmessageInfoList) || $.common.isEmpty(value)) {
return '';

View File

@ -46,7 +46,7 @@ public enum DesensitizedType
*/
CAR_LICENSE(DesensitizedUtil::carLicense),
WALLET_ADDRESS(s -> s.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
WALLET_ADDRESS(s -> s.replaceAll("(.{6})(.*)(.{8})", "$1****$3"));
private final Function<String, String> desensitizer;

View File

@ -2,8 +2,6 @@ package com.ruoyi.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.enums.DesensitizedType;
import lombok.Data;
import java.util.Date;
@ -23,12 +21,11 @@ public class TrxExchangeInfoVO {
/**
*
*/
@Excel(name = "收款账户别名")
@Excel(name = "收款账户")
private String monitorAddressName;
/** 转入账户 */
@Excel(name = "转入账户")
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
@Excel(name = "收款账户地址")
private String toAddress;
/* @Excel(name = "监听账户别名")
@ -36,7 +33,6 @@ public class TrxExchangeInfoVO {
/** 实际出账账户 */
@Excel(name = "实际出账账户")
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
private String accountAddress;
/** 单位 */

View File

@ -461,17 +461,17 @@ public class TRX2EneryTransferHandler {
arguments.put("trxAmount", amount == null ? "" : amount.toString());
arguments.put("price", price == null ? "" : price.toString());
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("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"));
// String message = MessageFormat.format(sysUsdtTranferNotice, arguments);
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
String message = substitutor.replace(sysenTrxTransferNotice);
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.HTML);
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.MARKDOWN);
try {
longPollingBot.execute(sendMessage);
} catch (TelegramApiException e) {
log.error("longPollingBot execute is null");
log.error("longPollingBot execute exception",e);
}
});

View File

@ -52,6 +52,7 @@ import java.math.BigDecimal;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@Component
@ -210,32 +211,37 @@ public class Usdt2TrxTransferHandler {
private void doSendTgNotice(BigDecimal oneUsdtToTrx, String from, BigDecimal trxValue, BigDecimal transferValue, String txId, MonitorAddressAccount monitorAddressAccount) throws TelegramApiException {
if (longPollingBot != null ) {
String sysUsdtTranferNotice = configService.selectConfigByKey("sys.usdt.tranfer.notice");
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
if (monitorAddressAccount != null){
String messageInfo = monitorAddressAccount.getMessageInfo();
if (StringUtils.isNotEmpty(messageInfo)){
sysUsdtTranferNotice = messageInfo;
CompletableFuture.runAsync(()->{
String sysUsdtTranferNotice = configService.selectConfigByKey("sys.usdt.tranfer.notice");
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
if (monitorAddressAccount != null){
String messageInfo = monitorAddressAccount.getMessageInfo();
if (StringUtils.isNotEmpty(messageInfo)){
sysUsdtTranferNotice = messageInfo;
}
String groupChatId = monitorAddressAccount.getGroupChatId();
if (StringUtils.isNotEmpty(groupChatId)){
sysTgGroupChatId = groupChatId;
}
}
String groupChatId = monitorAddressAccount.getGroupChatId();
if (StringUtils.isNotEmpty(groupChatId)){
sysTgGroupChatId = groupChatId;
}
}
Map<String, Object> arguments = new HashMap<>();
arguments.put("usdtAmount", transferValue.setScale(2, BigDecimal.ROUND_HALF_DOWN));
arguments.put("exchangeRate", oneUsdtToTrx);
arguments.put("trxAmount", trxValue);
arguments.put("FromAddress", from.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
arguments.put("txId", txId.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3"));
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(sysUsdtTranferNotice);
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.HTML);
longPollingBot.execute(sendMessage);
Map<String, Object> arguments = new HashMap<>();
arguments.put("usdtAmount", transferValue.setScale(2, BigDecimal.ROUND_HALF_DOWN));
arguments.put("exchangeRate", oneUsdtToTrx);
arguments.put("trxAmount", trxValue);
arguments.put("FromAddress", from.replaceAll("(.{6})(.*)(.{8})", "$1\\*\\*\\*\\*$3"));
arguments.put("txId", txId.replaceAll("(.{6})(.*)(.{8})", "$1\\*\\*\\*\\*\\*\\*\\*\\*$3"));
arguments.put("txTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
String message = substitutor.replace(sysUsdtTranferNotice);
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.MARKDOWN);
try {
longPollingBot.execute(sendMessage);
} catch (TelegramApiException e) {
log.error("longPollingBot execute exception",e);
}
});
} else {
log.warn("longPollingBot is null");
}

View File

@ -151,5 +151,6 @@
<if test="lcd != null "> and u.lcd = #{lcd}</if>
<if test="lcu != null and lcu != ''"> and u.lcu = #{lcu}</if>
</where>
order by u.fcd desc
</select>
</mapper>