Joburgess %!s(int64=5) %!d(string=hai) anos
pai
achega
f0c138b8ae

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamRoomStudentRelationController.java

@@ -46,7 +46,7 @@ public class ExamRoomStudentRelationController extends BaseController {
     }
 
     @ApiOperation("删除指定教室学员")
-    @PostMapping(value = "/addStudentForRoom")
+    @PostMapping(value = "/deleteStudentFromRoom")
     public HttpResponseResult deleteStudentFromRoom(Long examRoomId, String studentIds){
         examRoomStudentRelationService.deleteStudentFromRoom(examRoomId, studentIds);
         return succeed();

+ 16 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamReviewDao.java

@@ -2,8 +2,22 @@ package com.keao.edu.user.dao;
 
 
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.dto.ExamReviewDto;
 import com.keao.edu.user.entity.ExamReview;
 
+import java.util.List;
+import java.util.Map;
+
 public interface ExamReviewDao extends BaseDAO<Long, ExamReview> {
-	
-}
+
+    /**
+     * @describe 获取考试结果
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param params:
+     * @return java.util.List<com.keao.edu.user.dto.ExamReviewDto>
+     */
+    List<ExamReviewDto> findExamResult(Map<String, Object> params);
+    int countExamResult(Map<String, Object> params);
+
+}

+ 35 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dto/ExamReviewDto.java

@@ -0,0 +1,35 @@
+package com.keao.edu.user.dto;
+
+import com.keao.edu.auth.api.entity.SysUser;
+import com.keao.edu.user.entity.ExamRegistration;
+import com.keao.edu.user.entity.ExamReview;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.06.24
+ */
+public class ExamReviewDto extends ExamReview {
+
+    @ApiModelProperty(value = "学员基本信息")
+    private SysUser studentInfo;
+
+    @ApiModelProperty(value = "考生报名信息")
+    private ExamRegistration examRegistration;
+
+    public SysUser getStudentInfo() {
+        return studentInfo;
+    }
+
+    public void setStudentInfo(SysUser studentInfo) {
+        this.studentInfo = studentInfo;
+    }
+
+    public ExamRegistration getExamRegistration() {
+        return examRegistration;
+    }
+
+    public void setExamRegistration(ExamRegistration examRegistration) {
+        this.examRegistration = examRegistration;
+    }
+}

+ 57 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/ExamReviewQueryInfo.java

@@ -1,6 +1,8 @@
 package com.keao.edu.user.page;
 
 import com.keao.edu.common.page.QueryInfo;
+import com.keao.edu.user.enums.ExamStatusEnum;
+import com.keao.edu.user.enums.StudentRegistrationStatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
@@ -10,6 +12,21 @@ public class ExamReviewQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "考试项目编号")
     private Integer examinationBaseId;
 
+    @ApiModelProperty(value = "准考证号")
+    private String cardNo;
+
+    @ApiModelProperty(value = "合作单位编号")
+    private Integer organId;
+
+    @ApiModelProperty(value = "专业编号")
+    private Integer subjectId;
+
+    @ApiModelProperty(value = "考试级别")
+    private Integer level;
+
+    @ApiModelProperty(value = "学员报名状态")
+    private StudentRegistrationStatusEnum studentStatus;
+
     @ApiModelProperty(value = "考官编号")
     private Integer teacherId;
 
@@ -72,4 +89,44 @@ public class ExamReviewQueryInfo extends QueryInfo {
     public void setEvaluationResult(String evaluationResult) {
         this.evaluationResult = evaluationResult;
     }
+
+    public String getCardNo() {
+        return cardNo;
+    }
+
+    public void setCardNo(String cardNo) {
+        this.cardNo = cardNo;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public Integer getLevel() {
+        return level;
+    }
+
+    public void setLevel(Integer level) {
+        this.level = level;
+    }
+
+    public StudentRegistrationStatusEnum getStudentStatus() {
+        return studentStatus;
+    }
+
+    public void setStudentStatus(StudentRegistrationStatusEnum studentStatus) {
+        this.studentStatus = studentStatus;
+    }
 }

+ 13 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamReviewService.java

@@ -1,9 +1,21 @@
 package com.keao.edu.user.service;
 
 
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.dto.ExamReviewDto;
 import com.keao.edu.user.entity.ExamReview;
+import com.keao.edu.user.page.ExamReviewQueryInfo;
 
 public interface ExamReviewService extends BaseService<Long, ExamReview> {
 
-}
+    /**
+     * @describe 获取考试结果
+     * @author Joburgess
+     * @date 2020.06.24
+     * @param queryInfo:
+     * @return com.keao.edu.common.page.PageInfo<com.keao.edu.user.dto.ExamReviewDto>
+     */
+    PageInfo<ExamReviewDto> findExamResult(ExamReviewQueryInfo queryInfo);
+
+}

+ 40 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamReviewServiceImpl.java

@@ -1,14 +1,28 @@
 package com.keao.edu.user.service.impl;
 
 
+import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.page.PageInfo;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.dao.ExamReviewDao;
+import com.keao.edu.user.dto.ExamReviewDto;
+import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.ExamReview;
+import com.keao.edu.user.entity.Subject;
+import com.keao.edu.user.page.ExamReviewQueryInfo;
 import com.keao.edu.user.service.ExamReviewService;
+import com.keao.edu.util.collection.MapUtil;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 @Service
 public class ExamReviewServiceImpl extends BaseServiceImpl<Long, ExamReview> implements ExamReviewService {
 	
@@ -19,5 +33,29 @@ public class ExamReviewServiceImpl extends BaseServiceImpl<Long, ExamReview> imp
 	public BaseDAO<Long, ExamReview> getDAO() {
 		return examReviewDao;
 	}
-	
-}
+
+	@Override
+	public PageInfo<ExamReviewDto> findExamResult(ExamReviewQueryInfo queryInfo) {
+		PageInfo<ExamReviewDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<String, Object>();
+		MapUtil.populateMap(params, queryInfo);
+
+		List<ExamReviewDto> dataList = null;
+		int count = examReviewDao.countExamResult(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = examReviewDao.findExamResult(params);
+			List<Integer> studentIds = dataList.stream().map(ExamReviewDto::getStudentId).collect(Collectors.toList());
+			List<Integer> subjectIds = dataList.stream().map(e->e.getExamRegistration().getSubjectId()).collect(Collectors.toList());
+			Map<Integer, String> studentIdNameMap = this.getMap("sys_user", "id_", "real_name_", studentIds, Integer.class, String.class);
+			Map<Integer, String> subjectIdNameMap = this.getMap("subject", "id_", "name_", subjectIds, Integer.class, String.class);
+			for (ExamReviewDto e : dataList) {
+				e.setStudentInfo(new SysUser(e.getStudentId(),studentIdNameMap.get(e.getStudentId())));
+				e.getExamRegistration().setSubject(new Subject(e.getExamRegistration().getSubjectId(), subjectIdNameMap.get(e.getExamRegistration().getSubjectId())));
+			}
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+	}
+}

+ 51 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamReviewMapper.xml

@@ -18,6 +18,10 @@
 		<result column="tenant_id_" property="tenantId" />
 		<association property="examinationBasic" javaType="com.keao.edu.user.entity.ExaminationBasic"/>
 	</resultMap>
+
+	<resultMap id="ExamReviewDto" type="com.keao.edu.user.dto.ExamReviewDto" extends="ExamReview">
+		<association property="examRegistration" columnPrefix="regist_" resultMap="com.keao.edu.user.dao.ExamRegistrationDao.ExamRegistration"/>
+	</resultMap>
 	
 	<!-- 根据主键查询一条记录 -->
 	<select id="get" resultMap="ExamReview" >
@@ -79,4 +83,51 @@
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM exam_review
 	</select>
+
+	<sql id="findExamResultCondition">
+		<where>
+			<if test="examinationBaseId!=null">
+				AND ere.examination_basic_id_ = #{examinationBaseId}
+			</if>
+			<if test="cardNo!=null">
+				AND ere.card_no_=#{cardNo}
+			</if>
+			<if test="organId!=null">
+				AND ere.organ_id_=#{organId}
+			</if>
+			<if test="subjectId!=null">
+				AND ere.subject_id_=#{subjectId}
+			</if>
+			<if test="level!=null">
+				AND ere.level_=#{level}
+			</if>
+			<if test="studentStatus!=null">
+				AND ere.status_=#{studentStatus,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler}
+			</if>
+		</where>
+	</sql>
+	<select id="findExamResult" resultMap="ExamReviewDto">
+		SELECT
+			ere.id_ regist_id_,
+			ere.student_id_ regist_student_id_,
+			ere.organ_id_ regist_organ_id_,
+			ere.subject_id_ regist_subject_id_,
+			ere.level_ regist_level_,
+			ere.status_ regist_status_,
+			er.evaluation_result_
+		FROM
+			exam_registration ere
+			LEFT JOIN exam_review er ON ere.student_id_ = er.student_id_ AND ere.examination_basic_id_=er.examination_basic_id_
+		<include refid="findExamResultCondition"/>
+		ORDER BY ere.id_ DESC
+		<include refid="global.limit"/>
+	</select>
+	<select id="countExamResult" resultType="int">
+		SELECT
+			COUNT(ere.id_)
+		FROM
+			exam_registration ere
+			LEFT JOIN exam_review er ON ere.student_id_ = er.student_id_ AND ere.examination_basic_id_=er.examination_basic_id_
+		<include refid="findExamResultCondition"/>
+	</select>
 </mapper>