|
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -52,6 +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;//试卷预览地址前缀
|
|
|
|
|
|
@Override
|
|
|
public List<CoursePaperInfo> getCoursePaperList(CoursePaperQuery query) {
|
|
@@ -91,19 +94,21 @@ public class CoursePaperServiceImpl implements CoursePaperService {
|
|
|
Check.isEmpty(coursePaper.getPaperName(), "试卷名称不能为空!");
|
|
|
Check.isBlank(coursePaper.getPaperWordUrl(), "试卷Word文件地址不能为空!");
|
|
|
Check.isBlank(coursePaper.getAnswerWordUrl(), "答案Word文件地址不能为空!");
|
|
|
- Check.isBlank(coursePaper.getPaperHtmlUrl(), "试卷页面地址不能为空!");
|
|
|
- //Check.isNull(coursePaper.getPaperP(), "试卷页数不能为空!");
|
|
|
+ //Check.isBlank(coursePaper.getPaperHtmlUrl(), "试卷页面地址不能为空!");
|
|
|
//Check.isBlank(coursePaper.getPaperPdfUrl(), "试卷PDF文件地址不能为空!");
|
|
|
+ //Check.isNull(coursePaper.getPaperP(), "试卷页数不能为空!");
|
|
|
+
|
|
|
+ String paperHtmlUrl = PAPER_HTML_URL_PREFIX.concat(coursePaper.getPaperId());
|
|
|
|
|
|
CoursePaper oldCoursePaper = coursePaperRepository.findByExamIdAndPaperId(coursePaper.getExamId(), coursePaper.getPaperId());
|
|
|
if (oldCoursePaper != null) {
|
|
|
//存在则修改
|
|
|
oldCoursePaper.setPaperName(coursePaper.getPaperName());
|
|
|
- oldCoursePaper.setPaperP(coursePaper.getPaperP());//todo
|
|
|
oldCoursePaper.setPaperWordUrl(coursePaper.getPaperWordUrl());
|
|
|
oldCoursePaper.setAnswerWordUrl(coursePaper.getAnswerWordUrl());
|
|
|
- oldCoursePaper.setPaperHtmlUrl(coursePaper.getPaperHtmlUrl());
|
|
|
+ oldCoursePaper.setPaperHtmlUrl(paperHtmlUrl);
|
|
|
oldCoursePaper.setPaperPdfUrl(coursePaper.getPaperPdfUrl());//todo
|
|
|
+ oldCoursePaper.setPaperP(coursePaper.getPaperP());//todo
|
|
|
coursePaperRepository.save(oldCoursePaper);
|
|
|
|
|
|
//更新试卷试题结构
|