Browse Source

bug修复

wangliang 4 years ago
parent
commit
f41bfa6716

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

@@ -40,7 +40,8 @@ public interface TAExamCourseRecordMapper extends BaseMapper<TAExamCourseRecord>
      *
      * @param examId
      * @param courseCode
+     * @param filter
      * @return
      */
-    List<SurveyTeacherDistributionResult> surveyTeacherDistribution(@Param("examId") Long examId, @Param("courseCode") String courseCode);
+    List<SurveyTeacherDistributionResult> surveyTeacherDistribution(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("filter") boolean filter);
 }

+ 4 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/ReportCommonService.java

@@ -42,9 +42,10 @@ public interface ReportCommonService {
      * @param examId
      * @param courseCode
      * @param collegeId
+     * @param filter
      * @return
      */
-    List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId);
+    List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId, boolean filter);
 
     /**
      * 学院学科报表查询维度
@@ -94,9 +95,10 @@ public interface ReportCommonService {
      * @param schoolId
      * @param courseCode
      * @param examId
+     * @param filter
      * @return
      */
-    SurveyTeacherExamCourseResult findAvgScore(Long schoolId, String courseCode, Long examId);
+    SurveyTeacherExamCourseResult findAvgScore(Long schoolId, String courseCode, Long examId, boolean filter);
 
     /**
      * 武汉大学退出

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

@@ -31,7 +31,8 @@ public interface TAExamCourseRecordService extends IService<TAExamCourseRecord>
      *
      * @param examId
      * @param courseCode
+     * @param filter
      * @return
      */
-    List<SurveyTeacherDistributionResult> surveyTeacherDistribution(Long examId, String courseCode);
+    List<SurveyTeacherDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, boolean filter);
 }

+ 22 - 11
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -233,12 +233,13 @@ public class ReportCommonServiceImpl implements ReportCommonService {
      * @param examId
      * @param courseCode
      * @param collegeId
+     * @param filter
      * @return
      */
     @Override
-    public List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId) {
+    public List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId, boolean filter) {
         List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = new ArrayList<>();
-        List<SurveyTeacherDistributionResult> surveyTeacherDistributionResultList = taExamCourseRecordService.surveyTeacherDistribution(examId, courseCode);
+        List<SurveyTeacherDistributionResult> surveyTeacherDistributionResultList = taExamCourseRecordService.surveyTeacherDistribution(examId, courseCode, filter);
         surveyTeacherDistributionResultList = surveyTeacherDistributionResultList.stream().filter(e -> !e.getAbsent()).collect(Collectors.toList());
         //过滤应届
         List<SurveyTeacherDistributionResult> currentDistributionResultList = surveyTeacherDistributionResultList.stream().filter(e -> e.getStudentCurrent() == true && !e.getAbsent()).collect(Collectors.toList());
@@ -500,29 +501,39 @@ public class ReportCommonServiceImpl implements ReportCommonService {
      * @param schoolId
      * @param courseCode
      * @param examId
+     * @param filter
      * @return
      */
     @Override
-    public SurveyTeacherExamCourseResult findAvgScore(Long schoolId, String courseCode, Long examId) {
+    public SurveyTeacherExamCourseResult findAvgScore(Long schoolId, String courseCode, Long examId, boolean filter) {
         //取总体和应届平均分
         QueryWrapper<TAExamCourse> taExamCourseQueryWrapper = new QueryWrapper<>();
-        QueryWrapper<TBExamCourse> tbExamCourseQueryWrapper = new QueryWrapper<>();
         if (Objects.nonNull(schoolId)) {
             taExamCourseQueryWrapper.lambda().eq(TAExamCourse::getSchoolId, schoolId);
-            tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getSchoolId, schoolId);
         }
         if (Objects.nonNull(examId)) {
             taExamCourseQueryWrapper.lambda().eq(TAExamCourse::getExamId, examId);
-            tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getExamId, examId);
         }
         if (Objects.nonNull(courseCode)) {
             taExamCourseQueryWrapper.lambda().eq(TAExamCourse::getCourseCode, courseCode);
-            tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getCourseCode, courseCode);
         }
-        tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getPublishStatus, PublishStatusEnum.PUBLISH);
-        TBExamCourse tbExamCourse = tbExamCourseService.getOne(tbExamCourseQueryWrapper);
-        if (Objects.isNull(tbExamCourse)) {
-            return new SurveyTeacherExamCourseResult();
+        if (filter) {
+            QueryWrapper<TBExamCourse> tbExamCourseQueryWrapper = new QueryWrapper<>();
+            if (Objects.nonNull(schoolId)) {
+                tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getSchoolId, schoolId);
+            }
+            if (Objects.nonNull(examId)) {
+                tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getExamId, examId);
+            }
+            if (Objects.nonNull(courseCode)) {
+                tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getCourseCode, courseCode);
+            }
+            tbExamCourseQueryWrapper.lambda().eq(TBExamCourse::getPublishStatus, PublishStatusEnum.PUBLISH);
+            TBExamCourse tbExamCourse = tbExamCourseService.getOne(tbExamCourseQueryWrapper);
+            if (Objects.isNull(tbExamCourse)) {
+                BigDecimal bigDecimal = new BigDecimal(0);
+                return new SurveyTeacherExamCourseResult(bigDecimal, bigDecimal, bigDecimal, bigDecimal);
+            }
         }
         TAExamCourse taExamCourse = taExamCourseService.getOne(taExamCourseQueryWrapper);
         BigDecimal bigDecimal = new BigDecimal(1);

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseRecordServiceImpl.java

@@ -45,7 +45,7 @@ public class TAExamCourseRecordServiceImpl extends ServiceImpl<TAExamCourseRecor
      * @return
      */
     @Override
-    public List<SurveyTeacherDistributionResult> surveyTeacherDistribution(Long examId, String courseCode) {
-        return taExamCourseRecordMapper.surveyTeacherDistribution(examId, courseCode);
+    public List<SurveyTeacherDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, boolean filter) {
+        return taExamCourseRecordMapper.surveyTeacherDistribution(examId, courseCode, filter);
     }
 }

+ 4 - 4
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TAExamCourseServiceImpl.java

@@ -120,12 +120,12 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         //取总体和应届平均分
-        SurveyTeacherExamCourseResult surveyTeacherExamCourseResult = reportCommonService.findAvgScore(schoolId, courseCode, examId);
+        SurveyTeacherExamCourseResult surveyTeacherExamCourseResult = reportCommonService.findAvgScore(schoolId, courseCode, examId, true);
         //学院学科报表科目描述
         List<GradeDistributeResult> gradeDistributeResultList = new ArrayList<>();//全体卷面成绩
         List<GradeDistributePaperResult> gradeDistributePaperResultList = new ArrayList<>();//全体赋分成绩
         List<GradeDistributeCurrentAssignedResult> gradeDistributeCurrentAssignedResultList = new ArrayList<>();//应届赋分成绩
-        List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId());
+        List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId(), true);
         if (Objects.nonNull(surveyTeacherGradeDistributionResultList) && surveyTeacherGradeDistributionResultList.size() > 0) {
             for (SurveyTeacherGradeDistributionResult s : surveyTeacherGradeDistributionResultList) {
                 String describe = String.join(",", s.getDescribe());
@@ -190,10 +190,10 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         TeachCourseSurveyResult teachCourseSurveyResult = this.getTeachCourseSurveyInfo(semester, examId, courseCode);
 
         //取总体和应届平均分
-        SurveyTeacherExamCourseResult surveyTeacherExamCourseResult = reportCommonService.findAvgScore(schoolId, courseCode, examId);
+        SurveyTeacherExamCourseResult surveyTeacherExamCourseResult = reportCommonService.findAvgScore(schoolId, courseCode, examId, false);
 
         //学院学科报表科目描述
-        List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId());
+        List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId(), false);
         //查找题目信息
         QuestionListResult questionListResult = reportCommonService.findQuestionInfo(examId, courseCode, sysUser.getOrgId());
         return new SurveyTeacherViewResult(surveyTeacherGradeDistributionResultList, questionListResult, surveyTeacherExamCourseResult, teachCourseSurveyResult);

+ 5 - 1
teachcloud-report-business/src/main/resources/mapper/TAExamCourseRecordMapper.xml

@@ -137,8 +137,10 @@
             tber.id = taecr.exam_record_id
         join t_b_exam_student tbes on
             tber.exam_student_id = tbes.id
-        join t_b_exam_course tbec on
+        <if test="filter != null and filter == true">
+            join t_b_exam_course tbec on
             tbec.course_code = taecr.course_code
+        </if>
         <where>
             <if test="examId != null and examId != ''">
                 AND taecr.exam_id = #{examId}
@@ -146,7 +148,9 @@
             <if test="courseCode != null and courseCode != ''">
                 AND taecr.course_code = #{courseCode}
             </if>
+            <if test="filter != null and filter == true">
                 and tbec.publish_status = 'PUBLISH'
+            </if>
         </where>
     </select>
 </mapper>