|
@@ -150,28 +150,42 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public void createCourse(Long schoolId, Long examId, String courseCode, String courseName, String paperType, String teachCollegeName) {
|
|
public void createCourse(Long schoolId, Long examId, String courseCode, String courseName, String paperType, String teachCollegeName) {
|
|
|
|
+ Long teachCollegeId = sysOrgService.searchOrInsert(schoolId, teachCollegeName);
|
|
List<TBExamCourse> tbExamCourseList = this.list(new QueryWrapper<TBExamCourse>().lambda()
|
|
List<TBExamCourse> tbExamCourseList = this.list(new QueryWrapper<TBExamCourse>().lambda()
|
|
.eq(TBExamCourse::getExamId, examId)
|
|
.eq(TBExamCourse::getExamId, examId)
|
|
.eq(TBExamCourse::getSchoolId, schoolId)
|
|
.eq(TBExamCourse::getSchoolId, schoolId)
|
|
.eq(TBExamCourse::getCourseCode, courseCode)
|
|
.eq(TBExamCourse::getCourseCode, courseCode)
|
|
.eq(TBExamCourse::getPaperType, paperType));
|
|
.eq(TBExamCourse::getPaperType, paperType));
|
|
if (tbExamCourseList.size() > 0) {
|
|
if (tbExamCourseList.size() > 0) {
|
|
- throw ExceptionResultEnum.ERROR.exception("考试试卷已存在");
|
|
|
|
|
|
+ // 编辑
|
|
|
|
+ TBExamCourse tbExamCourse = tbExamCourseList.get(0);
|
|
|
|
+ if (this.verifyExamCourseCantRun(examId, schoolId, courseCode, courseName)){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考试id【" + examId + "】,课程编号为【" + courseCode + "】的课程试卷已经发布或检查,无法更新");
|
|
|
|
+ }
|
|
|
|
+ if (!Objects.equals(courseName,tbExamCourse.getCourseName()) ||
|
|
|
|
+ !Objects.equals(paperType,tbExamCourse.getPaperType()) ||
|
|
|
|
+ !Objects.equals(teachCollegeName,tbExamCourse.getTeachCollegeName())){
|
|
|
|
+ tbExamCourse.setOpenDataMd5(null);
|
|
|
|
+ }
|
|
|
|
+ tbExamCourse.setPaperType(paperType);
|
|
|
|
+ tbExamCourse.setCourseName(courseName);
|
|
|
|
+ tbExamCourse.setTeachCollegeName(teachCollegeName);
|
|
|
|
+ this.updateById(tbExamCourse);
|
|
|
|
+ }else {
|
|
|
|
+ // 新增
|
|
|
|
+ TBExamCourse tbExamCourse = new TBExamCourse();
|
|
|
|
+ tbExamCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
+ tbExamCourse.setSchoolId(schoolId);
|
|
|
|
+ tbExamCourse.setExamId(examId);
|
|
|
|
+ tbExamCourse.setCourseCode(courseCode);
|
|
|
|
+ tbExamCourse.setCourseName(courseName);
|
|
|
|
+ tbExamCourse.setPaperType(paperType);
|
|
|
|
+ tbExamCourse.setTestStatus(TestStatusEnum.UN_TEST);
|
|
|
|
+ tbExamCourse.setPublishStatus(PublishStatusEnum.UN_COMPUTE);
|
|
|
|
+ tbExamCourse.setTeachCollegeId(teachCollegeId);
|
|
|
|
+ tbExamCourse.setTeachCollegeName(teachCollegeName);
|
|
|
|
+ this.save(tbExamCourse);
|
|
}
|
|
}
|
|
- Long teachCollegeId = sysOrgService.searchOrInsert(schoolId, teachCollegeName);
|
|
|
|
-
|
|
|
|
- TBExamCourse tbExamCourse = new TBExamCourse();
|
|
|
|
- tbExamCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
- tbExamCourse.setSchoolId(schoolId);
|
|
|
|
- tbExamCourse.setExamId(examId);
|
|
|
|
- tbExamCourse.setCourseCode(courseCode);
|
|
|
|
- tbExamCourse.setCourseName(courseName);
|
|
|
|
- tbExamCourse.setPaperType(paperType);
|
|
|
|
- tbExamCourse.setTestStatus(TestStatusEnum.UN_TEST);
|
|
|
|
- tbExamCourse.setPublishStatus(PublishStatusEnum.UN_COMPUTE);
|
|
|
|
- tbExamCourse.setTeachCollegeId(teachCollegeId);
|
|
|
|
- tbExamCourse.setTeachCollegeName(teachCollegeName);
|
|
|
|
- this.save(tbExamCourse);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|