beetlsql3-dev
Mlxa0324 2 years ago
parent 08b70ebb60
commit 31fc3e8ab9

@ -1,11 +1,15 @@
package com.ibeetl.jlw.entity; package com.ibeetl.jlw.entity;
import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.annotation.DictDeep;
import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.entity.BaseEntity;
import com.ibeetl.admin.core.util.ValidateConfig; import com.ibeetl.admin.core.util.ValidateConfig;
import com.ibeetl.jlw.enums.QuestionBusinessTypeEnum; import com.ibeetl.jlw.enums.QuestionBusinessTypeEnum;
import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum; import com.ibeetl.jlw.enums.ResourcesQuestionSnapshotFromTypeEnum;
import org.beetl.sql.annotation.entity.AssignID; import org.beetl.sql.annotation.entity.AssignID;
import org.beetl.sql.annotation.entity.InsertIgnore;
import org.beetl.sql.annotation.entity.UpdateIgnore;
import org.beetl.sql.fetch.annotation.FetchOne;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -50,6 +54,15 @@ public class QuestionLogSummary extends BaseEntity{
//人员ID学生ID等等 //人员ID学生ID等等
private Long personId ; private Long personId ;
/**
*
*/
@UpdateIgnore
@InsertIgnore
@FetchOne("personId")
@DictDeep
private Student studentInfo;
//关联的做题日志IDs //关联的做题日志IDs
@ -382,4 +395,12 @@ public class QuestionLogSummary extends BaseEntity{
public void setQuestionLogSummaryStudentTotalScore(BigDecimal questionLogSummaryStudentTotalScore) { public void setQuestionLogSummaryStudentTotalScore(BigDecimal questionLogSummaryStudentTotalScore) {
this.questionLogSummaryStudentTotalScore = questionLogSummaryStudentTotalScore; this.questionLogSummaryStudentTotalScore = questionLogSummaryStudentTotalScore;
} }
public Student getStudentInfo() {
return studentInfo;
}
public void setStudentInfo(Student studentInfo) {
this.studentInfo = studentInfo;
}
} }

@ -52,7 +52,7 @@ public class TeacherOpenCourseMergeResourcesQuestion extends BaseEntity {
private Long teacherOpenCourseMergeCourseInfoId ; private Long teacherOpenCourseMergeCourseInfoId ;
//题型(1单选 2多选 3判断 4填空 5分析) //题型(1单选 2多选 3判断 4填空 5分析)
@ExcelSelector(fixedSelector = {"单选"+ID_SEPARATOR+"1", "多选"+ID_SEPARATOR+"2", "判断"+ID_SEPARATOR+"3" }) @ExcelSelector(fixedSelector = {"单选"+ID_SEPARATOR+"1", "多选"+ID_SEPARATOR+"2", "判断"+ID_SEPARATOR+"3", "填空"+ID_SEPARATOR+"4", "分析"+ID_SEPARATOR+"5" })
@ExcelProperty(value = "题型", index = 2) @ExcelProperty(value = "题型", index = 2)
private Integer questionType ; private Integer questionType ;

@ -178,16 +178,16 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
@InsertIgnore @InsertIgnore
private List<QuestionSettingDTO> questionSettingOptions; private List<QuestionSettingDTO> questionSettingOptions;
// /** /**
// * 其他表的字段,回显用 *
// */ */
// @UpdateIgnore @UpdateIgnore
// @InsertIgnore @InsertIgnore
// // 题目ID集合 // 题目ID集合
// @FetchSql("select group_concat(t.teacher_open_course_merge_resources_question_id) " + @FetchSql("select group_concat(t.teacher_open_course_merge_resources_question_id) " +
// "from resources_question_snapshot t where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# \n" + "from resources_question_snapshot t where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# \n" +
// "and t.question_status = 1 \n" "and t.question_status = 1 \n"
// ) )
// private String resourcesQuestionIdPlural; private String resourcesQuestionIdPlural;
} }

@ -246,21 +246,16 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
* @param student * @param student
*/ */
public void setMyQuestionLogScoreInfo(List<TeacherOpenCourseQuestionSetting> list, Student student) { public void setMyQuestionLogScoreInfo(List<TeacherOpenCourseQuestionSetting> list, Student student) {
if (ObjectUtil.isAllNotEmpty(list, student)) { Optional.ofNullable(list).orElse(Collections.emptyList()).forEach(item -> {
Long studentId = student.getStudentId(); Long questionSettingId = item.getTeacherOpenCourseQuestionSettingId();
list.forEach(item -> { if (ObjectUtil.isNotEmpty(student)) {
Long questionSettingId = item.getTeacherOpenCourseQuestionSettingId(); Long studentId = student.getStudentId();
QuestionLogSummaryQuery logSummaryQuery = new QuestionLogSummaryQuery(); QuestionLogSummaryQuery logSummaryQuery = new QuestionLogSummaryQuery();
logSummaryQuery.setPersonId(studentId); logSummaryQuery.setPersonId(studentId);
logSummaryQuery.setQuestionLogSummaryStatus(1); logSummaryQuery.setQuestionLogSummaryStatus(1);
logSummaryQuery.setQuestionSettingId(questionSettingId); logSummaryQuery.setQuestionSettingId(questionSettingId);
List<QuestionLogSummary> logSummaryList = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery); List<QuestionLogSummary> logSummaryList = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery);
QuestionLogSummaryQuery logSummaryQuery2 = new QuestionLogSummaryQuery();
logSummaryQuery2.setQuestionLogSummaryStatus(1);
logSummaryQuery2.setQuestionSettingId(questionSettingId);
List<QuestionLogSummary> logSummaryList2 = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery2);
// 我的得分,完成时间 // 我的得分,完成时间
if (ObjectUtil.isNotEmpty(logSummaryList)) { if (ObjectUtil.isNotEmpty(logSummaryList)) {
QuestionLogSummary scoreInfo = logSummaryList.get(0); QuestionLogSummary scoreInfo = logSummaryList.get(0);
@ -268,18 +263,31 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService<Tea
item.set("finishSecondTime", scoreInfo.getFinishSecondTime()); item.set("finishSecondTime", scoreInfo.getFinishSecondTime());
item.set("myScore", scoreInfo.getQuestionLogSummaryStudentTotalScore()); item.set("myScore", scoreInfo.getQuestionLogSummaryStudentTotalScore());
} }
}
// 平均及格率,平均得分等等 QuestionLogSummaryQuery logSummaryQuery2 = new QuestionLogSummaryQuery();
if (ObjectUtil.isNotEmpty(logSummaryList2)) { logSummaryQuery2.setQuestionLogSummaryStatus(1);
BigDecimal studentTotalScore = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryStudentTotalScore).reduce(BigDecimal::add).get(); logSummaryQuery2.setQuestionSettingId(questionSettingId);
int passTotalCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryIsPass).reduce(Integer::sum).get(); List<QuestionLogSummary> logSummaryList2 = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery2);
int logSummarySize = logSummaryList2.size();
item.set("avgScore", NumberUtil.div(studentTotalScore, logSummarySize)); // 平均及格率,平均得分等等
item.set("avgPassRate", NumberUtil.mul(NumberUtil.div(passTotalCount, logSummarySize, 3), 100)); if (ObjectUtil.isNotEmpty(logSummaryList2)) {
} BigDecimal studentTotalScore = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryStudentTotalScore).reduce(BigDecimal::add).get();
}); int passTotalCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryIsPass).reduce(Integer::sum).get();
int questionTotalCount = logSummaryList2.get(0).getQuestionLogSummaryQuestionTotalCount();
} int totalSuccessCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummarySuccessCount).reduce(Integer::sum).get();
int totalErrorCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryErrorCount).reduce(Integer::sum).get();
BigDecimal totalSuccessRate = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummarySuccessRate).reduce(BigDecimal::add).get();
int logSummarySize = logSummaryList2.size();
item.set("avgScore", NumberUtil.div(studentTotalScore, logSummarySize, 1));
item.set("avgPassRate", NumberUtil.div(passTotalCount, logSummarySize, 1));
item.set("questionCount", questionTotalCount);
item.set("avgSuccessCount", NumberUtil.div(totalSuccessCount, logSummarySize, 1));
item.set("avgErrorCount", NumberUtil.div(totalErrorCount, logSummarySize, 1));
item.set("avgSuccessRate", NumberUtil.div(totalSuccessRate, logSummarySize, 1));
}
});
} }
public TeacherOpenCourseQuestionSetting getInfo (Long teacherOpenCourseQuestionSettingId){ public TeacherOpenCourseQuestionSetting getInfo (Long teacherOpenCourseQuestionSettingId){

Loading…
Cancel
Save