|
|
|
@ -33,8 +33,10 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.time.Instant;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneId;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -67,12 +69,12 @@ public class AdminIndexDutyServiceImpl implements AdminIndexDutyService {
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public DutyIndexData getIndexData(String periodId) {
|
|
|
|
|
public DutyIndexData getIndexData(TimeRangeDto timeRangeDto) {
|
|
|
|
|
User loginUser = SecurityUtil.getLoginUser();
|
|
|
|
|
String schoolId = loginUser.getSchoolId();
|
|
|
|
|
|
|
|
|
|
final int SLICE_SIZE = 100;
|
|
|
|
|
if (StringUtils.isBlank(periodId)) {
|
|
|
|
|
if (StringUtils.isBlank(timeRangeDto.getPeriodId())) {
|
|
|
|
|
throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "不能为空");
|
|
|
|
|
}
|
|
|
|
|
final DutyIndexData DutyIndexData = new DutyIndexData();
|
|
|
|
@ -83,11 +85,21 @@ public class AdminIndexDutyServiceImpl implements AdminIndexDutyService {
|
|
|
|
|
Set<String> classIdSet = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
// 获取学期起止时间
|
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, timeRangeDto.getPeriodId());
|
|
|
|
|
SchoolDateUtil.semesterModel semesterModel = SchoolDateUtil.getSemesterByNow(semesters, LocalDate.now());
|
|
|
|
|
String academicYearId = semesterModel.getAcademicYearId();
|
|
|
|
|
LocalDateTime startDatetime = semesterModel.getStartDatetime();
|
|
|
|
|
LocalDateTime endDatetime = semesterModel.getEndDatetime();
|
|
|
|
|
LocalDateTime startDatetime = null;
|
|
|
|
|
LocalDateTime endDatetime = null;
|
|
|
|
|
String academicYearId = null;
|
|
|
|
|
if(timeRangeDto.getStartTime() != null) {
|
|
|
|
|
startDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timeRangeDto.getStartTime()), ZoneId.systemDefault());
|
|
|
|
|
endDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timeRangeDto.getEndTime()), ZoneId.systemDefault());
|
|
|
|
|
academicYearId = timeRangeDto.getAcademicYearId();
|
|
|
|
|
}else {
|
|
|
|
|
academicYearId = semesterModel.getAcademicYearId();
|
|
|
|
|
startDatetime = semesterModel.getStartDatetime();
|
|
|
|
|
endDatetime = semesterModel.getEndDatetime();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (startDatetime == null || endDatetime == null) throw new ServiceException(ErrorCode.PARAMS_ERROR);
|
|
|
|
|
long totalWeek = calculateWeekNum(startDatetime, endDatetime, null);
|
|
|
|
|
|
|
|
|
|