Explorar o código

1.导出字段和列表保持一致
2.区块链地址修改
3.列表时间倒序

kongxiangyang hai 1 mes
pai
achega
77b25c99ff

+ 3 - 4
crm-manager/src/main/java/com/crm/manager/controller/VaultodyController.java

@@ -1,6 +1,7 @@
 package com.crm.manager.controller;
 
 import com.crm.manager.service.VaultodyService;
+import com.crm.manager.util.BlockchainUtils;
 import com.crm.rely.backend.core.dto.base.BaseResultDto;
 import com.crm.rely.backend.model.dto.export.TransactionItemExport;
 import com.crm.rely.backend.model.entity.vaultody.vaults.VaultTransactionsEntity;
@@ -71,10 +72,8 @@ public class VaultodyController {
         for (TransactionItemTable item : items) {
             TransactionItemExport exportDto = new TransactionItemExport();
             BeanUtils.copyProperties(item, exportDto);
-            if("ETH".equals(exportDto.getBlockchain())){
-                exportDto.setTransactionId("https://etherscan.io/tx/"+exportDto.getTransactionId());
-            }else {
-                exportDto.setTransactionId("https://tronscan.org/#/transaction/"+exportDto.getTransactionId());
+            if(StringUtils.isNotBlank(item.getBlockchain()) && StringUtils.isNotBlank(item.getTransactionId())){
+                exportDto.setTransactionId(BlockchainUtils.getTransactionUrl(item.getBlockchain(), item.getTransactionId()));
             }
             exportDto.setCreatedTimestamp(secondToDateTimeStr(item.getCreatedTimestamp()));
             exportDtos.add(exportDto);

+ 20 - 0
crm-manager/src/main/java/com/crm/manager/util/BlockchainUtils.java

@@ -0,0 +1,20 @@
+package com.crm.manager.util;
+
+public class BlockchainUtils {
+
+    public static String getTransactionUrl(String blockchain, String transactionId) {
+        String url = null;
+        switch (blockchain) {
+            case "ethereum":
+                url = "https://etherscan.io/tx/" + transactionId;
+                break;
+            case "tron":
+                url = "https://tronscan.org/#/transaction/" + transactionId;
+                break;
+            default:
+                break;
+        }
+        return url;
+    }
+
+}

+ 2 - 0
crm-manager/src/main/resources/mapper/TransactionItemMapper.xml

@@ -34,10 +34,12 @@
     <select id="countList" resultType="java.lang.Integer">
         select count(*) from transaction_item ti
         <include refid="transactionItemWhere"/>
+        order by ti.created_timestamp desc
     </select>
 
     <select id="pageList" resultType="com.crm.rely.backend.model.pojo.table.TransactionItemTable">
         select * from transaction_item ti
         <include refid="transactionItemWhere"/>
+        order by ti.created_timestamp desc
     </select>
 </mapper>

+ 18 - 22
crm-model/src/main/java/com/crm/rely/backend/model/dto/export/TransactionItemExport.java

@@ -5,37 +5,33 @@ import lombok.Data;
 
 @Data
 public class TransactionItemExport {
-    @ExcelProperty(value = "请求id", index = 0)
-    private String requestId;
-    @ExcelProperty(value = "链上真实交易哈希值", index = 1)
-    private String transactionId;
-    @ExcelProperty(value = "交易状态", index = 2)
+    @ExcelProperty(value = "交易状态", index = 0)
     private String status;
-    @ExcelProperty(value = "创建时间", index = 3)
+    @ExcelProperty(value = "创建时间", index = 1)
     private String createdTimestamp;
-
-    @ExcelProperty(value = "转出钱包地址", index = 4)
+    @ExcelProperty(value = "转出钱包地址", index = 2)
     private String senderAddress;
-    @ExcelProperty(value = "转出钱包币种", index = 5)
+    @ExcelProperty(value = "付款钱包名称", index = 3)
+    private String senderLabel;
+    @ExcelProperty(value = "转出币种", index = 4)
     private String senderAmountUnit;
-    @ExcelProperty(value = "转出货币金额", index = 6)
+    @ExcelProperty(value = "转出金额", index = 5)
     private String senderAmount;
-    @ExcelProperty(value = "转出钱包名称", index = 7)
-    private String senderLabel;
-
-    @ExcelProperty(value = "收款钱包地址", index = 8)
+    @ExcelProperty(value = "收款钱包地址", index = 6)
     private String recipientAddress;
-    @ExcelProperty(value = "收款钱包币种", index = 9)
+    @ExcelProperty(value = "收款钱包名称", index = 7)
+    private String recipientLabel;
+    @ExcelProperty(value = "收款币种", index = 8)
     private String recipientAmountUnit;
-    @ExcelProperty(value = "收到货币金额", index = 10)
+    @ExcelProperty(value = "收到金额", index = 9)
     private String recipientAmount;
-    @ExcelProperty(value = "收款钱包名称", index = 11)
-    private String recipientLabel;
-
-    @ExcelProperty(value = "所属区块链", index = 12)
+    @ExcelProperty(value = "所属区块链", index = 10)
     private String blockchain;
-    @ExcelProperty(value = "区块链手续费", index = 13)
+    @ExcelProperty(value = "区块链手续费", index = 11)
     private String feeAmount;
-    @ExcelProperty(value = "区块链手续费币种", index = 14)
+    @ExcelProperty(value = "手续费币种", index = 12)
     private String feeAmountUnit;
+    @ExcelProperty(value = "链上交易哈希", index = 13)
+    private String transactionId;
+
 }