|
|
|
@ -18,6 +18,7 @@ import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.ResourcesQuestionSnapshotDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.StudentDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseQuestionLogDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseQuestionSettingDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.dto.QuestionLogAddDTO;
|
|
|
|
|
import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionLogAnswerLockVO;
|
|
|
|
@ -54,6 +55,7 @@ import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId;
|
|
|
|
|
import static com.ibeetl.jlw.enums.QuestionBusinessTypeEnum.FROM_OPEN_COURSE;
|
|
|
|
|
import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.*;
|
|
|
|
|
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE;
|
|
|
|
|
import static com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum.HOMEWORK_FILE;
|
|
|
|
|
import static com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum.isOneQuestion;
|
|
|
|
|
import static java.lang.Math.abs;
|
|
|
|
|
import static java.lang.Math.toIntExact;
|
|
|
|
@ -77,6 +79,8 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
@Autowired private ResourcesQuestionSnapshotDao resourcesQuestionSnapshotDao;
|
|
|
|
|
@Autowired @Lazy
|
|
|
|
|
private TeacherOpenCourseQuestionSettingService teacherOpenCourseQuestionSettingService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionSettingDao teacherOpenCourseQuestionSettingDao;
|
|
|
|
|
@Autowired private TeacherOpenCourseQuestionLogWrongService teacherOpenCourseQuestionLogWrongService;
|
|
|
|
|
@Autowired private QuestionLogSummaryService questionLogSummaryService;
|
|
|
|
|
@Autowired private CoreDictService coreDictService;
|
|
|
|
@ -300,12 +304,14 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 教师端-手动批改一些题目的分数
|
|
|
|
|
* 教师端-给学生打分
|
|
|
|
|
*
|
|
|
|
|
* @param teacherOpenCourseQuestionLogIds 指定更新分数的题目日志IDs
|
|
|
|
|
* @param score 分数
|
|
|
|
|
* @param reply 评语
|
|
|
|
|
*/
|
|
|
|
|
public void manualModifyQuestionScores(@NotNull(message = "题目做题日志ID不能为空!") final String teacherOpenCourseQuestionLogIds, @NotEmpty final BigDecimal score, @Nullable String reply) {
|
|
|
|
|
public void manualModifyQuestionScores(@NotNull(message = "题目做题日志ID不能为空!") final String teacherOpenCourseQuestionLogIds,
|
|
|
|
|
@NotNull(message = "设置的分数不能为空!") final BigDecimal score, @Nullable String reply) {
|
|
|
|
|
TeacherOpenCourseQuestionLogQuery teacherOpenCourseQuestionLogQuery = new TeacherOpenCourseQuestionLogQuery();
|
|
|
|
|
teacherOpenCourseQuestionLogQuery.setTeacherOpenCourseQuestionLogIdPlural(teacherOpenCourseQuestionLogIds);
|
|
|
|
|
teacherOpenCourseQuestionLogQuery.setTeacherOpenCourseQuestionLogStatus(1);
|
|
|
|
@ -412,10 +418,12 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
* @param student
|
|
|
|
|
*/
|
|
|
|
|
private void addFileRelatedLog(@NotBlank(message = "上传的附件不能为空!") String absFilePath, Long questionSettingId, Student student) {
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
TeacherOpenCourseQuestionLogQuery query = new TeacherOpenCourseQuestionLogQuery();
|
|
|
|
|
query.setTeacherOpenCourseQuestionLogUploadFile(absFilePath);
|
|
|
|
|
query.setTeacherOpenCourseQuestionSettingId(questionSettingId);
|
|
|
|
|
query.setTeacherOpenCourseQuestionLogUpdateTime(new Date());
|
|
|
|
|
query.setTeacherOpenCourseQuestionLogAddTime(now);
|
|
|
|
|
query.setTeacherOpenCourseQuestionLogFinishTime(RandomUtil.randomLong(100, 3600));
|
|
|
|
|
query.setTeacherOpenCourseQuestionLogStatus(1);
|
|
|
|
|
// 附件作业,只有一题,所有默认是全部提交的方式
|
|
|
|
|
query.setQuestionLogAddType(FINALLY_SUBMIT);
|
|
|
|
@ -640,6 +648,9 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
*/
|
|
|
|
|
private void addQuestionLogSummary(Student student, Long questionSettingId) {
|
|
|
|
|
if (student == null || questionSettingId == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseQuestionLog> logList = getValuesBySettingIds(questionSettingId.toString());
|
|
|
|
|
TeacherOpenCourseQuestionSetting questionSetting = teacherOpenCourseQuestionSettingService.getInfo(questionSettingId);
|
|
|
|
|
|
|
|
|
@ -649,8 +660,6 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能描述: <br>
|
|
|
|
|
* 题目日志信息,分析汇总到某张表里
|
|
|
|
@ -669,7 +678,12 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
// 构建实体
|
|
|
|
|
final QuestionLogSummary questionLogSummary = new QuestionLogSummary();
|
|
|
|
|
final Long questionSettingId = logList.get(0).getTeacherOpenCourseQuestionSettingId();
|
|
|
|
|
final Integer questionTotalCount = resourcesQuestionSnapshotDao.getQuestionTotalCountBySettingId(questionSettingId);
|
|
|
|
|
|
|
|
|
|
// 这里附件作业的数量,需要单独查询
|
|
|
|
|
final Integer questionTotalCount = snapshotFromTypeEnum.equals(HOMEWORK_FILE)
|
|
|
|
|
? teacherOpenCourseQuestionSettingDao.getHomeWorkFileTotalCountBySettingId(questionSettingId)
|
|
|
|
|
: resourcesQuestionSnapshotDao.getQuestionTotalCountBySettingId(questionSettingId);
|
|
|
|
|
|
|
|
|
|
// 做对数,做错数,总题数
|
|
|
|
|
Integer sumSuccessCount = 0, sumErrorCount = 0, sumDoCount = 0;
|
|
|
|
|
// 试卷总分数, 我的分数, 题目日志ID集
|
|
|
|
@ -677,7 +691,7 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
|
|
|
|
|
// 获取最大的完成时间
|
|
|
|
|
TeacherOpenCourseQuestionLog maxFinish = logList.stream()
|
|
|
|
|
.max((o1, o2) -> toIntExact(o1.getTeacherOpenCourseQuestionLogFinishTime() - o2.getTeacherOpenCourseQuestionLogFinishTime()))
|
|
|
|
|
.max((o1, o2) -> toIntExact(defaultIfNull(o1.getTeacherOpenCourseQuestionLogFinishTime(), 0L) - defaultIfNull(o2.getTeacherOpenCourseQuestionLogFinishTime(), 0L)))
|
|
|
|
|
.get();
|
|
|
|
|
|
|
|
|
|
for (TeacherOpenCourseQuestionLog questionLog : logList) {
|
|
|
|
@ -688,8 +702,8 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
|
|
|
|
|
sumSuccessCount += successCount;
|
|
|
|
|
sumErrorCount += errorCount;
|
|
|
|
|
sumDoCount += ObjectUtil.isNotEmpty(questionLog.getTeacherOpenCourseQuestionLogAnswer()) ? 1 : 0;
|
|
|
|
|
questionTotalScore = questionTotalScore.add(questionLog.getQuestionScore());
|
|
|
|
|
myTotalScore = myTotalScore.add(questionLog.getStudentScore());
|
|
|
|
|
questionTotalScore = questionTotalScore.add(defaultIfNull(questionLog.getQuestionScore(), questionLog.getStudentScore()));
|
|
|
|
|
myTotalScore = myTotalScore.add(defaultIfNull(questionLog.getStudentScore(), questionLog.getQuestionScore()));
|
|
|
|
|
idsSet.add(questionLog.getTeacherOpenCourseQuestionLogId().toString());
|
|
|
|
|
}
|
|
|
|
|
// 及格分值比率
|
|
|
|
|