|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
@ -23,6 +23,7 @@ import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeStudentQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseStudentSigninLogQuery;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
@ -33,6 +34,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
@ -40,6 +42,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
@ -71,29 +74,40 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseStudentSigninLogDao studentSigninLogDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseScheduleSessionDao teacherOpenCourseScheduleSessionDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private QuestionLogSummaryDao questionLogSummaryService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseQuestionSettingDao teacherOpenCourseQuestionSettingDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskVideoDao videoService;
|
|
|
|
|
private StudentHandsOnTaskVideoDao videoDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskPptDao pptService;
|
|
|
|
|
private StudentHandsOnTaskPptDao pptDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskStepDao stepService;
|
|
|
|
|
private StudentHandsOnTaskStepDao stepDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskTheoryDao theoryService;
|
|
|
|
|
private StudentHandsOnTaskTheoryDao theoryDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentHandsOnTaskReportDao reportService;
|
|
|
|
|
private StudentHandsOnTaskReportDao reportDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseChatLogDao courseChatLogDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private StudentService studentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseStudentSigninSettingService teacherOpenCourseStudentSigninSettingService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
@Lazy
|
|
|
|
|
private TeacherOpenCourseHandsOnSimulationTasksService teacherOpenCourseHandsOnSimulationTasksService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
@Lazy
|
|
|
|
|
private TeacherOpenCourseHandsOnService teacherOpenCourseHandsOnService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private HandsOnAchievementService handsOnAchievementService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseScoreDashboard> queryByCondition(PageQuery query) {
|
|
|
|
|
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query);
|
|
|
|
@ -442,155 +456,263 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
TeacherOpenCourseMergeStudentQuery studentQuery = new TeacherOpenCourseMergeStudentQuery();
|
|
|
|
|
studentQuery.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
studentQuery.setTeacherOpenCourseSchoolClassMergeStudentStatus(1);
|
|
|
|
|
//查开课里面的学生
|
|
|
|
|
List<TeacherOpenCourseMergeStudent> students = mergeStudentDao.getValuesByQueryNotWithPermission(studentQuery);
|
|
|
|
|
|
|
|
|
|
//todo 章节练习成绩,课程实操成绩,作业成绩,考试成绩,互动成绩
|
|
|
|
|
List<TeacherOpenCourseScoreDashboard> studentScores = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//班次数
|
|
|
|
|
Double classNum = null;
|
|
|
|
|
for (TeacherOpenCourseMergeStudent student : students) {
|
|
|
|
|
Long studentId = student.getStudentId();
|
|
|
|
|
for (TeacherOpenCourseMergeStudent teacherOpenCourseMergeStudent : students) {
|
|
|
|
|
Long studentId = teacherOpenCourseMergeStudent.getStudentId();
|
|
|
|
|
|
|
|
|
|
//通过id查询学生
|
|
|
|
|
Student student = studentService.queryById(studentId);
|
|
|
|
|
|
|
|
|
|
if (student == null) {
|
|
|
|
|
log.error("学生不存在,studentId={}", studentId);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseScoreDashboard scoreDashboard = new TeacherOpenCourseScoreDashboard();
|
|
|
|
|
scoreDashboard.setStudentId(studentId);
|
|
|
|
|
scoreDashboard.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
|
|
|
|
|
//签到成绩
|
|
|
|
|
{
|
|
|
|
|
//所有签到记录
|
|
|
|
|
TeacherOpenCourseStudentSigninLogQuery logQuery = new TeacherOpenCourseStudentSigninLogQuery();
|
|
|
|
|
logQuery.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
logQuery.setStudentId(studentId);
|
|
|
|
|
logQuery.setTeacherOpenCourseStudentSigninLogTag(SignInTypeEnum.SIGN_IN);
|
|
|
|
|
List<TeacherOpenCourseStudentSigninLog> logs = studentSigninLogDao.getValuesByQueryNotWithPermission(logQuery);
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.ZERO);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(logs)) {
|
|
|
|
|
//周次*开课星期的长度
|
|
|
|
|
|
|
|
|
|
long studentAllSignCount = logs.stream().map(TeacherOpenCourseStudentSigninLog::getTeacherOpenCourseStudentSigninSettingId).distinct().count();
|
|
|
|
|
|
|
|
|
|
//签到到课率
|
|
|
|
|
if (weight != null && "2".equals(weight.getSignInResultSetting())) {
|
|
|
|
|
//查询班次
|
|
|
|
|
if (classNum == null) {
|
|
|
|
|
TeacherOpenCourseScheduleSession teacherOpenCourseScheduleSession = teacherOpenCourseScheduleSessionDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseScheduleSession::getTeacherOpenCourseId, teacherOpenCourseId).singleSimple();
|
|
|
|
|
if (teacherOpenCourseScheduleSession != null) {
|
|
|
|
|
String teacherOpenCourseScheduleSessionStartDate = teacherOpenCourseScheduleSession.getTeacherOpenCourseScheduleSessionStartDate();
|
|
|
|
|
String teacherOpenCourseScheduleSessionEndDate = teacherOpenCourseScheduleSession.getTeacherOpenCourseScheduleSessionEndDate();
|
|
|
|
|
long l = DateUtil.betweenWeek(DateUtil.parseDate(teacherOpenCourseScheduleSessionStartDate),
|
|
|
|
|
DateUtil.parseDate(teacherOpenCourseScheduleSessionEndDate), true);
|
|
|
|
|
classNum = NumberUtil.mul(l, teacherOpenCourseScheduleSession.getTeacherOpenCourseScheduleSessionWeekNum().longValue());
|
|
|
|
|
|
|
|
|
|
//有关该班级的所有签到设置
|
|
|
|
|
List<TeacherOpenCourseStudentSigninSetting> teacherOpenCourseStudentSigninSettingList = teacherOpenCourseStudentSigninSettingService.getByClassId(student.getClassId());
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(teacherOpenCourseStudentSigninSettingList)) {
|
|
|
|
|
int baseSize = teacherOpenCourseStudentSigninSettingList.size();
|
|
|
|
|
//0.xxx * 100 = xx.x 结果保留一位小数
|
|
|
|
|
BigDecimal signScore = BigDecimal.valueOf(studentAllSignCount).divide(BigDecimal.valueOf(baseSize), 3, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
|
|
scoreDashboard.setSigninScore(signScore);
|
|
|
|
|
} else {
|
|
|
|
|
classNum = 0D;
|
|
|
|
|
//有签到记录,但是没有签到设置,不应该出现这种情况
|
|
|
|
|
log.error("有签到记录,但是没有签到设置,不应该出现这种情况,studentId={}", studentId);
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
double div = NumberUtil.div(logs.size(), classNum.intValue());
|
|
|
|
|
double score = NumberUtil.mul(div, 100);
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.valueOf(score));
|
|
|
|
|
} else if (weight != null && "1".equals(weight.getSignInResultSetting())) {
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.valueOf(NumberUtil.mul(logs.size(), Integer.parseInt(weight.getSignInScore()))));
|
|
|
|
|
} else {
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.valueOf(logs.size()));
|
|
|
|
|
//按签到次数乘以签到分数
|
|
|
|
|
else if (weight != null && "1".equals(weight.getSignInResultSetting())) {
|
|
|
|
|
if (StringUtils.isNotBlank(weight.getSignInScore())) {
|
|
|
|
|
BigDecimal signScore = BigDecimal.valueOf(studentAllSignCount).multiply(new BigDecimal(weight.getSignInScore())).setScale(1, RoundingMode.HALF_UP);
|
|
|
|
|
scoreDashboard.setSigninScore(signScore);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
scoreDashboard.setSigninScore(BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
//章节练习
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> select = teacherOpenCourseQuestionSettingDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingType, ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE).select();
|
|
|
|
|
if (CollectionUtil.isEmpty(select)) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//章节练习成绩
|
|
|
|
|
{
|
|
|
|
|
scoreDashboard.setCourseScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
List<Long> collect = select.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
|
|
|
|
|
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery()
|
|
|
|
|
|
|
|
|
|
//查询章节练习配置
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> chapterExerciseList = teacherOpenCourseQuestionSettingDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingType, ResourcesQuestionSnapshotFromTypeEnum.CHAPTER_EXERCISE)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingStatus, 1).select();
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtil.isEmpty(chapterExerciseList)) {
|
|
|
|
|
List<Long> teacherOpenCourseQuestionSettingIdList = chapterExerciseList.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//查询章节练习成绩
|
|
|
|
|
List<QuestionLogSummary> questionLogSummaryList = questionLogSummaryService.createLambdaQuery()
|
|
|
|
|
.andEq(QuestionLogSummary::getPersonId, studentId)
|
|
|
|
|
.andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
|
|
|
|
|
.andEq(QuestionLogSummary::getQuestionLogSummaryStatus, 1)
|
|
|
|
|
.andIn(QuestionLogSummary::getQuestionSettingId, teacherOpenCourseQuestionSettingIdList).select();
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(questionLogSummaryList)) {
|
|
|
|
|
questionLogSummaryList = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
Map<Long, List<QuestionLogSummary>> questionLogSummaryMap = questionLogSummaryList.stream().collect(Collectors.groupingBy(QuestionLogSummary::getQuestionSettingId));
|
|
|
|
|
|
|
|
|
|
//按正确率计算
|
|
|
|
|
if (weight == null || "1".equals(weight.getCoursePracticeResultSetting())) {
|
|
|
|
|
if (CollectionUtil.isEmpty(select1)) {
|
|
|
|
|
scoreDashboard.setCourseScore(BigDecimal.ZERO);
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal b = BigDecimal.ZERO;
|
|
|
|
|
for (QuestionLogSummary questionLogSummary : select1) {
|
|
|
|
|
b = b.add(questionLogSummary.getQuestionLogSummarySuccessRate());
|
|
|
|
|
//总章节练习数
|
|
|
|
|
int baseSize = teacherOpenCourseQuestionSettingIdList.size();
|
|
|
|
|
//总正确率
|
|
|
|
|
BigDecimal allSuccessRate = BigDecimal.ZERO;
|
|
|
|
|
for (Long settingId : teacherOpenCourseQuestionSettingIdList) {
|
|
|
|
|
List<QuestionLogSummary> list = questionLogSummaryMap.get(settingId);
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
BigDecimal div = NumberUtil.div(b, select1.size());
|
|
|
|
|
BigDecimal mul = NumberUtil.mul(div, 100);
|
|
|
|
|
scoreDashboard.setCourseScore(mul);
|
|
|
|
|
list.sort(Comparator.comparing(QuestionLogSummary::getQuestionLogSummaryAddTime).reversed());
|
|
|
|
|
QuestionLogSummary questionLogSummary = list.get(0);
|
|
|
|
|
BigDecimal questionLogSummarySuccessRate = questionLogSummary.getQuestionLogSummarySuccessRate();
|
|
|
|
|
if (questionLogSummarySuccessRate != null) {
|
|
|
|
|
allSuccessRate = allSuccessRate.add(questionLogSummarySuccessRate);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
BigDecimal b = BigDecimal.ZERO;
|
|
|
|
|
for (QuestionLogSummary questionLogSummary : select1) {
|
|
|
|
|
b = b.add(questionLogSummary.getQuestionLogSummaryStudentTotalScore());
|
|
|
|
|
}
|
|
|
|
|
scoreDashboard.setCourseScore(b);
|
|
|
|
|
//平均正确率*100得出分数
|
|
|
|
|
BigDecimal avgSuccessRate = allSuccessRate.divide(BigDecimal.valueOf(baseSize), 3, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
|
|
scoreDashboard.setCourseScore(avgSuccessRate);
|
|
|
|
|
} else if ("2".equals(weight.getCoursePracticeResultSetting())) {
|
|
|
|
|
//按完成进度计分:完成进度*100
|
|
|
|
|
//总章节练习数
|
|
|
|
|
int baseSize = teacherOpenCourseQuestionSettingIdList.size();
|
|
|
|
|
int successSize = questionLogSummaryList.size();
|
|
|
|
|
BigDecimal avgSuccessCount = BigDecimal.valueOf(successSize).divide(BigDecimal.valueOf(baseSize), 3, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
|
|
|
|
scoreDashboard.setCourseScore(avgSuccessCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//实操成绩
|
|
|
|
|
List<StudentHandsOnTaskVideo> single = videoService.createLambdaQuery()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
scoreDashboard.setRealOperationScore(BigDecimal.ZERO);
|
|
|
|
|
|
|
|
|
|
//查询本课程的所有实操任务
|
|
|
|
|
TeacherOpenCourseHandsOn param = new TeacherOpenCourseHandsOn();
|
|
|
|
|
param.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TeacherOpenCourseHandsOn> handsOnList = teacherOpenCourseHandsOnService.queryObjectList(param);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(handsOnList)) {
|
|
|
|
|
|
|
|
|
|
List<Long> handOnIdList = handsOnList.stream().map(TeacherOpenCourseHandsOn::getHandsOnId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
//查询本课程的所有实操任务子项
|
|
|
|
|
TeacherOpenCourseHandsOnSimulationTasks query = new TeacherOpenCourseHandsOnSimulationTasks();
|
|
|
|
|
param.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> teacherOpenCourseHandsOnSimulationTasksList = teacherOpenCourseHandsOnSimulationTasksService.queryObjectList(query);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(teacherOpenCourseHandsOnSimulationTasksList)) {
|
|
|
|
|
|
|
|
|
|
Map<Long, List<TeacherOpenCourseHandsOnSimulationTasks>> teacherOpenCourseHandsOnSimulationTasksMap = teacherOpenCourseHandsOnSimulationTasksList.stream().collect(Collectors.groupingBy(TeacherOpenCourseHandsOnSimulationTasks::getHandsOnId));
|
|
|
|
|
|
|
|
|
|
List<StudentHandsOnTaskVideo> studentHandsOnTaskVideoList = videoDao.createLambdaQuery()
|
|
|
|
|
.andEq(StudentHandsOnTaskVideo::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(StudentHandsOnTaskVideo::getStudentId, studentId).select();
|
|
|
|
|
List<StudentHandsOnTaskPpt> single2 = pptService.createLambdaQuery()
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StudentHandsOnTaskVideo>> studentHandsOnTaskVideoMap = studentHandsOnTaskVideoList.stream().collect(Collectors.groupingBy(StudentHandsOnTaskVideo::getHandsOnTaskId));
|
|
|
|
|
|
|
|
|
|
List<StudentHandsOnTaskPpt> studentHandsOnTaskPptList = pptDao.createLambdaQuery()
|
|
|
|
|
.andEq(StudentHandsOnTaskPpt::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(StudentHandsOnTaskPpt::getStudentId, studentId).select();
|
|
|
|
|
List<StudentHandsOnTaskStep> single3 = stepService.createLambdaQuery()
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StudentHandsOnTaskPpt>> studentHandsOnTaskPptMap = studentHandsOnTaskPptList.stream().collect(Collectors.groupingBy(StudentHandsOnTaskPpt::getHandsOnTaskId));
|
|
|
|
|
|
|
|
|
|
List<StudentHandsOnTaskStep> studentHandsOnTaskStepList = stepDao.createLambdaQuery()
|
|
|
|
|
.andEq(StudentHandsOnTaskStep::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(StudentHandsOnTaskStep::getStudentId, studentId).select();
|
|
|
|
|
List<StudentHandsOnTaskReport> single4 = reportService.createLambdaQuery()
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StudentHandsOnTaskStep>> studentHandsOnTaskStepMap = studentHandsOnTaskStepList.stream().collect(Collectors.groupingBy(StudentHandsOnTaskStep::getHandsOnTaskId));
|
|
|
|
|
|
|
|
|
|
List<StudentHandsOnTaskReport> studentHandsOnTaskReportList = reportDao.createLambdaQuery()
|
|
|
|
|
.andEq(StudentHandsOnTaskReport::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(StudentHandsOnTaskReport::getStudentId, studentId).select();
|
|
|
|
|
List<StudentHandsOnTaskTheory> single5 = theoryService.createLambdaQuery()
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StudentHandsOnTaskReport>> studentHandsOnTaskReportMap = studentHandsOnTaskReportList.stream().collect(Collectors.groupingBy(StudentHandsOnTaskReport::getHandsOnTaskId));
|
|
|
|
|
|
|
|
|
|
List<StudentHandsOnTaskTheory> studentHandsOnTaskTheoryList = theoryDao.createLambdaQuery()
|
|
|
|
|
.andEq(StudentHandsOnTaskTheory::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(StudentHandsOnTaskTheory::getStudentId, studentId).select();
|
|
|
|
|
BigDecimal realOperationScore = BigDecimal.ZERO;
|
|
|
|
|
if (CollectionUtil.isNotEmpty(single)) {
|
|
|
|
|
for (StudentHandsOnTaskVideo studentHandsOnTaskVideo : single) {
|
|
|
|
|
try {
|
|
|
|
|
realOperationScore = NumberUtil.add(realOperationScore,
|
|
|
|
|
NumberUtil.toBigDecimal(studentHandsOnTaskVideo.getVideoScore()));
|
|
|
|
|
} catch (Exception ee) {
|
|
|
|
|
ee.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<Long, List<StudentHandsOnTaskTheory>> studentHandsOnTaskTheoryMap = studentHandsOnTaskTheoryList.stream().collect(Collectors.groupingBy(StudentHandsOnTaskTheory::getHandsOnTaskId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//1平均分2平均完成进度
|
|
|
|
|
if (weight == null || "1".equals(weight.getCoursePracticeResultSetting())) {
|
|
|
|
|
BigDecimal allHandOnScore = BigDecimal.ZERO;
|
|
|
|
|
|
|
|
|
|
for (Long handOnId : handOnIdList) {
|
|
|
|
|
|
|
|
|
|
//获取这个实操任务的所有子项,并算出总分
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> list = teacherOpenCourseHandsOnSimulationTasksMap.get(handOnId);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(single2)) {
|
|
|
|
|
for (StudentHandsOnTaskPpt studentHandsOnTaskPpt : single2) {
|
|
|
|
|
try {
|
|
|
|
|
realOperationScore = NumberUtil.add(realOperationScore,
|
|
|
|
|
NumberUtil.toBigDecimal(studentHandsOnTaskPpt.getPptScore()));
|
|
|
|
|
} catch (Exception ee) {
|
|
|
|
|
ee.printStackTrace();
|
|
|
|
|
BigDecimal handOnTaskScoreSum = BigDecimal.ZERO;
|
|
|
|
|
for (TeacherOpenCourseHandsOnSimulationTasks item : list) {
|
|
|
|
|
BigDecimal taskScore = new BigDecimal(ObjectUtil.defaultIfBlank(item.getTaskScore(), "0"));
|
|
|
|
|
handOnTaskScoreSum = handOnTaskScoreSum.add(taskScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//得到这个学生的分数,一个学生一个实操任务只有一条记录
|
|
|
|
|
HandsOnAchievement handsOnAchievement = new HandsOnAchievement();
|
|
|
|
|
handsOnAchievement.setHandOnId(handOnId);
|
|
|
|
|
handsOnAchievement.setStudentId(studentId);
|
|
|
|
|
handsOnAchievement.setHandOnAchievementStatus(1);
|
|
|
|
|
HandsOnAchievement handsOnAchievementRes = handsOnAchievementService.queryObject(handsOnAchievement);
|
|
|
|
|
if (handsOnAchievementRes != null) {
|
|
|
|
|
String totalScore = handsOnAchievementRes.getTotalScore();
|
|
|
|
|
if (StringUtils.isNotBlank(totalScore)) {
|
|
|
|
|
//转换为百分制
|
|
|
|
|
BigDecimal formatScore = new BigDecimal(totalScore).multiply(new BigDecimal(100)).divide(handOnTaskScoreSum, 1, RoundingMode.HALF_UP);
|
|
|
|
|
allHandOnScore = allHandOnScore.add(formatScore);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(single3)) {
|
|
|
|
|
for (StudentHandsOnTaskStep studentHandsOnTaskStep : single3) {
|
|
|
|
|
try {
|
|
|
|
|
realOperationScore = NumberUtil.add(realOperationScore,
|
|
|
|
|
NumberUtil.toBigDecimal(studentHandsOnTaskStep.getTheoryScore()));
|
|
|
|
|
} catch (Exception ee) {
|
|
|
|
|
ee.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
BigDecimal avgScore = allHandOnScore.divide(new BigDecimal(handOnIdList.size()), 1, RoundingMode.HALF_UP);
|
|
|
|
|
scoreDashboard.setRealOperationScore(avgScore);
|
|
|
|
|
} else if ("2".equals(weight.getCoursePracticeResultSetting())) {
|
|
|
|
|
|
|
|
|
|
BigDecimal allDoStepSuccessProportion = BigDecimal.ZERO;
|
|
|
|
|
for (Long handOnId : handOnIdList) {
|
|
|
|
|
//获取这个实操任务的所有子项
|
|
|
|
|
List<TeacherOpenCourseHandsOnSimulationTasks> list = teacherOpenCourseHandsOnSimulationTasksMap.get(handOnId);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
|
//得出这个实操任务的完成率
|
|
|
|
|
int doStepTimes = 0;
|
|
|
|
|
for (TeacherOpenCourseHandsOnSimulationTasks task : list) {
|
|
|
|
|
if (studentHandsOnTaskVideoMap.containsKey(task.getTaskId())
|
|
|
|
|
|| studentHandsOnTaskPptMap.containsKey(task.getTaskId())
|
|
|
|
|
|| studentHandsOnTaskStepMap.containsKey(task.getTaskId())
|
|
|
|
|
|| studentHandsOnTaskReportMap.containsKey(task.getTaskId())
|
|
|
|
|
|| studentHandsOnTaskTheoryMap.containsKey(task.getTaskId())) {
|
|
|
|
|
doStepTimes++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(single4)) {
|
|
|
|
|
for (StudentHandsOnTaskReport studentHandsOnTaskReport : single4) {
|
|
|
|
|
try {
|
|
|
|
|
realOperationScore = NumberUtil.add(realOperationScore,
|
|
|
|
|
NumberUtil.toBigDecimal(studentHandsOnTaskReport.getReportScore()));
|
|
|
|
|
} catch (Exception ee) {
|
|
|
|
|
ee.printStackTrace();
|
|
|
|
|
//计算完成率
|
|
|
|
|
BigDecimal divide = new BigDecimal(doStepTimes).divide(new BigDecimal(list.size()), 5, RoundingMode.HALF_UP);
|
|
|
|
|
if (divide.compareTo(BigDecimal.ONE) > 0) {
|
|
|
|
|
divide = BigDecimal.ONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
allDoStepSuccessProportion = allDoStepSuccessProportion.add(divide);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(single5)) {
|
|
|
|
|
for (StudentHandsOnTaskTheory studentHandsOnTaskTheory : single5) {
|
|
|
|
|
try {
|
|
|
|
|
realOperationScore = NumberUtil.add(realOperationScore,
|
|
|
|
|
NumberUtil.toBigDecimal(studentHandsOnTaskTheory.getTheoryScore()));
|
|
|
|
|
} catch (Exception ee) {
|
|
|
|
|
ee.printStackTrace();
|
|
|
|
|
//计算平均完成率并乘以100得出分数
|
|
|
|
|
BigDecimal avgScore = allDoStepSuccessProportion.multiply(new BigDecimal(100)).divide(new BigDecimal(handOnIdList.size()), 1, RoundingMode.HALF_UP);
|
|
|
|
|
scoreDashboard.setRealOperationScore(avgScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
scoreDashboard.setRealOperationScore(realOperationScore);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//作业
|
|
|
|
|
{
|
|
|
|
|
//假设本课程开了 2门考试,为A考试 B考试
|
|
|
|
|
//
|
|
|
|
|
//A考试 学生考了两遍 第一遍 考了 80分 第二次考了79分 ,下面的计算取最近的一次 也就是79分
|
|
|
|
|
//
|
|
|
|
|
//B考试 学生考了一遍 得分 100分
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//则成绩页面考试得分 = (79+100)/2 = 89.5分
|
|
|
|
|
//记得百分制
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> select2 = teacherOpenCourseQuestionSettingDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingType, ResourcesQuestionSnapshotFromTypeEnum.HOMEWORK_QUESTION).select();
|
|
|
|
@ -611,7 +733,10 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
scoreDashboard.setQuestionHomeworkScore(b);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//考试
|
|
|
|
|
{
|
|
|
|
|
List<TeacherOpenCourseQuestionSetting> select3 = teacherOpenCourseQuestionSettingDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseId, teacherOpenCourseId)
|
|
|
|
|
.andEq(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingType, ResourcesQuestionSnapshotFromTypeEnum.EXAM).select();
|
|
|
|
@ -634,6 +759,8 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//互动
|
|
|
|
|
List<TeacherOpenCourseChatLog> chatLogList = courseChatLogDao.createLambdaQuery()
|
|
|
|
|
.andEq(TeacherOpenCourseChatLog::getStudentId, studentId)
|
|
|
|
@ -665,6 +792,8 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
chatScore = BigDecimal.valueOf(count2);
|
|
|
|
|
}
|
|
|
|
|
scoreDashboard.setChatScore(chatScore);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal totalScore = scoreDashboard.getSigninScore()
|
|
|
|
|
.add(scoreDashboard.getCourseScore())
|
|
|
|
|
.add(scoreDashboard.getRealOperationScore())
|
|
|
|
@ -675,7 +804,6 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
if (weight != null) {
|
|
|
|
|
lastStatus(weight, totalScore, scoreDashboard);
|
|
|
|
|
}
|
|
|
|
|
scoreDashboard.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
studentScores.add(scoreDashboard);
|
|
|
|
|
}
|
|
|
|
|
//通过课程id删除存量数据
|
|
|
|
|