|
|
@ -1,12 +1,12 @@
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import cn.hutool.core.bean.copier.CopyOptions;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
|
import cn.hutool.core.util.BooleanUtil;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
import cn.hutool.core.util.ReUtil;
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
@ -495,27 +495,27 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
query.setTeacherOpenCourseQuestionSettingId(questionSettingId);
|
|
|
|
query.setTeacherOpenCourseQuestionSettingId(questionSettingId);
|
|
|
|
query.setTeacherOpenCourseQuestionLogStatus(1);
|
|
|
|
query.setTeacherOpenCourseQuestionLogStatus(1);
|
|
|
|
query.setStudentId(studentId);
|
|
|
|
query.setStudentId(studentId);
|
|
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseQuestionLog> valuesByQuery = getValuesByQueryNotWithPermission(query);
|
|
|
|
List<TeacherOpenCourseQuestionLog> valuesByQuery = getValuesByQueryNotWithPermission(query);
|
|
|
|
return questionAnalysis(valuesByQuery);
|
|
|
|
return questionAnalysis(valuesByQuery);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取题目日志,信息
|
|
|
|
* 从题目日志中,获取题目快照信息,Bean Copy方式
|
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
|
* @param questionSettingId 题目配置ID
|
|
|
|
* @param studentId 学生ID
|
|
|
|
* @param studentId 学生ID
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<ResourcesQuestionSnapshot> questionAnalysisNotType(Long questionSettingId, Long studentId) {
|
|
|
|
public List<ResourcesQuestionSnapshot> questionAnalysisBySettingId2(Long questionSettingId, Long studentId) {
|
|
|
|
Map<Integer, List<TeacherOpenCourseQuestionLog>> tempMap = questionAnalysis(questionSettingId, studentId);
|
|
|
|
Map<Integer, List<TeacherOpenCourseQuestionLog>> tempMap = questionAnalysis(questionSettingId, studentId);
|
|
|
|
List<TeacherOpenCourseQuestionLog> collect = tempMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
|
|
|
|
List<TeacherOpenCourseQuestionLog> collect = tempMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList());
|
|
|
|
List<ResourcesQuestionSnapshot> result = new ArrayList<>();
|
|
|
|
List<ResourcesQuestionSnapshot> result = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> build = MapUtil.builder("courseInfoId", "teacherOpenCourseMergeCourseInfoId").build();
|
|
|
|
// 循环遍历某些特殊的属性,单独映射
|
|
|
|
CopyOptions copyOptions = CopyOptions.create().setFieldMapping(build);
|
|
|
|
|
|
|
|
Optional.ofNullable(collect).ifPresent(item -> {
|
|
|
|
Optional.ofNullable(collect).ifPresent(item -> {
|
|
|
|
for (TeacherOpenCourseQuestionLog questionLog : item) {
|
|
|
|
for (TeacherOpenCourseQuestionLog questionLog : item) {
|
|
|
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = new ResourcesQuestionSnapshot();
|
|
|
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = BeanUtil.copyProperties(questionLog, ResourcesQuestionSnapshot.class);
|
|
|
|
BeanUtil.copyProperties(questionLog, resourcesQuestionSnapshot, copyOptions);
|
|
|
|
// 学生提交过的答案
|
|
|
|
resourcesQuestionSnapshot.set("teacherOpenCourseQuestionLogAnswer", questionLog.getTeacherOpenCourseQuestionLogAnswer());
|
|
|
|
resourcesQuestionSnapshot.set("teacherOpenCourseQuestionLogAnswer", questionLog.getTeacherOpenCourseQuestionLogAnswer());
|
|
|
|
result.add(resourcesQuestionSnapshot);
|
|
|
|
result.add(resourcesQuestionSnapshot);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -545,6 +545,11 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Map<Integer, List<TeacherOpenCourseQuestionLog>> questionAnalysis(@NotEmpty(message = "未查询到题目列表!") final List<TeacherOpenCourseQuestionLog> questionLogList) {
|
|
|
|
public Map<Integer, List<TeacherOpenCourseQuestionLog>> questionAnalysis(@NotEmpty(message = "未查询到题目列表!") final List<TeacherOpenCourseQuestionLog> questionLogList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果未查询到题目日志,返回空Map
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(questionLogList)) {
|
|
|
|
|
|
|
|
return MapUtil.empty();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
|
|
|
|
TeacherOpenCourseQuestionSettingQuery settingQuery = new TeacherOpenCourseQuestionSettingQuery();
|
|
|
|
settingQuery.setTeacherOpenCourseQuestionSettingId(questionLogList.get(0).getTeacherOpenCourseQuestionSettingId());
|
|
|
|
settingQuery.setTeacherOpenCourseQuestionSettingId(questionLogList.get(0).getTeacherOpenCourseQuestionSettingId());
|
|
|
|
final TeacherOpenCourseQuestionSetting hwSetting = teacherOpenCourseQuestionSettingService.getInfo(settingQuery);
|
|
|
|
final TeacherOpenCourseQuestionSetting hwSetting = teacherOpenCourseQuestionSettingService.getInfo(settingQuery);
|
|
|
@ -555,11 +560,9 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
final Boolean isEndShowTrueFalse = BooleanUtil.toBoolean(String.valueOf(hwSetting.getTeacherOpenCourseQuestionSettingEndShowTrueFalse()));
|
|
|
|
final Boolean isEndShowTrueFalse = BooleanUtil.toBoolean(String.valueOf(hwSetting.getTeacherOpenCourseQuestionSettingEndShowTrueFalse()));
|
|
|
|
|
|
|
|
|
|
|
|
return questionLogList.stream().map(item -> {
|
|
|
|
return questionLogList.stream().map(item -> {
|
|
|
|
TeacherOpenCourseQuestionLog questionLog = new TeacherOpenCourseQuestionLog();
|
|
|
|
item.setQuestionAnswer(isEndShowQa ? item.getQuestionAnswer() : "");
|
|
|
|
questionLog.setResourcesQuestionSnapshotId(item.getResourcesQuestionSnapshotId());
|
|
|
|
item.setQuestionAnalysis(isEndShowTrueFalse ? item.getQuestionAnswer(): "");
|
|
|
|
questionLog.setQuestionAnswer(isEndShowQa ? item.getQuestionAnswer() : "");
|
|
|
|
return item;
|
|
|
|
questionLog.setQuestionAnalysis(isEndShowTrueFalse ? item.getQuestionAnswer(): "");
|
|
|
|
|
|
|
|
return questionLog;
|
|
|
|
|
|
|
|
}).collect(groupingBy(TeacherOpenCourseQuestionLog::getQuestionType));
|
|
|
|
}).collect(groupingBy(TeacherOpenCourseQuestionLog::getQuestionType));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|