|
@@ -70,7 +70,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
|
*/
|
|
|
@Override
|
|
|
public Result exportTask(Map<String, Object> map) throws IOException {
|
|
|
- log.info("开始导出考场数据");
|
|
|
+ log.info("开始导出成绩标准版数据");
|
|
|
long start = System.currentTimeMillis();
|
|
|
TaskExportCommon taskExportCommon = new TaskExportCommon(map);
|
|
|
taskExportCommon.init();
|
|
@@ -126,29 +126,31 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
|
String questionsTitle = s.getMainNumber() + "_" + s.getSubNumber();
|
|
|
if (Objects.nonNull(s.getAnswer())) {
|
|
|
ObjectiveAnswerCacheBean objectiveAnswerCacheBean = objectiveAnswerCacheBeanMap.get(questionsTitle);
|
|
|
- String title = QuestionTypeEnum.convertToTitle(objectiveAnswerCacheBean.getStructType()) + questionsTitle;
|
|
|
- String answer = null;
|
|
|
- if (objectiveAnswerCacheBean.getStructType().intValue() == 1 || objectiveAnswerCacheBean.getStructType().intValue() == 2) {
|
|
|
- List<String> list = Arrays.asList(s.getAnswer().replace("[", "").replace("]", "").replaceAll(" ", "").replaceAll("\n", "").split(","));
|
|
|
- List<String> answerList = new ArrayList<>();
|
|
|
- for (String s1 : list) {
|
|
|
- answerList.add(AnswerTypeEnum.convertToTitle(s1.toUpperCase()));
|
|
|
+ if (Objects.nonNull(objectiveAnswerCacheBean)) {
|
|
|
+ String title = QuestionTypeEnum.convertToTitle(objectiveAnswerCacheBean.getStructType()) + questionsTitle;
|
|
|
+ String answer = null;
|
|
|
+ if (objectiveAnswerCacheBean.getStructType().intValue() == 1 || objectiveAnswerCacheBean.getStructType().intValue() == 2) {
|
|
|
+ List<String> list = Arrays.asList(s.getAnswer().replace("[", "").replace("]", "").replaceAll(" ", "").replaceAll("\n", "").split(","));
|
|
|
+ List<String> answerList = new ArrayList<>();
|
|
|
+ for (String s1 : list) {
|
|
|
+ answerList.add(AnswerTypeEnum.convertToTitle(s1.toUpperCase()));
|
|
|
+ }
|
|
|
+ answer = answerList.toString();
|
|
|
+ } else if (objectiveAnswerCacheBean.getStructType().intValue() == 3) {
|
|
|
+ answer = AnswerTypeEnum.convertToTitle(s.getAnswer().toUpperCase());
|
|
|
}
|
|
|
- answer = answerList.toString();
|
|
|
- } else if (objectiveAnswerCacheBean.getStructType().intValue() == 3) {
|
|
|
- answer = AnswerTypeEnum.convertToTitle(s.getAnswer().toUpperCase());
|
|
|
- }
|
|
|
- ExcelDto excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
|
- ExcelDto excelScoreDto = new ExcelDto(title + "得分", String.valueOf(s.getScore()));
|
|
|
- List<ExcelDto> excelDtoList = null;
|
|
|
- if (!excelDtoMap.containsKey(m.getExamStudentId())) {
|
|
|
- excelDtoList = new ArrayList<>();
|
|
|
- } else {
|
|
|
- excelDtoList = excelDtoMap.get(m.getExamStudentId());
|
|
|
+ ExcelDto excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
|
+ ExcelDto excelScoreDto = new ExcelDto(title + "得分", String.valueOf(s.getScore()));
|
|
|
+ List<ExcelDto> excelDtoList = null;
|
|
|
+ if (!excelDtoMap.containsKey(m.getExamStudentId())) {
|
|
|
+ excelDtoList = new ArrayList<>();
|
|
|
+ } else {
|
|
|
+ excelDtoList = excelDtoMap.get(m.getExamStudentId());
|
|
|
+ }
|
|
|
+ excelDtoList.add(excelAnswerDto);
|
|
|
+ excelDtoList.add(excelScoreDto);
|
|
|
+ excelDtoMap.put(m.getExamStudentId(), excelDtoList);
|
|
|
}
|
|
|
- excelDtoList.add(excelAnswerDto);
|
|
|
- excelDtoList.add(excelScoreDto);
|
|
|
- excelDtoMap.put(m.getExamStudentId(), excelDtoList);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -222,9 +224,11 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
|
Map<Long, List<ExcelDto>> answerExcetDto = markResultStandardExportDto.getAnswerExcetDto();
|
|
|
if (Objects.nonNull(answerExcetDto)) {
|
|
|
List<ExcelDto> excelDtoList = answerExcetDto.get(markResultStandardExportDto.getExamStudentId());
|
|
|
- excelDtoList.forEach(s -> {
|
|
|
- taskExportCommon.createExcelCell(sxssfRow, position.get(s.getTitle()), s.getContent(), style);
|
|
|
- });
|
|
|
+ if (Objects.nonNull(excelDtoList) && excelDtoList.size() > 0) {
|
|
|
+ excelDtoList.forEach(s -> {
|
|
|
+ taskExportCommon.createExcelCell(sxssfRow, position.get(s.getTitle()), s.getContent(), style);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
taskExportCommon.createExcelCell(sxssfRow, cellIndex, field.get(markResultStandardExportDto), style);
|