xiongzhu 3 anni fa
parent
commit
2e3ec69914

+ 1 - 1
src/main/java/com/izouma/nineth/repo/AssetRepo.java

@@ -44,7 +44,7 @@ public interface AssetRepo extends JpaRepository<Asset, Long>, JpaSpecificationE
 
     Asset findFirstByTokenIdAndCreatedAtAfterOrderByCreatedAt(String tokenId, LocalDateTime time);
 
-    List<Asset> findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeOrderByCreatedAtDesc(LocalDateTime time);
+    List<Asset> findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeAndStatusOrderByCreatedAtDesc(LocalDateTime time, AssetStatus status);
 
     @Query("select id from Asset where status = ?1")
     List<Long> findAllByStatus(AssetStatus status);

+ 2 - 1
src/main/java/com/izouma/nineth/web/AssetController.java

@@ -7,6 +7,7 @@ import com.izouma.nineth.domain.GiftOrder;
 import com.izouma.nineth.domain.User;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.dto.UserHistory;
+import com.izouma.nineth.enums.AssetStatus;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.AssetRepo;
 import com.izouma.nineth.repo.TokenHistoryRepo;
@@ -140,7 +141,7 @@ public class AssetController extends BaseController {
 
     @GetMapping("/mint")
     public String mint() {
-        for (Asset asset : assetRepo.findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeOrderByCreatedAtDesc(LocalDateTime.now())) {
+        for (Asset asset : assetRepo.findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeAndStatusOrderByCreatedAtDesc(LocalDateTime.now(), AssetStatus.NORMAL)) {
             rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
         }
         return "ok";