修复一些问题

beetlsql3-dev
Mlxa0324 2 years ago
parent 0670c9fdf1
commit 6da9cebaf1

@ -44,8 +44,12 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
// 题目总数量 // 题目总数量
@FetchSql("select count(1) from resources_question_snapshot t " + @FetchSql("select count(1) from teacher_open_course_question_log t " +
"where t.question_status = 1 " + "where 1 = 1 " +
"and t.teacher_open_course_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" +
"@} \n" +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# "
) )
private int questionTotalCount; private int questionTotalCount;
@ -53,51 +57,46 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
// 答对数量 // 答对数量
@FetchSql("select count(1) from teacher_open_course_question_log t " + @FetchSql("select count(1) from teacher_open_course_question_log t " +
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " +
"where 1 = 1 " + "where 1 = 1 " +
"and t.teacher_open_course_question_log_status = 1 \n" + "and t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"and ta.question_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" + "@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" + "and t.student_id = #studentId# \n" +
"@} \n" + "@} \n" +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and (CONCAT(t.teacher_open_course_question_log_answer, ',') = ta.question_answer or t.teacher_open_course_question_log_answer = ta.question_answer)" "and t.teacher_open_course_question_log_answer = t.question_answer "
) )
private int correctCount; private int correctCount;
// 答错数量 // 答错数量
@FetchSql("select count(1) from teacher_open_course_question_log t " + @FetchSql("select count(1) from teacher_open_course_question_log t " +
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"where t.teacher_open_course_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" + "@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" + "and t.student_id = #studentId# \n" +
"@} \n" + "@} \n" +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer" "and t.teacher_open_course_question_log_answer != t.question_answer "
) )
private int wrongCount; private int wrongCount;
// 总得分 // 总得分
@FetchSql("select sum(IFNULL(ta.question_score, 0)) as total_score " + @FetchSql("select sum(IFNULL(t.question_score, 0)) as total_score " +
"from teacher_open_course_question_log t " + "from teacher_open_course_question_log t " +
"left join resources_question_snapshot ta on ta.resources_question_snapshot_id = t.resources_question_snapshot_id " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"where t.teacher_open_course_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" + "@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" + "and t.student_id = #studentId# \n" +
"@} \n" + "@} \n" +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and CONCAT(t.teacher_open_course_question_log_answer, ',') != ta.question_answer" "and t.teacher_open_course_question_log_answer = t.question_answer "
) )
private float totalScore; private float totalScore;
// 正确率 最大100 // 正确率 最大100
// 自动计算得到 // 自动计算得到
private int correctRate; private float correctRate;
@FetchSql(value = "SELECT t.* " + @FetchSql(value = "SELECT t.* " +
"FROM teacher_open_course_question_log t " + "FROM teacher_open_course_question_log t " +
"LEFT JOIN resources_question_snapshot ta ON ta.resources_question_snapshot_id = t.resources_question_snapshot_id " + "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
"WHERE t.teacher_open_course_question_log_status = 1 \n" +
"@if(!isEmpty(studentId)) { \n" + "@if(!isEmpty(studentId)) { \n" +
"and t.student_id = #studentId# \n" + "and t.student_id = #studentId# \n" +
"@} \n" + "@} \n" +
@ -132,8 +131,8 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
// 计算正确率, 取小数点后2位数 // 计算正确率, 取小数点后2位数
// 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100 // 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100
this.setCorrectRate(NumberUtil this.setCorrectRate(NumberUtil
.round(NumberUtil.div(getCorrectCount(), sumTotalCount) * 100, 0) .round(NumberUtil.div(getCorrectCount(), sumTotalCount) * 100, 2)
.intValue()); .floatValue());
} }
} }
} }

@ -118,7 +118,7 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
// 附件题目的得分和评语 // 附件题目的得分和评语
@FetchSql("select t.student_score, t.teacher_open_course_question_log_reply from teacher_open_course_question_log t " + @FetchSql("select t.student_score, t.teacher_open_course_question_log_reply from teacher_open_course_question_log t " +
"where t.teacher_open_course_question_log_status = 1 " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' " +
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and #teacherOpenCourseQuestionSettingType# = 'HOMEWORK_FILE' ") "and #teacherOpenCourseQuestionSettingType# = 'HOMEWORK_FILE' ")
@UpdateIgnore @UpdateIgnore
@ -136,7 +136,7 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
// 平均答对数量 // 平均答对数量
@FetchSql("select sum(t.student_score > 0) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" + @FetchSql("select sum(t.student_score > 0) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" +
"from teacher_open_course_question_log t \n" + "from teacher_open_course_question_log t \n" +
"where t.teacher_open_course_question_log_status = 1 " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' " +
" AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ") " AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ")
@UpdateIgnore @UpdateIgnore
@InsertIgnore @InsertIgnore
@ -145,7 +145,7 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
// 平均答错数量 // 平均答错数量
@FetchSql("select sum(t.student_score = 0) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" + @FetchSql("select sum(t.student_score = 0) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" +
"from teacher_open_course_question_log t \n" + "from teacher_open_course_question_log t \n" +
"where t.teacher_open_course_question_log_status = 1 " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' " +
" AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ") " AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ")
@UpdateIgnore @UpdateIgnore
@InsertIgnore @InsertIgnore
@ -159,7 +159,7 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
// 平均得分 // 平均得分
@FetchSql("select sum(t.student_score) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" + @FetchSql("select sum(t.student_score) / if(count(DISTINCT(t.student_id)) =0, 1, count(DISTINCT(t.student_id))) \n" +
"from teacher_open_course_question_log t \n" + "from teacher_open_course_question_log t \n" +
"where t.teacher_open_course_question_log_status = 1 " + "where t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' " +
" AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ") " AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ")
@UpdateIgnore @UpdateIgnore
@InsertIgnore @InsertIgnore
@ -183,7 +183,7 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
private String teacherOpenCourseQuestionSettingSchoolClassNames; private String teacherOpenCourseQuestionSettingSchoolClassNames;
// 快照ID // 快照ID
@FetchSql("select * " + @FetchSql("select t.*, null as question_answer " +
"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"
) )
@ -233,12 +233,21 @@ public class TeacherOpenCourseQuestionSetting extends BaseEntity {
*/ */
@UpdateIgnore @UpdateIgnore
@InsertIgnore @InsertIgnore
// 题目ID集合
@FetchSql("select max(ifnull(t.teacher_open_course_question_log_finish_time , 0)) from teacher_open_course_question_log t " + @FetchSql("select max(ifnull(t.teacher_open_course_question_log_finish_time , 0)) from teacher_open_course_question_log t " +
"where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " + "where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and t.teacher_open_course_question_log_status = 1 ") "and t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT'")
private long finishTime; private long finishTime;
/**
*
*/
@UpdateIgnore
@InsertIgnore
@FetchSql("select round(sum(ifnull(t.student_score , 0)), 1) from teacher_open_course_question_log t " +
"where t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
"and t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' ")
private String myScore;
public void setAvgSuccessCount(Integer avgSuccessCount) { public void setAvgSuccessCount(Integer avgSuccessCount) {
this.avgSuccessCount = avgSuccessCount; this.avgSuccessCount = avgSuccessCount;
tryToUpdateAvgSuccessRate(); tryToUpdateAvgSuccessRate();

@ -566,7 +566,7 @@ public class GeneralQuestionLogService extends CoreBaseService<GeneralQuestionLo
return; return;
} }
Assert.isTrue(null == questionLog.getQuestionLogAddType() Assert.isTrue(null == questionLog.getQuestionLogAddType()
|| questionLog.getQuestionLogAddType().equals(PRE_SUBMIT), "无法再次提交答案,题目已完成"); || questionLog.getQuestionLogAddType().equals(PRE_SUBMIT), "已交卷,无法重复提交");
// 学生提交的答案 // 学生提交的答案
String answersText = join(questionLogMap.get(questionLog.getGeneralResourcesQuestionSnapshotId().toString()).split(","), ","); String answersText = join(questionLogMap.get(questionLog.getGeneralResourcesQuestionSnapshotId().toString()).split(","), ",");
// 是否是正确答案 // 是否是正确答案

@ -376,7 +376,7 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
} }
Assert.isTrue(null == questionLog.getQuestionLogAddType() Assert.isTrue(null == questionLog.getQuestionLogAddType()
|| questionLog.getQuestionLogAddType().equals(PRE_SUBMIT), "无法再次提交答案,题目已完成"); || questionLog.getQuestionLogAddType().equals(PRE_SUBMIT), "已交卷,无法重复提交");
// 学生提交的答案 // 学生提交的答案
String answersText = join(questionLogMap.get(questionLog.getResourcesQuestionSnapshotId().toString()).split(","), ","); String answersText = join(questionLogMap.get(questionLog.getResourcesQuestionSnapshotId().toString()).split(","), ",");
// 是否是正确答案 // 是否是正确答案
@ -612,16 +612,16 @@ public class TeacherOpenCourseQuestionLogService extends CoreBaseService<Teacher
* ID + ID * ID + ID
* *
* @param questionSettingId ID * @param questionSettingId ID
* @param questionSnapshotIds IDs * @param questionSnapIds IDs
* @param isTuck true false * @param isTuck true false
* @param student * @param student
*/ */
public void tuck(@NotNull(message = "题目配置ID不能为空") Long questionSettingId, public void tuck(@NotNull(message = "题目配置ID不能为空") Long questionSettingId,
@NotBlank(message = "题目快照IDs不能为空") String questionSnapshotIds, boolean isTuck, @NotBlank(message = "题目快照IDs不能为空") String questionSnapIds, boolean isTuck,
@NotNull(message = "学生信息不能为空!") Student student) { @NotNull(message = "学生信息不能为空!") Student student) {
TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery(); TeacherOpenCourseQuestionLogQuery logQuery = new TeacherOpenCourseQuestionLogQuery();
logQuery.setTeacherOpenCourseQuestionSettingId(questionSettingId); logQuery.setTeacherOpenCourseQuestionSettingId(questionSettingId);
logQuery.setResourcesQuestionSnapshotIdPlural(questionSnapshotIds); logQuery.setResourcesQuestionSnapshotIdPlural(questionSnapIds);
logQuery.setTeacherOpenCourseQuestionLogStatus(1); logQuery.setTeacherOpenCourseQuestionLogStatus(1);
logQuery.setStudentId(student.getStudentId()); logQuery.setStudentId(student.getStudentId());
List<TeacherOpenCourseQuestionLog> list = getValuesByQueryNotWithPermission(logQuery); List<TeacherOpenCourseQuestionLog> list = getValuesByQueryNotWithPermission(logQuery);

@ -43,6 +43,7 @@ import static cn.jlw.util.CacheUserUtil.getStudent;
import static com.ibeetl.admin.core.util.ExcelUtil.convertData; import static com.ibeetl.admin.core.util.ExcelUtil.convertData;
import static com.ibeetl.admin.core.util.ExcelUtil.write; import static com.ibeetl.admin.core.util.ExcelUtil.write;
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT;
/** /**
* -- * --
@ -204,15 +205,15 @@ public class TeacherOpenCourseQuestionLogController {
/** /**
* / * /
* @param questionSettingId ID * @param questionSettingId ID
* @param questionSnapshotIds IDs * @param questionSnapIds IDs
* @param isTuck true, false * @param isTuck true, false
* @return * @return
*/ */
@PostMapping(API + "/tuck.do") @PostMapping(API + "/tuck.do")
public JsonResult tuck(Long questionSettingId, String questionSnapshotIds, boolean isTuck) { public JsonResult tuck(Long questionSettingId, String questionSnapIds, boolean isTuck) {
Student student = getStudent(); Student student = getStudent();
Assert.notNull(student, "该接口只能学生操作!"); Assert.notNull(student, "该接口只能学生操作!");
teacherOpenCourseQuestionLogService.tuck(questionSettingId, questionSnapshotIds, isTuck, student); teacherOpenCourseQuestionLogService.tuck(questionSettingId, questionSnapIds, isTuck, student);
return JsonResult.success(); return JsonResult.success();
} }
@ -240,7 +241,8 @@ public class TeacherOpenCourseQuestionLogController {
Assert.notNull(student, "非学生身份,无法获取收藏的题目!"); Assert.notNull(student, "非学生身份,无法获取收藏的题目!");
PageQuery query = new PageQuery(pageParam.getPage().longValue(), pageParam.getLimit().longValue()); PageQuery query = new PageQuery(pageParam.getPage().longValue(), pageParam.getLimit().longValue());
query.setPara("studentId", student.getStudentId()); query.setPara("studentId", student.getStudentId());
query.setPara("teacherOpenCourseQuestionLogStatus", 1); // 只查询已经做完的题目,因为有的人万一做到一半,去看收藏夹的答案,再来做题,就很离谱
query.setPara("questionLogAddType", FINALLY_SUBMIT.name());
// 只查询收藏的题目 // 只查询收藏的题目
query.setPara("isTuck", true); query.setPara("isTuck", true);
return JsonResult.success(teacherOpenCourseQuestionLogService.queryByConditionQuery(query)); return JsonResult.success(teacherOpenCourseQuestionLogService.queryByConditionQuery(query));
@ -258,18 +260,6 @@ public class TeacherOpenCourseQuestionLogController {
return JsonResult.success(); return JsonResult.success();
} }
/**
*
* @param query
* @return
*/
@PostMapping(API + "/scoreDetailInfo.do")
public JsonResult scoreDetailInfo(@Validated TeacherOpenCourseQuestionLogScoreDetailsInfoQuery query) {
teacherOpenCourseQuestionLogService.getQuestionLogScoreDetailsInfo(query.getPageQuery());
return JsonResult.success();
}
/** /**
* *
* @return * @return
@ -280,12 +270,24 @@ public class TeacherOpenCourseQuestionLogController {
Assert.notNull(student, "非学生身份,无法获取题目分析!"); Assert.notNull(student, "非学生身份,无法获取题目分析!");
PageQuery query = new PageQuery(pageParam.getPage().longValue(), pageParam.getLimit().longValue()); PageQuery query = new PageQuery(pageParam.getPage().longValue(), pageParam.getLimit().longValue());
query.setPara("studentId", student.getStudentId()); query.setPara("studentId", student.getStudentId());
query.setPara("teacherOpenCourseQuestionLogStatus", 1); // 只查询已经做完的题目,因为有的人万一做到一半,去看错题库的答案,再来做题,就很离谱
query.setPara("questionLogAddType", FINALLY_SUBMIT.name());
// 只查询收藏到错题库的题目 // 只查询收藏到错题库的题目
query.setPara("isErrorFavorite", true); query.setPara("isErrorFavorite", true);
return JsonResult.success(teacherOpenCourseQuestionLogService.queryByConditionQuery(query)); return JsonResult.success(teacherOpenCourseQuestionLogService.queryByConditionQuery(query));
} }
/**
*
* @param query
* @return
*/
@PostMapping(API + "/scoreDetailInfo.do")
public JsonResult scoreDetailInfo(@Validated TeacherOpenCourseQuestionLogScoreDetailsInfoQuery query) {
teacherOpenCourseQuestionLogService.getQuestionLogScoreDetailsInfo(query.getPageQuery());
return JsonResult.success();
}
/** /**
* - * -
* @param condition * @param condition

@ -97,6 +97,9 @@ queryByCondition
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@ -208,6 +211,9 @@ queryByConditionQuery
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@ -327,6 +333,9 @@ studentScoreList
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@ -521,6 +530,9 @@ getTeacherOpenCourseQuestionLogValues
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@ -592,6 +604,9 @@ getValuesByQuery
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}
@ -669,6 +684,9 @@ getValuesByQueryNotWithPermission
@if(!isEmpty(isErrorFavorite)){ @if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score) and (t.is_error_favorite =#isErrorFavorite# or t.student_score != t.question_score)
@} @}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){ @if(!isEmpty(orgId)){
and t.org_id =#orgId# and t.org_id =#orgId#
@} @}

Loading…
Cancel
Save