update 课列内容

develop
hhb@hotmail.com 4 months ago
parent 4eb23c5208
commit c8089b9a99

@ -388,11 +388,11 @@ public class TeacherServiceImpl implements TeacherService {
do { do {
if(StringUtils.isNotEmpty(teacherDto.getGrade())) { if(StringUtils.isNotEmpty(teacherDto.getGrade())) {
slice = lessonRecordRepository.findAllByGrade(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getGrade(),teacherDto.getSubjectId(),pageRequest); slice = lessonRecordRepository.findAllByGrade(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getGrade(),teacherDto.getSubjectId(),teacherDto.getPeriodId(),pageRequest);
} else if(StringUtils.isNotEmpty(teacherDto.getTmdId())) { } else if(StringUtils.isNotEmpty(teacherDto.getTmdId())) {
slice = lessonRecordRepository.findAllByAcademicYearId(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getTmdId(),teacherDto.getSubjectId(),pageRequest); slice = lessonRecordRepository.findAllByAcademicYearId(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getTmdId(),teacherDto.getSubjectId(),teacherDto.getPeriodId(),pageRequest);
} else { } else {
slice = lessonRecordRepository.findAll(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getSubjectId(), pageRequest); slice = lessonRecordRepository.findAll(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getSubjectId(),teacherDto.getPeriodId(), pageRequest);
} }
List<LessonRecord> content = slice.getContent(); List<LessonRecord> content = slice.getContent();
if (ObjectUtils.isEmpty(content)) { if (ObjectUtils.isEmpty(content)) {
@ -437,7 +437,7 @@ public class TeacherServiceImpl implements TeacherService {
long startTimestamp = startDatetime.toInstant(ZoneOffset.UTC).toEpochMilli(); long startTimestamp = startDatetime.toInstant(ZoneOffset.UTC).toEpochMilli();
long endTimestamp = endDatetime.toInstant(ZoneOffset.UTC).toEpochMilli(); long endTimestamp = endDatetime.toInstant(ZoneOffset.UTC).toEpochMilli();
List<LessonRecord> lessonRecords = lessonRecordRepository.getLessonsByConditions(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), startTimestamp, endTimestamp, teacherDto.getSubjectId(),teacherDto.getTmdId()); List<LessonRecord> lessonRecords = lessonRecordRepository.getLessonsByConditions(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), startTimestamp, endTimestamp, teacherDto.getSubjectId(),teacherDto.getTmdId(),teacherDto.getPeriodId());
int[] counts = {0, 0, 0, 0, 0}; int[] counts = {0, 0, 0, 0, 0};
String[] keys = {"cooperation", "internet", "task", "exam", "diffential"}; String[] keys = {"cooperation", "internet", "task", "exam", "diffential"};
@ -746,7 +746,9 @@ public class TeacherServiceImpl implements TeacherService {
} }
} }
} }
List<LessonRecord> lessonRecords = lessonRecordRepository.getLessonsByConditions(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), teacherDto.getStartTime(), teacherDto.getEndTime(), teacherDto.getSubjectId(),teacherDto.getTmdId(),teacherDto.getPeriodId());
if(teacherDto.getTmdId() != null) { if(teacherDto.getTmdId() != null) {
List<SugVo> sugVos = sugVoList.stream().filter(sugVo -> sugVo.getHabook().equals(teacherDto.getTmdId())).collect(Collectors.toList()); List<SugVo> sugVos = sugVoList.stream().filter(sugVo -> sugVo.getHabook().equals(teacherDto.getTmdId())).collect(Collectors.toList());
LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>(); LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>();
int[] scores = new int[5]; int[] scores = new int[5];
@ -767,6 +769,7 @@ public class TeacherServiceImpl implements TeacherService {
mapTeach.put("TAttendance",scores[3]); mapTeach.put("TAttendance",scores[3]);
//T(数据)互动次数 //T(数据)互动次数
mapTeach.put("TInteraction",scores[4]); mapTeach.put("TInteraction",scores[4]);
mapTeach.put("Lessons",lessonRecords.size());
return mapTeach; return mapTeach;
}else if(teacherDto.getGradeName() != null) { }else if(teacherDto.getGradeName() != null) {
@ -801,6 +804,7 @@ public class TeacherServiceImpl implements TeacherService {
mapTeach.put("TAttendance",scores[3]); mapTeach.put("TAttendance",scores[3]);
//T(数据)互动次数 //T(数据)互动次数
mapTeach.put("TInteraction",scores[4]); mapTeach.put("TInteraction",scores[4]);
mapTeach.put("Lessons",lessonRecords.size());
return mapTeach; return mapTeach;
}else { }else {
@ -823,6 +827,7 @@ public class TeacherServiceImpl implements TeacherService {
mapTeach.put("TAttendance", scores[3]); mapTeach.put("TAttendance", scores[3]);
//T(数据)互动次数 //T(数据)互动次数
mapTeach.put("TInteraction", scores[4]); mapTeach.put("TInteraction", scores[4]);
mapTeach.put("Lessons",lessonRecords.size());
return mapTeach; return mapTeach;

@ -15,19 +15,22 @@ public interface LessonRecordRepository extends CosmosRepository<LessonRecord, S
@Query("select * from LessonRecord as c where " + @Query("select * from LessonRecord as c where " +
"c.code = @code and " + "c.code = @code and " +
"(IS_NULL(@startTime) or c.startTime >= @startTime) and " + "(IS_NULL(@startTime) or c.startTime >= @startTime) and " +
"(IS_NULL(@endTime) or c.startTime <= @endTime) and"+ "(IS_NULL(@endTime) or c.startTime <= @endTime) and "+
"c.status<>404 and "+
"c.periodId = @periodId and "+
"(IS_NULL(@subjectId) or c.subjectId = @subjectId) and"+ "(IS_NULL(@subjectId) or c.subjectId = @subjectId) and"+
" c.tmdid = @tmdId") "(IS_NULL(@tmdId) or c.tmdId = @tmdId) ")
List<LessonRecord> getLessonsByConditions(String code, Long startTime, Long endTime,String subjectId,String tmdId); List<LessonRecord> getLessonsByConditions(String code, Long startTime, Long endTime,String subjectId,String tmdId,String periodId);
@Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and c.tmdid = @tmdId and " +
@Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and c.tmdid = @tmdId and c.periodId = @periodId and" +
"(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ")
Slice<LessonRecord> findAllByAcademicYearId(String code, String tmdId,String subjectId,Pageable pageable); Slice<LessonRecord> findAllByAcademicYearId(String code, String tmdId,String subjectId,String periodId,Pageable pageable);
@Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and array_contains(c.grade,@grade) and" + @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and array_contains(c.grade,@grade) and c.periodId = @periodId and" +
"(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ")
Slice<LessonRecord> findAllByGrade(String code, String grade,String subjectId,Pageable pageable); Slice<LessonRecord> findAllByGrade(String code, String grade,String subjectId,String periodId,Pageable pageable);
@Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and " + @Query("select * from LessonRecord as c where c.code = @code and c.expire<=0 and c.status<>404 and c.periodId = @periodId and" +
"(IS_NULL(@subjectId) or c.subjectId = @subjectId) ") "(IS_NULL(@subjectId) or c.subjectId = @subjectId) ")
Slice<LessonRecord> findAll(String code,String subjectId,Pageable pageable); Slice<LessonRecord> findAll(String code,String subjectId,String periodId,Pageable pageable);
} }

Loading…
Cancel
Save