deason 3 days ago
parent
commit
fb79efa6fc

+ 39 - 4
src/main/java/cn/com/qmth/examcloud/tool/service/CommonService.java

@@ -5,10 +5,12 @@ import cn.com.qmth.examcloud.tool.config.SysProperty;
 import cn.com.qmth.examcloud.tool.service.batch_create_user.vo.RoleInfo;
 import cn.com.qmth.examcloud.tool.service.batch_create_user.vo.RoleInfo;
 import cn.com.qmth.examcloud.tool.service.batch_create_user.vo.UserInfo;
 import cn.com.qmth.examcloud.tool.service.batch_create_user.vo.UserInfo;
 import cn.com.qmth.examcloud.tool.service.export_student_answer_and_score_detail.vo.CourseVO;
 import cn.com.qmth.examcloud.tool.service.export_student_answer_and_score_detail.vo.CourseVO;
-import cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score.vo.ExamStudentVO;
 import cn.com.qmth.examcloud.tool.utils.HttpHelper;
 import cn.com.qmth.examcloud.tool.utils.HttpHelper;
 import cn.com.qmth.examcloud.tool.utils.JsonMapper;
 import cn.com.qmth.examcloud.tool.utils.JsonMapper;
+import cn.com.qmth.examcloud.tool.vo.PageInfo;
 import cn.com.qmth.examcloud.tool.vo.Pager;
 import cn.com.qmth.examcloud.tool.vo.Pager;
+import cn.com.qmth.examcloud.tool.vo.examstudent.EwExamStudentVO;
+import cn.com.qmth.examcloud.tool.vo.examstudent.OeExamStudentVO;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.JsonNode;
@@ -233,10 +235,43 @@ public class CommonService {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 获取考务考生列表
+     */
+    public List<EwExamStudentVO> getExamStudentListFromEW(User loginUser, Long examId, Long courseId, String identityNumber) {
+        Map<String, String> headers = new HashMap<>();
+        headers.put("key", loginUser.getKey());
+        headers.put("token", loginUser.getToken());
+
+        JsonMapper jsonMapper = new JsonMapper();
+        int sum = 0, pageNo = 0, pageSize = 100;
+
+        String url = loginUser.getServerUrl() + "/api/ecs_exam_work/exam_student/examStudentPage/%s/%s?examId=" + examId
+                + "&courseId=" + (courseId != null ? courseId : "") + "&identityNumber=" + (StringUtils.isNotBlank(identityNumber) ? identityNumber : "");
+        List<EwExamStudentVO> all = new ArrayList<>();
+        while (true) {
+            String json = HttpHelper.get(String.format(url, pageNo, pageSize), headers, null);
+            PageInfo<EwExamStudentVO> page = jsonMapper.parseJson(json, new TypeReference<PageInfo<EwExamStudentVO>>() {
+
+            });
+            if (page == null || CollectionUtils.isEmpty(page.getList())) {
+                break;
+            }
+            all.addAll(page.getList());
+
+            pageNo++;
+            sum += page.getList().size();
+            float rate = sum * 100f / page.getTotal();
+            log.info("examId:{} courseId:{} 已获取考生数:{} 进度:{}%", examId, courseId, sum, rate);
+        }
+
+        return all;
+    }
+
     /**
     /**
      * 获取网考考生列表
      * 获取网考考生列表
      */
      */
-    public List<ExamStudentVO> getExamStudentList(User loginUser, Long examId, Long courseId, String identityNumber) {
+    public List<OeExamStudentVO> getExamStudentListFromOE(User loginUser, Long examId, Long courseId, String identityNumber) {
         Map<String, Object> params = new HashMap<>();
         Map<String, Object> params = new HashMap<>();
         params.put("examId", examId);
         params.put("examId", examId);
         if (courseId != null) {
         if (courseId != null) {
@@ -252,7 +287,7 @@ public class CommonService {
         headers.put("token", loginUser.getToken());
         headers.put("token", loginUser.getToken());
 
 
         String url = loginUser.getServerUrl() + "/api/ecs_oe_admin/exam/student/simple/list";
         String url = loginUser.getServerUrl() + "/api/ecs_oe_admin/exam/student/simple/list";
-        List<ExamStudentVO> all = new ArrayList<>();
+        List<OeExamStudentVO> all = new ArrayList<>();
         JsonMapper jsonMapper = new JsonMapper();
         JsonMapper jsonMapper = new JsonMapper();
 
 
         int sum = 0, pageNo = 0;
         int sum = 0, pageNo = 0;
@@ -260,7 +295,7 @@ public class CommonService {
             params.put("pageNo", ++pageNo);
             params.put("pageNo", ++pageNo);
             String json = HttpHelper.post(url, headers, params);
             String json = HttpHelper.post(url, headers, params);
 
 
-            Pager<ExamStudentVO> page = jsonMapper.parseJson(json, new TypeReference<Pager<ExamStudentVO>>() {
+            Pager<OeExamStudentVO> page = jsonMapper.parseJson(json, new TypeReference<Pager<OeExamStudentVO>>() {
 
 
             });
             });
             if (page == null || CollectionUtils.isEmpty(page.getContent())) {
             if (page == null || CollectionUtils.isEmpty(page.getContent())) {

+ 4 - 4
src/main/java/cn/com/qmth/examcloud/tool/service/batch_delete_exam_student/BatchDeleteExamStudentTask.java

@@ -5,7 +5,7 @@ import cn.com.qmth.examcloud.tool.entity.TaskEntity;
 import cn.com.qmth.examcloud.tool.service.CommonService;
 import cn.com.qmth.examcloud.tool.service.CommonService;
 import cn.com.qmth.examcloud.tool.service.TaskService;
 import cn.com.qmth.examcloud.tool.service.TaskService;
 import cn.com.qmth.examcloud.tool.service.batch_delete_exam_student.vo.ExamStudentExcelVO;
 import cn.com.qmth.examcloud.tool.service.batch_delete_exam_student.vo.ExamStudentExcelVO;
-import cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score.vo.ExamStudentVO;
+import cn.com.qmth.examcloud.tool.vo.examstudent.EwExamStudentVO;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import cn.com.qmth.examcloud.tool.vo.user.User;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.context.AnalysisContext;
@@ -63,9 +63,9 @@ public class BatchDeleteExamStudentTask implements TaskService {
         log.info("待删除条数:{}", list.size());
         log.info("待删除条数:{}", list.size());
 
 
         for (ExamStudentExcelVO vo : list) {
         for (ExamStudentExcelVO vo : list) {
-            List<ExamStudentVO> examStudents = commonService.getExamStudentList(loginUser, vo.getExamId(), null, vo.getIdentityNumber());
-            for (ExamStudentVO examStudent : examStudents) {
-                log.info("examId:{} identityNumber:{} examStudentId:{}", examStudent.getExamId(), examStudent.getIdentityNumber(), examStudent.getExamStudentId());
+            List<EwExamStudentVO> examStudents = commonService.getExamStudentListFromEW(loginUser, vo.getExamId(), null, vo.getIdentityNumber());
+            for (EwExamStudentVO examStudent : examStudents) {
+                log.info("examId:{} identityNumber:{} examStudentId:{}", examStudent.getExamId(), examStudent.getIdentityNumber(), examStudent.getId());
             }
             }
         }
         }
 
 

+ 3 - 3
src/main/java/cn/com/qmth/examcloud/tool/service/update_correct_answer_and_re_fix_score/UpdateCorrectAnswerAndReFixScoreTask.java

@@ -6,7 +6,7 @@ import cn.com.qmth.examcloud.tool.entity.TaskEntity;
 import cn.com.qmth.examcloud.tool.service.CommonService;
 import cn.com.qmth.examcloud.tool.service.CommonService;
 import cn.com.qmth.examcloud.tool.service.TaskService;
 import cn.com.qmth.examcloud.tool.service.TaskService;
 import cn.com.qmth.examcloud.tool.service.export_student_answer_and_score_detail.vo.CourseVO;
 import cn.com.qmth.examcloud.tool.service.export_student_answer_and_score_detail.vo.CourseVO;
-import cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score.vo.ExamStudentVO;
+import cn.com.qmth.examcloud.tool.vo.examstudent.OeExamStudentVO;
 import cn.com.qmth.examcloud.tool.utils.HttpHelper;
 import cn.com.qmth.examcloud.tool.utils.HttpHelper;
 import cn.com.qmth.examcloud.tool.utils.JsonMapper;
 import cn.com.qmth.examcloud.tool.utils.JsonMapper;
 import cn.com.qmth.examcloud.tool.utils.StatusException;
 import cn.com.qmth.examcloud.tool.utils.StatusException;
@@ -93,10 +93,10 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
 
 
     public void process(User loginUser, Long examId, CourseVO course, String questionIds,
     public void process(User loginUser, Long examId, CourseVO course, String questionIds,
                         Boolean updateObjectiveAnswer, Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
                         Boolean updateObjectiveAnswer, Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
-        List<ExamStudentVO> examStudents = commonService.getExamStudentList(loginUser, examId, course.getCourseId(), null);
+        List<OeExamStudentVO> examStudents = commonService.getExamStudentListFromOE(loginUser, examId, course.getCourseId(), null);
 
 
         int index = 0, total = examStudents.size();
         int index = 0, total = examStudents.size();
-        for (ExamStudentVO examStudent : examStudents) {
+        for (OeExamStudentVO examStudent : examStudents) {
             // 按考生逐个重新算分
             // 按考生逐个重新算分
             this.fix(loginUser, examId, course.getCourseId(), examStudent.getExamStudentId(), updateObjectiveAnswer,
             this.fix(loginUser, examId, course.getCourseId(), examStudent.getExamStudentId(), updateObjectiveAnswer,
                     updateObjectiveScore, updateSubjectiveScore, questionIds);
                     updateObjectiveScore, updateSubjectiveScore, questionIds);

+ 85 - 0
src/main/java/cn/com/qmth/examcloud/tool/vo/examstudent/EwExamStudentVO.java

@@ -0,0 +1,85 @@
+package cn.com.qmth.examcloud.tool.vo.examstudent;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+
+@Setter
+@Getter
+public class EwExamStudentVO implements Serializable {
+
+    private static final long serialVersionUID = -4647126917276922968L;
+
+    /**
+     * 考务的考生ID
+     */
+    private Long id;
+
+    /**
+     * 考试ID
+     */
+    private Long examId;
+
+    /**
+     * 学生ID
+     */
+    private Long studentId;
+
+    /**
+     * 学号
+     */
+    private String studentCode;
+
+    /**
+     * 学生姓名
+     */
+    private String studentName;
+
+    /**
+     * 身份证号
+     */
+    private String identityNumber;
+
+    /**
+     * 课程ID
+     */
+    private Long courseId;
+
+    /**
+     * 课程Code
+     */
+    private String courseCode;
+
+    /**
+     * 课程名称
+     */
+    private String courseName;
+
+    /**
+     * 课程层次
+     */
+    private String courseLevel;
+
+    /**
+     * 底照
+     */
+    private String photoPath;
+
+    /**
+     * 顶级机构ID
+     */
+    private Long rootOrgId;
+
+    /**
+     * 学习中心ID
+     */
+    private Long orgId;
+
+    /**
+     * 是否可用
+     */
+    private Boolean enable;
+
+
+}

+ 2 - 2
src/main/java/cn/com/qmth/examcloud/tool/service/update_correct_answer_and_re_fix_score/vo/ExamStudentVO.java → src/main/java/cn/com/qmth/examcloud/tool/vo/examstudent/OeExamStudentVO.java

@@ -1,4 +1,4 @@
-package cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score.vo;
+package cn.com.qmth.examcloud.tool.vo.examstudent;
 
 
 import lombok.Getter;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.Setter;
@@ -7,7 +7,7 @@ import java.io.Serializable;
 
 
 @Setter
 @Setter
 @Getter
 @Getter
-public class ExamStudentVO implements Serializable {
+public class OeExamStudentVO implements Serializable {
 
 
     private static final long serialVersionUID = -4647126917276922968L;
     private static final long serialVersionUID = -4647126917276922968L;