|
@@ -10,6 +10,7 @@ package cn.com.qmth.examcloud.core.print.service.impl;
|
|
|
import cn.com.qmth.examcloud.core.print.common.jpa.OrderBuilder;
|
|
|
import cn.com.qmth.examcloud.core.print.common.jpa.SearchBuilder;
|
|
|
import cn.com.qmth.examcloud.core.print.common.jpa.SpecUtils;
|
|
|
+import cn.com.qmth.examcloud.core.print.common.jpa.SqlWrapper;
|
|
|
import cn.com.qmth.examcloud.core.print.common.utils.Check;
|
|
|
import cn.com.qmth.examcloud.core.print.entity.CourseStatistic;
|
|
|
import cn.com.qmth.examcloud.core.print.enums.PaperStatus;
|
|
@@ -19,10 +20,7 @@ import cn.com.qmth.examcloud.core.print.service.PrintingProjectService;
|
|
|
import cn.com.qmth.examcloud.core.print.service.StatisticService;
|
|
|
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.CourseStatisticConvert;
|
|
|
-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.CourseStatisticRefreshReq;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.bean.coursestatistic.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -30,6 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -47,6 +47,8 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
private PrintingProjectService printingProjectService;
|
|
|
@Autowired
|
|
|
private StatisticService statisticService;
|
|
|
+ @Autowired
|
|
|
+ private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Override
|
|
|
public Page<CourseStatisticInfo> getCourseStatisticList(CourseStatisticQuery query) {
|
|
@@ -77,6 +79,23 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
return CourseStatisticConvert.ofPage(page);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void syncCourseNameByCourseId(Long courseId, String courseName) {
|
|
|
+ if (courseId == null || StringUtils.isBlank(courseName)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ courseStatisticRepository.updateCourseNameByCourseId(courseId, courseName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CourseStatisticLessInfo> getCourseStatisticLessInfoList(Long orgId, Long examId) {
|
|
|
+ SqlWrapper sql = new SqlWrapper()
|
|
|
+ .select("cs.id,cs.total_student,cp.paper_p").from("ec_prt_course_statistic cs")
|
|
|
+ .innerJoin("ec_prt_course_paper cp").on("cp.id", "cs.course_paper_id")
|
|
|
+ .where().eq("cs.org_id", orgId).and().eq("cs.exam_id", examId);
|
|
|
+ return jdbcTemplate.query(sql.build(), new BeanPropertyRowMapper(CourseStatisticLessInfo.class));
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void refreshCourseStatistic(CourseStatisticRefreshReq req) {
|
|
|
Check.isNull(req, "请求参数不能为空!");
|
|
@@ -170,12 +189,4 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
info.getTotalStudent());
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void syncCourseNameByCourseId(Long courseId, String courseName) {
|
|
|
- if (courseId == null || StringUtils.isBlank(courseName)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- courseStatisticRepository.updateCourseNameByCourseId(courseId, courseName);
|
|
|
- }
|
|
|
-
|
|
|
}
|