From 7ec8d20ae817ef1c96e31bdf1b52248b0954a169 Mon Sep 17 00:00:00 2001 From: "hhb@hotmail.com" Date: Wed, 13 Nov 2024 18:00:20 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=95=99=E5=B8=88=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/TeacherController.java | 7 +++++ .../admin/service/TeacherService.java | 2 ++ .../service/impl/TeacherServiceImpl.java | 26 ++++++++++++++++++ .../model/dto/admin/teacher/TeacherDto.java | 8 ++++++ src/main/resources/application.yml | 27 ++++++++++--------- 5 files changed, 57 insertions(+), 13 deletions(-) diff --git a/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java b/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java index 1de1f12..e95a9c2 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java @@ -29,4 +29,11 @@ public class TeacherController { List> res = teacherService.getTeacherList(teacherDto); return R.success(res); } + @PostMapping("getTeacherDetail") + @ApiOperation("获取教师素质素养数据") + public R> getTeacherDetail(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) { + Map res = teacherService.getTeacherDetail(teacherDto,request); + return R.success(res); + } + } diff --git a/src/main/java/cn/teammodel/controller/admin/service/TeacherService.java b/src/main/java/cn/teammodel/controller/admin/service/TeacherService.java index 423b3d0..f1592fe 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/TeacherService.java +++ b/src/main/java/cn/teammodel/controller/admin/service/TeacherService.java @@ -2,9 +2,11 @@ package cn.teammodel.controller.admin.service; import cn.teammodel.model.dto.admin.teacher.TeacherDto; +import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; public interface TeacherService { List> getTeacherList(TeacherDto teacherDto); + Map getTeacherDetail(TeacherDto teacherDto, HttpServletRequest request); } diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java index 4d4086d..36bd0ab 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java @@ -1,5 +1,7 @@ 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.model.dto.admin.teacher.TeacherDto; 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.SchoolRepository; import cn.teammodel.repository.SchoolTeacherRepository; +import cn.teammodel.utils.GroupUtil; import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.*; @Service public class TeacherServiceImpl implements TeacherService { @@ -21,11 +27,15 @@ public class TeacherServiceImpl implements TeacherService { private SchoolTeacherRepository schoolTeacherRepository; @Resource private SchoolRepository schoolRepository; + @Autowired + private Environment env; @Override public List> getTeacherList(TeacherDto teacherDto) { List> result = new ArrayList<>(); + Map teacherCountMap = new HashMap<>(); List groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode()); List schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode()); + teacherCountMap.put("教师总人数", schoolTeachers.size()); List school = schoolRepository.findBaseById(teacherDto.getCode()); List subjects = new ArrayList<>(); List periods = new ArrayList<>(); @@ -66,9 +76,25 @@ public class TeacherServiceImpl implements TeacherService { result.add(updatedSubjectCountMap); result.add(jobCountMap); result.add(periodCountMap); + result.add(teacherCountMap); return result; } + @Override + public Map getTeacherDetail(TeacherDto teacherDto, HttpServletRequest request) { + + Map 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 getStringIntegerMap(List subjects, List schoolTeachers) { Map subjectNameMap = new HashMap<>(); for (School.Subject subject : subjects) { diff --git a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java index f133cfc..7fd3dd6 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/teacher/TeacherDto.java @@ -7,4 +7,12 @@ import lombok.Data; public class TeacherDto { @ApiModelProperty("学校编码") public String code; + @ApiModelProperty("学校编码") + public String school_code; + @ApiModelProperty("TmdId") + public String tmdId; + public long startTime; + public long endTime; + @ApiModelProperty("学段Id") + public String periodId; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ab28e50..4a44e8b 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -20,23 +20,23 @@ spring: # 大小限制 max-file-size: 10MB #测试站数据库 -# env: dev -# cloud: -# azure: -# cosmos: -# endpoint: https://cdhabookdep-free.documents.azure.cn:443 -# database: TEAMModelOS -# key: JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A== -# populate-query-metrics: true - #正式站数据库 - env: prod + env: dev cloud: azure: cosmos: - endpoint: https://teammodelos.documents.azure.cn:443 + endpoint: https://cdhabookdep-free.documents.azure.cn:443 database: TEAMModelOS - key: clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg== + key: JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A== 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: oauth2: resourceserver: @@ -81,4 +81,5 @@ ies: server-url-exam-analysis-list: /common/exam/find-by-analysis server-url-exam-find-record: /common/exam/find-summary-record server-url-analysis-simple: /analysis/simple - server-url-find-simple-by-student: /common/exam/find-simple-by-student \ No newline at end of file + server-url-find-simple-by-student: /common/exam/find-simple-by-student + server-url-get-teacher-all: /school/teacher/get-teacher-all \ No newline at end of file