فهرست منبع

学生报告bug修复

xiaof 4 سال پیش
والد
کامیت
fedd866031

+ 11 - 0
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/bean/result/TBStudentReportResult.java

@@ -39,6 +39,9 @@ public class TBStudentReportResult implements Serializable {
     @ApiModelProperty(value = "学生名称")
     private String studentName;
 
+    @ApiModelProperty(value = "学号")
+    private String studentCode;
+
     @ApiModelProperty(value = "班级名称")
     private String clazzName;
 
@@ -116,4 +119,12 @@ public class TBStudentReportResult implements Serializable {
     public void setAbsent(Boolean absent) {
         this.absent = absent;
     }
+
+    public String getStudentCode() {
+        return studentCode;
+    }
+
+    public void setStudentCode(String studentCode) {
+        this.studentCode = studentCode;
+    }
 }

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseRecordDioMapper.java

@@ -18,7 +18,7 @@ import java.util.List;
  */
 public interface TAExamCourseRecordDioMapper extends BaseMapper<TAExamCourseRecordDio> {
 
-    List<ModuleDetailResult> listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName);
+    List<ModuleDetailResult> listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName, @Param("studentCode") String studentCode);
 
-    List<DimensionDetailResult> listSubDiosBySchoolIdAndExamIdAndStudentCodeAndCourseCodeAndModuleName(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName);
+    List<DimensionDetailResult> listSubDiosBySchoolIdAndExamIdAndStudentCodeAndCourseCodeAndModuleName(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode, @Param("moduleName") String moduleName);
 }

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TAExamCourseRecordMapper.java

@@ -22,9 +22,9 @@ public interface TAExamCourseRecordMapper extends BaseMapper<TAExamCourseRecord>
 
     List<TAExamCourseRecord> listExamCourseRecord(@Param("schoolId") Long schoolId, @Param("semester") String semester, @Param("examId") Long examId, @Param("courseCode") String courseCode);
 
-    ExamStudentResult getStudent(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
+    ExamStudentResult getStudent(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
 
-    SynthesisResult getSynthesisResult(@Param("schoolId") String schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
+    SynthesisResult getSynthesisResult(@Param("schoolId") Long schoolId, @Param("examId") String examId, @Param("studentCode") String studentCode, @Param("courseCode") String courseCode);
 
     /**
      * 查询考生信息

+ 2 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TBStudentMapper.java

@@ -3,6 +3,7 @@ package com.qmth.teachcloud.report.business.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.teachcloud.report.business.bean.result.StudentInfo;
 import com.qmth.teachcloud.report.business.entity.TBStudent;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -14,5 +15,5 @@ import com.qmth.teachcloud.report.business.entity.TBStudent;
  */
 public interface TBStudentMapper extends BaseMapper<TBStudent> {
 
-    StudentInfo getStudentBySchoolIdAndStudentCode(Long schoolId, String studentCode);
+    StudentInfo getStudentBySchoolIdAndStudentCode(@Param("schoolId") Long schoolId, @Param("studentCode") String studentCode);
 }

+ 1 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/TBExamStudentService.java

@@ -162,5 +162,5 @@ public interface TBExamStudentService extends IService<TBExamStudent> {
      * @param courseCode
      * @return
      */
-    PersonalReportResult reportMark(String schoolId, String studentCode, String examId, String courseCode);
+    PersonalReportResult reportMark(Long schoolId, String studentCode, String examId, String courseCode);
 }

+ 23 - 17
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamStudentServiceImpl.java

@@ -29,10 +29,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -232,6 +229,9 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
      */
     @Override
     public IPage<TBStudentReportResult> reportList(IPage<Map> iPage, Long schoolId, Long examId, Long collegeId, String courseCode, Long clazzId, Boolean absent) {
+        if(schoolId == null){
+            schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        }
         return tbExamStudentMapper.reportList(iPage, schoolId, examId, collegeId, courseCode, clazzId, absent);
     }
 
@@ -244,6 +244,9 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
      */
     @Override
     public ReportResult reportResult(Long schoolId, String studentCode) {
+        if(schoolId == null){
+            schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        }
         ReportResult reportResult = new ReportResult();
         // 考生信息
         StudentInfo studentInfo = tbStudentMapper.getStudentBySchoolIdAndStudentCode(schoolId, studentCode);
@@ -260,7 +263,10 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
     }
 
     @Override
-    public PersonalReportResult reportMark(String schoolId, String studentCode, String examId, String courseCode) {
+    public PersonalReportResult reportMark(Long schoolId, String studentCode, String examId, String courseCode) {
+        if(schoolId == null){
+            schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        }
         PersonalReportResult personalReportResult = new PersonalReportResult();
         // 考生信息
         ExamStudentResult examStudentResult = buildExamStudentResult(schoolId, examId, studentCode, courseCode);
@@ -272,7 +278,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
         return personalReportResult;
     }
 
-    private CollegeResult buildCollegeResult(String schoolId, String examId, String studentCode, String courseCode) {
+    private CollegeResult buildCollegeResult(Long schoolId, String examId, String studentCode, String courseCode) {
         CollegeResult collegeResult = new CollegeResult();
         // 综合信息
         SynthesisResult synthesisResult = taExamCourseRecordMapper.getSynthesisResult(schoolId, examId, studentCode, courseCode);
@@ -289,7 +295,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
         queryWrapper.lambda().eq(TBPaper::getExamId, examId).eq(TBPaper::getCourseCode, courseCode);
         List<TBPaper> papers = tbPaperMapper.selectList(queryWrapper);
 
-        if (examCourseRecords.size() != 1 || papers.size() != 1) {
+        if (examCourseRecords.size() != 1) {
             throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
         }
 
@@ -333,12 +339,12 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
             QueryWrapper<TBModuleProficiency> moduleProficiencyQueryWrapper = new QueryWrapper<>();
             moduleProficiencyQueryWrapper.lambda().eq(TBModuleProficiency::getExamId, examId).eq(TBModuleProficiency::getCourseCode, courseCode).eq(TBModuleProficiency::getModuleType, moduleName);
             List<TBModuleProficiency> moduleProficiencies = tbModuleProficiencyMapper.selectList(moduleProficiencyQueryWrapper);
-            List<TBModuleProficiency> moduleProficiencieTemps = moduleProficiencies.stream().flatMap(e -> {
-                TBModuleProficiency tbModuleProficiency = new TBModuleProficiency();
-                tbModuleProficiency.setExamId(e.getExamId());
-                tbModuleProficiency.setCourseCode(e.getCourseCode());
-                tbModuleProficiency.setModuleType(e.getModuleType());
-                tbModuleProficiency.setInterpret(e.getInterpret());
+            List<Map<String, String>> moduleProficiencieTemps = moduleProficiencies.stream().flatMap(e -> {
+                Map<String, String> tbModuleProficiency = new HashMap();
+                tbModuleProficiency.put("examId",e.getExamId().toString());
+                tbModuleProficiency.put("courseCode",e.getCourseCode());
+                tbModuleProficiency.put("moduleType", e.getModuleType());
+                tbModuleProficiency.put("interpret", e.getInterpret());
                 return Stream.of(tbModuleProficiency);
             }).distinct().collect(Collectors.toList());
 
@@ -346,11 +352,11 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
                 throw ExceptionResultEnum.ERROR.exception("获取数据异常,应该有且仅有一条数据");
             }
             ModuleResult moduleResult = new ModuleResult();
-            TBModuleProficiency tbModuleProficiency = moduleProficiencieTemps.get(0);
-            String info = tbModuleProficiency.getModuleType().concat(":").concat(tbModuleProficiency.getInterpret());
+            Map<String, String> tbModuleProficiency = moduleProficiencieTemps.get(0);
+            String info = tbModuleProficiency.get("moduleType").concat(":").concat(tbModuleProficiency.get("interpret"));
             moduleResult.setInfo(info);
 
-            List<ModuleDetailResult> dios = taExamCourseRecordDioMapper.listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(schoolId, examId, courseCode, moduleName);
+            List<ModuleDetailResult> dios = taExamCourseRecordDioMapper.listDiosBySchoolIdAndExamIdAndCourseCodeAndModuleName(schoolId, examId, courseCode, moduleName, studentCode);
             moduleResult.setDios(dios);
             diagnosisDetailResult.setModules(moduleResult);
 
@@ -384,7 +390,7 @@ public class TBExamStudentServiceImpl extends ServiceImpl<TBExamStudentMapper, T
         return collegeResult;
     }
 
-    private ExamStudentResult buildExamStudentResult(String schoolId, String examId, String studentCode, String courseCode) {
+    private ExamStudentResult buildExamStudentResult(Long schoolId, String examId, String studentCode, String courseCode) {
         ExamStudentResult examStudentResult = taExamCourseRecordMapper.getStudent(schoolId, examId, studentCode, courseCode);
         if (examStudentResult != null) {
             QueryWrapper<TBCommonRankLevelConfig> queryWrapper = new QueryWrapper<>();

+ 1 - 0
teachcloud-report-business/src/main/resources/mapper/TAExamCourseRecordDioMapper.xml

@@ -40,6 +40,7 @@
             and a.exam_id = #{examId}
             and a.course_code = #{courseCode}
             and a.dimension_type = #{moduleName}
+            and a.student_code = #{studentCode}
         </where>
     </select>
     <select id="listSubDiosBySchoolIdAndExamIdAndStudentCodeAndCourseCodeAndModuleName"

+ 3 - 3
teachcloud-report-business/src/main/resources/mapper/TBExamStudentMapper.xml

@@ -196,7 +196,7 @@
 
     <select id="reportList" resultType="com.qmth.teachcloud.report.business.bean.result.TBStudentReportResult">
         SELECT
-            c.name inspectCollegeName,
+            c.name collegeName,
             b.exam_code examCode,
             a.course_code courseCode,
             a.student_code studentCode,
@@ -245,7 +245,7 @@
                 LEFT JOIN
             t_b_exam b ON a.exam_id = b.id
         <where>
-            and a.school_id = #{schoolId}
+            and b.school_id = #{schoolId}
             and a.student_code = #{studentCode}
         </where>
         order by b.exam_time desc
@@ -266,7 +266,7 @@
                 LEFT JOIN
             t_b_exam c ON a.exam_id = c.id
         <where>
-            and a.school_id = #{schoolId}
+            and b.school_id = #{schoolId}
             and a.exam_id = #{examId}
             and a.student_code = #{studentCode}
         </where>

+ 9 - 9
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/StudentReportController.java

@@ -27,12 +27,12 @@ public class StudentReportController {
     @ApiOperation(value = "学生报告预览-列表接口")
     @RequestMapping(value = "/report/list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
-    public Result reportList(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId,
-                             @ApiParam(value = "考试id", required = true) @RequestParam String examId,
-                             @ApiParam(value = "学院id", required = true) @RequestParam String collegeId,
-                             @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
-                             @ApiParam(value = "班级id", required = true) @RequestParam String clazzId,
-                             @ApiParam(value = "是否缺考", required = true) @RequestParam Boolean absent,
+    public Result reportList(@ApiParam(value = "学校id", required = false) @RequestParam(required = false) String schoolId,
+                             @ApiParam(value = "考试id", required = true) @RequestParam(required = false) String examId,
+                             @ApiParam(value = "学院id", required = true) @RequestParam(required = false) String collegeId,
+                             @ApiParam(value = "科目编码", required = true) @RequestParam(required = false) String courseCode,
+                             @ApiParam(value = "班级id", required = true) @RequestParam(required = false) String clazzId,
+                             @ApiParam(value = "是否缺考", required = true) @RequestParam(required = false) Boolean absent,
                              @ApiParam(value = "分页页码", required = true) @RequestParam int pageNumber,
                              @ApiParam(value = "分页数", required = true) @RequestParam int pageSize) {
         return ResultUtil.ok(tbExamStudentService.reportList(new Page<>(pageNumber, pageSize), SystemConstant.convertIdToLong(schoolId),
@@ -46,7 +46,7 @@ public class StudentReportController {
     @ApiOperation(value = "学生报告-个人成绩总览接口")
     @RequestMapping(value = "/report/result", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
-    public Result reportResult(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId,
+    public Result reportResult(@ApiParam(value = "学校id", required = false) @RequestParam(required = false) String schoolId,
                                @ApiParam(value = "学号", required = true) @RequestParam String studentCode) {
         return ResultUtil.ok(tbExamStudentService.reportResult(SystemConstant.convertIdToLong(schoolId), studentCode));
     }
@@ -54,10 +54,10 @@ public class StudentReportController {
     @ApiOperation(value = "学生报告接口")
     @RequestMapping(value = "/report/mark", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "考生信息", response = TBExamStudentResult.class)})
-    public Result reportMark(@ApiParam(value = "学校id", required = true) @RequestParam String schoolId,
+    public Result reportMark(@ApiParam(value = "学校id", required = false) @RequestParam(required = false) String schoolId,
                              @ApiParam(value = "学号", required = true) @RequestParam String studentCode,
                              @ApiParam(value = "考试id", required = true) @RequestParam String examId,
                              @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode) {
-        return ResultUtil.ok(tbExamStudentService.reportMark(schoolId, studentCode, examId, courseCode));
+        return ResultUtil.ok(tbExamStudentService.reportMark(SystemConstant.convertIdToLong(schoolId), studentCode, examId, courseCode));
     }
 }