Przeglądaj źródła

1.交易详情列表时间筛选
2.导出链接跳转

kongxiangyang 1 miesiąc temu
rodzic
commit
96eb5f3431

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

@@ -72,9 +72,9 @@ public class VaultodyController {
             TransactionItemExport exportDto = new TransactionItemExport();
             BeanUtils.copyProperties(item, exportDto);
             if("ETH".equals(exportDto.getRecipientAmountUnit())){
-                exportDto.setTransactionId("https://tronscan.org/#/transaction/"+exportDto.getTransactionId());
-            }else {
                 exportDto.setTransactionId("https://etherscan.io/tx/"+exportDto.getTransactionId());
+            }else {
+                exportDto.setTransactionId("https://tronscan.org/#/transaction/"+exportDto.getTransactionId());
             }
             exportDto.setCreatedTimestamp(secondToDateTimeStr(item.getCreatedTimestamp()));
             exportDtos.add(exportDto);

+ 3 - 2
crm-manager/src/main/java/com/crm/manager/dao/mapper/TransactionItemMapper.java

@@ -3,12 +3,13 @@ package com.crm.manager.dao.mapper;
 import com.crm.rely.backend.model.entity.vaultody.vaults.VaultTransactionsSearchEntity;
 import com.crm.rely.backend.model.pojo.table.TransactionItemTable;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 @Mapper
 public interface TransactionItemMapper {
-    Integer countList(VaultTransactionsSearchEntity entity);
+    Integer countList(@Param("entity") VaultTransactionsSearchEntity entity, @Param("startSecond") Long startSecond, @Param("endSecond") Long endSecond);
 
-    List<TransactionItemTable> pageList(VaultTransactionsSearchEntity entity);
+    List<TransactionItemTable> pageList(@Param("entity") VaultTransactionsSearchEntity entity, @Param("startSecond") Long startSecond, @Param("endSecond") Long endSecond);
 }

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

@@ -6,6 +6,7 @@ import com.crm.manager.repository.TransactionItemRepository;
 import com.crm.manager.service.SysConfigService;
 import com.crm.manager.service.SysVaultodyConfigService;
 import com.crm.manager.service.VaultodyService;
+import com.crm.manager.util.DateUtils;
 import com.crm.rely.backend.core.constant.Constants;
 import com.crm.rely.backend.core.dto.base.BaseResultDto;
 import com.crm.rely.backend.core.dto.base.PageDto;
@@ -368,7 +369,15 @@ public class VaultodyServiceImpl implements VaultodyService {
     public List<TransactionItemTable> queryExportItems (VaultTransactionsEntity entity) throws Exception{
         VaultTransactionsSearchEntity vaultTransactionsSearchEntity = new VaultTransactionsSearchEntity();
         BeanUtils.copyProperties(entity, vaultTransactionsSearchEntity);
-        return transactionItemMapper.pageList(vaultTransactionsSearchEntity);
+        Long startTime = null;
+        Long endTime = null;
+        if(entity.getStartTime() != null){
+            startTime = DateUtils.dateToSecondTimestamp(entity.getStartTime());
+        }
+        if (entity.getEndTime() != null){
+            endTime = DateUtils.dateToSecondTimestamp(entity.getEndTime());
+        }
+        return transactionItemMapper.pageList(vaultTransactionsSearchEntity,startTime,endTime);
     }
 
     @Override
@@ -396,12 +405,23 @@ public class VaultodyServiceImpl implements VaultodyService {
             }
             batchSave(tables);
         }
-        Integer count = transactionItemMapper.countList(entity);
+
+        Long startSecond = null;
+        Long endSecond = null;
+
+        if(entity.getStartTime() != null){
+            startSecond = DateUtils.dateToSecondTimestamp(entity.getStartTime());
+        }
+        if (entity.getEndTime() != null){
+            endSecond = DateUtils.dateToSecondTimestamp(entity.getEndTime());
+        }
+
+        Integer count = transactionItemMapper.countList(entity,startSecond,endSecond);
         if (count == null || count <= 0) {
             return ResultWithPagerDto.success(new PageDto(), new ArrayList<>());
         }
         PageDto pageDto = PageDto.format(entity, count);
-        List<TransactionItemTable> dtos = transactionItemMapper.pageList(entity);
+        List<TransactionItemTable> dtos = transactionItemMapper.pageList(entity,startSecond,endSecond);
 
         if (dtos == null || dtos.size() <= 0) {
             throw new ServiceException(Constants.SYSTEM_ERROR);

+ 16 - 0
crm-manager/src/main/java/com/crm/manager/util/DateUtils.java

@@ -0,0 +1,16 @@
+package com.crm.manager.util;
+
+import java.util.Date;
+
+public class DateUtils {
+
+    /**
+     * Date 转 秒级时间戳(数据库存的就是这个)
+     */
+    public static long dateToSecondTimestamp(Date date) {
+        if (date == null) {
+            return 0;
+        }
+        return date.getTime() / 1000; // 毫秒 → 秒(关键)
+    }
+}

+ 17 - 10
crm-manager/src/main/resources/mapper/TransactionItemMapper.xml

@@ -6,20 +6,27 @@
 
     <sql id="transactionItemWhere">
         <where>
-            <if test="senderAddress != null and senderAddress != ''">
-                and ti.`sender_address` LIKE CONCAT('%', #{senderAddress}, '%')
+            <if test="entity.senderAddress != null and entity.senderAddress != ''">
+                and ti.`sender_address` LIKE CONCAT('%', #{entity.senderAddress}, '%')
             </if>
-            <if test="recipientAddress != null and recipientAddress != ''">
-                and ti.`recipient_address` LIKE CONCAT('%', #{recipientAddress}, '%')
+            <if test="entity.recipientAddress != null and entity.recipientAddress != ''">
+                and ti.`recipient_address` LIKE CONCAT('%', #{entity.recipientAddress}, '%')
             </if>
-            <if test="senderLabel != null and senderLabel != ''">
-                and ti.`sender_label` LIKE CONCAT('%', #{senderLabel}, '%')
+            <if test="entity.senderLabel != null and entity.senderLabel != ''">
+                and ti.`sender_label` LIKE CONCAT('%', #{entity.senderLabel}, '%')
             </if>
-            <if test="recipientLabel != null and recipientLabel != ''">
-                and ti.`recipient_label` LIKE CONCAT('%', #{recipientLabel}, '%')
+            <if test="entity.recipientLabel != null and entity.recipientLabel != ''">
+                and ti.`recipient_label` LIKE CONCAT('%', #{entity.recipientLabel}, '%')
             </if>
-            <if test="vaultId != null and vaultId != ''">
-                and ti.`vault_id` = #{vaultId}
+            <if test="entity.vaultId != null and entity.vaultId != ''">
+                and ti.`vault_id` = #{entity.vaultId}
+            </if>
+            <!-- 时间范围查询 -->
+            <if test="startSecond != null">
+                AND created_timestamp &gt;= #{startSecond}
+            </if>
+            <if test="endSecond != null">
+                AND created_timestamp &lt;= #{endSecond}
             </if>
         </where>
     </sql>

+ 11 - 0
crm-model/src/main/java/com/crm/rely/backend/model/entity/vaultody/vaults/VaultTransactionsEntity.java

@@ -2,6 +2,8 @@ package com.crm.rely.backend.model.entity.vaultody.vaults;
 
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * 获取保险箱交易记录入参
  */
@@ -37,4 +39,13 @@ public class VaultTransactionsEntity {
      * 收款钱包名称
      */
     private String recipientLabel;
+
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+    /**
+     * 结束时间
+     */
+    private Date endTime;
 }

+ 10 - 0
crm-model/src/main/java/com/crm/rely/backend/model/entity/vaultody/vaults/VaultTransactionsSearchEntity.java

@@ -3,6 +3,8 @@ package com.crm.rely.backend.model.entity.vaultody.vaults;
 import com.crm.rely.backend.core.entity.base.BaseSearchPageEntity;
 import lombok.Data;
 
+import java.util.Date;
+
 @Data
 public class VaultTransactionsSearchEntity extends BaseSearchPageEntity {
     /**
@@ -34,4 +36,12 @@ public class VaultTransactionsSearchEntity extends BaseSearchPageEntity {
      * 收款钱包名称
      */
     private String recipientLabel;
+    /**
+     * 开始时间
+     */
+    private Date startTime;
+    /**
+     * 结束时间
+     */
+    private Date endTime;
 }