|
@@ -26,13 +26,13 @@ import cn.com.qmth.scancloud.tools.utils.StatusException;
|
|
|
* 缺考导入
|
|
|
*/
|
|
|
@Service
|
|
|
-public class AbsentImportTask extends AbstractTask {
|
|
|
+public class BreachImportTask extends AbstractTask {
|
|
|
|
|
|
- private static final Logger log = LoggerFactory.getLogger(AbsentImportTask.class);
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(BreachImportTask.class);
|
|
|
|
|
|
@Override
|
|
|
protected String getTaskName() {
|
|
|
- return TaskType.ABSENT_IMPORT.getTitle();
|
|
|
+ return TaskType.BREACH_IMPORT.getTitle();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -46,7 +46,7 @@ public class AbsentImportTask extends AbstractTask {
|
|
|
throw new StatusException("当前考试不存在!examId = " + examId);
|
|
|
}
|
|
|
|
|
|
- if (!SysProperty.ABSENT_IMPORT.endsWith(".txt")) {
|
|
|
+ if (!SysProperty.BREACH_IMPORT.endsWith(".txt")) {
|
|
|
throw new StatusException("导入模板目前仅支持后缀名为“.txt”的文件!");
|
|
|
}
|
|
|
|
|
@@ -54,7 +54,7 @@ public class AbsentImportTask extends AbstractTask {
|
|
|
List<ExamStudent> list = new ArrayList<>();
|
|
|
Set<String> examNumbers = new HashSet<>();
|
|
|
|
|
|
- File file = new File(SysProperty.DATA_DIR + "/" + SysProperty.ABSENT_IMPORT);
|
|
|
+ File file = new File(SysProperty.DATA_DIR + "/" + SysProperty.BREACH_IMPORT);
|
|
|
List<String> lines = FileHelper.readAllLines(file);
|
|
|
for (int n = 1; n < lines.size(); n++) {
|
|
|
|
|
@@ -78,7 +78,7 @@ public class AbsentImportTask extends AbstractTask {
|
|
|
// 分批保存
|
|
|
int batchSize = 5000;
|
|
|
List<ExamStudent> batchList = new ArrayList<>();
|
|
|
- String url = SysProperty.SCAN_SERVER_URL + "/api/tool/import/cet/absent";
|
|
|
+ String url = SysProperty.SCAN_SERVER_URL + "/api/tool/import/cet/breach";
|
|
|
for (int n = 0; n < list.size(); n++) {
|
|
|
batchList.add(list.get(n));
|
|
|
|
|
@@ -110,29 +110,29 @@ public class AbsentImportTask extends AbstractTask {
|
|
|
try {
|
|
|
|
|
|
String examNumber = values[0].trim();
|
|
|
- String absent = values[2].trim();
|
|
|
- String breachCode = values[3].trim();
|
|
|
+// String absent = values[2].trim();
|
|
|
+ String breachCode = values[2].trim();
|
|
|
if (StringUtils.isEmpty(examNumber)) {
|
|
|
throw new StatusException(String.format("【第%s行】“准考证号”字段不能为空! %s", index + 1, line));
|
|
|
}
|
|
|
if (examNumbers.contains(examNumber)) {
|
|
|
throw new StatusException(String.format("【第%s行】考生信息存在重复! %s", index + 1, line));
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(absent)) {
|
|
|
- throw new StatusException(String.format("【第%s行】“缺考”字段不能为空! %s", index + 1, line));
|
|
|
- }
|
|
|
- if (!"0".equals(absent)&&!"1".equals(absent)) {
|
|
|
- throw new StatusException(String.format("【第%s行】“缺考”字段只能是0或1! %s", index + 1, line));
|
|
|
- }
|
|
|
+// if (StringUtils.isEmpty(absent)) {
|
|
|
+// throw new StatusException(String.format("【第%s行】“缺考”字段不能为空! %s", index + 1, line));
|
|
|
+// }
|
|
|
+// if (!"0".equals(absent)&&!"1".equals(absent)) {
|
|
|
+// throw new StatusException(String.format("【第%s行】“缺考”字段只能是0或1! %s", index + 1, line));
|
|
|
+// }
|
|
|
if (StringUtils.isEmpty(breachCode)) {
|
|
|
throw new StatusException(String.format("【第%s行】“违纪”字段不能为空! %s", index + 1, line));
|
|
|
}
|
|
|
- if("1".equals(absent)&&!"0".equals(breachCode)) {
|
|
|
- throw new StatusException(String.format("【第%s行】缺考的违纪只能是0! %s", index + 1, line));
|
|
|
- }
|
|
|
+// if("1".equals(absent)&&!"0".equals(breachCode)) {
|
|
|
+// throw new StatusException(String.format("【第%s行】缺考的违纪只能是0! %s", index + 1, line));
|
|
|
+// }
|
|
|
ExamStudent data = new ExamStudent();
|
|
|
data.setExamNumber(examNumber);
|
|
|
- data.setAbsent("1".equals(absent) ? true : false);
|
|
|
+ // data.setAbsent("1".equals(absent) ? true : false);
|
|
|
data.setBreachCode(breachCode);
|
|
|
return data;
|
|
|
} catch (ArrayIndexOutOfBoundsException e) {
|