use of com.actionworks.flashsale.domain.model.PagesQueryCondition in project flash-sale by ThoughtsBeta.
the class FlashItemWarmUpScheduler method warmUpFlashItemTask.
@Scheduled(cron = "*/5 * * * * ?")
@BetaTrace
public void warmUpFlashItemTask() {
logger.info("warmUpFlashItemTask|秒杀品预热调度");
PagesQueryCondition pagesQueryCondition = new PagesQueryCondition();
pagesQueryCondition.setStockWarmUp(0);
PageResult<FlashItem> pageResult = flashItemDomainService.getFlashItems(pagesQueryCondition);
pageResult.getData().forEach(flashItem -> {
boolean initSuccess = itemStockCacheService.alignItemStocks(flashItem.getId());
if (!initSuccess) {
logger.info("warmUpFlashItemTask|秒杀品库存已经初始化预热失败", flashItem.getId());
return;
}
flashItem.setStockWarmUp(1);
flashItemDomainService.publishFlashItem(flashItem);
logger.info("warmUpFlashItemTask|秒杀品库存已经初始化预热成功", flashItem.getId());
});
}
use of com.actionworks.flashsale.domain.model.PagesQueryCondition in project flash-sale by ThoughtsBeta.
the class FlashItemAppBuilder method toFlashItemsQuery.
public static PagesQueryCondition toFlashItemsQuery(FlashItemsQuery flashItemsQuery) {
PagesQueryCondition pagesQueryCondition = new PagesQueryCondition();
BeanUtils.copyProperties(flashItemsQuery, pagesQueryCondition);
return pagesQueryCondition;
}
use of com.actionworks.flashsale.domain.model.PagesQueryCondition in project flash-sale by ThoughtsBeta.
the class FlashActivityAppBuilder method toFlashActivitiesQuery.
public static PagesQueryCondition toFlashActivitiesQuery(FlashActivitiesQuery flashActivitiesQuery) {
if (flashActivitiesQuery == null) {
return new PagesQueryCondition();
}
PagesQueryCondition pagesQueryCondition = new PagesQueryCondition();
BeanUtils.copyProperties(flashActivitiesQuery, pagesQueryCondition);
return pagesQueryCondition;
}
use of com.actionworks.flashsale.domain.model.PagesQueryCondition in project flash-sale by ThoughtsBeta.
the class FlashItemDomainServiceImpl method getFlashItems.
@Override
public PageResult<FlashItem> getFlashItems(PagesQueryCondition pagesQueryCondition) {
if (pagesQueryCondition == null) {
pagesQueryCondition = new PagesQueryCondition();
}
List<FlashItem> flashItems = flashItemRepository.findFlashItemsByCondition(pagesQueryCondition.buildParams());
Integer total = flashItemRepository.countFlashItemsByCondition(pagesQueryCondition);
logger.info("Get flash items:{}", flashItems.size());
return PageResult.with(flashItems, total);
}
use of com.actionworks.flashsale.domain.model.PagesQueryCondition in project flash-sale by ThoughtsBeta.
the class FlashOrderDomainServiceImpl method getOrdersByUser.
@Override
public PageResult<FlashOrder> getOrdersByUser(Long userId, PagesQueryCondition pagesQueryCondition) {
if (pagesQueryCondition == null) {
pagesQueryCondition = new PagesQueryCondition();
}
List<FlashOrder> flashOrders = flashOrderRepository.findFlashOrdersByCondition(pagesQueryCondition.buildParams());
int total = flashOrderRepository.countFlashOrdersByCondition(pagesQueryCondition.buildParams());
logger.info("Get flash orders:{},{}", userId, flashOrders.size());
return PageResult.with(flashOrders, total);
}
Aggregations