beetlsql3-dev
xuliangtong 2 years ago
parent 6f4943b7f8
commit 3e15ccbfa9

@ -14,6 +14,7 @@ import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.*;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.enums.ChatLogSendTypeEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import com.ibeetl.jlw.enums.SignInTypeEnum;
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeStudentQuery;
@ -82,7 +83,8 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
private StudentHandsOnTaskTheoryDao theoryService;
@Autowired
private StudentHandsOnTaskReportDao reportService;
@Autowired private TeacherOpenCourseChatLogDao courseChatLogDao;
@Autowired private GeneralQuestionLogDao generalQuestionLogDao;
public PageQuery<TeacherOpenCourseScoreDashboard> queryByCondition(PageQuery query) {
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query);
@ -481,7 +483,9 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
scoreDashboard.setCourseScore(BigDecimal.ZERO);
} else {
List<Long> collect = select.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery()
.andEq(QuestionLogSummary::getPersonId, studentId)
.andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
if (weight == null || "1".equals(weight.getCoursePracticeResultSetting())) {
if (CollectionUtil.isEmpty(select1)) {
scoreDashboard.setCourseScore(BigDecimal.ZERO);
@ -579,7 +583,9 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
scoreDashboard.setQuestionHomeworkScore(BigDecimal.ZERO);
} else {
List<Long> collect = select2.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery()
.andEq(QuestionLogSummary::getPersonId, studentId)
.andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
if (CollectionUtil.isEmpty(select1)) {
scoreDashboard.setCourseScore(BigDecimal.ZERO);
} else {
@ -599,7 +605,9 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
} else {
if (weight == null || "1".equals(weight.getCoursePracticeResultSetting())) {
List<Long> collect = select3.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList());
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
List<QuestionLogSummary> select1 = questionLogSummaryService.createLambdaQuery()
.andEq(QuestionLogSummary::getPersonId, studentId)
.andIn(QuestionLogSummary::getQuestionSettingId, collect).select();
if (CollectionUtil.isEmpty(select1)) {
scoreDashboard.setCourseScore(BigDecimal.ZERO);
} else {
@ -612,13 +620,43 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
}
}
//互动
BigDecimal chatScore = BigDecimal.valueOf(new Random().nextInt(100));
List<TeacherOpenCourseChatLog> chatLogList = courseChatLogDao.createLambdaQuery()
.andEq(TeacherOpenCourseChatLog::getStudentId, studentId)
.andEq(TeacherOpenCourseChatLog::getTeacherOpenCourseId, teacherOpenCourseId).select();
//提问次数
long count = chatLogList.stream().filter(v -> v.getChatLogSendType().equals(ChatLogSendTypeEnum.student_ask)
|| v.getChatLogSendType().equals(ChatLogSendTypeEnum.specify_ask)).count();
//回复次数
long count2 = chatLogList.stream().filter(v ->
v.getChatLogSendType().equals(ChatLogSendTypeEnum.normal)).count();
//答题次数
long count3 = chatLogList.stream().filter(v ->
v.getChatLogSendType().equals(ChatLogSendTypeEnum.normal)
&& v.getStudentScore() != null
).count();
BigDecimal chatScore = BigDecimal.ZERO;
if (weight != null && StringUtils.isNotEmpty(weight.getInteractionResultSetting())) {
String interactionResultSetting = weight.getInteractionResultSetting();
if (interactionResultSetting.contains("1")) {
chatScore = NumberUtil.mul(count2, NumberUtil.toBigDecimal(weight.getInteractionResultMessageScore()));
}
if(interactionResultSetting.contains("2")) {
chatScore = NumberUtil.mul(count, NumberUtil.toBigDecimal(weight.getInteractionResultQuestionScore()));
}
if(interactionResultSetting.contains("3")) {
chatScore = NumberUtil.mul(count3, NumberUtil.toBigDecimal(weight.getInteractionResultAnswerScore()));
}
}else {
chatScore = BigDecimal.valueOf(count2);
}
scoreDashboard.setChatScore(chatScore);
BigDecimal totalScore = scoreDashboard.getSigninScore().add(scoreDashboard.getCourseScore())
.add(scoreDashboard.getRealOperationScore())
.add(scoreDashboard.getQuestionHomeworkScore())
.add(scoreDashboard.getExamScore())
.add(chatScore);
BigDecimal totalScore = NumberUtil.mul(scoreDashboard.getSigninScore(),weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getSignInResult()))
.add(NumberUtil.mul(scoreDashboard.getCourseScore(), weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getChapterContactResult())))
.add(NumberUtil.mul(scoreDashboard.getRealOperationScore(), weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getCoursePracticeResult())))
.add(NumberUtil.mul(scoreDashboard.getQuestionHomeworkScore(), weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getHomeworkResult())))
.add(NumberUtil.mul(scoreDashboard.getExamScore(), weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getExaminationResult())))
.add(NumberUtil.mul(scoreDashboard.getChatScore(), weight ==null ? 1 : NumberUtil.toBigDecimal(weight.getInteractionResult())))
;
scoreDashboard.setTotalScore(totalScore);
if (weight != null) {
lastStatus(weight, totalScore, scoreDashboard);

Loading…
Cancel
Save