Browse Source

下架天数

wangqifan 3 years ago
parent
commit
8531be8927

+ 5 - 2
src/main/java/com/izouma/nineth/repo/CollectionRepo.java

@@ -170,8 +170,11 @@ public interface CollectionRepo extends JpaRepository<Collection, Long>, JpaSpec
     @Query("select c.vipQuota from Collection c where c.id = ?1")
     @Query("select c.vipQuota from Collection c where c.id = ?1")
     Integer getVipQuota(Long id);
     Integer getVipQuota(Long id);
 
 
-    @Query(value = "select c.asset_id from collection_info c where  c.source =  'TRANSFER' and c.created_at <= ?1 and c.salable = true and c.on_shelf = true limit 3000", nativeQuery = true)
-    Set<Long> findResaleCollectionOverTime(LocalDateTime startTime);
+    @Query(value = "select c.asset_id from collection_info c where  c.source =  'TRANSFER' and c.created_at <= ?1 and c.created_at <= ?2 and c.salable = true and c.on_shelf = true limit 3000", nativeQuery = true)
+    Set<Long> findResaleCollectionOverTime(LocalDateTime startTime, LocalDateTime ruleTime);
+
+    @Query(value = "select c.asset_id from collection_info c where  c.source =  'TRANSFER' and c.created_at <= ?1 and c.created_at > ?2 and c.salable = true and c.on_shelf = true limit 3000", nativeQuery = true)
+    Set<Long> findResaleCollectionOverTimeV2(LocalDateTime startTime, LocalDateTime ruleTime);
 
 
     List<Collection> findAllByNameLike(String name);
     List<Collection> findAllByNameLike(String name);
 
 

+ 5 - 1
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -932,8 +932,12 @@ public class AssetService {
     @Scheduled(cron = "0 0 0/1 * * ?")
     @Scheduled(cron = "0 0 0/1 * * ?")
     public void offTheShelfAll() {
     public void offTheShelfAll() {
         LocalDateTime lastTime = LocalDateTime.now().minusDays(15);
         LocalDateTime lastTime = LocalDateTime.now().minusDays(15);
+        LocalDateTime newRuleStartTime = LocalDateTime.of(2022, 12, 9, 17, 0, 0);
         Set<Long> assetIds = collectionRepo
         Set<Long> assetIds = collectionRepo
-                .findResaleCollectionOverTime(lastTime);
+                .findResaleCollectionOverTime(lastTime, newRuleStartTime);
+        LocalDateTime newRuleLastTime = LocalDateTime.now().minusDays(30);
+        assetIds.addAll(collectionRepo
+                .findResaleCollectionOverTimeV2(newRuleLastTime, newRuleStartTime));
         assetIds.forEach(this::cancelConsignmentBySystem);
         assetIds.forEach(this::cancelConsignmentBySystem);
     }
     }