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

Loading…
Cancel
Save