package com.ks.lucky.job;
|
|
import com.ks.lucky.pojo.DO.LuckyMQ;
|
import com.ks.lucky.service.LuckyMQService;
|
import com.xxl.job.core.biz.model.ReturnT;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
import org.springframework.stereotype.Component;
|
|
import javax.annotation.Resource;
|
import java.util.Date;
|
import java.util.List;
|
|
@Component
|
public class MQJob {
|
|
@Resource
|
private LuckyMQService luckyMQService;
|
|
|
@XxlJob("mqjob-sendmq")
|
public ReturnT<String> sendMQ(String param) throws Exception {
|
Date now = new Date();
|
List<LuckyMQ> mqList = luckyMQService.listUnSendMsg(now, 1, 1000);
|
if (mqList != null) {
|
for (LuckyMQ mq : mqList) {
|
luckyMQService.sendMsg(mq.getTaskId());
|
}
|
}
|
return ReturnT.SUCCESS;
|
}
|
|
|
}
|