Browse Source

fix 二造

he2802 2 years ago
parent
commit
f2c3855b34

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/ExamServiceImpl.java

@@ -237,6 +237,9 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
                 throw new CustomException("该卷已被绑定,不允许修改发布状态为未发布");
             }
         }
+        if((entity.getDoType()!=2)&&(entity.getSimulateStatus()==1)){
+            throw new CustomException("非考试类型无法开启模拟随机做题");
+        }
         if(Validator.isNotEmpty(entity.getSimulateConfig())){
             Integer q1 = entity.getSimulateConfig().getSingleChoice().getQNum();
             Integer q2 = entity.getSimulateConfig().getMultipleChoice().getQNum();
@@ -244,12 +247,21 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
             if((q1>0)&&(q1<entity.getSimulateConfig().getSingleChoice().getKNum())){
                 throw new CustomException("模拟配置单选题参数错误");
             }
+            if(entity.getSimulateConfig().getSingleChoice().getOrderNum()>3){
+                throw new CustomException("模拟配置单选题参数错误");
+            }
             if((q2>0)&&(q2<entity.getSimulateConfig().getMultipleChoice().getKNum())){
                 throw new CustomException("模拟配置多选题参数错误");
             }
+            if(entity.getSimulateConfig().getMultipleChoice().getOrderNum()>3){
+                throw new CustomException("模拟配置多选题参数错误");
+            }
             if((q3>0)&&(q3<entity.getSimulateConfig().getCaseQuestion().getKNum())){
                 throw new CustomException("模拟配置案例题参数错误");
             }
+            if(entity.getSimulateConfig().getCaseQuestion().getOrderNum()>3){
+                throw new CustomException("模拟配置案例题参数错误");
+            }
             entity.setSimulateConfigJson(JSON.toJSONString(entity.getSimulateConfig()));
         }
     }