weiwenhai 6 роки тому
батько
коміт
f38b489d0e

+ 7 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/GenPaperService.java

@@ -38,6 +38,7 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
 import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
 import cn.com.qmth.examcloud.core.questions.base.question.enums.QuesStructType;
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
 import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
@@ -81,6 +82,9 @@ public class GenPaperService {
         //查询试卷结构
         long start = System.currentTimeMillis();
         PaperStruct paperStruct = paperStructRepo.findOne(genPaperDto.getPaperStructId());
+        if(paperStruct == null){
+        	throw new StatusException("Q-030086", "试卷结构不存在");
+        }
         PaperContext paperContext = new PaperContext(paperStruct, genPaperDto.getConditions());
         List<UnitContext> unitContexts = new LinkedList<UnitContext>();
         List<DetailContext> detailContexts = paperContext.getDetails();
@@ -869,6 +873,9 @@ public class GenPaperService {
         //查询试卷结构
         long start = System.currentTimeMillis();
         PaperStruct paperStruct = paperStructRepo.findOne(genPaperDto.getPaperStructId());
+        if(paperStruct == null){
+        	throw new StatusException("Q-030086", "试卷结构不存在");
+        }
         PaperContext paperContext = new PaperContext(paperStruct, genPaperDto.getConditions());
         List<UnitContext> unitContexts = new LinkedList<UnitContext>();
         List<DetailContext> detailContexts = paperContext.getDetails();