| | |
| | | * 每隔一分钟去处理的定时任务 |
| | | */ |
| | | @Scheduled(fixedRate = 60000) |
| | | public void taskMinute(){ |
| | | public void taskMinute() { |
| | | try { |
| | | //定时修改排课状态 |
| | | coursePackageSchedulingService.taskSetStatus(); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 每隔一分钟去处理的定时任务 预约课时 |
| | | */ |
| | | @Scheduled(cron = "0 0 18 * * ?") |
| | | public void pushOne(){ |
| | | public void pushOne() { |
| | | try { |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.add(Calendar.DATE,1); |
| | | instance.add(Calendar.DATE, 1); |
| | | Date time = instance.getTime(); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format1 = format.format(time); |
| | |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new LambdaQueryWrapper<CoursePackageScheduling>().like(CoursePackageScheduling::getClassDate, format1)); |
| | | for (CoursePackageScheduling coursePackageScheduling : list) { |
| | | CoursePackageStudent one = coursePackageStudentService.getOne(new LambdaQueryWrapper<CoursePackageStudent>().eq(CoursePackageStudent::getCoursePackageSchedulingId, coursePackageScheduling.getId())); |
| | | if(one!=null && one.getReservationStatus()==1){ |
| | | if (one != null && one.getReservationStatus() == 1) { |
| | | Integer appUserId = one.getAppUserId(); |
| | | |
| | | //调用推送 |
| | |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | String s1 = appUserId + "_" + "Class"; |
| | | //定时修改排课状态 |
| | | String s = internalRestTemplate.getForObject("http://mb-cloud-gateway/netty/sendMsgToClient?id="+s1, String.class); |
| | | String s = internalRestTemplate.getForObject("http://mb-cloud-gateway/netty/sendMsgToClient?id=" + s1, String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0 1 0 * * ?") |
| | | public void everyMorningTask() { |
| | | //定时清楚过期的课时 |
| | | coursePackageSchedulingService.taskOverdueClearing(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 零时任务 |
| | | * 每周一执行的定时任务 |
| | | */ |
| | | @Scheduled(cron = "0 0 23 * * *") |
| | | public void zeroTask(){ |
| | | @Scheduled(cron = "0 0 2 * * 2") |
| | | public void weekTask() { |
| | | //定时添加排课数据 |
| | | // coursePackageSchedulingService.taskAddData(); |
| | | coursePackageSchedulingService.cancel(); |
| | | coursePackageSchedulingService.taskCoursePackageScheduling(); |
| | | } |
| | | } |