| | |
| | | package com.dsh.other.util; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.other.entity.SiteBooking; |
| | | import com.dsh.other.feignclient.account.StudentHonorClient; |
| | | import com.dsh.other.feignclient.account.model.StudentHonor; |
| | | import com.dsh.other.mapper.SiteBookingMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private SiteBookingMapper siteBookingMapper; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 |
| | |
| | | if (System.currentTimeMillis() > time) { |
| | | siteBooking.setStatus(4); |
| | | siteBookingMapper.updateById(siteBooking); |
| | | |
| | | //添加勋章数据 |
| | | Integer number = siteBookingMapper.selectCount(new QueryWrapper<SiteBooking>() |
| | | .eq("appUserId", siteBooking.getAppUserId()).in("status", Arrays.asList(3, 4))); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(siteBooking.getAppUserId()); |
| | | studentHonor.setHonorType(3); |
| | | studentHonor.setNumber(number); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | |
| | | } |
| | | } |
| | | //定时修改赛事状态 |
| | |
| | | try { |
| | | // 获取待核销状态的记录 |
| | | List<SiteBooking> siteBookings = siteBookingMapper.selectList(new LambdaQueryWrapper<SiteBooking>() |
| | | .eq(SiteBooking::getStatus, 1)); |
| | | .eq(SiteBooking::getStatus, 0).eq(SiteBooking::getState, 1)); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | if(null == siteBooking.getEndTime()){ |
| | | continue; |
| | | } |
| | | long time = siteBooking.getEndTime().getTime(); |
| | | if (System.currentTimeMillis() > time) { |
| | | siteBooking.setStatus(4); |
| | | long time = siteBooking.getInsertTime().getTime(); |
| | | if (System.currentTimeMillis() > time + 1800000L) { |
| | | siteBooking.setState(3); |
| | | siteBookingMapper.updateById(siteBooking); |
| | | } |
| | | } |