wangliang 4 年 前
コミット
ac122a0b03

+ 9 - 6
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/CourseReportServiceImpl.java

@@ -29,16 +29,21 @@ public class CourseReportServiceImpl implements CourseReportService {
 
     @Override
     @Cacheable(value = SystemConstant.COLLEGE_DEAN_REPORT, key = "#schoolId + '-' + #semester + '-' + #examId + '-' +#collegeId")
-    public InspectCourseTotalReportResult findInfoInspectCourseExamTotal(Long schoolId, SemesterEnum semester, Long examId,Long collegeId) {
+    public InspectCourseTotalReportResult findInfoInspectCourseExamTotal(Long schoolId, SemesterEnum semester, Long examId, Long collegeId) {
 
         // 考试总览数据
         List<ExamBaseInfo> examBaseInfoList = courseReportMapper.findExamTotalByExamId(examId);
-        if (examBaseInfoList.size() != 1){
-            throw ExceptionResultEnum.ERROR.exception("考试分析数据异常");
+        if (Objects.isNull(examBaseInfoList) || examBaseInfoList.size() == 0) {
+            return null;
         }
 
+        InspectCourseTotalReportResult inspectCourseTotalReportResult = new InspectCourseTotalReportResult();
+        inspectCourseTotalReportResult.setExamBaseInfo(examBaseInfoList.get(0));
         // 学院下各课程数据和学校对比数据
-        List<CollegeCourseInfo> collegeCourseInfoList = courseReportMapper.findCollegeCourseInfo(examId,collegeId);
+        List<CollegeCourseInfo> collegeCourseInfoList = courseReportMapper.findCollegeCourseInfo(examId, collegeId);
+        if (Objects.isNull(collegeCourseInfoList) || collegeCourseInfoList.size() == 0) {
+            return inspectCourseTotalReportResult;
+        }
 
         // 低于平均分课程数据源
         List<CollegeCourseInfo> lowAvgDatasource = collegeCourseInfoList
@@ -63,8 +68,6 @@ public class CourseReportServiceImpl implements CourseReportService {
         collegeInfo.setCollegeCourseInfoList(collegeCourseInfoList);
         collegeInfo.setLowAvgInfo(lowAvgInfo);
 
-        InspectCourseTotalReportResult inspectCourseTotalReportResult = new InspectCourseTotalReportResult();
-        inspectCourseTotalReportResult.setExamBaseInfo(examBaseInfoList.get(0));
         inspectCourseTotalReportResult.setCollegeInfo(collegeInfo);
 
         return inspectCourseTotalReportResult;

+ 17 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/ReportCommonServiceImpl.java

@@ -9,9 +9,11 @@ import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.report.business.bean.result.*;
 import com.qmth.teachcloud.report.business.entity.TAExamCourse;
 import com.qmth.teachcloud.report.business.entity.TBDimension;
+import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.entity.TBPaper;
 import com.qmth.teachcloud.report.business.enums.GradeScopeEnum;
 import com.qmth.teachcloud.report.business.enums.PiecewiseScopeEnum;
+import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.service.*;
 import com.qmth.teachcloud.report.business.utils.AnalyzeScopeUtil;
 import com.qmth.teachcloud.report.business.utils.MathUtil;
@@ -68,6 +70,9 @@ public class ReportCommonServiceImpl implements ReportCommonService {
     @Resource
     TAExamCourseService taExamCourseService;
 
+    @Resource
+    TBExamCourseService tbExamCourseService;
+
     /**
      * 学院学科报表查询科目信息
      *
@@ -233,10 +238,10 @@ public class ReportCommonServiceImpl implements ReportCommonService {
     @Override
     public List<SurveyTeacherGradeDistributionResult> surveyTeacherDistribution(Long examId, String courseCode, Long collegeId) {
         List<SurveyTeacherDistributionResult> surveyTeacherDistributionResultList = taExamCourseRecordService.surveyTeacherDistribution(examId, courseCode);
-        surveyTeacherDistributionResultList = surveyTeacherDistributionResultList.stream().filter(e -> !e.getAbsent()).collect(Collectors.toList());
-        if (surveyTeacherDistributionResultList.size() < 1) {
-            throw ExceptionResultEnum.DATA_ERROR.exception();
+        if (Objects.isNull(surveyTeacherDistributionResultList) || surveyTeacherDistributionResultList.size() == 0) {
+            return null;
         }
+        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());
         double allTotalCount = surveyTeacherDistributionResultList.size(); // 总体人数
@@ -504,14 +509,23 @@ public class ReportCommonServiceImpl implements ReportCommonService {
     public SurveyTeacherExamCourseResult findAvgScore(Long schoolId, String courseCode, Long examId) {
         //取总体和应届平均分
         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 null;
         }
         TAExamCourse taExamCourse = taExamCourseService.getOne(taExamCourseQueryWrapper);
         BigDecimal bigDecimal = new BigDecimal(1);

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

@@ -126,11 +126,13 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         List<GradeDistributePaperResult> gradeDistributePaperResultList = new ArrayList<>();//全体赋分成绩
         List<GradeDistributeCurrentAssignedResult> gradeDistributeCurrentAssignedResultList = new ArrayList<>();//应届赋分成绩
         List<SurveyTeacherGradeDistributionResult> surveyTeacherGradeDistributionResultList = reportCommonService.surveyTeacherDistribution(examId, courseCode, sysUser.getOrgId());
-        for (SurveyTeacherGradeDistributionResult s : surveyTeacherGradeDistributionResultList) {
-            String describe = String.join(",", s.getDescribe());
-            gradeDistributeResultList.add(new GradeDistributeResult(describe, s.getAllCountRateAfter(), s.getAllCountAfter(), s.getCurrentCountAfter(), s.getCurrentCountRateAfter()));
-            gradeDistributePaperResultList.add(new GradeDistributePaperResult(describe, s.getAllCountRateBefore(), s.getAllCountBefore()));
-            gradeDistributeCurrentAssignedResultList.add(new GradeDistributeCurrentAssignedResult(describe, s.getCurrentCountRateAfter(), s.getCurrentCountAfter()));
+        if (Objects.nonNull(surveyTeacherGradeDistributionResultList) && surveyTeacherGradeDistributionResultList.size() > 0) {
+            for (SurveyTeacherGradeDistributionResult s : surveyTeacherGradeDistributionResultList) {
+                String describe = String.join(",", s.getDescribe());
+                gradeDistributeResultList.add(new GradeDistributeResult(describe, s.getAllCountRateAfter(), s.getAllCountAfter(), s.getCurrentCountAfter(), s.getCurrentCountRateAfter()));
+                gradeDistributePaperResultList.add(new GradeDistributePaperResult(describe, s.getAllCountRateBefore(), s.getAllCountBefore()));
+                gradeDistributeCurrentAssignedResultList.add(new GradeDistributeCurrentAssignedResult(describe, s.getCurrentCountRateAfter(), s.getCurrentCountAfter()));
+            }
         }
         return new GradeDistributeFinalResult(surveyTeacherExamCourseResult, gradeDistributeResultList, gradeDistributePaperResultList, gradeDistributeCurrentAssignedResultList);
     }

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

@@ -30,9 +30,12 @@
                 INNER JOIN t_a_exam_course pap ON col.exam_id = pap.exam_id
                 AND col.course_code = pap.course_code
                 AND col.school_id = pap.school_id
+            join t_b_exam_course tbec on
+		        tbec.course_code = col.course_code
         WHERE
             col.exam_id = #{examId}
           AND col.college_id = #{collegeId}
+          and tbec.publish_status = 'PUBLISH'
         ORDER BY
             col.course_code;
     </select>

+ 9 - 0
teachcloud-report-business/src/main/resources/mapper/TAExamCourseCollegeTeacherMapper.xml

@@ -17,6 +17,8 @@
             t_a_exam_course_college_teacher a
                 LEFT JOIN
             t_b_exam b ON a.exam_id = b.id
+            join t_b_exam_course tbec on
+                tbec.course_code = a.course_code
         <where>
             and b.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
@@ -37,6 +39,7 @@
                     #{collegeId}
                 </foreach>
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where> ) t
             <if test="column != null and column != '' and order != null and order != ''">
                 <choose>
@@ -108,6 +111,8 @@
         t_a_exam_course_college_teacher a
         LEFT JOIN
         t_b_exam b ON a.exam_id = b.id
+        join t_b_exam_course tbec on
+            tbec.course_code = a.course_code
         <where>
             and b.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
@@ -131,6 +136,7 @@
                     #{collegeId}
                 </foreach>
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where> ) t
             <if test="column != null and column != '' and order != null and order != ''">
                 <choose>
@@ -195,6 +201,8 @@
         t_a_exam_course_college_teacher a
         LEFT JOIN
         t_b_exam b ON a.exam_id = b.id
+        join t_b_exam_course tbec on
+        tbec.course_code = a.course_code
         <where>
             and b.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
@@ -206,6 +214,7 @@
             <if test="courseCode != null and courseCode != ''">
                 and a.course_code = #{courseCode}
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where> ) t
         <if test="column != null and column != '' and order != null and order != ''">
             <choose>

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

@@ -109,6 +109,8 @@
             t_a_exam_course a
                 LEFT JOIN
             t_b_exam b ON a.exam_id = b.id
+            join t_b_exam_course tbec on
+                tbec.course_code = a.course_code
         <where>
             <if test="schoolId != null">
                 and b.school_id = #{schoolId}
@@ -122,6 +124,7 @@
             <if test="courseCode != null and courseCode != ''">
                 and a.course_code = #{courseCode}
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where>
     </select>
 

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

@@ -137,6 +137,8 @@
             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
+            tbec.course_code = taecr.course_code
         <where>
             <if test="examId != null and examId != ''">
                 AND taecr.exam_id = #{examId}
@@ -144,6 +146,7 @@
             <if test="courseCode != null and courseCode != ''">
                 AND taecr.course_code = #{courseCode}
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where>
     </select>
 </mapper>

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

@@ -57,6 +57,8 @@
         t_a_exam_course a
         LEFT JOIN
         t_b_exam b ON a.exam_id = b.id
+        join t_b_exam_course tbec on
+        tbec.course_code = a.course_code
         <where>
             and b.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
@@ -71,6 +73,7 @@
                     #{collegeId}
                 </foreach>
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where>
         ) t
         <if test="column != null and column != '' and order != null and order != ''">

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

@@ -15,6 +15,8 @@
                 so.id = tbs.teach_college_id
             </otherwise>
         </choose>
+        join t_b_exam_course tbec on
+            tbec.course_code = bc.code
         <where>
             <if test="examId != null and examId != ''">
                 and tbs.exam_id = #{examId}
@@ -35,6 +37,7 @@
                     #{collegeId}
                 </foreach>
             </if>
+                and tbec.publish_status = 'PUBLISH'
         </where>
     </select>
 

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

@@ -245,6 +245,8 @@
         sys_org g ON a.inspect_college_id = g.id
         LEFT JOIN
         sys_user h ON a.teacher_id = h.id
+        join t_b_exam_course tbec on
+            tbec.course_code = a.course_code
         <where>
             and d.school_id = #{schoolId}
             <if test="semester != null and semester != ''">
@@ -273,6 +275,7 @@
                 or a.student_code like concat('%' ,#{studentParam}, '%')
                 or a.name like concat('%' ,#{studentParam}, '%'))
             </if>
+            and tbec.publish_status = 'PUBLISH'
         </where> ) t
         <if test="column != null and column != '' and order != null and order != ''">
             order by t.${column} ${order}

+ 0 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/TBExamStudentController.java

@@ -121,7 +121,6 @@ public class TBExamStudentController {
             @ApiParam(value = "分页数量", required = true) @RequestParam Integer pageSize,
             @ApiParam(value = "排序列", required = false) @RequestParam(required = false) String column,
             @ApiParam(value = "排序规则", required = false) @RequestParam(required = false) OrderEnum order) {
-
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         Long orgId = sysUser.getOrgId();
         return ResultUtil.ok(tbExamStudentService.listInspectCollegeResult(semester, examId, courseCode, current, orgId, teacherId, clazzId, studentParam, pageNumber, pageSize, column, order));

+ 4 - 4
teachcloud-report/src/main/resources/application-test.properties

@@ -46,10 +46,10 @@ sys.config.attachmentSize=200
 sys.config.serverUpload=
 sys.config.fileHost=192.168.10.136:8005
 sys.config.serverHost=192.168.10.136:8005
-#sys.config.accessKey=0bce69d94a7b4aef8bc0badf150351a9
-#sys.config.accessSecret=LdUwb5X4etmjW7fDn0KAdoXG0Yt7AkDu
-sys.config.accessKey=274f823e5f59410f8b3bb6edcd8e2b6e
-sys.config.accessSecret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
+#sys.config.accessKey=274f823e5f59410f8b3bb6edcd8e2b6e
+#sys.config.accessSecret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
+sys.config.accessKey=
+sys.config.accessSecret=
 sys.config.adminLogoUrl=http://qmth-test.oss-cn-shenzhen.aliyuncs.com/frontend/wx_logo.png
 #sys.config.htmlToPdfUrl=/usr/local/bin/wkhtmltopdf
 #sys.config.htmlToPdfUrl=/usr/local/bin/wkhtmltopdf