|
@@ -55,7 +55,16 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
|
|
|
private void execute(User user, JsonNode jsonParams) {
|
|
|
Long examId = jsonParams.get("examId").asLong(0L);
|
|
|
String courseCodes = jsonParams.get("courseCodes").asText("");
|
|
|
- log.info("examId = {}, courseCodes = {}", examId, courseCodes);
|
|
|
+
|
|
|
+ //是否更新客观题答案
|
|
|
+ Boolean updateObjectiveAnswer = jsonParams.get("updateObjectiveAnswer").asBoolean(false);
|
|
|
+ //是否更新客观题分值
|
|
|
+ Boolean updateObjectiveScore = jsonParams.get("updateObjectiveScore").asBoolean(false);
|
|
|
+ //是否更新主观题分值
|
|
|
+ Boolean updateSubjectiveScore = jsonParams.get("updateSubjectiveScore").asBoolean(false);
|
|
|
+
|
|
|
+ log.info("examId:{} courseCodes:{} updateObjectiveAnswer:{} updateObjectiveScore:{} updateSubjectiveScore:{}",
|
|
|
+ examId, courseCodes, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
|
|
|
|
|
|
// 待处理的课程列表(未指定课程则按考试的全部课程)
|
|
|
List<CourseVO> todoCourses;
|
|
@@ -77,17 +86,19 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
|
|
|
|
|
|
for (CourseVO course : todoCourses) {
|
|
|
// 按考试课程逐个处理
|
|
|
- this.process(user, examId, course);
|
|
|
+ this.process(user, examId, course, updateObjectiveAnswer, updateObjectiveScore, updateSubjectiveScore);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void process(User user, Long examId, CourseVO course) {
|
|
|
+ public void process(User user, Long examId, CourseVO course, Boolean updateObjectiveAnswer,
|
|
|
+ Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
|
|
|
List<ExamStudentVO> examStudents = this.getExamStudentList(user, examId, course.getCourseId());
|
|
|
|
|
|
int index = 0, total = examStudents.size();
|
|
|
for (ExamStudentVO examStudent : examStudents) {
|
|
|
// 按考生逐个更新正确答案并重新算分
|
|
|
- this.fix(user, examId, course.getCourseId(), examStudent.getExamStudentId());
|
|
|
+ this.fix(user, examId, course.getCourseId(), examStudent.getExamStudentId(), updateObjectiveAnswer,
|
|
|
+ updateObjectiveScore, updateSubjectiveScore);
|
|
|
|
|
|
index++;
|
|
|
if (index % 100 == 0) {
|
|
@@ -103,18 +114,22 @@ public class UpdateCorrectAnswerAndReFixScoreTask implements TaskService {
|
|
|
examStudents.clear();
|
|
|
}
|
|
|
|
|
|
- private void fix(User user, Long examId, Long courseId, Long examStudentId) {
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
- params.put("examId", String.valueOf(examId));
|
|
|
- params.put("courseId", String.valueOf(courseId));
|
|
|
- params.put("examStudentId", String.valueOf(examStudentId));
|
|
|
+ private void fix(User user, Long examId, Long courseId, Long examStudentId, Boolean updateObjectiveAnswer,
|
|
|
+ Boolean updateObjectiveScore, Boolean updateSubjectiveScore) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("examId", examId);
|
|
|
+ params.put("courseId", courseId);
|
|
|
+ params.put("examStudentId", examStudentId);
|
|
|
+ params.put("updateObjectiveAnswer", updateObjectiveAnswer);
|
|
|
+ params.put("updateObjectiveScore", updateObjectiveScore);
|
|
|
+ params.put("updateSubjectiveScore", updateSubjectiveScore);
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("key", user.getKey());
|
|
|
headers.put("token", user.getToken());
|
|
|
|
|
|
- String url = user.getServerUrl() + "/api/ecs_oe_admin/exam/score/updateCorrectAnswerAndReFixScore";
|
|
|
- HttpHelper.get(url, headers, params);
|
|
|
+ String url = user.getServerUrl() + "/api/ecs_oe_admin/exam/score/reFixScore";
|
|
|
+ HttpHelper.post(url, headers, params);
|
|
|
}
|
|
|
|
|
|
/**
|