|
@@ -1,6 +1,8 @@
|
|
package com.qmth.themis.business.templete.impl;
|
|
package com.qmth.themis.business.templete.impl;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -43,6 +45,7 @@ import javax.annotation.Resource;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.annotation.Annotation;
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -97,7 +100,8 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
String zipPath = null;
|
|
String zipPath = null;
|
|
File zip = null;
|
|
File zip = null;
|
|
List<File> files = null;
|
|
List<File> files = null;
|
|
- int finalSize = 0, line = 0;
|
|
|
|
|
|
+ int finalSize = 0;
|
|
|
|
+ int min = 0, line = 0;
|
|
try {
|
|
try {
|
|
taskExportCommon.getTxtList()
|
|
taskExportCommon.getTxtList()
|
|
.add(DateUtil.format(new Date(), Constants.DEFAULT_DATE_PATTERN) + "->开始准备处理导出的成绩标准版数据");
|
|
.add(DateUtil.format(new Date(), Constants.DEFAULT_DATE_PATTERN) + "->开始准备处理导出的成绩标准版数据");
|
|
@@ -117,6 +121,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
markResultQueryExportIpage = teExamStudentService.markResultQueryExportIpage(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode);
|
|
markResultQueryExportIpage = teExamStudentService.markResultQueryExportIpage(new Page<>(pageNumber, pageSize), examId, activityId, identity, name, courseCode);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Map<Long, Map<String, Double>> subjectiveScoreMap = null;
|
|
if (!CollectionUtils.isEmpty(markResultSimpleExportDtoList)) {
|
|
if (!CollectionUtils.isEmpty(markResultSimpleExportDtoList)) {
|
|
Set<String> examRecordIdsSet = new LinkedHashSet<>(markResultSimpleExportDtoList.size());
|
|
Set<String> examRecordIdsSet = new LinkedHashSet<>(markResultSimpleExportDtoList.size());
|
|
for (MarkResultSimpleExportDto markResultSimpleExportDto : markResultSimpleExportDtoList) {
|
|
for (MarkResultSimpleExportDto markResultSimpleExportDto : markResultSimpleExportDtoList) {
|
|
@@ -146,9 +151,30 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
//获取云阅卷同步成绩
|
|
//获取云阅卷同步成绩
|
|
List<TSyncExamStudentScore> tSyncExamStudentScoreList = tSyncExamStudentScoreService.findByExamRecordIds(examRecordIdsSet);
|
|
List<TSyncExamStudentScore> tSyncExamStudentScoreList = tSyncExamStudentScoreService.findByExamRecordIds(examRecordIdsSet);
|
|
if (!CollectionUtils.isEmpty(tSyncExamStudentScoreList)) {
|
|
if (!CollectionUtils.isEmpty(tSyncExamStudentScoreList)) {
|
|
|
|
+ subjectiveScoreMap = new LinkedHashMap<>(tSyncExamStudentScoreList.size());
|
|
for (TSyncExamStudentScore t : tSyncExamStudentScoreList) {
|
|
for (TSyncExamStudentScore t : tSyncExamStudentScoreList) {
|
|
- MarkResultSimpleExportDto markResultSimpleExportDto = markResultSimpleExportDtoMap.get(Long.parseLong(t.getExamNumber()));
|
|
|
|
|
|
+ MarkResultSimpleExportDto markResultSimpleExportDto = markResultSimpleExportDtoMap.get(t.getExamNumber());
|
|
if (Objects.nonNull(markResultSimpleExportDto)) {
|
|
if (Objects.nonNull(markResultSimpleExportDto)) {
|
|
|
|
+ if (Objects.nonNull(t.getSubjectiveScoreDetail()) && !Objects.equals(t.getSubjectiveScoreDetail().trim(), "")) {
|
|
|
|
+ JSONArray subjectiveScoreDetailJsonArray = JSONArray.parseArray(t.getSubjectiveScoreDetail());
|
|
|
|
+ Map<String, Double> tOeExamAnswerMap = new LinkedHashMap<>(subjectiveScoreDetailJsonArray.size());
|
|
|
|
+ for (int i = 0; i < subjectiveScoreDetailJsonArray.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = subjectiveScoreDetailJsonArray.getJSONObject(i);
|
|
|
|
+ Integer mainNumber = jsonObject.getInteger("mainNumber");
|
|
|
|
+ Integer subNumber = jsonObject.getInteger("subNumber");
|
|
|
|
+ Integer subIndex = jsonObject.getInteger("subIndex");
|
|
|
|
+ Double score = jsonObject.getDouble("score");
|
|
|
|
+ String questionsTitle = String.valueOf(mainNumber);
|
|
|
|
+ questionsTitle = Objects.nonNull(subNumber) ?
|
|
|
|
+ questionsTitle + "_" + subNumber :
|
|
|
|
+ questionsTitle;
|
|
|
|
+ questionsTitle = Objects.nonNull(subIndex) ?
|
|
|
|
+ questionsTitle + "_" + subIndex :
|
|
|
|
+ questionsTitle;
|
|
|
|
+ tOeExamAnswerMap.put(questionsTitle, score);
|
|
|
|
+ }
|
|
|
|
+ subjectiveScoreMap.put(Long.parseLong(t.getExamNumber()), tOeExamAnswerMap);
|
|
|
|
+ }
|
|
markResultSimpleExportDto.setSubjectiveScore(Objects.isNull(t.getSubjectiveScore()) ? "0" : String.valueOf(t.getSubjectiveScore()));
|
|
markResultSimpleExportDto.setSubjectiveScore(Objects.isNull(t.getSubjectiveScore()) ? "0" : String.valueOf(t.getSubjectiveScore()));
|
|
markResultSimpleExportDto.setSumScore(String.valueOf(Double.parseDouble(markResultSimpleExportDto.getObjectiveScore()) + Double.parseDouble(markResultSimpleExportDto.getSubjectiveScore())));
|
|
markResultSimpleExportDto.setSumScore(String.valueOf(Double.parseDouble(markResultSimpleExportDto.getObjectiveScore()) + Double.parseDouble(markResultSimpleExportDto.getSubjectiveScore())));
|
|
}
|
|
}
|
|
@@ -208,6 +234,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
String title = QuestionTypeEnum.convertToTitle(structType) + questionsTitle;
|
|
String title = QuestionTypeEnum.convertToTitle(structType) + questionsTitle;
|
|
String answer = null;
|
|
String answer = null;
|
|
ExcelDto excelAnswerDto = null;
|
|
ExcelDto excelAnswerDto = null;
|
|
|
|
+ Double score = null;
|
|
if (structType.intValue() == 1 || structType.intValue() == 2) {
|
|
if (structType.intValue() == 1 || structType.intValue() == 2) {
|
|
String string = s.getAnswer().replace("[", "").replace("]", "")
|
|
String string = s.getAnswer().replace("[", "").replace("]", "")
|
|
.replaceAll(" ", "").replaceAll("\n", "");
|
|
.replaceAll(" ", "").replaceAll("\n", "");
|
|
@@ -220,13 +247,21 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
answer = answerList.toString();
|
|
answer = answerList.toString();
|
|
}
|
|
}
|
|
excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
|
|
+ score = s.getScore();
|
|
} else if (structType.intValue() == 3) {
|
|
} else if (structType.intValue() == 3) {
|
|
answer = AnswerTypeEnum
|
|
answer = AnswerTypeEnum
|
|
.convertToTitle(s.getAnswer().replaceAll("\n", "").toUpperCase());
|
|
.convertToTitle(s.getAnswer().replaceAll("\n", "").toUpperCase());
|
|
excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
excelAnswerDto = new ExcelDto(title + "作答", answer);
|
|
|
|
+ score = s.getScore();
|
|
|
|
+ }
|
|
|
|
+ if (Objects.isNull(score) && !CollectionUtils.isEmpty(subjectiveScoreMap)) {
|
|
|
|
+ Map<String, Double> tOeExamAnswerMap = subjectiveScoreMap.get(s.getExamRecordId());
|
|
|
|
+ if (!CollectionUtils.isEmpty(tOeExamAnswerMap) && Objects.nonNull(tOeExamAnswerMap.get(questionsTitle))) {
|
|
|
|
+ score = tOeExamAnswerMap.get(questionsTitle);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
ExcelDto excelScoreDto = new ExcelDto(title + "得分",
|
|
ExcelDto excelScoreDto = new ExcelDto(title + "得分",
|
|
- Objects.nonNull(s.getScore()) ? String.valueOf(s.getScore()) : null);
|
|
|
|
|
|
+ Objects.nonNull(score) ? String.valueOf(score) : "0");
|
|
List<ExcelDto> excelDtoList = null;
|
|
List<ExcelDto> excelDtoList = null;
|
|
if (!excelDtoMap.containsKey(m.getExamStudentId())) {
|
|
if (!excelDtoMap.containsKey(m.getExamStudentId())) {
|
|
excelDtoList = new ArrayList<>();
|
|
excelDtoList = new ArrayList<>();
|
|
@@ -253,8 +288,14 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
stringJoiner.add(SystemConstant.FILES_DIR).add(File.separator);
|
|
stringJoiner.add(SystemConstant.FILES_DIR).add(File.separator);
|
|
}
|
|
}
|
|
excelSj.add(SystemConstant.FILES_DIR).add(File.separator);
|
|
excelSj.add(SystemConstant.FILES_DIR).add(File.separator);
|
|
- stringJoiner = SystemConstant.getDirName(stringJoiner, false);
|
|
|
|
- excelSj = SystemConstant.getDirName(excelSj, false);
|
|
|
|
|
|
+ LocalDateTime nowTime = LocalDateTime.now();
|
|
|
|
+ stringJoiner.add(String.valueOf(nowTime.getYear())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getDayOfMonth()));
|
|
|
|
+
|
|
|
|
+ excelSj.add(String.valueOf(nowTime.getYear())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getMonthValue())).add(File.separator)
|
|
|
|
+ .add(String.format("%02d", nowTime.getDayOfMonth()));
|
|
|
|
|
|
SXSSFWorkbook wb = null;
|
|
SXSSFWorkbook wb = null;
|
|
InputStream inputStream = null;
|
|
InputStream inputStream = null;
|
|
@@ -296,7 +337,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
num++;
|
|
num++;
|
|
}
|
|
}
|
|
List<MarkResultStandardExportDto> markResultStandardExportDtoTempList = markResultStandardExportDtoLinkedMultiValueMap.get(entry.getKey());
|
|
List<MarkResultStandardExportDto> markResultStandardExportDtoTempList = markResultStandardExportDtoLinkedMultiValueMap.get(entry.getKey());
|
|
- int min = 0, rowIndex = 0, cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultStandardExportDtoTempList
|
|
|
|
|
|
+ int rowIndex = 0, cellIndex = 0, max = SystemConstant.MAX_EXPORT_SIZE, size = markResultStandardExportDtoTempList
|
|
.size();
|
|
.size();
|
|
if (max >= size) {
|
|
if (max >= size) {
|
|
max = size;
|
|
max = size;
|
|
@@ -385,7 +426,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
|
|
}
|
|
}
|
|
if (files.size() > 0) {
|
|
if (files.size() > 0) {
|
|
StringBuilder stringBuilder = new StringBuilder(excelSj.toString());
|
|
StringBuilder stringBuilder = new StringBuilder(excelSj.toString());
|
|
- String uuid = SystemConstant.getNanoId();
|
|
|
|
|
|
+ String uuid = SystemConstant.getUuid();
|
|
StringBuilder zipStringBuilder = new StringBuilder(stringJoiner.toString());
|
|
StringBuilder zipStringBuilder = new StringBuilder(stringJoiner.toString());
|
|
zipPath = zipStringBuilder.append(File.separator).append(uuid).toString();
|
|
zipPath = zipStringBuilder.append(File.separator).append(uuid).toString();
|
|
zip = new File(stringBuilder.append(File.separator).append(uuid).append(".zip").toString());
|
|
zip = new File(stringBuilder.append(File.separator).append(uuid).append(".zip").toString());
|