|
|
|
@ -12,6 +12,7 @@ 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.admin.GpTeacherVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.SugVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.TeacherGradeVo;
|
|
|
|
|
import cn.teammodel.repository.LessonRecordRepository;
|
|
|
|
|
import cn.teammodel.repository.SchoolGroupListRepository;
|
|
|
|
@ -32,6 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.time.*;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
@ -730,8 +732,104 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getTeachingAndResearch(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
//录课数
|
|
|
|
|
|
|
|
|
|
List<SugVo> sugVoList = getSugVos(teacherDto, request);
|
|
|
|
|
//获取教师年级分配情况
|
|
|
|
|
Map<String, Object> Map = getTeacherGradeCount(teacherDto, request);
|
|
|
|
|
List<TeacherGradeVo> gradeList = new ArrayList<>();
|
|
|
|
|
for (Map.Entry<String, Object> entry : Map.entrySet()) {
|
|
|
|
|
if(entry.getKey().equals("teacher")) {
|
|
|
|
|
List<Map<String, Object>> teacherList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
for (Map<String, Object> statisticsMap : teacherList) {
|
|
|
|
|
TeacherGradeVo teacherGradeVo = convertToTeacherGradeVo(statisticsMap);
|
|
|
|
|
gradeList.add(teacherGradeVo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(teacherDto.getTmdId() != null) {
|
|
|
|
|
List<SugVo> sugVos = sugVoList.stream().filter(sugVo -> sugVo.getHabook().equals(teacherDto.getTmdId())).collect(Collectors.toList());
|
|
|
|
|
LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>();
|
|
|
|
|
int[] scores = new int[5];
|
|
|
|
|
for (SugVo sugVo : sugVos) {
|
|
|
|
|
scores[0] += sugVo.getT_data();
|
|
|
|
|
scores[1] += sugVo.getT_green();
|
|
|
|
|
scores[2] += sugVo.getT_duration();
|
|
|
|
|
scores[3] += sugVo.getT_attendance();
|
|
|
|
|
scores[4] += sugVo.getT_interaction();
|
|
|
|
|
}
|
|
|
|
|
//T(数据)
|
|
|
|
|
mapTeach.put("TData",scores[0]);
|
|
|
|
|
//T(绿灯)
|
|
|
|
|
mapTeach.put("TGreen",scores[1]);
|
|
|
|
|
//总时长
|
|
|
|
|
mapTeach.put("TDuration",scores[2]);
|
|
|
|
|
//T(数据)学生人次
|
|
|
|
|
mapTeach.put("TAttendance",scores[3]);
|
|
|
|
|
//T(数据)互动次数
|
|
|
|
|
mapTeach.put("TInteraction",scores[4]);
|
|
|
|
|
return mapTeach;
|
|
|
|
|
|
|
|
|
|
}else if(teacherDto.getGradeName() != null) {
|
|
|
|
|
|
|
|
|
|
List<String> teachers = new ArrayList<>();
|
|
|
|
|
for (TeacherGradeVo gradeVo : gradeList) {
|
|
|
|
|
for(TeacherGradeVo.IdAndName gradeId : gradeVo.getGrade()) {
|
|
|
|
|
if (gradeId.getGradeName().equals(teacherDto.getGradeName() )) {
|
|
|
|
|
teachers.add(gradeVo.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<SugVo> filteredSugVoList = sugVoList.stream()
|
|
|
|
|
.filter(sugVo -> teachers.contains(sugVo.getHabook()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>();
|
|
|
|
|
int[] scores = new int[5];
|
|
|
|
|
for (SugVo sugVo : filteredSugVoList) {
|
|
|
|
|
scores[0] += sugVo.getT_data();
|
|
|
|
|
scores[1] += sugVo.getT_green();
|
|
|
|
|
scores[2] += sugVo.getT_duration();
|
|
|
|
|
scores[3] += sugVo.getT_attendance();
|
|
|
|
|
scores[4] += sugVo.getT_interaction();
|
|
|
|
|
}
|
|
|
|
|
//T(数据)
|
|
|
|
|
mapTeach.put("TData",scores[0]);
|
|
|
|
|
//T(绿灯)
|
|
|
|
|
mapTeach.put("TGreen",scores[1]);
|
|
|
|
|
//总时长
|
|
|
|
|
mapTeach.put("TDuration",scores[2]);
|
|
|
|
|
//T(数据)学生人次
|
|
|
|
|
mapTeach.put("TAttendance",scores[3]);
|
|
|
|
|
//T(数据)互动次数
|
|
|
|
|
mapTeach.put("TInteraction",scores[4]);
|
|
|
|
|
|
|
|
|
|
return mapTeach;
|
|
|
|
|
}else {
|
|
|
|
|
LinkedHashMap<String, Object> mapTeach = new LinkedHashMap<>();
|
|
|
|
|
int[] scores = new int[5];
|
|
|
|
|
for (SugVo sugVo : sugVoList) {
|
|
|
|
|
scores[0] += sugVo.getT_data();
|
|
|
|
|
scores[1] += sugVo.getT_green();
|
|
|
|
|
scores[2] += sugVo.getT_duration();
|
|
|
|
|
scores[3] += sugVo.getT_attendance();
|
|
|
|
|
scores[4] += sugVo.getT_interaction();
|
|
|
|
|
}
|
|
|
|
|
//T(数据)
|
|
|
|
|
mapTeach.put("TData", scores[0]);
|
|
|
|
|
//T(绿灯)
|
|
|
|
|
mapTeach.put("TGreen", scores[1]);
|
|
|
|
|
//总时长
|
|
|
|
|
mapTeach.put("TDuration", scores[2]);
|
|
|
|
|
//T(数据)学生人次
|
|
|
|
|
mapTeach.put("TAttendance", scores[3]);
|
|
|
|
|
//T(数据)互动次数
|
|
|
|
|
mapTeach.put("TInteraction", scores[4]);
|
|
|
|
|
|
|
|
|
|
return mapTeach;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Map<String, Object> map = new HashMap<>();
|
|
|
|
|
/*//录课数
|
|
|
|
|
map.put("Lessons",new Random().nextInt(100) + 1);
|
|
|
|
|
//T(数据)
|
|
|
|
|
map.put("TData",new Random().nextInt(100) + 1);
|
|
|
|
@ -758,23 +856,49 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
//被标记数
|
|
|
|
|
map.put("TMarkers",new Random().nextInt(30) + 1);
|
|
|
|
|
//被点阅数
|
|
|
|
|
map.put("ClickAndRead",new Random().nextInt(100) + 1);
|
|
|
|
|
return map;
|
|
|
|
|
map.put("ClickAndRead",new Random().nextInt(100) + 1);*/
|
|
|
|
|
//return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<LinkedHashMap<String,LinkedHashMap<String,Object>>> getTeachingOfTeacher(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
List<LinkedHashMap<String,LinkedHashMap<String,Object>>> list = new ArrayList<>();
|
|
|
|
|
if(teacherDto.getGrade() != null) {
|
|
|
|
|
LinkedHashMap<String,LinkedHashMap<String,Object>> map = new LinkedHashMap<>();
|
|
|
|
|
List<SugVo> sugVoList = getSugVos(teacherDto, request);
|
|
|
|
|
//获取教师年级分配情况
|
|
|
|
|
Map<String, Object> Map = getTeacherGradeCount(teacherDto, request);
|
|
|
|
|
List<TeacherGradeVo> gradeList = new ArrayList<>();
|
|
|
|
|
for (Map.Entry<String, Object> entry : Map.entrySet()) {
|
|
|
|
|
if(entry.getKey().equals("teacher")) {
|
|
|
|
|
List<Map<String, Object>> teacherList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
for (Map<String, Object> statisticsMap : teacherList) {
|
|
|
|
|
TeacherGradeVo teacherGradeVo = convertToTeacherGradeVo(statisticsMap);
|
|
|
|
|
gradeList.add(teacherGradeVo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(teacherDto.getTmdId() != null) {
|
|
|
|
|
List<SugVo> sugVos = sugVoList.stream().filter(sugVo -> sugVo.getHabook().equals(teacherDto.getTmdId())).collect(Collectors.toList());
|
|
|
|
|
LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>();
|
|
|
|
|
mapTeach.put("interaction", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("cooperation", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("test", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("quest", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("differentiation", new Random().nextInt(50) + 1);
|
|
|
|
|
|
|
|
|
|
map.put(teacherDto.getGrade(), mapTeach);
|
|
|
|
|
LinkedHashMap<String,LinkedHashMap<String,Object>> map = new LinkedHashMap<>();
|
|
|
|
|
int[] scores = new int[7];
|
|
|
|
|
for (SugVo sugVo : sugVos) {
|
|
|
|
|
scores[0] += sugVo.getCooperation();
|
|
|
|
|
scores[1] += sugVo.getInteraction();
|
|
|
|
|
scores[2] += sugVo.getTask();
|
|
|
|
|
scores[3] += sugVo.getExam();
|
|
|
|
|
scores[4] += sugVo.getDiffential();
|
|
|
|
|
scores[5] += sugVo.getSmartRating();
|
|
|
|
|
scores[6] += sugVo.getCowork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapTeach.put("cooperation", scores[0]);
|
|
|
|
|
mapTeach.put("interaction", scores[1]);
|
|
|
|
|
mapTeach.put("task", scores[2]);
|
|
|
|
|
mapTeach.put("exam", scores[3]);
|
|
|
|
|
mapTeach.put("differential", scores[4]);
|
|
|
|
|
mapTeach.put("smartRating", scores[5]);
|
|
|
|
|
mapTeach.put("cowork", scores[6]);
|
|
|
|
|
map.put(teacherDto.getTmdId(), mapTeach);
|
|
|
|
|
list.add(map);
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
@ -782,12 +906,37 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
List<String> grades = getGrades(teacherDto, school);
|
|
|
|
|
LinkedHashMap<String,LinkedHashMap<String,Object>> map = new LinkedHashMap<>();
|
|
|
|
|
for (String grade : grades) {
|
|
|
|
|
List<String> teachers = new ArrayList<>();
|
|
|
|
|
for (TeacherGradeVo gradeVo : gradeList) {
|
|
|
|
|
for(TeacherGradeVo.IdAndName gradeId : gradeVo.getGrade()) {
|
|
|
|
|
if (gradeId.getGradeName().equals(grade)) {
|
|
|
|
|
teachers.add(gradeVo.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<SugVo> filteredSugVoList = sugVoList.stream()
|
|
|
|
|
.filter(sugVo -> teachers.contains(sugVo.getHabook()))
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
LinkedHashMap<String,Object> mapTeach = new LinkedHashMap<>();
|
|
|
|
|
mapTeach.put("interaction", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("cooperation", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("test", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("quest", new Random().nextInt(50) + 1);
|
|
|
|
|
mapTeach.put("differentiation", new Random().nextInt(50) + 1);
|
|
|
|
|
int[] scores = new int[7]; // 索引 0: cooperation, 1: interaction, 2: task, 3: exam, 4: diffential, 5: smartRating, 6: cowork
|
|
|
|
|
for (SugVo sugVo : filteredSugVoList) {
|
|
|
|
|
scores[0] += sugVo.getCooperation();
|
|
|
|
|
scores[1] += sugVo.getInteraction();
|
|
|
|
|
scores[2] += sugVo.getTask();
|
|
|
|
|
scores[3] += sugVo.getExam();
|
|
|
|
|
scores[4] += sugVo.getDiffential();
|
|
|
|
|
scores[5] += sugVo.getSmartRating();
|
|
|
|
|
scores[6] += sugVo.getCowork();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapTeach.put("cooperation", scores[0]);
|
|
|
|
|
mapTeach.put("interaction", scores[1]);
|
|
|
|
|
mapTeach.put("task", scores[2]);
|
|
|
|
|
mapTeach.put("exam", scores[3]);
|
|
|
|
|
mapTeach.put("differential", scores[4]);
|
|
|
|
|
mapTeach.put("smartRating", scores[5]);
|
|
|
|
|
mapTeach.put("cowork", scores[6]);
|
|
|
|
|
|
|
|
|
|
map.put(grade, mapTeach);
|
|
|
|
|
}
|
|
|
|
|
list.add(map);
|
|
|
|
@ -796,6 +945,63 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private @NotNull List<SugVo> getSugVos(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
String url = env.getProperty("ies.server-url-get-channel-data");
|
|
|
|
|
Map<String, Object> overView;
|
|
|
|
|
List<SugVo> sugVoList = new ArrayList<SugVo>();
|
|
|
|
|
try {
|
|
|
|
|
Instant instantSTime = Instant.ofEpochMilli(teacherDto.getStartTime());
|
|
|
|
|
Instant instantETime = Instant.ofEpochMilli(teacherDto.getEndTime());
|
|
|
|
|
LocalDate localDateSTime = instantSTime.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
|
|
LocalDate localDateETime = instantETime.atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
String sTime = localDateSTime.format(formatter);
|
|
|
|
|
String eTime = localDateETime.format(formatter);
|
|
|
|
|
teacherDto.duration.add(sTime);
|
|
|
|
|
teacherDto.duration.add(eTime);
|
|
|
|
|
teacherDto.school_shortcode.add(teacherDto.getCode());
|
|
|
|
|
overView = GroupUtil.getGroupId(teacherDto,new GroupUtil(env), request,url);
|
|
|
|
|
for(Map.Entry<String, Object> entry : overView.entrySet()) {
|
|
|
|
|
if (entry.getKey().equals("data")) {
|
|
|
|
|
List<Map<String, Object>> dataList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
for (Map<String, Object> dataMap : dataList) {
|
|
|
|
|
if(dataMap.containsKey("statistics")) {
|
|
|
|
|
List<Map<String, Object>> statisticsList = (List<Map<String, Object>>) dataMap.get("statistics");
|
|
|
|
|
for (Map<String, Object> statisticsMap : statisticsList) {
|
|
|
|
|
SugVo sugVo = convertToSugVo(statisticsMap);
|
|
|
|
|
sugVoList.add(sugVo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return sugVoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SugVo convertToSugVo(Map<String, Object> dataMap) {
|
|
|
|
|
SugVo sugVo = new SugVo();
|
|
|
|
|
sugVo.setDate(dataMap.get("date").toString());
|
|
|
|
|
sugVo.setHabook(dataMap.get("habook").toString());
|
|
|
|
|
sugVo.setT_data(Integer.parseInt(dataMap.get("t_data").toString()));
|
|
|
|
|
sugVo.setT_green(Integer.parseInt(dataMap.get("t_green").toString()));
|
|
|
|
|
sugVo.setT_duration(Integer.parseInt(dataMap.get("t_duration").toString()));
|
|
|
|
|
sugVo.setT_attendance(Integer.parseInt(dataMap.get("t_attendance").toString()));
|
|
|
|
|
sugVo.setT_interaction(Integer.parseInt(dataMap.get("t_interaction").toString()));
|
|
|
|
|
sugVo.setCooperation(Integer.parseInt(dataMap.get("cooperation").toString()));
|
|
|
|
|
sugVo.setInteraction(Integer.parseInt(dataMap.get("interaction").toString()));
|
|
|
|
|
sugVo.setTask(Integer.parseInt(dataMap.get("task").toString()));
|
|
|
|
|
sugVo.setExam(Integer.parseInt(dataMap.get("exam").toString()));
|
|
|
|
|
sugVo.setDiffential(Integer.parseInt(dataMap.get("diffential").toString()));
|
|
|
|
|
sugVo.setSmartRating(Integer.parseInt(dataMap.get("smartRating").toString()));
|
|
|
|
|
sugVo.setCowork(Integer.parseInt(dataMap.get("cowork").toString()));
|
|
|
|
|
return sugVo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static @NotNull List<String> getGrades(TeacherDto teacherDto, List<School> school) {
|
|
|
|
|
List<String> grades = new ArrayList<>();
|
|
|
|
|
if(school != null && !school.isEmpty()) {
|
|
|
|
|