|
@@ -132,9 +132,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public ExamVo insertByAddBo(ExamAddBo bo) {
|
|
|
Exam add = BeanUtil.toBean(bo, Exam.class);
|
|
|
- if(Validator.isNotEmpty(bo.getSimulateConfig())){
|
|
|
- add.setSimulateConfigJson(JSON.toJSONString(bo.getSimulateConfig()));
|
|
|
- }
|
|
|
add.setCode(ServletUtils.getEncoded("SJ"));
|
|
|
validEntityBeforeSave(add);
|
|
|
add.setCreateTime(DateUtils.getNowTime());
|
|
@@ -185,9 +182,6 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
throw new CustomException("试卷ID缺失");
|
|
|
}
|
|
|
Exam update = BeanUtil.toBean(bo, Exam.class);
|
|
|
- if(Validator.isNotEmpty(bo.getSimulateConfig())){
|
|
|
- update.setSimulateConfigJson(JSON.toJSONString(bo.getSimulateConfig()));
|
|
|
- }
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
if(bo.getQuestionList()!=null){
|
|
@@ -243,7 +237,21 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
throw new CustomException("该卷已被绑定,不允许修改发布状态为未发布");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if(Validator.isNotEmpty(entity.getSimulateConfig())){
|
|
|
+ Integer q1 = entity.getSimulateConfig().getSingleChoice().getQNum();
|
|
|
+ Integer q2 = entity.getSimulateConfig().getMultipleChoice().getQNum();
|
|
|
+ Integer q3 = entity.getSimulateConfig().getCaseQuestion().getQNum();
|
|
|
+ if((q1>0)&&(q1<entity.getSimulateConfig().getSingleChoice().getKNum())){
|
|
|
+ throw new CustomException("模拟配置单选题参数错误");
|
|
|
+ }
|
|
|
+ if((q2>0)&&(q2<entity.getSimulateConfig().getMultipleChoice().getKNum())){
|
|
|
+ throw new CustomException("模拟配置多选题参数错误");
|
|
|
+ }
|
|
|
+ if((q3>0)&&(q3<entity.getSimulateConfig().getCaseQuestion().getKNum())){
|
|
|
+ throw new CustomException("模拟配置案例题参数错误");
|
|
|
+ }
|
|
|
+ entity.setSimulateConfigJson(JSON.toJSONString(entity.getSimulateConfig()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|