diff --git a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java index 6e177820..93caad47 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/GeneralQuestionLogService.java @@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.MultiValueMapAdapter; import org.springframework.validation.annotation.Validated; import javax.annotation.Nullable; @@ -703,7 +704,7 @@ public class GeneralQuestionLogService extends CoreBaseService updateList) { if (student == null || questionSettingId == null) { return; } @@ -799,12 +803,34 @@ public class GeneralQuestionLogService extends CoreBaseService logList = getValuesBySettingIds(questionSettingId.toString()); GeneralQuestionSetting questionSetting = generalQuestionSettingService.getInfo(questionSettingId); + setErrorSuccessCountField(updateList, logList); + if (CollectionUtil.isNotEmpty(logList) && questionSetting != null) { String logIds = logList.stream().map(GeneralQuestionLog::getGeneralQuestionLogId).map(Objects::toString).collect(joining(",")); addQuestionLogSummary(logIds, logList, student, questionSetting.getGeneralQuestionSettingName(), questionSetting.getBusinessType(), questionSetting.getGeneralQuestionSettingType()); } } + /** + * 拷贝正确错误的字段 + * + * @param updateList + * @param logList + */ + private void setErrorSuccessCountField(List updateList, List logList) { + Map> listMap = updateList.stream() + .collect(groupingBy(GeneralQuestionLog::getGeneralQuestionLogId)); + MultiValueMapAdapter mapAdapter = new MultiValueMapAdapter<>(listMap); + + logList.forEach(item -> { + GeneralQuestionLog first = mapAdapter.getFirst(item.getGeneralQuestionLogId()); + if (first != null) { + item.setErrorCount(first.getErrorCount()); + item.setSuccessCount(first.getSuccessCount()); + } + }); + } + private List getValuesBySettingIds(String settingIds) { GeneralQuestionLogQuery logQuery = new GeneralQuestionLogQuery(); logQuery.setGeneralQuestionSettingIdPlural(settingIds); diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java index 3b5083e8..6e952a2a 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java @@ -461,8 +461,8 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService updateList) { if (student == null || questionSettingId == null) { return; } List logList = getValuesBySettingIds(questionSettingId.toString()); + + setErrorSuccessCountField(updateList, logList); + TeacherOpenCourseQuestionSetting questionSetting = teacherOpenCourseQuestionSettingService.getInfo(questionSettingId); if (CollectionUtil.isNotEmpty(logList) && questionSetting != null) { @@ -667,6 +673,26 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService updateList, List logList) { + Map> listMap = updateList.stream() + .collect(groupingBy(TeacherOpenCourseQuestionLog::getTeacherOpenCourseQuestionLogId)); + MultiValueMapAdapter mapAdapter = new MultiValueMapAdapter<>(listMap); + + logList.forEach(item -> { + TeacherOpenCourseQuestionLog first = mapAdapter.getFirst(item.getTeacherOpenCourseQuestionLogId()); + if (first != null) { + item.setErrorCount(first.getErrorCount()); + item.setSuccessCount(first.getSuccessCount()); + } + }); + } + /** * 功能描述:
* 题目日志信息,分析汇总到某张表里 diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java index 955f0371..f6fa1a9c 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java @@ -115,6 +115,7 @@ public class TeacherOpenCourseQuestionSettingController{ /** * 学生端-教师端-根据题目配置信息,获取相关的题目 * 每次获取 + * 申请试卷 * * @param teacherOpenCourseQuestionSettingId 配置ID * @param fromTypeEnum 来源类型