|
@@ -12,6 +12,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
import com.qmth.teachcloud.common.enums.ExamModelEnum;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.mark.MarkMode;
|
|
|
import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
|
|
|
import com.qmth.teachcloud.common.service.FileUploadService;
|
|
|
import com.qmth.teachcloud.common.service.TeachcloudCommonService;
|
|
@@ -75,15 +76,15 @@ public class MarkDocumentServiceImpl extends ServiceImpl<MarkDocumentMapper, Mar
|
|
|
list.sort(Comparator.comparingInt(d -> d.getType().getValue()));
|
|
|
for (MarkDocument d : list) {
|
|
|
//
|
|
|
- if(DocumentType.PAPER.equals(d.getType())){
|
|
|
+ if (DocumentType.PAPER.equals(d.getType())) {
|
|
|
List<String> urlList = new ArrayList<>();
|
|
|
- if(StringUtils.isNotBlank(d.getFilePath())){
|
|
|
+ if (StringUtils.isNotBlank(d.getFilePath())) {
|
|
|
for (String s : JSON.parseArray(d.getFilePath(), String.class)) {
|
|
|
urlList.add(teachcloudCommonService.filePreview(s));
|
|
|
}
|
|
|
d.setFilePath(JSON.toJSONString(urlList));
|
|
|
}
|
|
|
- } else{
|
|
|
+ } else {
|
|
|
d.setFilePath(teachcloudCommonService.filePreview(d.getFilePath()));
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +199,7 @@ public class MarkDocumentServiceImpl extends ServiceImpl<MarkDocumentMapper, Mar
|
|
|
if (documentType.equals(DocumentType.PAPER)) {
|
|
|
if (StringUtils.isNotBlank(markPaper.getPaperFilePath())) {
|
|
|
List<String> urlList = new ArrayList<>();
|
|
|
- if(StringUtils.isNotBlank(markPaper.getPaperFilePath())){
|
|
|
+ if (StringUtils.isNotBlank(markPaper.getPaperFilePath())) {
|
|
|
urlList = JSON.parseArray(markPaper.getPaperFilePath(), String.class);
|
|
|
}
|
|
|
markDocument.setFileCount(urlList.size());
|
|
@@ -220,8 +221,8 @@ public class MarkDocumentServiceImpl extends ServiceImpl<MarkDocumentMapper, Mar
|
|
|
markDocument.setFileCount(1);
|
|
|
} else if (documentType.equals(DocumentType.SHEET)) {
|
|
|
markDocument.setFileCount(markPaper.getUploadCount());
|
|
|
- // } else if (documentType.equals(DocumentType.TRACK)) {
|
|
|
- // markDocument.setFileCount(markPaper.getUploadCount());
|
|
|
+ } else if (documentType.equals(DocumentType.TRACK)) {
|
|
|
+ markDocument.setFileCount(markPaper.getMarkMode().equals(MarkMode.TRACK) ? markPaper.getUploadCount() : 0);
|
|
|
} else if (documentType.equals(DocumentType.SIGN)) {
|
|
|
List<ScanPackage> scanPackageList = scanPackageService.listByExamIdAndCoursePaperIdAndPackageCode(
|
|
|
markPaper.getExamId(), markPaper.getCoursePaperId(), null);
|
|
@@ -253,59 +254,59 @@ public class MarkDocumentServiceImpl extends ServiceImpl<MarkDocumentMapper, Mar
|
|
|
DocumentType documentType = markDocument.getType();
|
|
|
|
|
|
switch (documentType) {
|
|
|
- case SYLLABUS:
|
|
|
- case PROCESS_SCORE:
|
|
|
- case PAPER:
|
|
|
- case ANSWER:
|
|
|
- case PAPER_REPORT:
|
|
|
- case CHECK_IN:
|
|
|
- case CUSTOM:
|
|
|
- if (SystemConstant.strNotNull(path)) {
|
|
|
- FilePathVo filePathVo = JSON.parseObject(path, FilePathVo.class);
|
|
|
- String suffix = FilenameUtils.getExtension(filePathVo.getPath());
|
|
|
- filePath = tempFile.getPath() + File.separator + name + "." + suffix;
|
|
|
- File file = fileUploadService.downloadFile(markDocument.getFilePath(), filePath);
|
|
|
+ case SYLLABUS:
|
|
|
+ case PROCESS_SCORE:
|
|
|
+ case PAPER:
|
|
|
+ case ANSWER:
|
|
|
+ case PAPER_REPORT:
|
|
|
+ case CHECK_IN:
|
|
|
+ case CUSTOM:
|
|
|
+ if (SystemConstant.strNotNull(path)) {
|
|
|
+ FilePathVo filePathVo = JSON.parseObject(path, FilePathVo.class);
|
|
|
+ String suffix = FilenameUtils.getExtension(filePathVo.getPath());
|
|
|
+ filePath = tempFile.getPath() + File.separator + name + "." + suffix;
|
|
|
+ File file = fileUploadService.downloadFile(markDocument.getFilePath(), filePath);
|
|
|
+ writer.write(file, file.getName());
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case APPROVE_RECORD:
|
|
|
+ case SCORE_REPORT:
|
|
|
+ case SHEET:
|
|
|
+ case TRACK:
|
|
|
+ break;
|
|
|
+ case SCORE:
|
|
|
+ ArchiveStudentQuery query = new ArchiveStudentQuery();
|
|
|
+ query.setExamId(examId);
|
|
|
+ query.setPaperNumber(paperNumber);
|
|
|
+
|
|
|
+ filePath = tempFile.getPath() + File.separator + name + SystemConstant.EXCEL_PREFIX;
|
|
|
+ File file = new File(filePath);
|
|
|
+ OutputStream outputStream = new FileOutputStream(file);
|
|
|
+ markStudentService.scoreExport(query, response);
|
|
|
writer.write(file, file.getName());
|
|
|
file.delete();
|
|
|
- }
|
|
|
- break;
|
|
|
- case APPROVE_RECORD:
|
|
|
- case SCORE_REPORT:
|
|
|
- case SHEET:
|
|
|
- case TRACK:
|
|
|
- break;
|
|
|
- case SCORE:
|
|
|
- ArchiveStudentQuery query = new ArchiveStudentQuery();
|
|
|
- query.setExamId(examId);
|
|
|
- query.setPaperNumber(paperNumber);
|
|
|
-
|
|
|
- filePath = tempFile.getPath() + File.separator + name + SystemConstant.EXCEL_PREFIX;
|
|
|
- File file = new File(filePath);
|
|
|
- OutputStream outputStream = new FileOutputStream(file);
|
|
|
- markStudentService.scoreExport(query, response);
|
|
|
- writer.write(file, file.getName());
|
|
|
- file.delete();
|
|
|
- break;
|
|
|
- case SIGN:
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
- if (markPaper == null) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("试卷不存在");
|
|
|
- }
|
|
|
- QueryWrapper<ScanPackage> wrapper = new QueryWrapper<>();
|
|
|
- LambdaQueryWrapper<ScanPackage> lw = wrapper.lambda();
|
|
|
- lw.eq(ScanPackage::getExamId, examId);
|
|
|
- lw.eq(ScanPackage::getCoursePaperId, markPaper.getCoursePaperId());
|
|
|
- lw.orderByAsc(ScanPackage::getPackageNo);
|
|
|
- List<ScanPackage> scanPackageList = scanPackageService.list(wrapper);
|
|
|
- if (CollectionUtils.isNotEmpty(scanPackageList)) {
|
|
|
- for (ScanPackage scanPackage : scanPackageList) {
|
|
|
- FilePathVo filePathVo = JSON.parseObject(scanPackage.getPath(), FilePathVo.class);
|
|
|
- filePath = tempFile.getPath() + File.separator + FilenameUtils.getName(filePathVo.getPath());
|
|
|
- File scanPackageFile = fileUploadService.downloadFile(scanPackage.getPath(), filePath);
|
|
|
- writer.write(scanPackageFile, name, scanPackageFile.getName());
|
|
|
- scanPackageFile.delete();
|
|
|
+ break;
|
|
|
+ case SIGN:
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
+ if (markPaper == null) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("试卷不存在");
|
|
|
+ }
|
|
|
+ QueryWrapper<ScanPackage> wrapper = new QueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<ScanPackage> lw = wrapper.lambda();
|
|
|
+ lw.eq(ScanPackage::getExamId, examId);
|
|
|
+ lw.eq(ScanPackage::getCoursePaperId, markPaper.getCoursePaperId());
|
|
|
+ lw.orderByAsc(ScanPackage::getPackageNo);
|
|
|
+ List<ScanPackage> scanPackageList = scanPackageService.list(wrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(scanPackageList)) {
|
|
|
+ for (ScanPackage scanPackage : scanPackageList) {
|
|
|
+ FilePathVo filePathVo = JSON.parseObject(scanPackage.getPath(), FilePathVo.class);
|
|
|
+ filePath = tempFile.getPath() + File.separator + FilenameUtils.getName(filePathVo.getPath());
|
|
|
+ File scanPackageFile = fileUploadService.downloadFile(scanPackage.getPath(), filePath);
|
|
|
+ writer.write(scanPackageFile, name, scanPackageFile.getName());
|
|
|
+ scanPackageFile.delete();
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
writer.close();
|