|
@@ -25,15 +25,14 @@ public class FixExamStudentId {
|
|
|
|
|
|
private static int errRecord = 0;
|
|
|
|
|
|
- public void start() {
|
|
|
- final Long examId = 427L;
|
|
|
- final Long courseId = 1865L;
|
|
|
-
|
|
|
+ public void start(Long examId, Long courseId) {
|
|
|
// 查询网考端考生表记录
|
|
|
StringBuilder querySql = new StringBuilder()
|
|
|
- .append("select id,exam_id,course_id,student_id,exam_student_id from ec_oe_exam_student ")
|
|
|
- .append("where id > %s and exam_id = %s and course_id = %s ")
|
|
|
- .append("order by id asc limit 0,10");
|
|
|
+ .append("select id,exam_id,course_id,student_id,exam_student_id ")
|
|
|
+ .append(" from ec_oe_exam_student ")
|
|
|
+ .append(" where id > %s and exam_id = %s ")
|
|
|
+ .append(courseId != null ? " and course_id = %s " : "%s")
|
|
|
+ .append(" order by id asc limit 0,1000");
|
|
|
|
|
|
int total = 0;
|
|
|
Long nextMinId = 0L;
|
|
@@ -42,7 +41,7 @@ public class FixExamStudentId {
|
|
|
log.info("query nextMinId:" + nextMinId + ", total " + total + ", errRecord " + errRecord);
|
|
|
|
|
|
List<ExamStudentVO> list = jdbcTemplate.query(
|
|
|
- String.format(querySql.toString(), nextMinId, examId, courseId),
|
|
|
+ String.format(querySql.toString(), nextMinId, examId, courseId != null ? courseId : ""),
|
|
|
new BeanPropertyRowMapper(ExamStudentVO.class));
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
@@ -52,7 +51,7 @@ public class FixExamStudentId {
|
|
|
nextMinId = list.get(list.size() - 1).getId();
|
|
|
total += list.size();
|
|
|
|
|
|
- // this.fix(list);
|
|
|
+ this.fix(list);
|
|
|
}
|
|
|
|
|
|
log.info("task end...");
|