update 修正顺序

develop
hhb@hotmail.com 1 day ago
parent d0379cd7b8
commit 02fa60e427

@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -69,8 +70,8 @@ public class TeacherController {
}
@PostMapping("getTeachingOfTeacher")
@ApiOperation("获取教师教学法数据")
public R<List<Map<String,Map<String,Object>>>> getTeachingOfTeacher(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) {
List<Map<String,Map<String,Object>>> res = teacherService.getTeachingOfTeacher(teacherDto,request);
public R<List<LinkedHashMap<String, LinkedHashMap<String,Object>>> > getTeachingOfTeacher(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) {
List<LinkedHashMap<String,LinkedHashMap<String,Object>>> res = teacherService.getTeachingOfTeacher(teacherDto,request);
return R.success(res);
}

@ -4,6 +4,7 @@ import cn.teammodel.model.dto.admin.teacher.GpTeacherDto;
import cn.teammodel.model.dto.admin.teacher.TeacherDto;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@ -15,5 +16,5 @@ public interface TeacherService {
Map<String,Object> getTeacherGradeCount(TeacherDto teacherDto, HttpServletRequest request);
List<Map<String,Map<String, Long>>> getDistributionOfTeachers(TeacherDto teacherDto, HttpServletRequest request);
Map<String,Object> getTeachingAndResearch(TeacherDto teacherDto, HttpServletRequest request);
List<Map<String,Map<String,Object>>> getTeachingOfTeacher(TeacherDto teacherDto, HttpServletRequest request);
List<LinkedHashMap<String, LinkedHashMap<String,Object>>> getTeachingOfTeacher(TeacherDto teacherDto, HttpServletRequest request);
}

@ -763,11 +763,11 @@ public class TeacherServiceImpl implements TeacherService {
}
@Override
public List<Map<String,Map<String,Object>>> getTeachingOfTeacher(TeacherDto teacherDto, HttpServletRequest request) {
List<Map<String,Map<String,Object>>> list = new ArrayList<>();
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) {
Map<String,Map<String,Object>> map = new HashMap<>();
Map<String,Object> mapTeach = new HashMap<>();
LinkedHashMap<String,LinkedHashMap<String,Object>> map = new LinkedHashMap<>();
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);
@ -779,19 +779,10 @@ public class TeacherServiceImpl implements TeacherService {
}else {
List<School> school = schoolRepository.findBaseById(teacherDto.getCode());
List<String> grades = new ArrayList<>();
if(school != null && !school.isEmpty()) {
for (School base : school) {
for (School.Period period : base.getPeriod()) {
if(period.getId().equals(teacherDto.getPeriodId())) {
grades = period.getGrades();
}
}
}
}
Map<String,Map<String,Object>> map = new HashMap<>();
List<String> grades = getGrades(teacherDto, school);
LinkedHashMap<String,LinkedHashMap<String,Object>> map = new LinkedHashMap<>();
for (String grade : grades) {
Map<String,Object> mapTeach = new HashMap<>();
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);
@ -805,6 +796,22 @@ public class TeacherServiceImpl implements TeacherService {
return list;
}
private static @NotNull List<String> getGrades(TeacherDto teacherDto, List<School> school) {
List<String> grades = new ArrayList<>();
if(school != null && !school.isEmpty()) {
for (School base : school) {
for (School.Period period : base.getPeriod()) {
if(period.getId().equals(teacherDto.getPeriodId())) {
for(String grade : period.getGrades()) {
grades.add(grade.trim());
}
}
}
}
}
return grades;
}
public Map<String, Object> getTeacherBase(GpTeacherDto gpTeacherDto, HttpServletRequest request) {
Map<String, Object> gradeMap;

Loading…
Cancel
Save