deason 6 years ago
parent
commit
a6e6782363

+ 9 - 4
examcloud-core-print-service/src/main/java/cn/com/qmth/examcloud/core/print/service/impl/CoursePaperServiceImpl.java

@@ -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);
 
             //更新试卷试题结构

+ 3 - 1
examcloud-core-print-starter/src/main/resources/application-dev.properties

@@ -20,4 +20,6 @@ upyun.psw=ecs87863577!@#
 upyun.bucket=exam-cloud-test
 upyun.bucketUrl=https://v0.api.upyun.com/exam-cloud-test
 upyun.fileUrl=https://ecs-test-static.qmth.com.cn
-upyun.uploadUrl=/ecs-print/test/
+upyun.uploadUrl=/ecs-print/test/
+# question prefix config
+paper.html.url.prefix=http://192.168.10.39:8008/api/ecs_ques/paper/pdf/

+ 3 - 1
examcloud-core-print-starter/src/main/resources/application-prod.properties

@@ -20,4 +20,6 @@ upyun.psw=ecs87863577!@#
 upyun.bucket=exam-cloud
 upyun.bucketUrl=https://v0.api.upyun.com/exam-cloud
 upyun.fileUrl=https://ecs-static.qmth.com.cn
-upyun.uploadUrl=/ecs-print/prod/
+upyun.uploadUrl=/ecs-print/prod/
+# question prefix config
+paper.html.url.prefix=http://ecs.qmth.com.cn:8008/api/ecs_ques/paper/pdf/

+ 3 - 1
examcloud-core-print-starter/src/main/resources/application-test.properties

@@ -20,4 +20,6 @@ upyun.psw=ecs87863577!@#
 upyun.bucket=exam-cloud-test
 upyun.bucketUrl=https://v0.api.upyun.com/exam-cloud-test
 upyun.fileUrl=https://ecs-test-static.qmth.com.cn
-upyun.uploadUrl=/ecs-print/test/
+upyun.uploadUrl=/ecs-print/test/
+# question prefix config
+paper.html.url.prefix=http://ecs-dev.qmth.com.cn:8008/api/ecs_ques/paper/pdf/