|
@@ -19,7 +19,7 @@ import cn.com.qmth.examcloud.core.print.service.CourseStatisticService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.common.ExamCourseInfo;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.common.ExamInfo;
|
|
|
-import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseRefreshForm;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseRefreshReq;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticConvert;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
|
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticQuery;
|
|
@@ -78,20 +78,22 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void initCourseStatistic(CourseRefreshForm form) {
|
|
|
- Check.isNull(form, "请求参数不能为空!");
|
|
|
- Check.isNull(form.getOrgId(), "学校ID不能为空!");
|
|
|
- Check.isNull(form.getExamId(), "考试ID不能为空!");
|
|
|
- List<CourseRefreshForm.Course> courses = form.getCourses();
|
|
|
+ public void initCourseStatistic(CourseRefreshReq req) {
|
|
|
+ Check.isNull(req, "请求参数不能为空!");
|
|
|
+ Check.isNull(req.getOrgId(), "学校ID不能为空!");
|
|
|
+ Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
+
|
|
|
+ List<CourseRefreshReq.Course> courses = req.getCourses();
|
|
|
if (courses == null || courses.size() == 0) {
|
|
|
//课程ID和试卷类型未指定时,则不统计
|
|
|
return;
|
|
|
}
|
|
|
- for (CourseRefreshForm.Course course : courses) {
|
|
|
+
|
|
|
+ for (CourseRefreshReq.Course course : courses) {
|
|
|
if (course.getCourseId() == null || StringUtils.isBlank(course.getPaperType())) {
|
|
|
continue;
|
|
|
}
|
|
|
- List<ExamCourseInfo> examCourses = commonService.getExamCourseList(form.getOrgId(), form.getExamId(), course.getCourseId(), course.getPaperType());
|
|
|
+ List<ExamCourseInfo> examCourses = commonService.getExamCourseList(req.getOrgId(), req.getExamId(), course.getCourseId(), course.getPaperType());
|
|
|
this.syncCourseStatisticList(examCourses);
|
|
|
}
|
|
|
}
|
|
@@ -117,6 +119,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
if (info.getCourseId() == null) {
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
boolean isExist = this.isExistCourseStatistic(info);
|
|
|
if (isExist) {
|
|
|
this.syncTotalStudentByOrgExamCourse(info);
|
|
@@ -154,8 +157,12 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
}
|
|
|
|
|
|
private void syncTotalStudentByOrgExamCourse(ExamCourseInfo info) {
|
|
|
+ if (info == null || info.getTotalStudent() == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
//仅更新total_student字段
|
|
|
- courseStatisticRepository.updateTotalStudentByOrgExamCourse(info.getOrgId(), info.getExamId(), info.getCourseId(), info.getPaperType(), info.getTotalStudent());
|
|
|
+ courseStatisticRepository.updateTotalStudentByOrgExamCourse(info.getOrgId(), info.getExamId(), info.getCourseId(), info.getPaperType(),
|
|
|
+ info.getTotalStudent());
|
|
|
}
|
|
|
|
|
|
@Override
|