develop
hhb@hotmail.com 1 month ago
parent 1dcd782331
commit 5933e2daee

@ -9,7 +9,6 @@ import cn.teammodel.model.entity.common.GroupList;
import cn.teammodel.model.entity.school.LessonRecord;
import cn.teammodel.model.entity.school.School;
import cn.teammodel.model.entity.school.SchoolTeacher;
import cn.teammodel.model.vo.appraise.RecordVo;
import cn.teammodel.repository.LessonRecordRepository;
import cn.teammodel.repository.SchoolGroupListRepository;
import cn.teammodel.repository.SchoolRepository;
@ -115,8 +114,8 @@ public class TeacherServiceImpl implements TeacherService {
// 获取学期起止时间
List<School.Semester> semesters = schoolRepository.findSemestersById(teacherDto.getCode(), teacherDto.getPeriodId());
SchoolDateUtil.semesterModel semesterModel = SchoolDateUtil.getSemesterByNow(semesters, LocalDate.now());
LocalDateTime startDatetime = null;
LocalDateTime endDatetime = null;
LocalDateTime startDatetime;
LocalDateTime endDatetime;
if(teacherDto.getStartTime() != null) {
startDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(teacherDto.getStartTime()), ZoneId.systemDefault());
endDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(teacherDto.getEndTime()), ZoneId.systemDefault());
@ -162,8 +161,8 @@ public class TeacherServiceImpl implements TeacherService {
// 获取学期起止时间
List<School.Semester> semesters = schoolRepository.findSemestersById(teacherDto.getCode(), teacherDto.getPeriodId());
SchoolDateUtil.semesterModel semesterModel = SchoolDateUtil.getSemesterByNow(semesters, LocalDate.now());
LocalDateTime startDatetime = null;
LocalDateTime endDatetime = null;
LocalDateTime startDatetime;
LocalDateTime endDatetime;
if(teacherDto.getStartTime() != null) {
startDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(teacherDto.getStartTime()), ZoneId.systemDefault());
endDatetime = LocalDateTime.ofInstant(Instant.ofEpochMilli(teacherDto.getEndTime()), ZoneId.systemDefault());
@ -178,26 +177,22 @@ public class TeacherServiceImpl implements TeacherService {
long endTimestamp = endDatetime.toInstant(ZoneOffset.UTC).toEpochMilli();
List<LessonRecord> lessonRecords = lessonRecordRepository.getLessonsByConditions(String.format(PK.PK_LESSON_RECORD, teacherDto.getCode()), startTimestamp, endTimestamp, teacherDto.getTmdId());
int cooperationCount = 0;
int internetCount = 0;
int taskCount = 0;
int examCount = 0;
int diffentialCount = 0;
int[] counts = {0, 0, 0, 0, 0};
String[] keys = {"cooperation", "internet", "task", "exam", "diffential"};
for (LessonRecord record : lessonRecords) {
if (record.getLearningCategory() != null) {
cooperationCount += record.getLearningCategory().getCooperation();
internetCount += record.getLearningCategory().getInteraction();
taskCount += record.getLearningCategory().getTask();
examCount += record.getLearningCategory().getExam();
diffentialCount += record.getLearningCategory().getDiffential();
}
}
LearningCategory.put("cooperation", cooperationCount);
LearningCategory.put("internet", internetCount);
LearningCategory.put("task", taskCount);
LearningCategory.put("exam", examCount);
LearningCategory.put("diffential", diffentialCount);
counts[0] += record.getLearningCategory().getCooperation();
counts[1] += record.getLearningCategory().getInteraction();
counts[2] += record.getLearningCategory().getTask();
counts[3] += record.getLearningCategory().getExam();
counts[4] += record.getLearningCategory().getDiffential();
}
}
for (int i = 0; i < keys.length; i++) {
LearningCategory.put(keys[i], counts[i]);
}
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");

Loading…
Cancel
Save