From 82f67e1afe34d1c40096eaf7105902607bc7d1e9 Mon Sep 17 00:00:00 2001 From: "hhb@hotmail.com" Date: Wed, 9 Oct 2024 16:37:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B4=BB=E5=8A=A8=E5=88=86?= =?UTF-8?q?=E6=9E=90=E6=9F=A5=E8=AF=A2=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/ArtController.java | 5 +++ .../admin/controller/CommonController.java | 2 +- .../admin/controller/ExamController.java | 16 +++++++-- .../controller/admin/service/ExamService.java | 6 ++-- .../admin/service/impl/ExamServiceImpl.java | 34 +++++++++++++++++++ .../dto/admin/appraise/TimeRangeDto.java | 3 +- .../model/dto/admin/exam/ExamRecordDto.java | 19 +++++++++++ .../model/dto/admin/exam/FindExamDto.java | 12 +++++++ .../teammodel/repository/ExamRepository.java | 2 ++ src/main/resources/application.yml | 4 ++- 10 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 src/main/java/cn/teammodel/model/dto/admin/exam/ExamRecordDto.java create mode 100644 src/main/java/cn/teammodel/model/dto/admin/exam/FindExamDto.java diff --git a/src/main/java/cn/teammodel/controller/admin/controller/ArtController.java b/src/main/java/cn/teammodel/controller/admin/controller/ArtController.java index 76ba5a2..260d06b 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/ArtController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/ArtController.java @@ -20,6 +20,11 @@ import javax.validation.Valid; import java.util.List; import java.util.Map; +/** + * @author zzzzz + * @since 2024-01-09 17:59 + */ + @RestController @RequestMapping("admin/art") @Api(tags = "管理员端-艺术评测") diff --git a/src/main/java/cn/teammodel/controller/admin/controller/CommonController.java b/src/main/java/cn/teammodel/controller/admin/controller/CommonController.java index 4806d52..d9148ae 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/CommonController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/CommonController.java @@ -43,7 +43,7 @@ public class CommonController { return R.success(res); } @PostMapping("find") - @ApiOperation("根据ID查询评语评语") + @ApiOperation("根据ID查询评语") public R> findComment(@Valid @RequestBody Comment comment) { List res = commonService.getCommentById(comment); return R.success(res); diff --git a/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java b/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java index 59df099..f929bd7 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/ExamController.java @@ -3,9 +3,7 @@ package cn.teammodel.controller.admin.controller; import cn.teammodel.common.R; import cn.teammodel.controller.admin.service.ExamService; import cn.teammodel.model.dto.admin.art.ArtFindDto; -import cn.teammodel.model.dto.admin.exam.AnalysisDto; -import cn.teammodel.model.dto.admin.exam.BlobSasDto; -import cn.teammodel.model.dto.admin.exam.OverViewDto; +import cn.teammodel.model.dto.admin.exam.*; import cn.teammodel.model.vo.admin.ArtElementsVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -38,5 +36,17 @@ public class ExamController { Map res = examService.getExamList(analysisDto,request); return R.success(res); } + @PostMapping("getExamRecord") + @ApiOperation("获取该活动的作答记录") + public R> getExamRecord(@Valid @RequestBody ExamRecordDto examRecordDto, HttpServletRequest request) { + Map res = examService.getExamRecord(examRecordDto,request); + return R.success(res); + } + @PostMapping("getExamSummary") + @ApiOperation("获取该活动详细信息和部分分析结果") + public R> getExamSummary(@Valid @RequestBody FindExamDto findExamDto, HttpServletRequest request) { + Map res = examService.getExamSimpleAnalysis(findExamDto,request); + return R.success(res); + } } diff --git a/src/main/java/cn/teammodel/controller/admin/service/ExamService.java b/src/main/java/cn/teammodel/controller/admin/service/ExamService.java index e36eccd..5ac51dd 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/ExamService.java +++ b/src/main/java/cn/teammodel/controller/admin/service/ExamService.java @@ -1,8 +1,6 @@ package cn.teammodel.controller.admin.service; -import cn.teammodel.model.dto.admin.exam.AnalysisDto; -import cn.teammodel.model.dto.admin.exam.BlobSasDto; -import cn.teammodel.model.dto.admin.exam.OverViewDto; +import cn.teammodel.model.dto.admin.exam.*; import javax.servlet.http.HttpServletRequest; import java.util.Map; @@ -10,4 +8,6 @@ import java.util.Map; public interface ExamService { Map getAnalysis(OverViewDto overViewDto, HttpServletRequest request); Map getExamList(AnalysisDto analysisDto, HttpServletRequest request); + Map getExamSimpleAnalysis(FindExamDto findExamDto, HttpServletRequest request); + Map getExamRecord(ExamRecordDto examRecordDto, HttpServletRequest request); } diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java index 7650bfb..874d472 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/ExamServiceImpl.java @@ -4,8 +4,12 @@ import cn.teammodel.common.ErrorCode; import cn.teammodel.config.exception.ServiceException; import cn.teammodel.controller.admin.service.ExamService; import cn.teammodel.model.dto.admin.exam.AnalysisDto; +import cn.teammodel.model.dto.admin.exam.ExamRecordDto; +import cn.teammodel.model.dto.admin.exam.FindExamDto; import cn.teammodel.model.dto.admin.exam.OverViewDto; +import cn.teammodel.model.entity.common.Exam; import cn.teammodel.model.entity.school.School; +import cn.teammodel.repository.ExamRepository; import cn.teammodel.repository.SchoolRepository; import cn.teammodel.utils.GroupUtil; import com.azure.cosmos.models.PartitionKey; @@ -20,6 +24,8 @@ import java.util.*; @Service public class ExamServiceImpl implements ExamService { + @Resource + private ExamRepository examRepository; @Resource private SchoolRepository schoolRepository; @Autowired @@ -61,4 +67,32 @@ public class ExamServiceImpl implements ExamService { } return overView; } + + @Override + public Map getExamSimpleAnalysis(FindExamDto findExamDto, HttpServletRequest request) { + Map simpleView; + String url_simple = env.getProperty("ies.server-url-analysis-simple"); + try { + List examList = examRepository.findExamById("Exam-"+findExamDto.getCode(), findExamDto.getId()); + simpleView = GroupUtil.getGroupId(findExamDto,new GroupUtil(env), request,url_simple); + simpleView.put("examList",examList); + }catch (Exception e) { + throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误"); + + } + return simpleView; + } + + @Override + public Map getExamRecord(ExamRecordDto examRecordDto, HttpServletRequest request) { + Map record; + String url = env.getProperty("ies.server-url-exam-find-record"); + try { + record = GroupUtil.getGroupId(examRecordDto,new GroupUtil(env), request,url); + }catch (Exception e) { + throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误"); + + } + return record; + } } diff --git a/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java b/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java index ab4ecc5..ea458ab 100644 --- a/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java +++ b/src/main/java/cn/teammodel/model/dto/admin/appraise/TimeRangeDto.java @@ -5,7 +5,7 @@ import javax.validation.constraints.NotNull; /** * @author winter - * @create 2023-12-06 19:03 + * @since 2023-12-06 19:03 */ @Data public class TimeRangeDto { @@ -13,6 +13,7 @@ public class TimeRangeDto { private Long endTime; @NotNull private String periodId; + @NotNull // todo: 似乎不需要(有时间范围就不需要这个字段来划分时间,如果不传时间那就需要) private String academicYearId; } diff --git a/src/main/java/cn/teammodel/model/dto/admin/exam/ExamRecordDto.java b/src/main/java/cn/teammodel/model/dto/admin/exam/ExamRecordDto.java new file mode 100644 index 0000000..5745e57 --- /dev/null +++ b/src/main/java/cn/teammodel/model/dto/admin/exam/ExamRecordDto.java @@ -0,0 +1,19 @@ +package cn.teammodel.model.dto.admin.exam; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class ExamRecordDto { + @ApiModelProperty("班级ID") + private String classId; + @ApiModelProperty("学校编码") + private String code; + @ApiModelProperty("该活动唯一ID") + private String id; + @ApiModelProperty("科目ID") + private String subjectId; + @ApiModelProperty("该活动开始时间") + private long startTime; + +} diff --git a/src/main/java/cn/teammodel/model/dto/admin/exam/FindExamDto.java b/src/main/java/cn/teammodel/model/dto/admin/exam/FindExamDto.java new file mode 100644 index 0000000..6cf61ba --- /dev/null +++ b/src/main/java/cn/teammodel/model/dto/admin/exam/FindExamDto.java @@ -0,0 +1,12 @@ +package cn.teammodel.model.dto.admin.exam; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class FindExamDto { + @ApiModelProperty("该活动唯一ID") + private String id; + @ApiModelProperty("学校编码") + private String code; +} diff --git a/src/main/java/cn/teammodel/repository/ExamRepository.java b/src/main/java/cn/teammodel/repository/ExamRepository.java index 31fb11e..b0be74a 100644 --- a/src/main/java/cn/teammodel/repository/ExamRepository.java +++ b/src/main/java/cn/teammodel/repository/ExamRepository.java @@ -14,4 +14,6 @@ public interface ExamRepository extends CosmosRepository { @Query("select * from Exam as s where s.code = @code and array_contains(s.classes,@classId) and s.period.id = @periodId and s.progress = 'finish' order by s.createTime ") List findExamByClassId(@Param("code")String code, @Param("classId")String classId, @Param("periodId")String periodId); + @Query("select * from Exam as s where s.code = @code and s.id = @id") + List findExamById(@Param("code")String code, @Param("id")String id); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 64c0c73..551fe7f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -78,4 +78,6 @@ ies: server-url-exam-rate: /common/exam/get-exam-point server-url-art-analysis: /analysis/art/statistics server-url-blob-sas-rcwld: /blob/sas-rcwld - server-url-exam-analysis-list: /common/exam/find-by-analysis \ No newline at end of file + 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 \ No newline at end of file