licailing il y a 4 ans
Parent
commit
aa5a92cd8a
1 fichiers modifiés avec 15 ajouts et 15 suppressions
  1. 15 15
      src/main/java/com/izouma/nineth/service/CollectionService.java

+ 15 - 15
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -60,21 +60,21 @@ public class CollectionService {
 
     private final Map<Long, ScheduledFuture<?>> tasks = new HashMap<>();
 
-//    @PostConstruct
-//    public void init() {
-//        List<Collection> collections = collectionRepo.findByScheduleSaleTrueAndOnShelfFalseAndStartTimeBeforeAndDelFalse(LocalDateTime.now());
-//        for (Collection collection : collections) {
-//            onShelfTask(collection);
-//        }
-//        for (CollectionStockAndSale collection : collectionRepo.getStockAndSale()) {
-//            if (redisTemplate.opsForValue().get("collectionStock::" + collection.getId()) == null) {
-//                redisTemplate.opsForValue().set("collectionStock::" + collection.getId(), collection.getStock());
-//            }
-//            if (redisTemplate.opsForValue().get("collectionSale::" + collection.getId()) == null) {
-//                redisTemplate.opsForValue().set("collectionSale::" + collection.getId(), collection.getSale());
-//            }
-//        }
-//    }
+    @PostConstruct
+    public void init() {
+        List<Collection> collections = collectionRepo.findByScheduleSaleTrueAndOnShelfFalseAndStartTimeBeforeAndDelFalse(LocalDateTime.now());
+        for (Collection collection : collections) {
+            onShelfTask(collection);
+        }
+        for (CollectionStockAndSale collection : collectionRepo.getStockAndSale()) {
+            if (redisTemplate.opsForValue().get("collectionStock::" + collection.getId()) == null) {
+                redisTemplate.opsForValue().set("collectionStock::" + collection.getId(), collection.getStock());
+            }
+            if (redisTemplate.opsForValue().get("collectionSale::" + collection.getId()) == null) {
+                redisTemplate.opsForValue().set("collectionSale::" + collection.getId(), collection.getSale());
+            }
+        }
+    }
 
     public Page<Collection> all(PageQuery pageQuery) {
         pageQuery.getQuery().put("del", false);