|
@@ -58,7 +58,7 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
schoolCourseQuery.lambda()
|
|
|
.eq(BasicCourse::getSchoolId, schoolId)
|
|
|
.eq(BasicCourse::getCode, courseCode);
|
|
|
- if (SystemConstant.strNotNull(courseName)){
|
|
|
+ if (SystemConstant.strNotNull(courseName)) {
|
|
|
schoolCourseQuery.lambda().eq(BasicCourse::getName, courseName);
|
|
|
}
|
|
|
List<BasicCourse> tbSchoolCourseList = basicCourseService.list(schoolCourseQuery);
|
|
@@ -70,7 +70,7 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
examCourseQuery.lambda()
|
|
|
.eq(TBExamCourse::getExamId, examId)
|
|
|
.eq(TBExamCourse::getCourseCode, courseCode);
|
|
|
- if (SystemConstant.strNotNull(courseName)){
|
|
|
+ if (SystemConstant.strNotNull(courseName)) {
|
|
|
examCourseQuery.lambda().eq(TBExamCourse::getCourseName, courseName);
|
|
|
}
|
|
|
List<TBExamCourse> tbExamCourseList = this.list(examCourseQuery);
|
|
@@ -84,6 +84,33 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
publishStatusEnum.equals(PublishStatusEnum.PUBLISH);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean verifyExamCourseCantDelete(Long examId, Long schoolId, String courseCode) {
|
|
|
+ QueryWrapper<BasicCourse> schoolCourseQuery = new QueryWrapper<>();
|
|
|
+ schoolCourseQuery.lambda()
|
|
|
+ .eq(BasicCourse::getSchoolId, schoolId)
|
|
|
+ .eq(BasicCourse::getCode, courseCode);
|
|
|
+ List<BasicCourse> tbSchoolCourseList = basicCourseService.list(schoolCourseQuery);
|
|
|
+ if (tbSchoolCourseList.size() != 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学校课程基础数据异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<TBExamCourse> examCourseQuery = new QueryWrapper<>();
|
|
|
+ examCourseQuery.lambda()
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getCourseCode, courseCode);
|
|
|
+ List<TBExamCourse> tbExamCourseList = this.list(examCourseQuery);
|
|
|
+ if (tbExamCourseList.size() != 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考试课程基础数据异常");
|
|
|
+ }
|
|
|
+ TBExamCourse tbExamCourse = tbExamCourseList.get(0);
|
|
|
+ TestStatusEnum testStatusEnum = tbExamCourse.getTestStatus();
|
|
|
+ PublishStatusEnum publishStatusEnum = tbExamCourse.getPublishStatus();
|
|
|
+ // 已发布的和计算中的 分析课程不能被删除
|
|
|
+ return testStatusEnum.equals(TestStatusEnum.TEST) || testStatusEnum.equals(TestStatusEnum.CHECKED) ||
|
|
|
+ publishStatusEnum.equals(PublishStatusEnum.PUBLISH) || publishStatusEnum.equals(PublishStatusEnum.COMPUTING);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<String> findEffectiveByExamId(Long examId, String courseCode) {
|
|
|
List<PublishStatusEnum> publishStatusEnumList = new ArrayList<>();
|
|
@@ -159,19 +186,19 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
if (tbExamCourseList.size() > 0) {
|
|
|
// 编辑
|
|
|
TBExamCourse tbExamCourse = tbExamCourseList.get(0);
|
|
|
- if (this.verifyExamCourseCantRun(examId, schoolId, courseCode, null)){
|
|
|
+ if (this.verifyExamCourseCantRun(examId, schoolId, courseCode, null)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试id【" + examId + "】,课程编号为【" + courseCode + "】的课程试卷已经发布或检查,无法更新");
|
|
|
}
|
|
|
- if (!Objects.equals(courseName,tbExamCourse.getCourseName()) ||
|
|
|
- !Objects.equals(paperType,tbExamCourse.getPaperType()) ||
|
|
|
- !Objects.equals(teachCollegeName,tbExamCourse.getTeachCollegeName())){
|
|
|
+ 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 {
|
|
|
+ } else {
|
|
|
// 新增
|
|
|
TBExamCourse tbExamCourse = new TBExamCourse();
|
|
|
tbExamCourse.setId(SystemConstant.getDbUuid());
|
|
@@ -191,10 +218,10 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
@Override
|
|
|
public boolean checkFinishCalculate(Long schoolId, Long examId, String courseCode) {
|
|
|
TBExamCourse tbExamCourse = this.getOne(new QueryWrapper<TBExamCourse>().lambda()
|
|
|
- .eq(TBExamCourse::getSchoolId,schoolId)
|
|
|
- .eq(TBExamCourse::getExamId,examId)
|
|
|
- .eq(TBExamCourse::getCourseCode,courseCode));
|
|
|
- if (Objects.isNull(tbExamCourse)){
|
|
|
+ .eq(TBExamCourse::getSchoolId, schoolId)
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getCourseCode, courseCode));
|
|
|
+ if (Objects.isNull(tbExamCourse)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到基础分析课程");
|
|
|
}
|
|
|
return !PublishStatusEnum.UN_COMPUTE.equals(tbExamCourse.getPublishStatus());
|