|
@@ -19,10 +19,10 @@ 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.PrintingProjectService;
|
|
import cn.com.qmth.examcloud.core.print.service.bean.common.ExamCourseInfo;
|
|
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.common.ExamInfo;
|
|
-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.CourseStatisticConvert;
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticInfo;
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticQuery;
|
|
import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticQuery;
|
|
|
|
+import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.CourseStatisticRefreshReq;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -78,21 +78,22 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void initCourseStatistic(CourseRefreshReq req) {
|
|
|
|
|
|
+ public void refreshCourseStatistic(CourseStatisticRefreshReq req) {
|
|
Check.isNull(req, "请求参数不能为空!");
|
|
Check.isNull(req, "请求参数不能为空!");
|
|
Check.isNull(req.getOrgId(), "学校ID不能为空!");
|
|
Check.isNull(req.getOrgId(), "学校ID不能为空!");
|
|
Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
Check.isNull(req.getExamId(), "考试ID不能为空!");
|
|
|
|
|
|
- List<CourseRefreshReq.Course> courses = req.getCourses();
|
|
|
|
|
|
+ List<CourseStatisticRefreshReq.Course> courses = req.getCourses();
|
|
if (courses == null || courses.size() == 0) {
|
|
if (courses == null || courses.size() == 0) {
|
|
//课程ID和试卷类型未指定时,则不统计
|
|
//课程ID和试卷类型未指定时,则不统计
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- for (CourseRefreshReq.Course course : courses) {
|
|
|
|
|
|
+ for (CourseStatisticRefreshReq.Course course : courses) {
|
|
if (course.getCourseId() == null || StringUtils.isBlank(course.getPaperType())) {
|
|
if (course.getCourseId() == null || StringUtils.isBlank(course.getPaperType())) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ //按课程和试卷类型逐个更新统计信息
|
|
List<ExamCourseInfo> examCourses = commonService.findExamCourses(req.getOrgId(), req.getExamId(), course.getCourseId(), course.getPaperType());//todo
|
|
List<ExamCourseInfo> examCourses = commonService.findExamCourses(req.getOrgId(), req.getExamId(), course.getCourseId(), course.getPaperType());//todo
|
|
this.syncCourseStatisticList(examCourses);
|
|
this.syncCourseStatisticList(examCourses);
|
|
}
|
|
}
|
|
@@ -102,12 +103,13 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
public void initAllCourseStatistic() {
|
|
public void initAllCourseStatistic() {
|
|
log.debug("initAllCourseStatistic...");
|
|
log.debug("initAllCourseStatistic...");
|
|
|
|
|
|
- //只处理已存在印刷项目中的考试
|
|
|
|
|
|
+ //只处理印刷项目中已有的考试
|
|
List<ExamInfo> exams = printingProjectService.getExamList(null);
|
|
List<ExamInfo> exams = printingProjectService.getExamList(null);
|
|
if (exams == null || exams.isEmpty()) {
|
|
if (exams == null || exams.isEmpty()) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //todo 优化
|
|
for (ExamInfo info : exams) {
|
|
for (ExamInfo info : exams) {
|
|
List<ExamCourseInfo> examCourses = commonService.findExamCourses(info.getOrgId(), info.getExamId());//todo
|
|
List<ExamCourseInfo> examCourses = commonService.findExamCourses(info.getOrgId(), info.getExamId());//todo
|
|
this.syncCourseStatisticList(examCourses);
|
|
this.syncCourseStatisticList(examCourses);
|