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

View File

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

View File

@ -98,12 +98,13 @@
}, },
{ {
field: 'receiverAddress', field: 'receiverAddress',
title: '接收能量地址', title: '委托地址',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null) { if (value == null) {
return value; 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); return $.table.selectDictLabel(energyBusiTypeDatas, value);
} }
} , } ,
{
field: 'price',
title: '单价',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' ' + row['exchangeUnit'];
}
},
{ {
field: 'transferCount', field: 'transferCount',
title: '笔数', title: '笔数',
@ -176,11 +168,11 @@
}, },
{ {
field: 'delegatedDays', field: 'delegatedDays',
title: '已经委托天数' title: '委托天数'
}, },
{ {
field: 'totalCountUsed', field: 'totalCountUsed',
title: '已使用笔数' title: '已用笔数'
}, },
{ {
field: 'calcRule', field: 'calcRule',
@ -191,6 +183,15 @@
}, { }, {
field: 'remark', field: 'remark',
title: '备注' title: '备注'
},{
field: 'price',
title: '单价',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' ' + (row['exchangeUnit'] == 'USDT' ? 'U' : 'TRX');
}
}, },
{ {
field: 'fcd', field: 'fcd',

View File

@ -84,26 +84,32 @@
field: 'fromAddress', field: 'fromAddress',
title: '付款账户', title: '付款账户',
formatter:function(value, row, index) { 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', field: 'toAddress',
title: '收款账户', title: '收款账户地址',
visible: false visible: false
}, { }, {
field: 'monitorAddressName', field: 'monitorAddressName',
title: '收款账户别名', title: '收款账户',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null) { if (value == null) {
return value; 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', field: 'usdtTxId',
title: '交易订单' title: '交易订单',
visible: false
}, },
{ {
field: 'usdtAmount', field: 'usdtAmount',
@ -112,7 +118,7 @@
if (value == null) { if (value == null) {
return value; return value;
} }
return value + ' USDT' ; return value + ' U' ;
} }
}, },
{ {

View File

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

View File

@ -46,7 +46,7 @@ public enum DesensitizedType
*/ */
CAR_LICENSE(DesensitizedUtil::carLicense), 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; 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.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.enums.DesensitizedType;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -23,12 +21,11 @@ public class TrxExchangeInfoVO {
/** /**
* *
*/ */
@Excel(name = "收款账户别名") @Excel(name = "收款账户")
private String monitorAddressName; private String monitorAddressName;
/** 转入账户 */ /** 转入账户 */
@Excel(name = "转入账户") @Excel(name = "收款账户地址")
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
private String toAddress; private String toAddress;
/* @Excel(name = "监听账户别名") /* @Excel(name = "监听账户别名")
@ -36,7 +33,6 @@ public class TrxExchangeInfoVO {
/** 实际出账账户 */ /** 实际出账账户 */
@Excel(name = "实际出账账户") @Excel(name = "实际出账账户")
@Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS)
private String accountAddress; private String accountAddress;
/** 单位 */ /** 单位 */

View File

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

View File

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