|
@@ -2,20 +2,22 @@ package com.zhongzheng.modules.bank.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.bank.bo.*;
|
|
|
-import com.zhongzheng.modules.bank.domain.Exam;
|
|
|
-import com.zhongzheng.modules.bank.domain.ExamQuestion;
|
|
|
-import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
+import com.zhongzheng.modules.bank.domain.*;
|
|
|
import com.zhongzheng.modules.bank.mapper.ExamMapper;
|
|
|
import com.zhongzheng.modules.bank.service.IExamQuestionService;
|
|
|
import com.zhongzheng.modules.bank.service.IExamService;
|
|
|
import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
|
+import com.zhongzheng.modules.bank.service.IQuestionChapterExamService;
|
|
|
import com.zhongzheng.modules.bank.vo.ExamVo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
|
import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsAttached;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
|
|
|
import com.zhongzheng.modules.user.domain.User;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -46,6 +48,12 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
@Autowired
|
|
|
private IQuestionBusinessService iQuestionBusinessService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGoodsAttachedService iGoodsAttachedService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IQuestionChapterExamService iQuestionChapterExamService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ExamMapper examMapper;
|
|
|
|
|
@@ -178,6 +186,15 @@ public class ExamServiceImpl extends ServiceImpl<ExamMapper, Exam> implements IE
|
|
|
*/
|
|
|
private void validEntityBeforeSave(Exam entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
+ if(entity.getExamId()>0&&entity.getPublishStatus().equals(0)){
|
|
|
+ GoodsAttached one = iGoodsAttachedService.getOne(new LambdaQueryWrapper<GoodsAttached>().eq(GoodsAttached::getMajorId, entity.getExamId()).eq(GoodsAttached::getType,3).last("limit 1"));
|
|
|
+ if(one!=null){
|
|
|
+ throw new CustomException("该卷已被绑定,不允许修改发布状态为未发布");
|
|
|
+ }
|
|
|
+ if(iQuestionChapterExamService.getOne(new LambdaQueryWrapper<QuestionChapterExam>().eq(QuestionChapterExam::getExamId,entity.getExamId()).last("limit 1"))!=null){
|
|
|
+ throw new CustomException("该卷已被绑定,不允许修改发布状态为未发布");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|