|
@@ -12,7 +12,9 @@ import com.xjrsoft.common.enums.ArchivesStatusEnum;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseClass;
|
|
|
import com.xjrsoft.module.base.entity.BaseCourseSubject;
|
|
|
+import com.xjrsoft.module.base.service.IBaseClassService;
|
|
|
import com.xjrsoft.module.base.service.IBaseCourseSubjectService;
|
|
|
import com.xjrsoft.module.generator.entity.ImportConfig;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
@@ -72,6 +74,8 @@ public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSub
|
|
|
private final IUserService userService;
|
|
|
private final IExamSubjectScoreService scoreService;
|
|
|
|
|
|
+ private final IBaseClassService classService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -139,11 +143,33 @@ public class ExamSubjectScoreEnterServiceImpl extends MPJBaseServiceImpl<ExamSub
|
|
|
|
|
|
@Override
|
|
|
public Boolean save(AddExamSubjectScoreEnterDto dto) {
|
|
|
+ BaseCourseSubject courseSubject = courseSubjectService.getById(dto.getCourseSubjectId());
|
|
|
+
|
|
|
+
|
|
|
+ List<String> classNames = new ArrayList<>();
|
|
|
+ for (Long classId : dto.getClassIds()) {
|
|
|
+ List<ExamSubjectScoreEnter> list = this.list(
|
|
|
+ new QueryWrapper<ExamSubjectScoreEnter>().lambda()
|
|
|
+ .eq(ExamSubjectScoreEnter::getSemesterId, dto.getSemesterId())
|
|
|
+ .eq(ExamSubjectScoreEnter::getExamPlanId, dto.getExamPlanId())
|
|
|
+ .eq(ExamSubjectScoreEnter::getCourseSubjectId, dto.getCourseSubjectId())
|
|
|
+ .like(ExamSubjectScoreEnter::getClassIds, classId)
|
|
|
+ .eq(ExamSubjectScoreEnter::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ );
|
|
|
+ if(!list.isEmpty()){
|
|
|
+ User user = userService.getById(list.get(0).getCreateUserId());
|
|
|
+ BaseClass aClass = classService.getById(classId);
|
|
|
+ classNames.add(aClass.getName() + "的" + courseSubject.getName() + "已被" + user.getName() + "添加");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!classNames.isEmpty()){
|
|
|
+ String messgae = classNames.toString().replace("[", "").replace("]", "").replace(", ", ";");
|
|
|
+ throw new MyException(messgae + ",不能重复添加");
|
|
|
+ }
|
|
|
ExamSubjectScoreEnter examSubjectScoreEnter = BeanUtil.toBean(dto, ExamSubjectScoreEnter.class);
|
|
|
examSubjectScoreEnter.setCreateDate(new Date());
|
|
|
String classIds = dto.getClassIds().toString().replace("[", "").replace("]", "").replace(" ", "");
|
|
|
examSubjectScoreEnter.setClassIds(classIds);
|
|
|
- BaseCourseSubject courseSubject = courseSubjectService.getById(examSubjectScoreEnter.getCourseSubjectId());
|
|
|
examSubjectScoreEnter.setCoursename(courseSubject.getName());
|
|
|
boolean isSuccess = this.save(examSubjectScoreEnter);
|
|
|
List<User> userList = userService.list(
|