| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.controller.CoursePackagePaymentController; |
| | | import com.dsh.course.entity.CoursePackageScheduling; |
| | | import com.dsh.course.entity.CoursePackageStudent; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.mapper.CoursePackageSchedulingMapper; |
| | | import com.dsh.course.model.QueryCoursePackageSchedulingList; |
| | | import com.dsh.course.model.vo.response.AppUserVideoResponse; |
| | | import com.dsh.course.service.CoursePackageStudentService; |
| | | import com.dsh.course.service.ICoursePackageSchedulingService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService packagePaymentService; |
| | | /** |
| | | * 定时修改状态 |
| | | */ |
| | | @Override |
| | | public void cancel() { |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(); |
| | | Date now = new Date(); |
| | | List<Long> pays = new ArrayList<>(); |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | if (now.before(coursePackagePayment.getUseTime())){ |
| | | pays.add(coursePackagePayment.getId()); |
| | | } |
| | | } |
| | | |
| | | List<CoursePackageStudent> coursePackagePaymentId = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().in("coursePackagePaymentId", pays)); |
| | | List<Long> scs = new ArrayList<>(); |
| | | for (CoursePackageStudent coursePackageStudent : coursePackagePaymentId) { |
| | | scs.add(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | } |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().in("coursePackagePaymentId", pays)); |
| | | coursePackageSchedulingMapper.delete(new QueryWrapper<CoursePackageScheduling>().in("id",scs)); |
| | | |
| | | |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | /** |
| | | * 定时修改状态 |
| | | */ |