update 教师相关数据

develop
hhb@hotmail.com 1 month ago
parent 12ad733286
commit 7ec8d20ae8

@ -29,4 +29,11 @@ public class TeacherController {
List<Map<String, Integer>> res = teacherService.getTeacherList(teacherDto); List<Map<String, Integer>> res = teacherService.getTeacherList(teacherDto);
return R.success(res); return R.success(res);
} }
@PostMapping("getTeacherDetail")
@ApiOperation("获取教师素质素养数据")
public R<Map<String, Object>> getTeacherDetail(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) {
Map<String, Object> res = teacherService.getTeacherDetail(teacherDto,request);
return R.success(res);
}
} }

@ -2,9 +2,11 @@ package cn.teammodel.controller.admin.service;
import cn.teammodel.model.dto.admin.teacher.TeacherDto; import cn.teammodel.model.dto.admin.teacher.TeacherDto;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public interface TeacherService { public interface TeacherService {
List<Map<String,Integer>> getTeacherList(TeacherDto teacherDto); List<Map<String,Integer>> getTeacherList(TeacherDto teacherDto);
Map<String,Object> getTeacherDetail(TeacherDto teacherDto, HttpServletRequest request);
} }

@ -1,5 +1,7 @@
package cn.teammodel.controller.admin.service.impl; package cn.teammodel.controller.admin.service.impl;
import cn.teammodel.common.ErrorCode;
import cn.teammodel.config.exception.ServiceException;
import cn.teammodel.controller.admin.service.TeacherService; import cn.teammodel.controller.admin.service.TeacherService;
import cn.teammodel.model.dto.admin.teacher.TeacherDto; import cn.teammodel.model.dto.admin.teacher.TeacherDto;
import cn.teammodel.model.entity.common.GroupList; import cn.teammodel.model.entity.common.GroupList;
@ -8,10 +10,14 @@ import cn.teammodel.model.entity.school.SchoolTeacher;
import cn.teammodel.repository.SchoolGroupListRepository; import cn.teammodel.repository.SchoolGroupListRepository;
import cn.teammodel.repository.SchoolRepository; import cn.teammodel.repository.SchoolRepository;
import cn.teammodel.repository.SchoolTeacherRepository; import cn.teammodel.repository.SchoolTeacherRepository;
import cn.teammodel.utils.GroupUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
@Service @Service
public class TeacherServiceImpl implements TeacherService { public class TeacherServiceImpl implements TeacherService {
@ -21,11 +27,15 @@ public class TeacherServiceImpl implements TeacherService {
private SchoolTeacherRepository schoolTeacherRepository; private SchoolTeacherRepository schoolTeacherRepository;
@Resource @Resource
private SchoolRepository schoolRepository; private SchoolRepository schoolRepository;
@Autowired
private Environment env;
@Override @Override
public List<Map<String, Integer>> getTeacherList(TeacherDto teacherDto) { public List<Map<String, Integer>> getTeacherList(TeacherDto teacherDto) {
List<Map<String, Integer>> result = new ArrayList<>(); List<Map<String, Integer>> result = new ArrayList<>();
Map<String, Integer> teacherCountMap = new HashMap<>();
List<GroupList> groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode()); List<GroupList> groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode());
List<SchoolTeacher> schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode()); List<SchoolTeacher> schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode());
teacherCountMap.put("教师总人数", schoolTeachers.size());
List<School> school = schoolRepository.findBaseById(teacherDto.getCode()); List<School> school = schoolRepository.findBaseById(teacherDto.getCode());
List<School.Subject> subjects = new ArrayList<>(); List<School.Subject> subjects = new ArrayList<>();
List<School.Period> periods = new ArrayList<>(); List<School.Period> periods = new ArrayList<>();
@ -66,9 +76,25 @@ public class TeacherServiceImpl implements TeacherService {
result.add(updatedSubjectCountMap); result.add(updatedSubjectCountMap);
result.add(jobCountMap); result.add(jobCountMap);
result.add(periodCountMap); result.add(periodCountMap);
result.add(teacherCountMap);
return result; return result;
} }
@Override
public Map<String, Object> getTeacherDetail(TeacherDto teacherDto, HttpServletRequest request) {
Map<String, Object> teachers;
//获取全学校教师名单详情
String url = env.getProperty("ies.server-url-get-teacher-all");
try {
teachers = GroupUtil.getGroupId(teacherDto,new GroupUtil(env), request,url);
}catch (Exception e) {
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
}
return teachers;
}
private static @NotNull Map<String, Integer> getStringIntegerMap(List<School.Subject> subjects, List<SchoolTeacher> schoolTeachers) { private static @NotNull Map<String, Integer> getStringIntegerMap(List<School.Subject> subjects, List<SchoolTeacher> schoolTeachers) {
Map<String, String> subjectNameMap = new HashMap<>(); Map<String, String> subjectNameMap = new HashMap<>();
for (School.Subject subject : subjects) { for (School.Subject subject : subjects) {

@ -7,4 +7,12 @@ import lombok.Data;
public class TeacherDto { public class TeacherDto {
@ApiModelProperty("学校编码") @ApiModelProperty("学校编码")
public String code; public String code;
@ApiModelProperty("学校编码")
public String school_code;
@ApiModelProperty("TmdId")
public String tmdId;
public long startTime;
public long endTime;
@ApiModelProperty("学段Id")
public String periodId;
} }

@ -20,23 +20,23 @@ spring:
# 大小限制 # 大小限制
max-file-size: 10MB max-file-size: 10MB
#测试站数据库 #测试站数据库
# env: dev env: dev
# cloud:
# azure:
# cosmos:
# endpoint: https://cdhabookdep-free.documents.azure.cn:443
# database: TEAMModelOS
# key: JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==
# populate-query-metrics: true
#正式站数据库
env: prod
cloud: cloud:
azure: azure:
cosmos: cosmos:
endpoint: https://teammodelos.documents.azure.cn:443 endpoint: https://cdhabookdep-free.documents.azure.cn:443
database: TEAMModelOS database: TEAMModelOS
key: clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg== key: JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==
populate-query-metrics: true populate-query-metrics: true
#正式站数据库
# env: prod
# cloud:
# azure:
# cosmos:
# endpoint: https://teammodelos.documents.azure.cn:443
# database: TEAMModelOS
# key: clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==
# populate-query-metrics: true
security: security:
oauth2: oauth2:
resourceserver: resourceserver:
@ -82,3 +82,4 @@ ies:
server-url-exam-find-record: /common/exam/find-summary-record server-url-exam-find-record: /common/exam/find-summary-record
server-url-analysis-simple: /analysis/simple server-url-analysis-simple: /analysis/simple
server-url-find-simple-by-student: /common/exam/find-simple-by-student server-url-find-simple-by-student: /common/exam/find-simple-by-student
server-url-get-teacher-all: /school/teacher/get-teacher-all
Loading…
Cancel
Save