|
@@ -1,7 +1,9 @@
|
|
|
package com.zhongzheng.modules.exam.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
@@ -17,6 +19,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Collection;
|
|
|
import java.util.Collections;
|
|
@@ -73,10 +76,16 @@ public class ExamBeforeApplyServiceImpl extends ServiceImpl<ExamBeforeApplyMappe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean insertByAddBo(ExamBeforeApplyAddBo bo) {
|
|
|
remove(new LambdaQueryWrapper<ExamBeforeApply>().eq(ExamBeforeApply::getBeforeId, bo.getBeforeId()));
|
|
|
Collection<ExamBeforeApply> coll = new HashSet<>();
|
|
|
for(Long applyId : bo.getApplyIds()){
|
|
|
+ //考试安排只能被一个前培绑定
|
|
|
+ ExamBeforeApply apply = getOne(new LambdaQueryWrapper<ExamBeforeApply>().eq(ExamBeforeApply::getApplyId, applyId));
|
|
|
+ if(Validator.isNotEmpty(apply)){
|
|
|
+ throw new CustomException("考试计划ID"+applyId+"已被绑定");
|
|
|
+ }
|
|
|
ExamBeforeApply add = new ExamBeforeApply();
|
|
|
add.setBeforeId(bo.getBeforeId());
|
|
|
add.setApplyId(applyId);
|