瀏覽代碼

新增考查学院查询列表

wangliang 2 年之前
父節點
當前提交
7d06f4bad2

+ 57 - 7
src/main/java/com/qmth/eds/api/SysController.java

@@ -6,27 +6,31 @@ import com.qmth.boot.api.annotation.BOOL;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.eds.bean.params.LoginParam;
 import com.qmth.eds.bean.result.EditResult;
+import com.qmth.eds.bean.result.ExamineCollegeResult;
 import com.qmth.eds.bean.result.LoginResult;
+import com.qmth.eds.common.entity.CloudMarkingScore;
+import com.qmth.eds.common.entity.ExamSyncStudent;
 import com.qmth.eds.common.entity.SysUser;
 import com.qmth.eds.common.enums.AppSourceEnum;
 import com.qmth.eds.common.enums.ExceptionResultEnum;
-import com.qmth.eds.service.SysUserService;
-import com.qmth.eds.service.TeachcloudCommonService;
 import com.qmth.eds.common.util.Result;
 import com.qmth.eds.common.util.ResultUtil;
 import com.qmth.eds.common.util.ServletUtil;
+import com.qmth.eds.service.CloudMarkingScoreService;
+import com.qmth.eds.service.ExamSyncStudentService;
+import com.qmth.eds.service.SysUserService;
+import com.qmth.eds.service.TeachcloudCommonService;
 import io.swagger.annotations.*;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.security.NoSuchAlgorithmException;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 系统公共Controller
@@ -35,12 +39,19 @@ import java.util.List;
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/common")
 public class SysController {
+
     @Resource
     SysUserService sysUserService;
 
     @Resource
     TeachcloudCommonService teachcloudCommonService;
 
+    @Resource
+    CloudMarkingScoreService cloudMarkingScoreService;
+
+    @Resource
+    ExamSyncStudentService examSyncStudentService;
+
     /**
      * 登录
      *
@@ -99,4 +110,43 @@ public class SysController {
         return ResultUtil.ok();
     }
 
+    /**
+     * 登出
+     */
+    @ApiOperation(value = "查询考查学院列表")
+    @PostMapping("/examine/college/list")
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = ExamineCollegeResult.class)})
+    public Result examineCollegeList(@ApiParam(value = "学期id") @RequestParam(required = false) Long semesterId,
+                                     @ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
+                                     @ApiParam(value = "科目代码") @RequestParam(required = false) String subjectCode) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
+        QueryWrapper<CloudMarkingScore> cloudMarkingScoreQueryWrapper = new QueryWrapper<>();
+        cloudMarkingScoreQueryWrapper.lambda().eq(CloudMarkingScore::getSchoolId, sysUser.getOrgId());
+        if (Objects.nonNull(semesterId) && !Objects.equals(semesterId, "")) {
+            cloudMarkingScoreQueryWrapper.lambda().eq(CloudMarkingScore::getSemesterId, semesterId);
+        }
+        if (Objects.nonNull(examId) && !Objects.equals(examId, "")) {
+            cloudMarkingScoreQueryWrapper.lambda().eq(CloudMarkingScore::getExamId, examId);
+        }
+        if (Objects.nonNull(subjectCode) && !Objects.equals(subjectCode.trim(), "")) {
+            cloudMarkingScoreQueryWrapper.lambda().eq(CloudMarkingScore::getSubjectCode, subjectCode);
+        }
+        //先查询云阅卷科目代码
+        List<CloudMarkingScore> cloudMarkingScoreList = cloudMarkingScoreService.queryBySyncCourseCode(schoolId, sysUser.getOrgId(), subjectCode);
+        Set<String> subjectCodeSet = null;
+        if (!CollectionUtils.isEmpty(cloudMarkingScoreList)) {
+            subjectCodeSet = new HashSet<>(cloudMarkingScoreList.size());
+            subjectCodeSet = cloudMarkingScoreList.stream().map(s -> s.getSubjectCode()).collect(Collectors.toSet());
+        }
+        List<ExamSyncStudent> examSyncStudentList = examSyncStudentService.queryByExamineCollegeList(schoolId, sysUser.getOrgId(), examId, subjectCode, subjectCodeSet);
+        List<ExamineCollegeResult> examineCollegeResultList = null;
+        if (!CollectionUtils.isEmpty(examSyncStudentList)) {
+            examineCollegeResultList = new ArrayList<>(examSyncStudentList.size());
+            for (ExamSyncStudent e : examSyncStudentList) {
+                examineCollegeResultList.add(new ExamineCollegeResult(e.getJgmc(), e.getJgmc()));
+            }
+        }
+        return ResultUtil.ok(examineCollegeResultList);
+    }
 }

+ 46 - 0
src/main/java/com/qmth/eds/bean/result/ExamineCollegeResult.java

@@ -0,0 +1,46 @@
+package com.qmth.eds.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 考查学院result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2023/5/23
+ */
+public class ExamineCollegeResult implements Serializable {
+
+    @ApiModelProperty(value = "编码")
+    String code;
+
+    @ApiModelProperty(value = "名称")
+    String name;
+
+    public ExamineCollegeResult() {
+
+    }
+
+    public ExamineCollegeResult(String code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 0 - 2
src/main/java/com/qmth/eds/common/entity/CloudMarkingScore.java

@@ -1,7 +1,5 @@
 package com.qmth.eds.common.entity;
 
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

+ 12 - 0
src/main/java/com/qmth/eds/mapper/CloudMarkingScoreMapper.java

@@ -7,10 +7,22 @@ import com.qmth.eds.bean.dto.CloudMarkingScoreDto;
 import com.qmth.eds.common.entity.CloudMarkingScore;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 云阅卷成绩表 Mapper 接口
  */
 public interface CloudMarkingScoreMapper extends BaseMapper<CloudMarkingScore> {
 
     IPage<CloudMarkingScoreDto> pageData(@Param("page") Page<CloudMarkingScoreDto> page, @Param("collegeId") Long collegeId, @Param("semesterId") Long semesterId, @Param("examTypeId") Long examTypeId, @Param("examId") String examId);
+
+    /**
+     * 根据科目代码查询
+     *
+     * @param schoolId
+     * @param orgId
+     * @param courseCode
+     * @return
+     */
+    List<CloudMarkingScore> queryBySyncCourseCode(@Param("schoolId") Long schoolId, @Param("orgId") Long orgId, @Param("courseCode") String courseCode);
 }

+ 16 - 0
src/main/java/com/qmth/eds/mapper/ExamSyncStudentMapper.java

@@ -2,9 +2,25 @@ package com.qmth.eds.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.qmth.eds.common.entity.ExamSyncStudent;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Set;
 
 /**
  * 考务数据同步考生信息表 Mapper 接口
  */
 public interface ExamSyncStudentMapper extends BaseMapper<ExamSyncStudent> {
+
+    /**
+     * 根据机构id、考试id、科目代码查询考查学院
+     *
+     * @param schoolId
+     * @param orgId
+     * @param examId
+     * @param courseCode
+     * @param subjectCodeSet
+     * @return
+     */
+    List<ExamSyncStudent> queryByExamineCollegeList(@Param("schoolId") Long schoolId, @Param("orgId") Long orgId, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("subjectCodeSet") Set<String> subjectCodeSet);
 }

+ 12 - 0
src/main/java/com/qmth/eds/service/CloudMarkingScoreService.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.eds.bean.dto.CloudMarkingScoreDto;
 import com.qmth.eds.common.entity.CloudMarkingScore;
 
+import java.util.List;
+
 /**
  * 云阅卷成绩表 服务类
  */
@@ -13,4 +15,14 @@ public interface CloudMarkingScoreService extends IService<CloudMarkingScore> {
     void deleteByKeys(Long schoolId, Long semesterId, Long examTypeId, Integer examId);
 
     IPage<CloudMarkingScoreDto> pageData(Long collegeId, Long semesterId, Long examTypeId, String examId, Integer pageNumber, Integer pageSize);
+
+    /**
+     * 根据科目代码查询
+     *
+     * @param schoolId
+     * @param orgId
+     * @param courseCode
+     * @return
+     */
+    List<CloudMarkingScore> queryBySyncCourseCode(Long schoolId, Long orgId, String courseCode);
 }

+ 13 - 0
src/main/java/com/qmth/eds/service/ExamSyncStudentService.java

@@ -5,6 +5,7 @@ import com.qmth.eds.common.entity.ExamSyncStudent;
 import com.qmth.eds.common.entity.ExamSyncTotal;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * 考试类型表 服务类
@@ -12,4 +13,16 @@ import java.util.List;
 public interface ExamSyncStudentService extends IService<ExamSyncStudent> {
 
     List<ExamSyncStudent> listByExamSyncTotalId(ExamSyncTotal examSyncTotal);
+
+    /**
+     * 根据机构id、考试id、科目代码查询考查学院
+     *
+     * @param schoolId
+     * @param orgId
+     * @param examId
+     * @param courseCode
+     * @param cloudMarkSubjectCodeSet
+     * @return
+     */
+    List<ExamSyncStudent> queryByExamineCollegeList(Long schoolId, Long orgId, Long examId, String courseCode, Set<String> cloudMarkSubjectCodeSet);
 }

+ 20 - 1
src/main/java/com/qmth/eds/service/impl/CloudMarkingScoreServiceImpl.java

@@ -5,15 +5,21 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.eds.bean.dto.CloudMarkingScoreDto;
-import com.qmth.eds.bean.dto.ExamDownloadRecordDto;
 import com.qmth.eds.common.entity.CloudMarkingScore;
 import com.qmth.eds.common.util.ServletUtil;
 import com.qmth.eds.mapper.CloudMarkingScoreMapper;
 import com.qmth.eds.service.CloudMarkingScoreService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 @Service
 public class CloudMarkingScoreServiceImpl extends ServiceImpl<CloudMarkingScoreMapper, CloudMarkingScore> implements CloudMarkingScoreService {
+
+    @Resource
+    CloudMarkingScoreMapper cloudMarkingScoreMapper;
+
     @Override
     public void deleteByKeys(Long schoolId, Long semesterId, Long examTypeId, Integer examId) {
         UpdateWrapper<CloudMarkingScore> updateWrapper = new UpdateWrapper<>();
@@ -30,4 +36,17 @@ public class CloudMarkingScoreServiceImpl extends ServiceImpl<CloudMarkingScoreM
         Page<CloudMarkingScoreDto> page = new Page<>(pageNumber, pageSize);
         return this.baseMapper.pageData(page, collegeId, semesterId, examTypeId, examId);
     }
+
+    /**
+     * 根据科目代码查询
+     *
+     * @param schoolId
+     * @param orgId
+     * @param courseCode
+     * @return
+     */
+    @Override
+    public List<CloudMarkingScore> queryBySyncCourseCode(Long schoolId, Long orgId, String courseCode) {
+        return cloudMarkingScoreMapper.queryBySyncCourseCode(schoolId, orgId, courseCode);
+    }
 }

+ 19 - 0
src/main/java/com/qmth/eds/service/impl/ExamSyncStudentServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 
 @Service
 public class ExamSyncStudentServiceImpl extends ServiceImpl<ExamSyncStudentMapper, ExamSyncStudent> implements ExamSyncStudentService {
@@ -20,6 +21,9 @@ public class ExamSyncStudentServiceImpl extends ServiceImpl<ExamSyncStudentMappe
     @Resource
     private ExamCourseMappingService examCourseMappingService;
 
+    @Resource
+    ExamSyncStudentMapper examSyncStudentMapper;
+
     @Override
     public List<ExamSyncStudent> listByExamSyncTotalId(ExamSyncTotal examSyncTotal) {
         Long examSyncTotalId = examSyncTotal.getId();
@@ -47,4 +51,19 @@ public class ExamSyncStudentServiceImpl extends ServiceImpl<ExamSyncStudentMappe
 
         return examSyncStudents;
     }
+
+    /**
+     * 根据机构id、考试id、科目代码查询考查学院
+     *
+     * @param schoolId
+     * @param orgId
+     * @param examId
+     * @param courseCode
+     * @param cloudMarkSubjectCodeSet
+     * @return
+     */
+    @Override
+    public List<ExamSyncStudent> queryByExamineCollegeList(Long schoolId, Long orgId, Long examId, String courseCode, Set<String> cloudMarkSubjectCodeSet) {
+        return examSyncStudentMapper.queryByExamineCollegeList(schoolId, orgId, examId, courseCode, cloudMarkSubjectCodeSet);
+    }
 }

+ 27 - 0
src/main/resources/mapper/CloudMarkingScoreMapper.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.qmth.eds.mapper.CloudMarkingScoreMapper">
+
     <select id="pageData" resultType="com.qmth.eds.bean.dto.CloudMarkingScoreDto">
         SELECT
             exam_id examId,
@@ -37,4 +38,30 @@
             </if>
         </where>
     </select>
+
+    <select id="queryBySyncCourseCode" resultType="com.qmth.eds.common.entity.CloudMarkingScore">
+        select
+            cms.*
+        from
+            cloud_marking_score cms
+        <where> 1 = 1
+            <if test="orgId != null and orgId != ''">
+                and cms.school_id = #{orgId}
+            </if>
+                and exists (
+                    select
+                        ecm.cloud_marking_course_code
+                    from
+                        exam_course_mapping ecm
+                    <where> 1 = 1
+                        <if test="schoolId != null and schoolId != ''">
+                            and ecm.school_id = #{schoolId}
+                        </if>
+                        <if test="courseCode != null and courseCode != ''">
+                            and ecm.sync_course_code = #{courseCode}
+                        </if>
+                      and cms.subject_code = ecm.cloud_marking_course_code
+                    </where>)
+        </where>
+    </select>
 </mapper>

+ 43 - 0
src/main/resources/mapper/ExamSyncStudentMapper.xml

@@ -1,4 +1,47 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.qmth.eds.mapper.ExamSyncStudentMapper">
+
+    <select id="queryByExamineCollegeList" resultType="com.qmth.eds.common.entity.ExamSyncStudent">
+        select
+            *
+        from
+            exam_sync_student ess
+        join exam_course_mapping ecm on 1 = 1
+        <if test="courseCode != null and courseCode != ''">
+            and ecm.sync_course_code = #{courseCode}
+        </if>
+        <if test="subjectCodeSet != null and subjectCodeSet != '' and subjectCodeSet.size > 0">
+            and ecm.cloud_marking_course_code in
+            <foreach collection="subjectCodeSet" item="subjectCode" index="index" open="(" close=")" separator=",">
+                #{subjectCode}
+            </foreach>
+        </if>
+        <where>
+            <if test="schoolId != null and schoolId != ''">
+                and ess.school_id = #{schoolId}
+            </if>
+                and exists(
+                select
+                    cms.student_code
+                from
+                    cloud_marking_score cms
+                <where>
+                    <if test="orgId != null and orgId != ''">
+                        and cms.school_id = #{orgId}
+                    </if>
+                    <if test="examId != null and examId != ''">
+                        and cms.exam_id = #{examId}
+                    </if>
+                    <if test="subjectCodeSet != null and subjectCodeSet != '' and subjectCodeSet.size > 0">
+                        and cms.subject_code in
+                        <foreach collection="subjectCodeSet" item="subjectCode" index="index" open="(" close=")" separator=",">
+                            #{subjectCode}
+                        </foreach>
+                    </if>
+                    and ess.xh = cms.student_code
+                </where>)
+        </where>
+        order by ess.jgmc
+    </select>
 </mapper>