|
@@ -78,6 +78,18 @@ public class ObjectiveQuestionExportTask extends AbstractTask {
|
|
|
String filePath = String.format("%s/export-slice-data.txt", SysProperty.DATA_DIR);
|
|
|
String answerFilePath = String.format("%s/export-answer-data.txt", SysProperty.DATA_DIR);
|
|
|
String queryUrl = SysProperty.SCAN_SERVER_URL + "/api/tool/export/cet/data";
|
|
|
+ File file = new File(filePath);
|
|
|
+ if (file.exists()) {
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ File sliceFile = new File(filePath);
|
|
|
+ if (sliceFile.exists()) {
|
|
|
+ sliceFile.delete();
|
|
|
+ }
|
|
|
+ File answerFile = new File(answerFilePath);
|
|
|
+ if (answerFile.exists()) {
|
|
|
+ answerFile.delete();
|
|
|
+ }
|
|
|
params.put("pageSize", 100);
|
|
|
int pageNumber = 0;
|
|
|
int sum = 0;
|
|
@@ -92,8 +104,8 @@ public class ObjectiveQuestionExportTask extends AbstractTask {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- exportMarking(list, filePath, cms, examNumbers);
|
|
|
- exportAnswer(list, answerFilePath, cms);
|
|
|
+ exportMarking(list, sliceFile, cms, examNumbers);
|
|
|
+ exportAnswer(list, answerFile, cms);
|
|
|
sum += list.size();
|
|
|
float rate = sum * 100f / total;
|
|
|
log.info("已处理数:{} 进度:{}%", sum, rate);
|
|
@@ -102,7 +114,7 @@ public class ObjectiveQuestionExportTask extends AbstractTask {
|
|
|
log.info("导出文件:" + filePath);
|
|
|
}
|
|
|
|
|
|
- private void exportAnswer(List<ExportCetVo> list, String filePath, Map<String, CetMarking> cms) {
|
|
|
+ private void exportAnswer(List<ExportCetVo> list, File file, Map<String, CetMarking> cms) {
|
|
|
List<String> lines = new ArrayList<>();
|
|
|
for (ExportCetVo data : list) {
|
|
|
List<String> line = new ArrayList<>();
|
|
@@ -144,14 +156,11 @@ public class ObjectiveQuestionExportTask extends AbstractTask {
|
|
|
lines.add(StringUtils.join(line, ","));
|
|
|
}
|
|
|
|
|
|
- File file = new File(filePath);
|
|
|
- if (file.exists()) {
|
|
|
- file.delete();
|
|
|
- }
|
|
|
+
|
|
|
FileHelper.writeLines(file, lines, true);
|
|
|
}
|
|
|
|
|
|
- private void exportMarking(List<ExportCetVo> list, String filePath, Map<String, CetMarking> cms,
|
|
|
+ private void exportMarking(List<ExportCetVo> list, File file, Map<String, CetMarking> cms,
|
|
|
Set<String> examNumbers) {
|
|
|
String template = "%s,%s,%s";
|
|
|
|
|
@@ -184,10 +193,6 @@ public class ObjectiveQuestionExportTask extends AbstractTask {
|
|
|
StringUtils.join(data.getSliceImageInfo(), ";")));
|
|
|
}
|
|
|
|
|
|
- File file = new File(filePath);
|
|
|
- if (file.exists()) {
|
|
|
- file.delete();
|
|
|
- }
|
|
|
FileHelper.writeLines(file, lines, true);
|
|
|
}
|
|
|
|