Jelajahi Sumber

refactor(vaultody): 优化配置验证和交易导出功能

- 移除 ManagerConstants 中的无效常量 NOT_PERMIT
- 将 TransactionItemExport 的 id 字段类型从 String 改为 Long
- 重新调整 Excel 列索引,移除区块高度字段并更新手续费相关字段位置
- 实现多链交易链接跳转逻辑,ETH 链使用 etherscan,其他链使用 tronscan
- 更新配置验证异常处理,统一使用 Constants.NOT_PERMIT 常量
kongxiangyang 2 bulan lalu
induk
melakukan
bc7ce8903f

+ 5 - 1
crm-manager/src/main/java/com/crm/manager/controller/VaultodyController.java

@@ -66,7 +66,11 @@ public class VaultodyController {
         for (TransactionItemTable item : items) {
             TransactionItemExport exportDto = new TransactionItemExport();
             BeanUtils.copyProperties(item, exportDto);
-            exportDto.setTransactionId("https://tronscan.org/#/transaction/"+exportDto.getTransactionId());
+            if("ETH".equals(exportDto.getRecipientAmountUnit())){
+                exportDto.setTransactionId("https://tronscan.org/#/transaction/"+exportDto.getTransactionId());
+            }else {
+                exportDto.setTransactionId("https://etherscan.io/tx/"+exportDto.getTransactionId());
+            }
             exportDtos.add(exportDto);
         }
         ExportUtil.transferToResponse(FileProcessUtil.genExportFileName("VAULTODY_VAULT_TRANSACTIONS"), exportDtos,

+ 2 - 2
crm-manager/src/main/java/com/crm/manager/service/impl/VaultodyServiceImpl.java

@@ -213,13 +213,13 @@ public class VaultodyServiceImpl implements VaultodyService {
         VaultodyConfig vaultodyConfig = JSON.parseObject(property, VaultodyConfig.class);
         List<VaultodyConfig> vaultodyList = vaultodyConfig.getVaultodyList();
         if(CollectionUtils.isEmpty(vaultodyList)){
-            throw ServiceException.exception(ManagerConstants.NOT_PERMIT);
+            throw ServiceException.exception(Constants.NOT_PERMIT);
         }
 
         Map<String, VaultodyConfig> list = vaultodyList.stream().collect(Collectors.toMap(VaultodyConfig::getVaultId, v -> v));
         VaultodyConfig config = new VaultodyConfig();
         if(!list.containsKey(vaultId)){
-            throw ServiceException.exception(ManagerConstants.NOT_PERMIT);
+            throw ServiceException.exception(Constants.NOT_PERMIT);
         }
         config = list.get(vaultId);
         return config;

+ 0 - 1
crm-model/src/main/java/com/crm/rely/backend/model/constant/ManagerConstants.java

@@ -8,6 +8,5 @@ package com.crm.rely.backend.model.constant;
  */
 public class ManagerConstants {
     public static final String ROLE_USER_PREFIX = "CRM_PAY_";
-    public final static String NOT_PERMIT = "not_permit";
 
 }

+ 3 - 5
crm-model/src/main/java/com/crm/rely/backend/model/dto/export/TransactionItemExport.java

@@ -8,7 +8,7 @@ public class TransactionItemExport {
     @ExcelProperty(value = "请求id", index = 0)
     private String requestId;
     @ExcelProperty(value = "交易流水id", index = 1)
-    private String id;
+    private Long id;
     @ExcelProperty(value = "链上真实交易哈希值", index = 2)
     private String transactionId;
     @ExcelProperty(value = "交易状态", index = 3)
@@ -36,10 +36,8 @@ public class TransactionItemExport {
 
     @ExcelProperty(value = "所属区块链", index = 13)
     private String blockchain;
-    @ExcelProperty(value = "区块高度", index = 14)
-    private String minedInBlockHeight;
-    @ExcelProperty(value = "区块链手续费", index = 15)
+    @ExcelProperty(value = "区块链手续费", index = 14)
     private String feeAmount;
-    @ExcelProperty(value = "区块链手续费币种", index = 16)
+    @ExcelProperty(value = "区块链手续费币种", index = 15)
     private String feeAmountUnit;
 }