|
@@ -53,8 +53,8 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
private CourseStatisticRepository courseStatisticRepository;
|
|
|
@Autowired
|
|
|
private QuestionStructureService questionStructureService;
|
|
|
- @Value("${paper.html.url.prefix}")
|
|
|
- private String PAPER_HTML_URL_PREFIX;//试卷预览地址前缀
|
|
|
+ @Value("${question.url.prefix}")
|
|
|
+ private String QUESTION_URL_PREFIX;//题库访问地址前缀
|
|
|
|
|
|
@Override
|
|
|
public List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query) {
|
|
@@ -92,22 +92,22 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
Check.isEmpty(coursePaper.getCourseName(), "课程名称不能为空!");
|
|
|
Check.isEmpty(coursePaper.getPaperId(), "试卷ID不能为空!");
|
|
|
Check.isEmpty(coursePaper.getPaperName(), "试卷名称不能为空!");
|
|
|
- Check.isBlank(coursePaper.getPaperWordUrl(), "试卷Word文件地址不能为空!");
|
|
|
- Check.isBlank(coursePaper.getAnswerWordUrl(), "答案Word文件地址不能为空!");
|
|
|
- //Check.isBlank(coursePaper.getPaperHtmlUrl(), "试卷页面地址不能为空!");
|
|
|
- //Check.isBlank(coursePaper.getPaperPdfUrl(), "试卷PDF文件地址不能为空!");
|
|
|
- //Check.isNull(coursePaper.getPaperP(), "试卷页数不能为空!");
|
|
|
+// Check.isBlank(coursePaper.getPaperHtmlUrl(), "试卷页面地址不能为空!");
|
|
|
+// Check.isBlank(coursePaper.getAnswerHtmlUrl(), "答案页面地址不能为空!");
|
|
|
+// Check.isNull(coursePaper.getPaperP(), "试卷页数不能为空!");
|
|
|
|
|
|
- String paperHtmlUrl = PAPER_HTML_URL_PREFIX.concat(coursePaper.getPaperId());
|
|
|
+ //试卷预览和答案预览地址
|
|
|
+ String paperHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/pdf/").concat(coursePaper.getPaperId());
|
|
|
+ String answerHtmlUrl = QUESTION_URL_PREFIX.concat("/api/ecs_ques/paper/pdf/").concat(coursePaper.getPaperId());
|
|
|
|
|
|
CoursePaper oldCoursePaper = coursePaperRepository.findByExamIdAndPaperId(coursePaper.getExamId(), coursePaper.getPaperId());
|
|
|
if (oldCoursePaper != null) {
|
|
|
//存在则修改
|
|
|
oldCoursePaper.setPaperName(coursePaper.getPaperName());
|
|
|
- oldCoursePaper.setPaperWordUrl(coursePaper.getPaperWordUrl());
|
|
|
- oldCoursePaper.setAnswerWordUrl(coursePaper.getAnswerWordUrl());
|
|
|
oldCoursePaper.setPaperHtmlUrl(paperHtmlUrl);
|
|
|
+ oldCoursePaper.setAnswerHtmlUrl(answerHtmlUrl);
|
|
|
oldCoursePaper.setPaperPdfUrl(coursePaper.getPaperPdfUrl());//todo
|
|
|
+ oldCoursePaper.setAnswerPdfUrl(coursePaper.getAnswerPdfUrl());//todo
|
|
|
oldCoursePaper.setPaperP(coursePaper.getPaperP());//todo
|
|
|
coursePaperRepository.save(oldCoursePaper);
|
|
|
|
|
@@ -315,11 +315,11 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
ExportFileInfo info = new ExportFileInfo();
|
|
|
|
|
|
if (needPaper) {
|
|
|
- info.setPaperWord(new Pair<>(title + PAPER_DOC_NAME, paper.getPaperWordUrl()));
|
|
|
+ info.setPaperPdf(new Pair<>(title + PAPER_PDF_NAME, paper.getPaperPdfUrl()));
|
|
|
}
|
|
|
|
|
|
if (needAnswer) {
|
|
|
- info.setAnswerWord(new Pair<>(title + ANSWER_DOC_NAME, paper.getAnswerWordUrl()));
|
|
|
+ info.setAnswerPdf(new Pair<>(title + ANSWER_PDF_NAME, paper.getAnswerPdfUrl()));
|
|
|
}
|
|
|
|
|
|
if (needStruct) {
|
|
@@ -356,16 +356,18 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
}
|
|
|
|
|
|
private void doPaperAndAnswerFiles(List<ExportFileInfo> exportFiles, final String targetDir) {
|
|
|
+ if (exportFiles.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
//试卷或答案存放目录
|
|
|
- final String paperDir = targetDir + "/" + PAPER_DIR;
|
|
|
- final String answerDir = targetDir + "/" + ANSWER_DIR;
|
|
|
- FileUtils.makeDirs(paperDir);
|
|
|
- FileUtils.makeDirs(answerDir);
|
|
|
+ final String tempDir = targetDir + "/paper";
|
|
|
+ FileUtils.makeDirs(tempDir);
|
|
|
|
|
|
//下载试卷或答案文件
|
|
|
for (ExportFileInfo info : exportFiles) {
|
|
|
- this.loadFile(paperDir, info.getPaperWord());
|
|
|
- this.loadFile(answerDir, info.getAnswerWord());
|
|
|
+ this.loadFile(tempDir, info.getPaperPdf());
|
|
|
+ this.loadFile(tempDir, info.getAnswerPdf());
|
|
|
}
|
|
|
}
|
|
|
|