|
@@ -10,7 +10,6 @@ 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.ExamType;
|
|
@@ -30,7 +29,6 @@ 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.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.List;
|
|
@@ -46,8 +44,6 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
private CourseStatisticRepository courseStatisticsRepository;
|
|
|
@Autowired
|
|
|
private CommonService commonService;
|
|
|
- @Autowired
|
|
|
- private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@Override
|
|
|
public Page<CourseStatisticInfo> getCourseStatisticList(CourseStatisticQuery query) {
|
|
@@ -107,7 +103,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
}
|
|
|
boolean isExist = this.isExistCourseStatistic(info);
|
|
|
if (isExist) {
|
|
|
- this.syncCourseStatisticForTotalStudent(info);
|
|
|
+ this.syncTotalStudentByOrgExamCourse(info);
|
|
|
} else {
|
|
|
this.addCourseStatistic(info);
|
|
|
}
|
|
@@ -141,30 +137,17 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
courseStatisticsRepository.save(statistic);
|
|
|
}
|
|
|
|
|
|
- private void syncCourseStatisticForTotalStudent(ExamCourseInfo info) {
|
|
|
+ private void syncTotalStudentByOrgExamCourse(ExamCourseInfo info) {
|
|
|
//仅更新total_student字段
|
|
|
- SqlWrapper sql = new SqlWrapper()
|
|
|
- .update("ec_prt_course_statistic")
|
|
|
- .set().append("total_student = ").append(info.getTotalStudent())
|
|
|
- .where()
|
|
|
- .eq("org_id", info.getOrgId())
|
|
|
- .and().eq("exam_id", info.getExamId())
|
|
|
- .and().eq("course_id", info.getCourseId())
|
|
|
- .and().eq("paper_type", info.getPaperType());
|
|
|
- jdbcTemplate.update(sql.build());
|
|
|
+ courseStatisticsRepository.updateTotalStudentByOrgExamCourse(info.getOrgId(), info.getExamId(), info.getCourseId(), info.getPaperType(), info.getTotalStudent());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncCourseStatisticForCourseName(Long courseId, String courseName) {
|
|
|
+ public void syncCourseNameByCourseId(Long courseId, String courseName) {
|
|
|
if (courseId == null || StringUtils.isBlank(courseName)) {
|
|
|
return;
|
|
|
}
|
|
|
- SqlWrapper sql = new SqlWrapper()
|
|
|
- .update("ec_prt_course_statistic")
|
|
|
- .set().append("course_name = '").append(courseName).append("'")
|
|
|
- .where()
|
|
|
- .eq("course_id", courseId);
|
|
|
- jdbcTemplate.update(sql.build());
|
|
|
+ courseStatisticsRepository.updateCourseNameByCourseId(courseId, courseName);
|
|
|
}
|
|
|
|
|
|
}
|