|
@@ -10,11 +10,8 @@ import cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score
|
|
|
import cn.com.qmth.examcloud.tool.utils.HttpHelper;
|
|
|
import cn.com.qmth.examcloud.tool.utils.JsonMapper;
|
|
|
import cn.com.qmth.examcloud.tool.utils.StatusException;
|
|
|
-import cn.com.qmth.examcloud.tool.vo.Pager;
|
|
|
import cn.com.qmth.examcloud.tool.vo.user.User;
|
|
|
-import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -96,7 +93,7 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
|
|
|
|
|
|
public void process(User loginUser, Long examId, CourseVO course, String questionIds,
|
|
|
Boolean updateObjectiveAnswer, Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
|
|
|
- List<ExamStudentVO> examStudents = this.getExamStudentList(loginUser, examId, course.getCourseId());
|
|
|
+ List<ExamStudentVO> examStudents = commonService.getExamStudentList(loginUser, examId, course.getCourseId(), null);
|
|
|
|
|
|
int index = 0, total = examStudents.size();
|
|
|
for (ExamStudentVO examStudent : examStudents) {
|
|
@@ -137,42 +134,4 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
|
|
|
HttpHelper.post(url, headers, params);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取网考考生列表
|
|
|
- */
|
|
|
- private List<ExamStudentVO> getExamStudentList(User loginUser, Long examId, Long courseId) {
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("examId", examId);
|
|
|
- params.put("courseId", courseId);
|
|
|
- params.put("pageSize", 500);
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("key", loginUser.getKey());
|
|
|
- headers.put("token", loginUser.getToken());
|
|
|
-
|
|
|
- String url = loginUser.getServerUrl() + "/api/ecs_oe_admin/exam/student/simple/list";
|
|
|
- List<ExamStudentVO> all = new ArrayList<>();
|
|
|
- JsonMapper jsonMapper = new JsonMapper();
|
|
|
-
|
|
|
- int sum = 0, pageNo = 0;
|
|
|
- while (true) {
|
|
|
- params.put("pageNo", ++pageNo);
|
|
|
- String json = HttpHelper.post(url, headers, params);
|
|
|
-
|
|
|
- Pager<ExamStudentVO> page = jsonMapper.parseJson(json, new TypeReference<Pager<ExamStudentVO>>() {
|
|
|
-
|
|
|
- });
|
|
|
- if (page == null || CollectionUtils.isEmpty(page.getContent())) {
|
|
|
- break;
|
|
|
- }
|
|
|
- all.addAll(page.getContent());
|
|
|
-
|
|
|
- sum += page.getContent().size();
|
|
|
- float rate = sum * 100f / page.getTotalElements();
|
|
|
- log.info("examId:{} courseId:{} 已获取考生数:{} 进度:{}%", examId, courseId, sum, rate);
|
|
|
- }
|
|
|
-
|
|
|
- return all;
|
|
|
- }
|
|
|
-
|
|
|
}
|