From 4cd92057e141d0ac32a5fbe87f1478d79a41c9b6 Mon Sep 17 00:00:00 2001 From: leej1012 Date: Wed, 22 May 2024 17:12:14 +0800 Subject: [PATCH] Update nodeInfo --- .../com/github/ontio/model/dao/NodeInfoOffChain.java | 6 ++++++ .../github/ontio/model/dto/NodeInfoOffChainDto.java | 4 ++-- .../java/com/github/ontio/model/dto/NodeStakeDto.java | 4 ++++ .../github/ontio/service/impl/AddressServiceImpl.java | 10 ++++++++++ .../main/resources/mapper/NodeInfoOffChainMapper.xml | 2 ++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/NodeInfoOffChain.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/NodeInfoOffChain.java index d28285bc..3f238836 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/NodeInfoOffChain.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dao/NodeInfoOffChain.java @@ -85,6 +85,12 @@ public class NodeInfoOffChain { @Transient private String progress; + @Transient + private Long totalPos; + + @Transient + private Long maxAuthorize; + @Transient private String userApy; } \ No newline at end of file diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeInfoOffChainDto.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeInfoOffChainDto.java index d177c7fc..08057db2 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeInfoOffChainDto.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeInfoOffChainDto.java @@ -14,7 +14,7 @@ public class NodeInfoOffChainDto extends NodeInfoOffChain { @Builder - public NodeInfoOffChainDto(String publicKey, String name, String address, String ontId, Integer nodeType, String introduction, String logoUrl, String region, BigDecimal longitude, BigDecimal latitude, String ip, String website, String socialMedia, String telegram, String twitter, String facebook, String openMail, String contactMail, Boolean openFlag, Integer verification, Integer contactInfoVerified, Integer feeSharingRatio, Integer ontologyHarbinger, Integer oldNode, Integer badActor, Integer risky, Integer status, String progress, String userApy) { - super(publicKey, name, address, ontId, nodeType, introduction, logoUrl, region, longitude, latitude, ip, website, socialMedia, telegram, twitter, facebook, openMail, contactMail, openFlag, verification, contactInfoVerified, feeSharingRatio, ontologyHarbinger, oldNode, badActor, risky, status, progress, userApy); + public NodeInfoOffChainDto(String publicKey, String name, String address, String ontId, Integer nodeType, String introduction, String logoUrl, String region, BigDecimal longitude, BigDecimal latitude, String ip, String website, String socialMedia, String telegram, String twitter, String facebook, String openMail, String contactMail, Boolean openFlag, Integer verification, Integer contactInfoVerified, Integer feeSharingRatio, Integer ontologyHarbinger, Integer oldNode, Integer badActor, Integer risky, Integer status, String progress, Long totalPos, Long maxAuthorize, String userApy) { + super(publicKey, name, address, ontId, nodeType, introduction, logoUrl, region, longitude, latitude, ip, website, socialMedia, telegram, twitter, facebook, openMail, contactMail, openFlag, verification, contactInfoVerified, feeSharingRatio, ontologyHarbinger, oldNode, badActor, risky, status, progress, totalPos, maxAuthorize, userApy); } } diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeStakeDto.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeStakeDto.java index 389c53b4..c8e9d2a6 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeStakeDto.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeStakeDto.java @@ -29,6 +29,10 @@ public class NodeStakeDto { private boolean allowStake; + private long totalPos; + + private long maxAuthorize; + private int currentRound; // user apr diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/AddressServiceImpl.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/AddressServiceImpl.java index a0a5624d..8d7f9e9c 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/AddressServiceImpl.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/AddressServiceImpl.java @@ -1606,6 +1606,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff String nodeName = nodeInfoOffChain.getName(); String address = nodeInfoOffChain.getAddress(); String progress = nodeInfoOffChain.getProgress(); + Long totalPos = Optional.ofNullable(nodeInfoOffChain.getTotalPos()).orElse(0L); + Long maxAuthorize = Optional.ofNullable(nodeInfoOffChain.getMaxAuthorize()).orElse(0L); int nodeType = nodeInfoOffChain.getNodeType(); // 节点存在且质押进度没到100%,则可以质押 boolean allowStake = progress != null && !"100.00%".equals(progress); @@ -1631,6 +1633,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff dto.setNodeType(nodeType); dto.setNodeState(nodeStatus); dto.setAllowStake(allowStake); + dto.setTotalPos(totalPos); + dto.setMaxAuthorize(maxAuthorize); dto.setCurrentRound(currentRound); dto.setApr(userApy); nodeStakeDtos.add(dto); @@ -1645,6 +1649,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff dto.setNodeType(nodeType); dto.setNodeState(nodeStatus); dto.setAllowStake(allowStake); + dto.setTotalPos(totalPos); + dto.setMaxAuthorize(maxAuthorize); dto.setCurrentRound(currentRound); dto.setApr(userApy); nodeStakeDtos.add(dto); @@ -1659,6 +1665,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff dto.setNodeType(nodeType); dto.setNodeState(nodeStatus); dto.setAllowStake(allowStake); + dto.setTotalPos(totalPos); + dto.setMaxAuthorize(maxAuthorize); dto.setCurrentRound(currentRound); dto.setApr(userApy); nodeStakeDtos.add(dto); @@ -1674,6 +1682,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff dto.setNodeType(nodeType); dto.setNodeState(nodeStatus); dto.setAllowStake(allowStake); + dto.setTotalPos(totalPos); + dto.setMaxAuthorize(maxAuthorize); dto.setCurrentRound(currentRound); dto.setApr(userApy); nodeStakeDtos.add(dto); diff --git a/back-end-projects/Explorer/src/main/resources/mapper/NodeInfoOffChainMapper.xml b/back-end-projects/Explorer/src/main/resources/mapper/NodeInfoOffChainMapper.xml index acf577bd..08192f78 100644 --- a/back-end-projects/Explorer/src/main/resources/mapper/NodeInfoOffChainMapper.xml +++ b/back-end-projects/Explorer/src/main/resources/mapper/NodeInfoOffChainMapper.xml @@ -98,6 +98,8 @@ a.address, a.node_type, b.progress, + b.total_pos, + b.max_authorize, c.user_apy FROM tbl_node_info_off_chain a LEFT JOIN tbl_node_info_on_chain b ON a.public_key = b.public_key