|
@@ -21,12 +21,14 @@ import com.xjrsoft.module.courseTable.service.ICourseTableService;
|
|
|
import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
|
|
|
import com.xjrsoft.module.schedule.dto.CourseTableDto;
|
|
|
import com.xjrsoft.module.schedule.dto.CourseTablePreCheckDto;
|
|
|
+import com.xjrsoft.module.schedule.dto.ScheduleWeekDto;
|
|
|
import com.xjrsoft.module.schedule.dto.ScheduleWeekExportQueryDto;
|
|
|
import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
|
|
|
import com.xjrsoft.module.schedule.service.ICourseReceiveMsgService;
|
|
|
import com.xjrsoft.module.schedule.util.ScheduleUtil;
|
|
|
import com.xjrsoft.module.schedule.vo.CourseListVo;
|
|
|
import com.xjrsoft.module.schedule.vo.CourseTableVo;
|
|
|
+import com.xjrsoft.module.schedule.vo.ScheduleWeekVo;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
|
|
|
import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
@@ -51,6 +53,7 @@ import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -308,4 +311,36 @@ public class ScheduleController {
|
|
|
return RT.error(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping(value = "/week-list")
|
|
|
+ @ApiOperation(value="获取周次列表")
|
|
|
+ @SaCheckPermission("room:detail")
|
|
|
+ public RT<List<ScheduleWeekVo>> weekList(@Valid ScheduleWeekDto dto){
|
|
|
+ List<BaseSemester> semesterList = semesterService.list(new QueryWrapper<BaseSemester>().lambda().orderByDesc(BaseSemester::getStartDate));
|
|
|
+ BaseSemester baseSemester = semesterList.get(0);
|
|
|
+ if(dto.getSemesterId() != null){
|
|
|
+ baseSemester = semesterService.getById(dto.getSemesterId());
|
|
|
+ }
|
|
|
+ LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());
|
|
|
+ Duration between = Duration.between(startDateTime, endDateTime);
|
|
|
+ long days = between.toDays();
|
|
|
+ int weeks = (int) Math.ceil((double) days / 7);
|
|
|
+ List<ScheduleWeekVo> result = new ArrayList<>();
|
|
|
+ for (int i = 0; i < weeks; i++) {
|
|
|
+ LocalDateTime startDate = startDateTime.plusDays(i * 6).withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
+ LocalDateTime endDate = startDateTime.plusDays((i + 1) * 6).withHour(23).withMinute(59).withSecond(59).withNano(9999);
|
|
|
+ int week = i + 1;
|
|
|
+ result.add(
|
|
|
+ new ScheduleWeekVo(){{
|
|
|
+ setWeek(week);
|
|
|
+ setWeekCn("第" + week + "周");
|
|
|
+ setStartDate(startDate.toLocalDate());
|
|
|
+ setEndDate(endDate.toLocalDate());
|
|
|
+ }}
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ return RT.ok(result);
|
|
|
+ }
|
|
|
}
|