|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -11,6 +13,7 @@ import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseQuestionLogWrongDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionLog;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseQuestionLogWrong;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionLogWrongQuery;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -29,6 +32,7 @@ import javax.annotation.Resource;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.ExcelUtil.getCellFormatValue;
|
|
|
|
|
|
|
|
|
@ -374,5 +378,31 @@ public class TeacherOpenCourseQuestionLogWrongService extends CoreBaseService<Te
|
|
|
|
|
return teacherOpenCourseQuestionLogWrongDao.getExcelValues(teacherOpenCourseQuestionLogWrongQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* 根据题目日志,插入到学生错题集。插入到数据,可以关联到试卷ID teacherOpenCourseQuestionSettingId
|
|
|
|
|
* 方法内部自带判断是否是错误的题目
|
|
|
|
|
*
|
|
|
|
|
* @param questionLogList
|
|
|
|
|
*/
|
|
|
|
|
public void insertBatchByQuestionLogList(List<TeacherOpenCourseQuestionLog> questionLogList) {
|
|
|
|
|
|
|
|
|
|
// 空值直接返回
|
|
|
|
|
if(CollectionUtil.isEmpty(questionLogList)) { return; }
|
|
|
|
|
|
|
|
|
|
// 错题集
|
|
|
|
|
List<TeacherOpenCourseQuestionLog> questionWrongList = questionLogList.stream().filter(questionLog -> {
|
|
|
|
|
// 学生写答案了,并且也给打分了,但是呢,分数是0的情况。这个时候,就是错题了
|
|
|
|
|
return (null != questionLog.getStudentScore()
|
|
|
|
|
&& StringUtils.isNotBlank(questionLog.getTeacherOpenCourseQuestionLogAnswer())
|
|
|
|
|
&& questionLog.getStudentScore().compareTo(BigDecimal.ZERO) == 0);
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
// 判空
|
|
|
|
|
if(CollectionUtil.isEmpty(questionWrongList)) { return; }
|
|
|
|
|
|
|
|
|
|
// 除了ID,其他字段都一样。只为了记录错题集
|
|
|
|
|
insertBatch(BeanUtil.copyToList(questionWrongList, TeacherOpenCourseQuestionLogWrong.class));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|