微信小程序点歌接口

This commit is contained in:
2024-07-09 17:16:11 +08:00
parent 71bc50e8bd
commit ec0dbc3337
22 changed files with 1294 additions and 7 deletions

View File

@@ -2,11 +2,15 @@ package com.chaozhanggui.system.cashierservice.task;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.service.TbShopSongOrderService;
import com.chaozhanggui.system.cashierservice.util.DateUtils;
import com.chaozhanggui.system.cashierservice.util.NicknameGenerator;
import com.chaozhanggui.system.cashierservice.util.RandomUtil;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -19,6 +23,7 @@ import java.util.concurrent.*;
@Component
public class TaskScheduler {
private static final Logger log = LoggerFactory.getLogger(TaskScheduler.class);
@Autowired
private TbWiningUserMapper tbWiningUserMapper;
@Autowired
@@ -31,6 +36,13 @@ public class TaskScheduler {
private TbReleaseFlowMapper releaseFlowMapper;
@Autowired
private TbUserCouponsMapper userCouponsMapper;
private final TbShopSongOrderService shopSongOrderService;
public TaskScheduler(@Qualifier("tbShopSongOrderServiceImpl") TbShopSongOrderService shopSongOrderService) {
this.shopSongOrderService = shopSongOrderService;
}
//更新订单状态
// @Scheduled(fixedRate = 1000000)
public void orderStatus() throws InterruptedException {
@@ -160,4 +172,10 @@ public class TaskScheduler {
long randomMilliseconds = ThreadLocalRandom.current().nextLong(startTimestamp, endTimestamp);
return randomMilliseconds;
}
@Scheduled(fixedRate = 60000)
public void clearSongOrder() {
log.info("定时任务执行,清楚过期歌曲订单");
shopSongOrderService.clearExpireOrder();
}
}