|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.teammodel.service.impl;
|
|
|
|
package cn.teammodel.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.Pair;
|
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
@ -25,8 +26,8 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.time.*;
|
|
|
|
import java.time.Instant;
|
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -326,15 +327,9 @@ public class DutyServiceImpl implements DutyService {
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(schoolId, periodId);
|
|
|
|
String academicYearId = SchoolDateUtil.calculateAcademicYearId(semesters, LocalDate.now());
|
|
|
|
String academicYearId = SchoolDateUtil.calculateAcademicYearId(semesters, LocalDate.now());
|
|
|
|
|
|
|
|
|
|
|
|
if (startTime == null || endTime == null) {
|
|
|
|
Pair<Long, Long> pair = SchoolDateUtil.adjustTimeRangeToCurrentWeekIfNull(startTime, endTime);
|
|
|
|
LocalDateTime mondayOfCurWeek = LocalDateTime.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))
|
|
|
|
startTime = pair.getKey();
|
|
|
|
.withHour(0)
|
|
|
|
endTime = pair.getValue();
|
|
|
|
.withMinute(0)
|
|
|
|
|
|
|
|
.withSecond(0)
|
|
|
|
|
|
|
|
.withNano(0);
|
|
|
|
|
|
|
|
startTime = mondayOfCurWeek.atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli();
|
|
|
|
|
|
|
|
endTime = Instant.now().toEpochMilli();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<DutyRecordVo> records = dutyRecordRepository.findRecordsByConditions(
|
|
|
|
List<DutyRecordVo> records = dutyRecordRepository.findRecordsByConditions(
|
|
|
|
String.format(PK.WEEK_DUTY_RECORD, schoolId),
|
|
|
|
String.format(PK.WEEK_DUTY_RECORD, schoolId),
|
|
|
|
academicYearId,
|
|
|
|
academicYearId,
|
|
|
@ -371,7 +366,28 @@ public class DutyServiceImpl implements DutyService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<DutyRecordVo> findAdminRecords(AdminFindDutyRecordDto adminFindDutyRecordDto) {
|
|
|
|
public List<DutyRecordVo> findAdminRecords(AdminFindDutyRecordDto adminFindDutyRecordDto) {
|
|
|
|
return null;
|
|
|
|
String teacherId = adminFindDutyRecordDto.getTeacherId();
|
|
|
|
|
|
|
|
String classId = adminFindDutyRecordDto.getClassId();
|
|
|
|
|
|
|
|
String academicYearId = adminFindDutyRecordDto.getAcademicYearId();
|
|
|
|
|
|
|
|
Boolean positive = adminFindDutyRecordDto.getPositive();
|
|
|
|
|
|
|
|
Long startTime = adminFindDutyRecordDto.getStartTime();
|
|
|
|
|
|
|
|
Long endTime = adminFindDutyRecordDto.getEndTime();
|
|
|
|
|
|
|
|
User user = SecurityUtil.getLoginUser();
|
|
|
|
|
|
|
|
String schoolId = user.getSchoolId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pair<Long, Long> pair = SchoolDateUtil.adjustTimeRangeToCurrentWeekIfNull(startTime, endTime);
|
|
|
|
|
|
|
|
startTime = pair.getKey();
|
|
|
|
|
|
|
|
endTime = pair.getValue();
|
|
|
|
|
|
|
|
List<DutyRecordVo> records = dutyRecordRepository.findRecordsByConditions(
|
|
|
|
|
|
|
|
String.format(PK.WEEK_DUTY_RECORD, schoolId),
|
|
|
|
|
|
|
|
academicYearId,
|
|
|
|
|
|
|
|
teacherId,
|
|
|
|
|
|
|
|
classId,
|
|
|
|
|
|
|
|
positive,
|
|
|
|
|
|
|
|
startTime,
|
|
|
|
|
|
|
|
endTime);
|
|
|
|
|
|
|
|
records = records.stream().sorted((o1, o2) -> o2.getInfo().getCreateTime().compareTo(o1.getInfo().getCreateTime())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
return records;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|