From 3e15ccbfa9d13add27abc646512e695ba06a26e2 Mon Sep 17 00:00:00 2001 From: xuliangtong <1124839262@qq.com> Date: Sat, 11 Feb 2023 19:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eacherOpenCourseScoreDashboardService.java | 58 +++++++++++++++---- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScoreDashboardService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScoreDashboardService.java index 14dd310e..94b688f5 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScoreDashboardService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseScoreDashboardService.java @@ -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 queryByCondition(PageQuery query) { PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query); @@ -481,7 +483,9 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService collect = select.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList()); - List select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select(); + List 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 collect = select2.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList()); - List select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select(); + List 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 collect = select3.stream().map(TeacherOpenCourseQuestionSetting::getTeacherOpenCourseQuestionSettingId).collect(Collectors.toList()); - List select1 = questionLogSummaryService.createLambdaQuery().andIn(QuestionLogSummary::getQuestionSettingId, collect).select(); + List 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 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);