|
@@ -81,6 +81,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
@Override
|
|
|
public void initCourseStatistic(Long orgId, Long examId, Long[] courseIds) {
|
|
|
List<ExamCourseInfo> examCourses = commonService.getExamCourseList(orgId, examId);
|
|
|
+ //courseIds paperType todo
|
|
|
this.syncCourseStatisticList(examCourses);
|
|
|
}
|
|
|
|
|
@@ -106,7 +107,7 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
}
|
|
|
boolean isExist = this.isExistCourseStatistic(info);
|
|
|
if (isExist) {
|
|
|
- this.updateCourseStatistic(info);
|
|
|
+ this.syncCourseStatisticForTotalStudent(info);
|
|
|
} else {
|
|
|
this.addCourseStatistic(info);
|
|
|
}
|
|
@@ -140,13 +141,11 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
courseStatisticsRepository.save(statistic);
|
|
|
}
|
|
|
|
|
|
- private void updateCourseStatistic(ExamCourseInfo info) {
|
|
|
- //仅更新total_student、course_name字段
|
|
|
+ private void syncCourseStatisticForTotalStudent(ExamCourseInfo info) {
|
|
|
+ //仅更新total_student字段
|
|
|
SqlWrapper sql = new SqlWrapper()
|
|
|
.update("ec_prt_course_statistic")
|
|
|
- .set()
|
|
|
- .append("total_student = '").append(info.getTotalStudent()).append("'")
|
|
|
- .append(",course_name = '").append(info.getCourseName()).append("'")
|
|
|
+ .set().append("total_student = ").append(info.getTotalStudent())
|
|
|
.where()
|
|
|
.eq("org_id", info.getOrgId())
|
|
|
.and().eq("exam_id", info.getExamId())
|
|
@@ -155,4 +154,17 @@ public class CourseStatisticServiceImpl implements CourseStatisticService {
|
|
|
jdbcTemplate.update(sql.build());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void syncCourseStatisticForCourseName(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());
|
|
|
+ }
|
|
|
+
|
|
|
}
|