|
|
@@ -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);
|