|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
+import com.qmth.teachcloud.report.business.bean.result.TBExamCourseResult;
|
|
|
import com.qmth.teachcloud.report.business.entity.TBExamCourse;
|
|
|
import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
|
|
|
import com.qmth.teachcloud.report.business.enums.TestStatusEnum;
|
|
@@ -27,28 +28,32 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBExamCourse> implements TBExamCourseService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBExamCourseMapper tbExamCourseMapper;
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicCourseService basicCourseService;
|
|
|
|
|
|
@Override
|
|
|
- public boolean verifyExamCourseCantRun(Long examId,Long schoolId, String courseCode, String courseName) {
|
|
|
+ public boolean verifyExamCourseCantRun(Long examId, Long schoolId, String courseCode, String courseName) {
|
|
|
QueryWrapper<BasicCourse> schoolCourseQuery = new QueryWrapper<>();
|
|
|
schoolCourseQuery.lambda()
|
|
|
- .eq(BasicCourse::getSchoolId,schoolId)
|
|
|
- .eq(BasicCourse::getCode,courseCode)
|
|
|
- .eq(BasicCourse::getName,courseName);
|
|
|
+ .eq(BasicCourse::getSchoolId, schoolId)
|
|
|
+ .eq(BasicCourse::getCode, courseCode)
|
|
|
+ .eq(BasicCourse::getName, courseName);
|
|
|
List<BasicCourse> tbSchoolCourseList = basicCourseService.list(schoolCourseQuery);
|
|
|
- if (tbSchoolCourseList.size() != 1){
|
|
|
+ if (tbSchoolCourseList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("学校课程基础数据异常");
|
|
|
}
|
|
|
|
|
|
QueryWrapper<TBExamCourse> examCourseQuery = new QueryWrapper<>();
|
|
|
examCourseQuery.lambda()
|
|
|
- .eq(TBExamCourse::getExamId,examId)
|
|
|
- .eq(TBExamCourse::getCourseCode,courseCode)
|
|
|
- .eq(TBExamCourse::getCourseName,courseName);
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getCourseCode, courseCode)
|
|
|
+ .eq(TBExamCourse::getCourseName, courseName);
|
|
|
List<TBExamCourse> tbExamCourseList = this.list(examCourseQuery);
|
|
|
- if (tbExamCourseList.size() != 1){
|
|
|
+ if (tbExamCourseList.size() != 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试课程基础数据异常");
|
|
|
}
|
|
|
TBExamCourse tbExamCourse = tbExamCourseList.get(0);
|
|
@@ -58,25 +63,38 @@ public class TBExamCourseServiceImpl extends ServiceImpl<TBExamCourseMapper, TBE
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<String> findEffectiveByExamId(Long examId,String courseCode) {
|
|
|
+ public List<String> findEffectiveByExamId(Long examId, String courseCode) {
|
|
|
|
|
|
List<TBExamCourse> effectiveCourseList = this.list(new QueryWrapper<TBExamCourse>().lambda()
|
|
|
- .eq(TBExamCourse::getExamId,examId)
|
|
|
- .eq(TBExamCourse::getTestStatus,TestStatusEnum.UN_TEST)
|
|
|
- .eq(TBExamCourse::getPublishStatus,PublishStatusEnum.UN_COMPUTE));
|
|
|
+ .eq(TBExamCourse::getExamId, examId)
|
|
|
+ .eq(TBExamCourse::getTestStatus, TestStatusEnum.UN_TEST)
|
|
|
+ .eq(TBExamCourse::getPublishStatus, PublishStatusEnum.UN_COMPUTE));
|
|
|
|
|
|
- if (effectiveCourseList.size() == 0){
|
|
|
+ if (effectiveCourseList.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("该考试目前没有任何课程可以分析");
|
|
|
}
|
|
|
List<String> effectCourseCodeList = new ArrayList<>();
|
|
|
- if (courseCode != null && courseCode.length() > 0){
|
|
|
- if (!effectiveCourseList.stream().map(TBExamCourse::getCourseCode).collect(Collectors.toList()).contains(courseCode)){
|
|
|
+ if (courseCode != null && courseCode.length() > 0) {
|
|
|
+ if (!effectiveCourseList.stream().map(TBExamCourse::getCourseCode).collect(Collectors.toList()).contains(courseCode)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("课程【" + courseCode + "】无法进行分析");
|
|
|
}
|
|
|
effectCourseCodeList.add(courseCode);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
effectCourseCodeList = effectiveCourseList.stream().map(TBExamCourse::getCourseCode).collect(Collectors.toList());
|
|
|
}
|
|
|
return effectCourseCodeList;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询科目信息
|
|
|
+ *
|
|
|
+ * @param schoolId
|
|
|
+ * @param examId
|
|
|
+ * @param inspect
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<TBExamCourseResult> findCourseList(Long schoolId, Long examId, boolean inspect) {
|
|
|
+ return tbExamCourseMapper.findCourseList(schoolId, examId, inspect);
|
|
|
+ }
|
|
|
}
|