xiongzhu 4 years ago
parent
commit
9446aaeedd

+ 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> findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBefore(LocalDateTime time);
+    List<Asset> findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeOrderByCreatedAtDesc(LocalDateTime time);
 
     @Query("select id from Asset where status = ?1")
     List<Long> findAllByStatus(AssetStatus status);

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

@@ -140,7 +140,7 @@ public class AssetController extends BaseController {
 
     @GetMapping("/mint")
     public String mint() {
-        for (Asset asset : assetRepo.findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBefore(LocalDateTime.now())) {
+        for (Asset asset : assetRepo.findByTxHashIsNullAndTokenIdNotNullAndCreatedAtBeforeOrderByCreatedAtDesc(LocalDateTime.now())) {
             rocketMQTemplate.syncSend(generalProperties.getMintTopic(), asset.getId());
         }
         return "ok";