| | |
| | | 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 |
| | |
| | | private CoursePackageSchedulingMapper coursePackageSchedulingMapper; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取课包排课数据 |
| | | * |
| | | * @param page |
| | | * @param queryCoursePackageSchedulingList |
| | | * @return |
| | |
| | | // map.put("registered", count); |
| | | int count1 = coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", id).eq("reservationStatus", 1)); |
| | | int count2 = coursePackageStudentService.count(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", id).eq("reservationStatus", 0)); |
| | | |
| | | |
| | | map.put("registered", count2); |
| | | map.put("actualArrival", count1); |
| | | map.put("nonArrival", count - count1); |
| | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if(null != coursePackageScheduling){ |
| | | if (null != coursePackageScheduling) { |
| | | calendar.setTime(sdf1.parse(sdf.format(coursePackageScheduling.getClassDate()) + " 00:00:00")); |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1); |
| | | }else{ |
| | | } else { |
| | | calendar.setTime(sdf1.parse(sdf.format(new Date()) + " 00:00:00")); |
| | | } |
| | | coursePackageScheduling = new CoursePackageScheduling(); |
| | |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingMapper.insert(coursePackageScheduling); |
| | | } |
| | | }catch (Exception e){ |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | /** |
| | | * 定时修改状态 |
| | |
| | | coursePackageSchedulingMapper.updateById(coursePackageScheduling); |
| | | |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageScheduling.getCoursePackageId()); |
| | | if(coursePackage.getStatus() == 1){ |
| | | if (coursePackage.getStatus() == 1) { |
| | | coursePackage.setStatus(2); |
| | | coursePackageService.updateById(coursePackage); |
| | | } |
| | |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | @Override |
| | | public List<AppUserVideoResponse> queryAll(List<Long> longs) { |
| | | |
| | | if (longs.size() > 0) { |
| | | List<AppUserVideoResponse> appUserVideoResponses = this.baseMapper.queryAll(longs); |
| | | |
| | | for (AppUserVideoResponse appUserVideoRespon : appUserVideoResponses) { |
| | | if (appUserVideoRespon.getVideoId() != null) { |
| | | if (this.baseMapper.isHave(appUserVideoRespon.getVideoId()) > 0) { |
| | | appUserVideoRespon.setStudyStatus(2); |
| | | } else { |
| | | appUserVideoRespon.setStudyStatus(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return appUserVideoResponses; |
| | | |
| | | } else return null; |
| | | |
| | | } |
| | | } |