浏览代码

Merge remote-tracking branch 'origin/dev_v2.1.0' into dev_v2.1.0

caozixuan 4 年之前
父节点
当前提交
18aad64a05

+ 3 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/mapper/TBExamCourseMapper.java

@@ -7,6 +7,7 @@ import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * <p>
@@ -24,8 +25,9 @@ public interface TBExamCourseMapper extends BaseMapper<TBExamCourse> {
      * @param schoolId
      * @param examId
      * @param inspect
+     * @param collegeIds
      * @return
      */
-    List<TBExamCourseResult> findCourseList(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("inspect") boolean inspect);
+    List<TBExamCourseResult> findCourseList(@Param("schoolId") Long schoolId, @Param("examId") Long examId, @Param("inspect") boolean inspect, @Param("collegeIds") List<Long> collegeIds);
 
 }

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

@@ -164,9 +164,6 @@ public class TAExamCourseServiceImpl extends ServiceImpl<TAExamCourseMapper, TAE
         if (Objects.isNull(sysUser)) {
             throw ExceptionResultEnum.NOT_LOGIN.exception();
         }
-        // 开课课程考试概况
-        ExamCourseResult examCourseResult = taExamCourseService.getOverview(semester,examId,courseCode);
-
         //取总体和应届平均分
         SurveyTeacherExamCourseResult surveyTeacherExamCourseResult = reportCommonService.findAvgScore(schoolId, courseCode, examId);
 

+ 19 - 3
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/TBExamCourseServiceImpl.java

@@ -3,8 +3,12 @@ package com.qmth.teachcloud.report.business.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.teachcloud.common.entity.BasicCourse;
+import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.service.BasicCourseService;
+import com.qmth.teachcloud.common.service.SysOrgService;
+import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.report.business.bean.result.TBExamCourseResult;
 import com.qmth.teachcloud.report.business.entity.TBExamCourse;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
@@ -14,8 +18,7 @@ import com.qmth.teachcloud.report.business.service.TBExamCourseService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -35,6 +38,9 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
     @Resource
     private BasicCourseService basicCourseService;
 
+    @Resource
+    SysOrgService sysOrgService;
+
     @Override
     public boolean verifyExamCourseCantRun(Long examId, Long schoolId, String courseCode, String courseName) {
         QueryWrapper<BasicCourse> schoolCourseQuery = new QueryWrapper<>();
@@ -101,6 +107,16 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
      */
     @Override
     public List<TBExamCourseResult> findCourseList(Long schoolId, Long examId, boolean inspect) {
-        return tbExamCourseMapper.findCourseList(schoolId, examId, inspect);
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+        sysOrgQueryWrapper.lambda().eq(SysOrg::getParentId, sysUser.getOrgId())
+                .eq(SysOrg::getEnable, true);
+        List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
+        if (Objects.nonNull(sysOrgList) && sysOrgList.size() > 0) {
+            List<Long> collegeIds = sysOrgList.stream().map(s -> s.getId()).collect(Collectors.toList());
+            return tbExamCourseMapper.findCourseList(schoolId, examId, inspect, collegeIds);
+        } else {
+            return tbExamCourseMapper.findCourseList(schoolId, examId, inspect, Arrays.asList(sysUser.getOrgId()));
+        }
     }
 }

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

@@ -90,7 +90,7 @@
                 and a.exam_id = #{examId}
             </if>
             <if test="teachCollegeId != null">
-                and a.teach_college_id = #{teachCollegeId}
+                and a.inspect_college_id = #{teachCollegeId}
             </if>
             <if test="courseCode != null and courseCode != ''">
                 and a.course_code = #{courseCode}

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

@@ -22,6 +22,19 @@
             <if test="schoolId != null and schoolId != ''">
                 and bc.school_id = #{schoolId}
             </if>
+            <if test="collegeIds != null and collegeIds != ''">
+                <choose>
+                    <when test="inspect != null and inspect == true">
+                        and tbs.inspect_college_id in
+                    </when>
+                    <otherwise>
+                        and tbs.teach_college_id in
+                    </otherwise>
+                </choose>
+                <foreach collection="collegeIds" item="collegeId" index="index" open="(" separator="," close=")">
+                    #{collegeId}
+                </foreach>
+            </if>
         </where>
     </select>
 </mapper>