2024-03-30 15:17:31 +08:00
|
|
|
package com.ics.quartz.task;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import com.ics.admin.domain.meeting.Reservation;
|
|
|
|
import com.ics.admin.service.meeting.IReservationService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
@Component("payTimeOutTask")
|
|
|
|
public class PayTimeOutTask {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private IReservationService iReservationService;
|
|
|
|
|
|
|
|
|
|
|
|
// 支付超时处理
|
|
|
|
public void payTimeOut() {
|
|
|
|
log.info("执行支付超时处理任务");
|
|
|
|
// 处理逻辑
|
|
|
|
Reservation reservation = new Reservation();
|
|
|
|
reservation.setStatusValue(0);
|
|
|
|
List<Reservation> reservations = iReservationService.selectReservationList(reservation);
|
|
|
|
for (Reservation reservation1 : reservations) {
|
|
|
|
Date endDate = reservation1.getEndDate();
|
|
|
|
DateUtil.offset(endDate, DateField.MINUTE, 5);
|
|
|
|
int compare = DateUtil.compare(DateUtil.date(), endDate);
|
|
|
|
if (compare < 0) {
|
|
|
|
reservation1.setStauts(Reservation.Status.CANCELED);
|
2024-04-08 11:15:03 +08:00
|
|
|
reservation1.setCancelResaon("管理员取消原因为:支付超时");
|
2024-03-30 15:17:31 +08:00
|
|
|
iReservationService.updateReservation(reservation1);
|
|
|
|
log.info("支付超时处理任务执行成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 开会开始状态
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void meetingStartStatus() {
|
|
|
|
log.info("执行开会开始状态任务");
|
|
|
|
Reservation reservation = new Reservation();
|
|
|
|
|
|
|
|
reservation.setStatusValue(1);
|
|
|
|
List<Reservation> reservations = iReservationService.selectReservationList(reservation);
|
|
|
|
for (Reservation reservation1 : reservations) {
|
|
|
|
Date startTime = reservation1.getStartTime();
|
|
|
|
Date endDate = reservation1.getEndDate();
|
|
|
|
boolean in = DateUtil.isIn(DateUtil.date(), startTime, endDate);
|
|
|
|
if (in) {
|
|
|
|
reservation1.setStauts(Reservation.Status.ONGOING);
|
|
|
|
iReservationService.updateReservation(reservation1);
|
|
|
|
log.info("执行开会开始状态任务");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|