|
@@ -38,6 +38,7 @@ import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreQuery;
|
|
import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
|
|
import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.CourseCard;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.CourseCard;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.Description;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.Description;
|
|
|
|
+import com.qmth.teachcloud.mark.bean.cardJson.DescriptionCourse;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
@@ -536,16 +537,24 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
|
|
parentDirVar = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
|
|
parentDirVar = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
|
|
FileUtils.copyToFile(file.getInputStream(), parentDirVar);
|
|
FileUtils.copyToFile(file.getInputStream(), parentDirVar);
|
|
ZipReader zipReader = new ZipReader(parentDirVar);
|
|
ZipReader zipReader = new ZipReader(parentDirVar);
|
|
|
|
+ String zipRoot = "cards";
|
|
String descriptionJson = "description.json";
|
|
String descriptionJson = "description.json";
|
|
|
|
|
|
// 读取指定文件内容description.json
|
|
// 读取指定文件内容description.json
|
|
- String descriptionContent = SystemConstant.readJson(zipReader.read(descriptionJson));
|
|
|
|
|
|
+ String descriptionContent = SystemConstant.readJson(zipReader.read(zipRoot + "/" + descriptionJson));
|
|
if (StringUtils.isBlank(descriptionContent)) {
|
|
if (StringUtils.isBlank(descriptionContent)) {
|
|
throw ExceptionResultEnum.ERROR.exception("数据包description.json文件内容为空");
|
|
throw ExceptionResultEnum.ERROR.exception("数据包description.json文件内容为空");
|
|
}
|
|
}
|
|
// 解析description.json内容
|
|
// 解析description.json内容
|
|
- Description description = JSON.parseObject(descriptionContent, Description.class);
|
|
|
|
- List<CourseCard> courseCardList = description.getCourseCardList();
|
|
|
|
|
|
+ List<Description> descriptionList = JSON.parseArray(descriptionContent, Description.class);
|
|
|
|
+ List<CourseCard> courseCardList = new ArrayList<>();
|
|
|
|
+ if (CollectionUtils.isNotEmpty(descriptionList)) {
|
|
|
|
+ for (Description description : descriptionList) {
|
|
|
|
+ for (DescriptionCourse course : description.getCourses()) {
|
|
|
|
+ courseCardList.add(new CourseCard(description.getCode(), course.getCode(), course.getName()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (CollectionUtils.isEmpty(courseCardList)) {
|
|
if (CollectionUtils.isEmpty(courseCardList)) {
|
|
throw ExceptionResultEnum.ERROR.exception("没有可导入文件");
|
|
throw ExceptionResultEnum.ERROR.exception("没有可导入文件");
|
|
}
|
|
}
|
|
@@ -555,7 +564,7 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
|
|
for (Map.Entry<String, CourseCard> entry : courseCardMap.entrySet()) {
|
|
for (Map.Entry<String, CourseCard> entry : courseCardMap.entrySet()) {
|
|
String courseCode = entry.getKey();
|
|
String courseCode = entry.getKey();
|
|
CourseCard courseCard = entry.getValue();
|
|
CourseCard courseCard = entry.getValue();
|
|
- String jsonFileName = courseCard.getCode() + SystemConstant.ZIP_PREFIX;
|
|
|
|
|
|
+ String jsonFileName = zipRoot + "/" + courseCard.getCode() + SystemConstant.JSON_PREFIX;
|
|
String jsonContent = SystemConstant.readJson(zipReader.read(jsonFileName));
|
|
String jsonContent = SystemConstant.readJson(zipReader.read(jsonFileName));
|
|
|
|
|
|
// 解析试卷结构,结构为空,跳过导入
|
|
// 解析试卷结构,结构为空,跳过导入
|
|
@@ -582,6 +591,10 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)]存在多个试卷", courseCard.getCourseName(), courseCard.getCourseCode()));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)]存在多个试卷", courseCard.getCourseName(), courseCard.getCourseCode()));
|
|
}
|
|
}
|
|
MarkPaper markPaper = markPaperList.get(0);
|
|
MarkPaper markPaper = markPaperList.get(0);
|
|
|
|
+ // 结束阅卷,跳过导入
|
|
|
|
+ if(MarkPaperStatus.FINISH.equals(markPaper.getStatus())){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
|
|
List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndPaperNumber(examId, markPaper.getPaperNumber());
|
|
List<ScanAnswerCard> scanAnswerCardList = scanAnswerCardService.listByExamIdAndPaperNumber(examId, markPaper.getPaperNumber());
|
|
// 已创建自定义卡格式,跳过导入
|
|
// 已创建自定义卡格式,跳过导入
|