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