diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/trx2Energy/Trx2EnergyMonitorAddressInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/trx2Energy/Trx2EnergyMonitorAddressInfoController.java index 7901b4f9e..235597bea 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/trx2Energy/Trx2EnergyMonitorAddressInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/trx2Energy/Trx2EnergyMonitorAddressInfoController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.MonitorAddressInfoVO; import com.ruoyi.system.service.IAccountAddressInfoService; import com.ruoyi.system.service.IMonitorAddressInfoService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -52,7 +53,7 @@ public class Trx2EnergyMonitorAddressInfoController extends BaseController { startPage(); monitorAddressInfo.setBusiType(DictUtils.getDictValue("sys_busi_type", "TRX兑能量")); - List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); + List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); return getDataTable(list); } @@ -66,8 +67,8 @@ public class Trx2EnergyMonitorAddressInfoController extends BaseController public AjaxResult export(MonitorAddressInfo monitorAddressInfo) { monitorAddressInfo.setBusiType(DictUtils.getDictValue("sys_busi_type", "TRX兑能量")); - List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); - ExcelUtil util = new ExcelUtil(MonitorAddressInfo.class); + List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); + ExcelUtil util = new ExcelUtil(MonitorAddressInfoVO.class); return util.exportExcel(list, "监听账户入账数据"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/usdt2Trx/Usdt2TrxMonitorAddressInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/usdt2Trx/Usdt2TrxMonitorAddressInfoController.java index 15f630b00..0fba96d2b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/usdt2Trx/Usdt2TrxMonitorAddressInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/usdt2Trx/Usdt2TrxMonitorAddressInfoController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.MonitorAddressInfoVO; import com.ruoyi.system.service.IAccountAddressInfoService; import com.ruoyi.system.service.IMonitorAddressInfoService; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -52,7 +53,7 @@ public class Usdt2TrxMonitorAddressInfoController extends BaseController { startPage(); monitorAddressInfo.setBusiType(DictUtils.getDictValue("sys_busi_type", "USDT兑TRX")); - List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); + List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); return getDataTable(list); } @@ -66,8 +67,8 @@ public class Usdt2TrxMonitorAddressInfoController extends BaseController public AjaxResult export(MonitorAddressInfo monitorAddressInfo) { monitorAddressInfo.setBusiType(DictUtils.getDictValue("sys_busi_type", "USDT兑TRX")); - List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); - ExcelUtil util = new ExcelUtil(MonitorAddressInfo.class); + List list = monitorAddressInfoService.selectMonitorAddressInfoList(monitorAddressInfo); + ExcelUtil util = new ExcelUtil(MonitorAddressInfoVO.class); return util.exportExcel(list, "监听账户入账数据"); } diff --git a/ruoyi-admin/src/main/resources/templates/trx2Energy/account/trx2Energy.html b/ruoyi-admin/src/main/resources/templates/trx2Energy/account/trx2Energy.html index 8eccd347a..b5c772668 100644 --- a/ruoyi-admin/src/main/resources/templates/trx2Energy/account/trx2Energy.html +++ b/ruoyi-admin/src/main/resources/templates/trx2Energy/account/trx2Energy.html @@ -71,7 +71,13 @@ }, { field: 'address', - title: '地址' + title: '地址', + formatter: function (value, row, index) { + if (value == null) { + return value; + } + return "" + value + ""; + } }, { field: 'busiType', title: '业务类型', diff --git a/ruoyi-admin/src/main/resources/templates/trx2Energy/monitor/monitor.html b/ruoyi-admin/src/main/resources/templates/trx2Energy/monitor/monitor.html index 3c750a275..6f59f3671 100644 --- a/ruoyi-admin/src/main/resources/templates/trx2Energy/monitor/monitor.html +++ b/ruoyi-admin/src/main/resources/templates/trx2Energy/monitor/monitor.html @@ -1,197 +1,226 @@ - + -
-
-
-
-
-
    -
  • - - -
  • -
  • - - -
  • - -
  • - - -
  • -
  • - - -
  • -
  • - - - - - -
  • -
  • -  搜索 -  重置 -
  • -
-
-
-
+
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • + +
  • + + +
  • +
  • + + +
  • +
  • + + + - + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
- -
-
-
+ +
+
- - + }; + $.table.init(options); + }); + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/trx2Energy/tenant/tenant.html b/ruoyi-admin/src/main/resources/templates/trx2Energy/tenant/tenant.html index 30c383b4c..b3af4d0b8 100644 --- a/ruoyi-admin/src/main/resources/templates/trx2Energy/tenant/tenant.html +++ b/ruoyi-admin/src/main/resources/templates/trx2Energy/tenant/tenant.html @@ -98,7 +98,13 @@ }, { field: 'receiverAddress', - title: '接收能量地址' + title: '接收能量地址', + formatter: function (value, row, index) { + if (value == null) { + return value; + } + return "" + value + ""; + } }, { field: 'monitorAddress', diff --git a/ruoyi-admin/src/main/resources/templates/usdt2Trx/account/usdt2Trx.html b/ruoyi-admin/src/main/resources/templates/usdt2Trx/account/usdt2Trx.html index 42c972f2a..f975eb9ae 100644 --- a/ruoyi-admin/src/main/resources/templates/usdt2Trx/account/usdt2Trx.html +++ b/ruoyi-admin/src/main/resources/templates/usdt2Trx/account/usdt2Trx.html @@ -71,7 +71,13 @@ }, { field: 'address', - title: '地址' + title: '地址', + formatter: function (value, row, index) { + if (value == null) { + return value; + } + return "" + value + ""; + } }, { field: 'busiType', title: '业务类型', diff --git a/ruoyi-admin/src/main/resources/templates/usdt2Trx/monitor/monitor.html b/ruoyi-admin/src/main/resources/templates/usdt2Trx/monitor/monitor.html index 6f2cd8900..e4c478b02 100644 --- a/ruoyi-admin/src/main/resources/templates/usdt2Trx/monitor/monitor.html +++ b/ruoyi-admin/src/main/resources/templates/usdt2Trx/monitor/monitor.html @@ -101,8 +101,22 @@ }, { field: 'monitorAddress', - title: '监听地址' - }, { + title: '监听地址', + formatter: function (value, row, index) { + if (value == null) { + return value; + } + return "" + value + ""; + } + }, + { + field: 'trxBalance', + title: 'TRX余额' + }, + { + field: 'usdtBalance', + title: 'USDT余额' + }, { field: 'busiType', title: '业务类型', formatter: function(value, row, index) { @@ -111,7 +125,13 @@ }, { field: 'accountAddress', - title: '出账地址' + title: '出账地址', + formatter: function (value, row, index) { + if (value == null) { + return value; + } + return "" + value + ""; + } }, { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/ITronScanApi.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/ITronScanApi.java new file mode 100644 index 000000000..a35f060a1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/ITronScanApi.java @@ -0,0 +1,7 @@ +package com.ruoyi.system.api; + +import com.ruoyi.system.api.entity.tronscan.AccountResponse; + +public interface ITronScanApi { + AccountResponse getAccount(String monitorAddress); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/AccountResponse.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/AccountResponse.java new file mode 100644 index 000000000..d6cd68aa7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/AccountResponse.java @@ -0,0 +1,64 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +@Data +public class AccountResponse implements Serializable { + + + private static final long serialVersionUID = 1L; + + private long totalFrozenV2; + private int transactions_out; + private long frozenForEnergyV2; + private int rewardNum; + private int delegatedFrozenV2BalanceForBandwidth; + private OwnerPermission ownerPermission; + private String redTag; + private int delegateFrozenForEnergy; + private long balance; + private long frozenForBandWidthV2; + private int canWithdrawAmountV2; + + private int transactions_in; + private int totalTransactionCount; + private Representative representative; + private String announcement; + private List allowExchange; + private int accountType; + private List exchanges; + private Frozen frozen; + private int transactions; + private long delegatedFrozenV2BalanceForEnergy; + private String name; + private int frozenForEnergy; + private double energyCost; + private List activePermissions; + private int acquiredDelegatedFrozenV2BalanceForBandwidth; + private double netCost; + private int acquiredDelegateFrozenForBandWidth; + private String greyTag; + private String publicTag; + private List withPriceTokens; + private int unfreezeV2; + private boolean feedbackRisk; + private int voteTotal; + private int totalFrozen; + private long latest_operation_time; + private int frozenForBandWidth; + private int reward; + private String addressTagLogo; + private String address; + private List frozen_supply; + private Bandwidth bandwidth; + private long date_created; + private long acquiredDelegatedFrozenV2BalanceForEnergy; + private String blueTag; + private int witness; + private long freezing; + private int delegateFrozenForBandWidth; + private boolean activated; + private int acquiredDelegateFrozenForEnergy; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/ActivePermissions.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/ActivePermissions.java new file mode 100644 index 000000000..367b6a16d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/ActivePermissions.java @@ -0,0 +1,18 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +@Data +public class ActivePermissions implements Serializable { + + + private static final long serialVersionUID = 1L; + private String operations; + private List keys; + private int threshold; + private int id; + private String type; + private String permission_name; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Bandwidth.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Bandwidth.java new file mode 100644 index 000000000..86a1e6019 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Bandwidth.java @@ -0,0 +1,32 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; +@Data +public class Bandwidth implements Serializable { + + + private static final long serialVersionUID = 1L; + private long energyRemaining; + private long totalEnergyLimit; + private long totalEnergyWeight; + private int netUsed; + private int storageLimit; + private int storagePercentage; + + private double netPercentage; + private int storageUsed; + private int storageRemaining; + private int freeNetLimit; + private long energyUsed; + private int freeNetRemaining; + private int netLimit; + private int netRemaining; + private long energyLimit; + private int freeNetUsed; + private long totalNetWeight; + private int freeNetPercentage; + private double energyPercentage; + private long totalNetLimit; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Frozen.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Frozen.java new file mode 100644 index 000000000..104dd6776 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Frozen.java @@ -0,0 +1,14 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +@Data +public class Frozen implements Serializable { + + + private static final long serialVersionUID = 1L; + private int total; + private List balances; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Keys.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Keys.java new file mode 100644 index 000000000..29b893e0d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Keys.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class Keys implements Serializable { + + + private static final long serialVersionUID = 1L; + + private String address; + private int weight; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/OwnerPermission.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/OwnerPermission.java new file mode 100644 index 000000000..baf71ea4e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/OwnerPermission.java @@ -0,0 +1,16 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; +@Data +public class OwnerPermission implements Serializable { + + + private static final long serialVersionUID = 1L; + + private List keys; + private int threshold; + private String permission_name; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Representative.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Representative.java new file mode 100644 index 000000000..f4a3315c0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/Representative.java @@ -0,0 +1,17 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class Representative implements Serializable { + + + private static final long serialVersionUID = 1L; + private int lastWithDrawTime; + private int allowance; + private boolean enabled; + private String url; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/WithPriceTokens.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/WithPriceTokens.java new file mode 100644 index 000000000..42ac78005 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/entity/tronscan/WithPriceTokens.java @@ -0,0 +1,23 @@ +package com.ruoyi.system.api.entity.tronscan; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class WithPriceTokens implements Serializable { + + + private static final long serialVersionUID = 1L; + private String amount; + private int tokenPriceInTrx; + private String tokenId; + private String balance; + private String tokenName; + private int tokenDecimal; + private String tokenAbbr; + private int tokenCanShow; + private String tokenType; + private boolean vip; + private String tokenLogo; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/api/impl/TronScanApiImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/api/impl/TronScanApiImpl.java new file mode 100644 index 000000000..989d87b27 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/api/impl/TronScanApiImpl.java @@ -0,0 +1,58 @@ +package com.ruoyi.system.api.impl; + +import com.ruoyi.common.utils.http.RestTemplateUtils; +import com.ruoyi.system.api.ITronScanApi; +import com.ruoyi.system.api.entity.tronscan.AccountResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +@Component +@Slf4j +public class TronScanApiImpl implements ITronScanApi { + + private static List apiKeyList = new ArrayList(); + + static { + + apiKeyList.add("3ee210c5-6508-4868-8feb-c1199cec9599"); + apiKeyList.add("6c06ab7f-5020-4ddd-9502-1c8fb708a16b"); + apiKeyList.add("830092eb-82b3-4f75-a9d7-a75cd5ce3bec"); + } + @Override + public AccountResponse getAccount(String monitorAddress) { + + + Random random = new Random(); + int i = random.nextInt(3); + HttpHeaders headers = new HttpHeaders(); +// Collections.shuffle(apiKeyList); + String headerValue = apiKeyList.get(i); + log.info("tronscan api key:{}", headerValue); + headers.add("TRON-PRO-API-KEY", headerValue); + + ResponseEntity responseResponseEntity = RestTemplateUtils.get("https://apilist.tronscanapi.com/api/accountv2?address=" + monitorAddress, headers, AccountResponse.class); + + if (responseResponseEntity == null) { + return null; + } + HttpStatus statusCode = responseResponseEntity.getStatusCode(); + if (statusCode != HttpStatus.OK) { + log.error("获取trx交易信息失败:{}", monitorAddress); + return null; + } + + AccountResponse body = responseResponseEntity.getBody(); + if (body == null) { + return null; + } + return body; + + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MonitorAddressInfoVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MonitorAddressInfoVO.java new file mode 100644 index 000000000..70ffa70ea --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MonitorAddressInfoVO.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 监听账户入账对象 monitor_address_info + * + * @author dorion + * @date 2024-04-14 + */ +@Data +@Accessors(chain = true) +public class MonitorAddressInfoVO +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long idMonitorAddress; + + /** 业务类型 */ + @Excel(name = "业务类型") + private String busiType; + + /** 地址别名 */ + @Excel(name = "地址别名") + private String monitorAddressName; + + /** 监听地址 */ + @Excel(name = "监听地址") + private String monitorAddress; + + @Excel(name = "TRX余额") + private BigDecimal trxBalance; + + + @Excel(name = "USDT余额") + private BigDecimal usdtBalance; + + /** 出账地址 */ + @Excel(name = "出账地址") + private String accountAddress; + + + /** trx兑换单价 */ + @Excel(name = "trx兑换单价") + private Long trxPrice; + + /** usdt兑换单价 */ + @Excel(name = "usdt兑换单价") + private BigDecimal usdtPrice; + + /** trx或者usdt */ + @Excel(name = "trx或者usdt") + private String monitorType; + + /** API_KEY */ + @Excel(name = "API_KEY") + private String apiKey; + + /** 是否有效 */ + @Excel(name = "是否有效") + private String isValid; + + /** 绑定时长 */ + @Excel(name = "绑定时长") + private String bindPeriod; + /** 备注 */ + @Excel(name = "备注") + private String comment; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date fcd; + + /** 创建用户 */ + @Excel(name = "创建用户") + private String fcu; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date lcd; + + /** 更新用户 */ + @Excel(name = "更新用户") + private String lcu; + + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TrxExchangeInfoVO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TrxExchangeInfoVO.java index ea130a159..b7c76c920 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TrxExchangeInfoVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/TrxExchangeInfoVO.java @@ -1,116 +1,125 @@ 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; @Data public class TrxExchangeInfoVO { - /** - * - */ - private String idTrxExchangeInfo; - /** - * - */ + private static final long serialVersionUID = 1L; + + /** trx进账表 */ + private Long idTrxExchangeInfo; + + /** 转出账户 */ + @Excel(name = "付款账户") private String fromAddress; /** * */ - private String toAddress; - - /** - * - */ + @Excel(name = "收款账户别名") private String monitorAddressName; - /** - * - */ + /** 转入账户 */ + @Excel(name = "转入账户") + @Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS) + private String toAddress; + + /* @Excel(name = "监听账户别名") + private String monitorAddressName;*/ + + /** 实际出账账户 */ + @Excel(name = "实际出账账户") + @Sensitive(desensitizedType = DesensitizedType.WALLET_ADDRESS) private String accountAddress; - /** - * - */ - private Integer price; + /** 单位 */ + @Excel(name = "单价") + private Long price; - /** - * - */ + /** 订单hash */ + @Excel(name = "TRX订单") private String trxTxId; - /** - * - */ - private String tranferCount; + /** 笔数 */ + @Excel(name = "笔数") + private Long tranferCount; - /** - * - */ + + + /** 业务类型 */ + @Excel(name = "业务类型") private String energyBusiType; - /** - * - */ - private String trxAmount; - /** - * - */ + /** 转入金额 */ + @Excel(name = "转入金额") + private Long trxAmount; + + /** 转入单位 */ + @Excel(name = "转入单位") private String trxAmountUnit; - /** - * - */ - private String delegateAmountTrx; + /** 兑换支出能量 */ + @Excel(name = "兑换支出TRX") + private Long delegateAmountTrx; - /** - * - */ + /** 资源类型 */ + @Excel(name = "资源类型") private String resourceCode; - /** - * - */ + + /** 能量交易订单hash */ + @Excel(name = "能量交易订单") private String delegateTxId; - /** - * - */ - private String lockPeriod; + /** 锁定周期 */ + @Excel(name = "锁定周期") + private Long lockPeriod; - /** - * - */ + /** 资源委托状态 */ + @Excel(name = "资源状态") private String delegateStatus; + /** 笔数计算规则 */ + @Excel(name = "笔数计算规则") + private String calcRule; - /** - * - */ + /** 回收资源交易id */ + @Excel(name = "回收资源交易") private String unDelegateTxId; - /** - * - */ + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date fcd; - /** - * - */ + /** 创建用户 */ + @Excel(name = "创建用户") private String fcu; - /** - * - */ + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "更新时间", width = 30, dateFormat ="yyyy-MM-dd HH:mm:ss") private Date lcd; - /** - * - */ + /** 更新用户 */ + @Excel(name = "更新用户") private String lcu; - private String calcRule; + + + + + + + + } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMonitorAddressInfoService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMonitorAddressInfoService.java index 78e363ed9..ec08623ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMonitorAddressInfoService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMonitorAddressInfoService.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service; import com.ruoyi.common.core.domain.entity.MonitorAddressInfo; import com.ruoyi.system.domain.MonitorAddressAccount; +import com.ruoyi.system.domain.vo.MonitorAddressInfoVO; import java.util.List; @@ -24,11 +25,11 @@ public interface IMonitorAddressInfoService /** * 查询监听账户入账列表 - * + * * @param monitorAddressInfo 监听账户入账 * @return 监听账户入账集合 */ - public List selectMonitorAddressInfoList(MonitorAddressInfo monitorAddressInfo); + public List selectMonitorAddressInfoList(MonitorAddressInfo monitorAddressInfo); /** * 新增监听账户入账 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MonitorAddressInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MonitorAddressInfoServiceImpl.java index b8d3334fc..72153c549 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MonitorAddressInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MonitorAddressInfoServiceImpl.java @@ -3,14 +3,24 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.core.domain.entity.MonitorAddressInfo; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.system.api.ITronScanApi; +import com.ruoyi.system.api.entity.tronscan.AccountResponse; +import com.ruoyi.system.api.entity.tronscan.WithPriceTokens; import com.ruoyi.system.domain.MonitorAddressAccount; +import com.ruoyi.system.domain.vo.MonitorAddressInfoVO; import com.ruoyi.system.mapper.MonitorAddressInfoMapper; import com.ruoyi.system.service.IMonitorAddressInfoService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; /** * 监听账户入账Service业务层处理 @@ -24,6 +34,9 @@ public class MonitorAddressInfoServiceImpl implements IMonitorAddressInfoService @Autowired private MonitorAddressInfoMapper monitorAddressInfoMapper; + @Autowired + private ITronScanApi tronScanApi; + /** * 查询监听账户入账 @@ -43,8 +56,37 @@ public class MonitorAddressInfoServiceImpl implements IMonitorAddressInfoService * @return 监听账户入账 */ @Override - public List selectMonitorAddressInfoList(MonitorAddressInfo monitorAddressInfo) { - return monitorAddressInfoMapper.selectMonitorAddressInfoList(monitorAddressInfo); + public List selectMonitorAddressInfoList(MonitorAddressInfo monitorAddressInfo) { + List monitorAddressInfoList = monitorAddressInfoMapper.selectMonitorAddressInfoList(monitorAddressInfo); + List monitorAddressInfoVOList = new ArrayList<>(); + + + monitorAddressInfoList.parallelStream().forEach(monitorAddressInfo1 -> { + AccountResponse accountResponse = tronScanApi.getAccount(monitorAddressInfo1.getMonitorAddress()); + + Optional.ofNullable(accountResponse).ifPresent(accountResponse1 -> { + MonitorAddressInfoVO monitorAddressInfoVO = new MonitorAddressInfoVO(); + BeanUtils.copyProperties(monitorAddressInfo1,monitorAddressInfoVO); + List withPriceTokens = accountResponse1.getWithPriceTokens(); + Optional.ofNullable(withPriceTokens).ifPresent(withPriceTokens1 -> { + withPriceTokens1.forEach(withPriceToken -> { + String tokenType = withPriceToken.getTokenType(); + String balance = withPriceToken.getBalance(); + BigDecimal finalBalance = new BigDecimal(balance).movePointLeft(withPriceToken.getTokenDecimal()); + if ("trc10".equals(tokenType)){ + monitorAddressInfoVO.setTrxBalance(finalBalance); + }else if ("trc20".equals(tokenType)){ + monitorAddressInfoVO.setUsdtBalance(finalBalance); + } + }); + }); + monitorAddressInfoVOList.add(monitorAddressInfoVO); + }); + }); + + List sortedMonitorAddressInfoVOList = monitorAddressInfoVOList.stream().sorted(Comparator.comparingLong(MonitorAddressInfoVO::getIdMonitorAddress)) + .collect(Collectors.toList()); + return sortedMonitorAddressInfoVOList; } /**