拷贝课程日志优化

This commit is contained in:
limqhz
2022-03-14 16:39:20 +08:00
parent 5012f0e7a3
commit 6910ba2f4f

View File

@@ -42,7 +42,6 @@ public class CopyLessonTask {
*/
@Scheduled(cron = "0 */1 * * * ?")
public void execute(){
logger.info("开始执行拷贝课程批处理");
LocalTime time = LocalTime.now();
LocalDate date = LocalDate.now();
logger.info(time.toString());
@@ -55,13 +54,15 @@ public class CopyLessonTask {
// 非篮球馆有课程
LocalTime copyTime = venue.getCopyTime();
if (checkTime(time,copyTime)){
Integer id = venue.getId();
logger.info("开始执行拷贝课程" + id);
LocalDate startDate = date.plusDays(-7);
LocalDate endDate = date.plusDays(-1);
String startTime = dtf.format(startDate);
String endTime = dtf.format(endDate);
List<VenueLesson> allForCopy = venueLessonService.findAllForCopy(startTime, endTime,venue.getId());
List<VenueLesson> allForCopy = venueLessonService.findAllForCopy(startTime, endTime, id);
if (allForCopy!= null && allForCopy.size()>0){
logger.info("需要操作的课程数为:" + allForCopy.size());
logger.info(id + "需要操作的课程数为:" + allForCopy.size());
Integer copyTarget = venue.getCopyTarget();
if (copyTarget == null){
copyTarget = 1;
@@ -72,7 +73,7 @@ public class CopyLessonTask {
Date copyDate = DateUtilCard.addDays(venueLesson.getDate(), 7 * copyTarget + 7);
venueLessonService.copyOneLesson(venueLesson.getId(),copyDate);
}
logger.info("拷贝的课程数量为:" + count);
logger.info(id + "拷贝的课程数量为:" + count);
}
}
}