定时任务
This commit is contained in:
parent
d44071565e
commit
eab0cdfa16
@ -3,6 +3,9 @@ package com.ruoyi.web.task;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.quartz.domain.SysJob;
|
||||
import com.ruoyi.quartz.service.ISysJobService;
|
||||
import com.ruoyi.system.domain.Perform;
|
||||
import com.ruoyi.system.mapper.PerformMapper;
|
||||
import com.ruoyi.system.service.IPerformService;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -22,6 +25,10 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class RyTask {
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
@Autowired
|
||||
private IPerformService performService;
|
||||
@Autowired
|
||||
private PerformMapper performMapper;
|
||||
|
||||
/**
|
||||
* 抢票
|
||||
@ -29,6 +36,8 @@ public class RyTask {
|
||||
* @param pid
|
||||
*/
|
||||
public void rob(Long pid, Long jobId) throws SchedulerException {
|
||||
Perform perform = performService.selectPerformById(pid);
|
||||
|
||||
System.out.println(pid + "," + jobId);
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
@ -96,6 +96,7 @@ public class PerformServiceImpl implements IPerformService {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.HOUR_OF_DAY, -1);
|
||||
calendar.add(Calendar.MINUTE, 9);
|
||||
// 获取年、月、日、时、分、秒
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
int month = calendar.get(Calendar.MONTH) + 1; // 月份从0开始,所以加1
|
||||
|
Loading…
Reference in New Issue
Block a user