From a7e4a7630d0b8d8776f25e8ddc533b88adb2eb5f Mon Sep 17 00:00:00 2001 From: wgf <121463602@qq.com> Date: Tue, 15 Aug 2023 19:05:41 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=AF=BE=E7=A8=8B=E4=B8=AD=E5=BF=83-?= =?UTF-8?q?=E7=AB=A0=E8=8A=82=E7=BB=83=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jlw/dao/StudentChapterQuestionLogDao.java | 25 ++ .../ibeetl/jlw/entity/ResourcesQuestion.java | 13 +- .../jlw/entity/StudentChapterQuestionLog.java | 130 ++++++++ .../jlw/entity/dto/QuestionLogAddDTO.java | 12 + .../ibeetl/jlw/service/CourseInfoService.java | 26 ++ .../jlw/service/ResourcesQuestionService.java | 50 ++- .../ResourcesQuestionSnapshotService.java | 28 ++ .../StudentChapterQuestionLogService.java | 301 ++++++++++++++++++ ...acherOpenCourseQuestionSettingService.java | 41 +++ .../ibeetl/jlw/web/CourseInfoController.java | 15 + .../jlw/web/ResourcesQuestionController.java | 15 + .../ResourcesQuestionSnapshotController.java | 15 + .../StudentChapterQuestionLogController.java | 73 +++++ ...erOpenCourseQuestionSettingController.java | 16 + .../query/StudentChapterQuestionLogQuery.java | 161 ++++++++++ .../sql/jlw/studentChapterQuestionLog.md | 89 ++++++ 16 files changed, 1000 insertions(+), 10 deletions(-) create mode 100644 web/src/main/java/com/ibeetl/jlw/dao/StudentChapterQuestionLogDao.java create mode 100644 web/src/main/java/com/ibeetl/jlw/entity/StudentChapterQuestionLog.java create mode 100644 web/src/main/java/com/ibeetl/jlw/service/StudentChapterQuestionLogService.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/StudentChapterQuestionLogController.java create mode 100644 web/src/main/java/com/ibeetl/jlw/web/query/StudentChapterQuestionLogQuery.java create mode 100644 web/src/main/resources/sql/jlw/studentChapterQuestionLog.md diff --git a/web/src/main/java/com/ibeetl/jlw/dao/StudentChapterQuestionLogDao.java b/web/src/main/java/com/ibeetl/jlw/dao/StudentChapterQuestionLogDao.java new file mode 100644 index 00000000..85965fb2 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/dao/StudentChapterQuestionLogDao.java @@ -0,0 +1,25 @@ +package com.ibeetl.jlw.dao; + +import com.ibeetl.jlw.entity.StudentChapterQuestionLog; +import com.ibeetl.jlw.web.query.StudentChapterQuestionLogQuery; +import org.beetl.sql.mapper.BaseMapper; +import org.beetl.sql.mapper.annotation.SqlResource; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 资源管理-学生做题记录 + */ +@Repository +@SqlResource("jlw.studentChapterQuestionLog") +public interface StudentChapterQuestionLogDao extends BaseMapper { + + /** + * 查询学习做题记录 + * + * @param studentChapterQuestionLogQuery + * @return + */ + List getValuesByQueryNotWithPermission(StudentChapterQuestionLogQuery studentChapterQuestionLogQuery); +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/ResourcesQuestion.java b/web/src/main/java/com/ibeetl/jlw/entity/ResourcesQuestion.java index 354815c5..d3b99813 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/ResourcesQuestion.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/ResourcesQuestion.java @@ -117,7 +117,10 @@ public class ResourcesQuestion extends BaseEntity{ //学生分数 private BigDecimal studentScore; - + + //学生选择答案 + private String myOptions; + public ResourcesQuestion(){ } @@ -343,6 +346,14 @@ public class ResourcesQuestion extends BaseEntity{ this.sourceType = sourceType; } + public String getMyOptions() { + return myOptions; + } + + public void setMyOptions(String myOptions) { + this.myOptions = myOptions; + } + /**题干, 图片转换成正则 *@return */ diff --git a/web/src/main/java/com/ibeetl/jlw/entity/StudentChapterQuestionLog.java b/web/src/main/java/com/ibeetl/jlw/entity/StudentChapterQuestionLog.java new file mode 100644 index 00000000..67664b07 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/entity/StudentChapterQuestionLog.java @@ -0,0 +1,130 @@ +package com.ibeetl.jlw.entity; + +import com.ibeetl.admin.core.entity.BaseEntity; +import com.ibeetl.admin.core.util.ValidateConfig; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.FieldNameConstants; +import org.beetl.sql.annotation.entity.AssignID; +import org.beetl.sql.fetch.annotation.Fetch; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +/* + * 资源管理-题库-做题日志 + * gen by Spring Boot2 Admin 2022-10-05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Fetch +@FieldNameConstants +public class StudentChapterQuestionLog extends BaseEntity { + + //学生做题日志ID + @NotNull(message = "ID不能为空", groups = ValidateConfig.UPDATE.class) + @AssignID(value = "maskAutoID",param = "com.ibeetl.jlw.entity.StudentChapterQuestionLog") + private Long studentChapterQuestionLogId; + + //学生提交的答案 + private String questionLogAnswer; + + //附件,学生端上传附件(单文件) + private String questionLogUploadFile; + + //创建时间 + private Date questionLogAddTime; + + //状态(1正常 2删除) + private Integer questionLogStatus; + + // 题目提交类型 + private QuestionLogAddTypeEnum questionLogAddType; + + //学生ID + + private Long studentId; + + //学生得分 + private BigDecimal studentScore; + + + //题型(1单选 2多选 3判断 4填空 5分析) + + private Integer questionType; + + //分值 + + private BigDecimal questionScore; + + //题干 + + private String questionStem; + + //选项A + + private String questionOptionA; + + //选项B + + private String questionOptionB; + + //选项C + + private String questionOptionC; + + //选项D + + private String questionOptionD; + + //选项E + + private String questionOptionE; + + //答案(单选是一个 多选是多个 判断是对错) + + private String questionAnswer; + + //解析 + + private String questionAnalysis; + + //是否收藏 + + private Boolean isTuck; + + //是否收藏到错题库 + + private Boolean isErrorFavorite; + + //修改时间 + + private Date resourcesQuestionLogUpdateTime; + + //用时(秒) + + private Long resourcesQuestionLogFinishTime; + + //评语 + + private String resourcesQuestionLogReply; + + //组织ID + + private Long orgId; + + //用户ID + + private Long userId; + + //课程类型(1教师开课 2系统授权) + private Integer courseType; + + //资源ID + private Long resourcesQuestionId; + + //课程章节id + private Long courseInfoId; +} diff --git a/web/src/main/java/com/ibeetl/jlw/entity/dto/QuestionLogAddDTO.java b/web/src/main/java/com/ibeetl/jlw/entity/dto/QuestionLogAddDTO.java index 787cf915..5125aea9 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/dto/QuestionLogAddDTO.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/dto/QuestionLogAddDTO.java @@ -51,6 +51,18 @@ public class QuestionLogAddDTO { @Nullable private QuestionLogAddTypeEnum questionLogAddType; + /** + * 课程ID + */ + @Nullable + private Long courseInfoId; + + /** + * 课程类型 + */ + @Nullable + private Integer courseType; + public QuestionLogAddDTO() { // 默认值 setQuestionLogAddType(PRE_SUBMIT); diff --git a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java index 6182ef93..b579447f 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java @@ -21,6 +21,7 @@ import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.enums.MoveEnum; import com.ibeetl.jlw.web.query.CourseInfoQuery; import com.ibeetl.jlw.web.query.ResourcesInfoQuery; +import com.ibeetl.jlw.web.query.StudentChapterQuestionLogQuery; import com.ibeetl.jlw.web.query.UniversitiesCollegesJurisdictionCurriculumResourcesQuery; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -51,6 +52,7 @@ import static cn.jlw.util.ConvertM3U8.booleanMap; import static com.ibeetl.admin.core.util.StreamUtils.listJoin; import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUserId; import static com.ibeetl.jlw.enums.CourseLabelTypeEnum.*; +import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT; import static java.lang.Math.min; import static java.math.BigDecimal.ROUND_HALF_UP; import static java.math.BigDecimal.ZERO; @@ -92,6 +94,9 @@ public class CourseInfoService extends CoreBaseService { @Autowired private UniversitiesCollegesJurisdictionCurriculumResourcesDao universitiesCollegesJurisdictionCurriculumResourcesDao; + @Autowired + private StudentChapterQuestionLogDao studentChapterQuestionLogDao; + private final List> results = new ArrayList<>(); @@ -1639,6 +1644,27 @@ public class CourseInfoService extends CoreBaseService { return courseInfoDao.queryChapterExerciseInfoList(pageQuery); } + + /** + * 课程中心-授权课程章节列表 + * @param pageQuery + * @return + */ + public PageQuery queryCourseCentreChapterExerciseInfoList(PageQuery pageQuery) { + PageQuery courseInfoPageQuery = courseInfoDao.queryChapterExerciseInfoList(pageQuery); + for (CourseInfo courseInfo : courseInfoPageQuery.getList()) { + StudentChapterQuestionLogQuery questionLogQuery = new StudentChapterQuestionLogQuery(); + questionLogQuery.setCourseType(2); + questionLogQuery.setCourseInfoId(courseInfo.getCourseInfoId()); + questionLogQuery.setQuestionLogStatus(1); + questionLogQuery.setQuestionLogAddType(FINALLY_SUBMIT); + List questionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery); + BigDecimal reduce = questionLogList.stream().map(StudentChapterQuestionLog::getStudentScore).reduce(ZERO, BigDecimal::add); + courseInfo.set("studentScore",reduce); + } + return courseInfoPageQuery; + } + public PageQuery queryAllAuthCourseInfoAndOpenCourse(PageQuery query) { PageQuery ret = courseInfoDao.queryAllAuthCourseInfoAndOpenCourse(query); queryListAfter(ret.getList()); diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java index 7a1d2f0a..a62fabcd 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionService.java @@ -14,6 +14,7 @@ import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.CourseInfoDao; import com.ibeetl.jlw.dao.ResourcesQuestionDao; +import com.ibeetl.jlw.dao.StudentChapterQuestionLogDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.entity.dto.QuestionSettingDTO; import com.ibeetl.jlw.entity.vo.ImportQuestionByWordTemplateResultVO; @@ -21,11 +22,13 @@ import com.ibeetl.jlw.entity.vo.QuestionTypeCountVO; import com.ibeetl.jlw.entity.vo.ResourcesCourseInfoAuthDetailsVO; import com.ibeetl.jlw.enums.MatchTypeEnum; import com.ibeetl.jlw.enums.QuestionBusinessTypeEnum; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum; import com.ibeetl.jlw.service.strategy.StrategyContext; import com.ibeetl.jlw.validator.QuestionValidator; import com.ibeetl.jlw.web.query.CourseInfoQuery; import com.ibeetl.jlw.web.query.ResourcesQuestionQuery; +import com.ibeetl.jlw.web.query.StudentChapterQuestionLogQuery; import lombok.Cleanup; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -69,7 +72,6 @@ import static com.ibeetl.jlw.entity.ResourcesQuestion.SPLIT_; import static com.ibeetl.jlw.entity.ResourcesQuestionOptionEntity.shuffleOrderOptions; import static com.ibeetl.jlw.enums.AddTypeEnum.ADMIN_ADD; import static com.ibeetl.jlw.enums.AddTypeEnum.FACULTY_ADD; -import static com.ibeetl.jlw.enums.CourseLabelTypeEnum.THEORY; import static com.ibeetl.jlw.service.strategy.StrategyContext.QuestionParagraphTypeEnum.OTHER; import static com.ibeetl.jlw.service.strategy.StrategyContext.QuestionTypeConcatEnum.*; import static com.ibeetl.jlw.service.strategy.WordQuestionOption.OPTION_REGEX; @@ -114,6 +116,9 @@ public class ResourcesQuestionService extends CoreBaseService @Autowired private UniversitiesCollegesJurisdictionCurriculumResourcesService universitiesCollegesJurisdictionCurriculumResourcesService; + @Autowired + private StudentChapterQuestionLogDao studentChapterQuestionLogDao; + public PageQuery queryByCondition(PageQuery query) { PageQuery ret = resourcesQuestionDao.queryByCondition(query); @@ -590,7 +595,7 @@ public class ResourcesQuestionService extends CoreBaseService //} } - if (Objects.equals(courseInfo.getCourseInfoStatus(),2)){ + if (Objects.equals(courseInfo.getCourseInfoStatus(), 2)) { errMsg.add(new String[]{"第" + ToolUtils.numberToLetter(map.get(columns[0]) + 1) + "列,第" + (i + 1) + "行课程处于禁止状态,禁止导入"}); continue; } @@ -664,7 +669,7 @@ public class ResourcesQuestionService extends CoreBaseService pojo.setQuestionStatus(1); if (coreUser.isUniAdmin()) { pojo.setAddType(FACULTY_ADD); - }else { + } else { pojo.setAddType(ADMIN_ADD); } pojo.setUserId(coreUser.getId()); @@ -835,9 +840,9 @@ public class ResourcesQuestionService extends CoreBaseService public String formatQuestion(String question) { - if (StringUtils.isNotBlank(question)&&StringUtils.isNotBlank(question.replace("

","").replace("
","").replace("

","").replace("
","").trim())){ + if (StringUtils.isNotBlank(question) && StringUtils.isNotBlank(question.replace("

", "").replace("
", "").replace("

", "").replace("
", "").trim())) { return question; - }else { + } else { return ""; } @@ -1401,14 +1406,41 @@ public class ResourcesQuestionService extends CoreBaseService } - - public List getChapterExerciseQuestionList(Long courseInfoId){ + public List getChapterExerciseQuestionList(Long courseInfoId) { return resourcesQuestionDao.createLambdaQuery() - .andEq(ResourcesQuestion::getCourseInfoId,courseInfoId) - .andEq(ResourcesQuestion::getQuestionStatus,1) + .andEq(ResourcesQuestion::getCourseInfoId, courseInfoId) + .andEq(ResourcesQuestion::getQuestionStatus, 1) .select(); } + /** + * 课程中心-章节练习试题 + * @param courseInfoId + * @param gradeDetails true 成绩详情 false 开始答题 + * @return + */ + public List getCourseCentreChapterExerciseQuestionList(Long courseInfoId,Boolean gradeDetails) { + List select = resourcesQuestionDao.createLambdaQuery() + .andEq(ResourcesQuestion::getCourseInfoId, courseInfoId) + .andEq(ResourcesQuestion::getQuestionStatus, 1) + .select(); + + for (ResourcesQuestion resourcesQuestion : select) { + StudentChapterQuestionLogQuery logQuery = new StudentChapterQuestionLogQuery(); + logQuery.setResourcesQuestionId(resourcesQuestion.getResourcesQuestionId()); + logQuery.setCourseInfoId(courseInfoId); + logQuery.setCourseType(2); + logQuery.setQuestionLogStatus(1); + logQuery.setQuestionLogAddType(gradeDetails ? QuestionLogAddTypeEnum.FINALLY_SUBMIT : QuestionLogAddTypeEnum.PRE_SUBMIT); + List questionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(logQuery); + if (CollectionUtils.isNotEmpty(questionLogList)){ + StudentChapterQuestionLog questionLog = questionLogList.get(0); + resourcesQuestion.setStudentScore(questionLog.getStudentScore()); + resourcesQuestion.setMyOptions(questionLog.getQuestionLogAnswer()); + } + } + return select; + } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java index 93341b6c..37ce86b3 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesQuestionSnapshotService.java @@ -12,6 +12,7 @@ import com.ibeetl.admin.core.util.PlatformException; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.admin.core.web.JsonReturnCode; import com.ibeetl.jlw.dao.ResourcesQuestionSnapshotDao; +import com.ibeetl.jlw.dao.StudentChapterQuestionLogDao; import com.ibeetl.jlw.dao.StudentDao; import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesQuestionDao; import com.ibeetl.jlw.entity.*; @@ -22,6 +23,7 @@ import com.ibeetl.jlw.entity.vo.TeacherOpenCourseQuestionTestSimpleInfoVO; import com.ibeetl.jlw.enums.GlobalUpStatusEnum; import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery; +import com.ibeetl.jlw.web.query.StudentChapterQuestionLogQuery; import com.ibeetl.jlw.web.query.TeacherOpenCourseQuestionSettingQuery; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -50,6 +52,7 @@ import static cn.hutool.core.util.ObjectUtil.defaultIfNull; import static cn.jlw.util.CacheUserUtil.getStudent; import static com.ibeetl.admin.core.util.StreamUtils.listJoin; import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT; +import static java.math.BigDecimal.ZERO; /** * 题目快照 Service @@ -72,6 +75,9 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService queryByCondition(PageQuery query) { PageQuery ret = resourcesQuestionSnapshotDao.queryByCondition(query); queryListAfter(ret.getList()); @@ -455,6 +461,28 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService getCourseCentreQuestionTestInfoSupplyCenter(@NotNull TeacherOpenCourseQuestionTestSimpleInfoDTO query) { + PageQuery pageQuery = query.getPageQuery(); + PageQuery questionTestSimpleInfo = resourcesQuestionSnapshotDao.getQuestionTestInfoSupplyCenter(pageQuery); + dictParser(questionTestSimpleInfo.getList()); + for (TeacherOpenCourseQuestionTestSimpleInfoVO testSimpleInfoVO : questionTestSimpleInfo.getList()) { + StudentChapterQuestionLogQuery questionLogQuery = new StudentChapterQuestionLogQuery(); + questionLogQuery.setCourseType(1); + questionLogQuery.setCourseInfoId(testSimpleInfoVO.getTeacherOpenCourseMergeCourseInfoId()); + questionLogQuery.setQuestionLogStatus(1); + questionLogQuery.setQuestionLogAddType(FINALLY_SUBMIT); + List questionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery); + BigDecimal reduce = questionLogList.stream().map(StudentChapterQuestionLog::getStudentScore).reduce(ZERO, BigDecimal::add); + testSimpleInfoVO.set("studentScore", reduce); + } + + return questionTestSimpleInfo; + } /** * 随机抽题,扩展参数 diff --git a/web/src/main/java/com/ibeetl/jlw/service/StudentChapterQuestionLogService.java b/web/src/main/java/com/ibeetl/jlw/service/StudentChapterQuestionLogService.java new file mode 100644 index 00000000..48667642 --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/service/StudentChapterQuestionLogService.java @@ -0,0 +1,301 @@ +package com.ibeetl.jlw.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.ibeetl.admin.core.entity.CoreUser; +import com.ibeetl.admin.core.service.CoreBaseService; +import com.ibeetl.admin.core.util.PlatformException; +import com.ibeetl.jlw.dao.ResourcesQuestionDao; +import com.ibeetl.jlw.dao.StudentChapterQuestionLogDao; +import com.ibeetl.jlw.entity.ResourcesQuestion; +import com.ibeetl.jlw.entity.Student; +import com.ibeetl.jlw.entity.StudentChapterQuestionLog; +import com.ibeetl.jlw.entity.dto.QuestionLogAddDTO; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; +import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum; +import com.ibeetl.jlw.web.query.ResourcesQuestionQuery; +import com.ibeetl.jlw.web.query.StudentChapterQuestionLogQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.util.*; +import java.util.stream.Collectors; + +import static cn.hutool.core.date.DateUnit.SECOND; +import static cn.hutool.core.util.ArrayUtil.join; +import static cn.jlw.util.CacheUserUtil.getStudent; +import static com.ibeetl.jlw.enums.QuestionLogAddTypeEnum.FINALLY_SUBMIT; +import static java.math.BigDecimal.ZERO; + +/** + * 学生实操日志 Service + * 当分布式ID开启后请勿使用insert(*,true) + */ + +@Service +@Transactional +@Validated +public class StudentChapterQuestionLogService extends CoreBaseService { + + @Autowired + private StudentChapterQuestionLogDao studentChapterQuestionLogDao; + + @Autowired + private ResourcesQuestionDao resourcesQuestionDao; + + + /** + * 课程中心章节练习-学生答题记录 + * + * @param questionLogAddDTO + * @param coreUser + * @return + */ + public void addStudentChapterQuestionLog(@NotNull(message = "提交题目信息不能为空") QuestionLogAddDTO questionLogAddDTO, CoreUser coreUser) { + + // 查询学生身份 + Student student = getStudent(); + Assert.notNull(student, "非学生身份,无法提交!"); + + Date addTime = questionLogAddDTO.getAddTime(); + if (addTime == null) { + throw new PlatformException("提交时间不能为空"); + } + + Map questionLogMap = questionLogAddDTO.getQuestionLogMap(); + + // 查询符合条件的日志表 + String questionSnapshotIds = join(questionLogMap.keySet().toArray(), ","); + + + ResourcesQuestionQuery query = new ResourcesQuestionQuery(); + query.setResourcesQuestionIds(questionSnapshotIds); + + List resourcesQuestionList = resourcesQuestionDao.getValuesByQueryNotWithPermission(query); + Assert.notEmpty(resourcesQuestionList, "找不到试题"); + + // 代表填空题和分析题的类型 + List questionType = Arrays.asList(ResourcesQuestionTypeEnum.FILL_QUESTION.getCode(), ResourcesQuestionTypeEnum.ANALYSIS_QUESTION.getCode()); + + for (ResourcesQuestion resourcesQuestion : resourcesQuestionList) { + + + StudentChapterQuestionLogQuery questionLogQuery = new StudentChapterQuestionLogQuery(); + questionLogQuery.setResourcesQuestionId(resourcesQuestion.getResourcesQuestionId()); + questionLogQuery.setCourseInfoId(questionLogAddDTO.getCourseInfoId()); + + List studentChapterQuestionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery); + + // 学生提交的答案 + String answer = questionLogMap.get(resourcesQuestion.getResourcesQuestionId().toString()); + + if (CollectionUtil.isNotEmpty(studentChapterQuestionLogList)) { + + List collect = studentChapterQuestionLogList.stream() + .filter(v -> ObjectUtil.equals(studentChapterQuestionLogList.get(0).getResourcesQuestionId(), resourcesQuestion.getResourcesQuestionId())) + .collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(collect)) { + + StudentChapterQuestionLog questionLog = collect.get(0); + long finishSecondTime = DateUtil.between(questionLog.getResourcesQuestionLogUpdateTime(), addTime, SECOND); + // 默认0分 + questionLog.setStudentScore(BigDecimal.valueOf(0)); + + // 学生提交的答案处理 + String answersText = null; + // 填空题和分析题 + if (questionType.contains(questionLog.getQuestionType())) { + + answersText = answer; + + JSONObject studentAnswerArr = new JSONObject(); + + if (StrUtil.isNotBlank(answersText)) { + studentAnswerArr = JSONUtil.parseObj(answersText); + } + // 学生答案和正确答案集合 + + JSONObject questionAnswerArr = JSONUtil.parseObj(questionLog.getQuestionAnswer()); + // 每题分数 + BigDecimal eachScore = NumberUtil.div(questionLog.getQuestionScore(), questionAnswerArr.size(), 1); + + BigDecimal studentScore = new BigDecimal("0"); + for (Map.Entry map : questionAnswerArr.entrySet()) { + Object questionAns = map.getValue(); + String k = map.getKey(); + String studentAns = studentAnswerArr.getStr(k, ""); + + // 比对答案 + if (StrUtil.isAllNotBlank(questionAns.toString(), studentAns) && questionAns.toString().equalsIgnoreCase(studentAns)) { + studentScore = studentScore.add(eachScore); + } + } + + // 填空题和分析题计算分数 + // 计算该题目学生的得分情况 + questionLog.setStudentScore(studentScore); + + if (ObjectUtil.equals(questionLogAddDTO.getQuestionLogAddType(), FINALLY_SUBMIT)) { + // 是否是错题 + questionLog.setIsErrorFavorite(NumberUtil.equals(studentScore, ZERO)); + } + + } + // 基础题目类型,单选多选判断 类型:1、2、3 + else { + answersText = join(answer.split(","), ","); + // 是否是正确答案 + Boolean isCorrectAnswer = questionLog.getQuestionAnswer().equalsIgnoreCase(answersText); + + // 学生得分 + questionLog.setStudentScore(isCorrectAnswer ? questionLog.getQuestionScore() : ZERO); + + if (ObjectUtil.equals(questionLogAddDTO.getQuestionLogAddType(), FINALLY_SUBMIT)) { + // 是否是错题 + questionLog.setIsErrorFavorite(!isCorrectAnswer); + } + + } + questionLog.setQuestionLogAddType(questionLogAddDTO.getQuestionLogAddType()); + questionLog.setQuestionLogAnswer(answersText); + questionLog.setResourcesQuestionLogUpdateTime(addTime); + if (ObjectUtil.equals(questionLogAddDTO.getQuestionLogAddType(), FINALLY_SUBMIT)) { + questionLog.setResourcesQuestionLogFinishTime(finishSecondTime); + } + studentChapterQuestionLogDao.updateTemplateById(questionLog); + } + + } else { + + StudentChapterQuestionLog questionLog = new StudentChapterQuestionLog(); + + // 默认0分 + questionLog.setStudentScore(BigDecimal.valueOf(0)); + + // 学生提交的答案处理 + String answersText = null; + // 填空题和分析题 + if (questionType.contains(resourcesQuestion.getQuestionType())) { + answersText = answer; + JSONObject studentAnswerArr = new JSONObject(); + if (StrUtil.isNotBlank(answersText)) { + studentAnswerArr = JSONUtil.parseObj(answersText); + } + // 学生答案和正确答案集合 + + JSONObject questionAnswerArr = JSONUtil.parseObj(resourcesQuestion.getQuestionAnswer()); + // 每题分数 + BigDecimal eachScore = NumberUtil.div(resourcesQuestion.getQuestionScore(), questionAnswerArr.size(), 1); + + BigDecimal studentScore = new BigDecimal("0"); + for (Map.Entry map : questionAnswerArr.entrySet()) { + Object questionAns = map.getValue(); + String k = map.getKey(); + String studentAns = studentAnswerArr.getStr(k, ""); + + // 比对答案 + if (StrUtil.isAllNotBlank(questionAns.toString(), studentAns) && questionAns.toString().equalsIgnoreCase(studentAns)) { + studentScore = studentScore.add(eachScore); + } + } + // 填空题和分析题计算分数 + // 计算该题目学生的得分情况 + questionLog.setStudentScore(studentScore); + + if (ObjectUtil.equals(questionLogAddDTO.getQuestionLogAddType(), FINALLY_SUBMIT)) { + // 是否是错题 + questionLog.setIsErrorFavorite(NumberUtil.equals(studentScore, ZERO)); + } + + } else { + // 基础题目类型,单选多选判断 类型:1、2、3 + + answersText = join(answer.split(","), ","); + // 是否是正确答案 + Boolean isCorrectAnswer = resourcesQuestion.getQuestionAnswer().equalsIgnoreCase(answersText); + + // 学生得分 + questionLog.setStudentScore(isCorrectAnswer ? resourcesQuestion.getQuestionScore() : ZERO); + + if (ObjectUtil.equals(questionLogAddDTO.getQuestionLogAddType(), FINALLY_SUBMIT)) { + // 是否是错题 + questionLog.setIsErrorFavorite(!isCorrectAnswer); + } + + } + + questionLog.setQuestionLogAnswer(answersText); + questionLog.setQuestionLogAddTime(addTime); + questionLog.setQuestionLogStatus(1); + questionLog.setQuestionLogAddType(questionLogAddDTO.getQuestionLogAddType()); + questionLog.setStudentId(student.getStudentId()); + questionLog.setQuestionType(resourcesQuestion.getQuestionType()); + questionLog.setQuestionScore(resourcesQuestion.getQuestionScore()); + questionLog.setQuestionStem(resourcesQuestion.getQuestionStem()); + questionLog.setQuestionOptionA(resourcesQuestion.getQuestionOptionA()); + questionLog.setQuestionOptionB(resourcesQuestion.getQuestionOptionB()); + questionLog.setQuestionOptionC(resourcesQuestion.getQuestionOptionC()); + questionLog.setQuestionOptionD(resourcesQuestion.getQuestionOptionD()); + questionLog.setQuestionOptionE(resourcesQuestion.getQuestionOptionE()); + questionLog.setQuestionAnswer(resourcesQuestion.getQuestionAnswer()); + questionLog.setQuestionAnalysis(resourcesQuestion.getQuestionAnalysis()); + questionLog.setResourcesQuestionLogUpdateTime(addTime); + questionLog.setOrgId(coreUser.getOrgId()); + questionLog.setUserId(coreUser.getId()); + questionLog.setCourseType(questionLogAddDTO.getCourseType()); + questionLog.setResourcesQuestionId(resourcesQuestion.getResourcesQuestionId()); + questionLog.setCourseInfoId(questionLogAddDTO.getCourseInfoId()); + studentChapterQuestionLogDao.insertTemplate(questionLog); + } + + } + } + + /** + * 课程中心章节练习-学生答题统计 + * @param courseInfoId + * @param courseType + * @return + */ + public Map getStudentChapterGradeTotal(Long courseInfoId, Integer courseType) { + StudentChapterQuestionLogQuery questionLogQuery = new StudentChapterQuestionLogQuery(); + questionLogQuery.setCourseType(courseType); + questionLogQuery.setCourseInfoId(courseInfoId); + questionLogQuery.setQuestionLogStatus(1); + questionLogQuery.setQuestionLogAddType(FINALLY_SUBMIT); + List questionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(questionLogQuery); + + int totalTopic = CollectionUtil.isEmpty(questionLogList) ? 0 : questionLogList.size(); + int totalRight = 0; + BigDecimal totalScore = BigDecimal.ZERO; + + for (StudentChapterQuestionLog questionLog : questionLogList) { + if (ObjectUtil.isNotEmpty(questionLog.getStudentScore()) && !ObjectUtil.equals(questionLog.getStudentScore(), BigDecimal.ZERO)) { + totalScore = totalScore.add(questionLog.getStudentScore()); + totalRight += 1; + } + } + + DecimalFormat dt = new DecimalFormat("0.##"); + + Map map = new HashMap<>(); + map.put("totalTopic", totalTopic); + map.put("totalRight", totalRight); + map.put("totalWrong", totalTopic - totalRight); + map.put("totalScore", totalScore); + map.put("accuracy", totalTopic == 0 ? 0 : dt.format(BigDecimal.valueOf(totalRight).divide(new BigDecimal(totalTopic), 2, RoundingMode.UP).multiply(BigDecimal.valueOf(100)))); + return map; + } +} diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java index 8aefdb36..0f9c91c8 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseQuestionSettingService.java @@ -30,6 +30,7 @@ import com.ibeetl.jlw.enums.*; import com.ibeetl.jlw.service.questionQueue.questionSettingQueue.QuestionSettingRedisDelayQueueImpl; import com.ibeetl.jlw.web.query.*; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.beetl.sql.core.SqlId; import org.beetl.sql.core.engine.PageQuery; @@ -95,6 +96,9 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService queryByCondition(PageQuery query) { PageQuery ret = teacherOpenCourseQuestionSettingDao.queryByCondition(query); queryListAfter(ret.getList()); @@ -1104,4 +1108,41 @@ public class TeacherOpenCourseQuestionSettingService extends CoreBaseService questionCourseCentreDetailBYCenter(@NotNull(message = "题目配置ID不能为空!") final Long teacherOpenCourseQuestionSettingId,Boolean gradeDetails, CoreUser coreUser) { + // 获取学生ID + + TeacherOpenCourseQuestionSetting setting = getInfo(teacherOpenCourseQuestionSettingId); + Assert.notNull(setting, "未查询到来源ID对应的题目!"); + + ResourcesQuestionSnapshotQuery questionSnapshotQuery = new ResourcesQuestionSnapshotQuery(); + questionSnapshotQuery.setTeacherOpenCourseQuestionSettingId(teacherOpenCourseQuestionSettingId); + questionSnapshotQuery.setQuestionStatus(1); + // 题目查询 + List resourcesQuestionSnapshotList = resourcesQuestionSnapshotDao.getValuesByQueryNotWithPermission(questionSnapshotQuery); + resourcesQuestionSnapshotList = ObjectUtil.defaultIfNull(resourcesQuestionSnapshotList, new ArrayList<>()); + + for (ResourcesQuestionSnapshot resourcesQuestionSnapshot : resourcesQuestionSnapshotList) { + StudentChapterQuestionLogQuery logQuery = new StudentChapterQuestionLogQuery(); + logQuery.setResourcesQuestionId(resourcesQuestionSnapshot.getTeacherOpenCourseMergeResourcesQuestionId()); + logQuery.setCourseInfoId(resourcesQuestionSnapshot.getTeacherOpenCourseMergeCourseInfoId()); + logQuery.setCourseType(1); + logQuery.setQuestionLogStatus(1); + logQuery.setQuestionLogAddType(gradeDetails ? QuestionLogAddTypeEnum.FINALLY_SUBMIT : QuestionLogAddTypeEnum.PRE_SUBMIT); + List questionLogList = studentChapterQuestionLogDao.getValuesByQueryNotWithPermission(logQuery); + if (CollectionUtils.isNotEmpty(questionLogList)){ + StudentChapterQuestionLog questionLog = questionLogList.get(0); + resourcesQuestionSnapshot.set("studentScore",questionLog.getStudentScore()); + resourcesQuestionSnapshot.set("myOptions",questionLog.getQuestionLogAnswer()); + } + } + return resourcesQuestionSnapshotList; + } + } diff --git a/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java b/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java index 2896783f..f2690485 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java @@ -521,6 +521,21 @@ public class CourseInfoController { return JsonResult.success(courseInfoService.queryChapterExerciseInfoList(courseInfoQuery.getPageQuery())); } + /** + * 课程中心-授权课程章节列表 + * @param courseInfoQuery + * @param coreUser + * @return + */ + @GetMapping(API + "/queryCourseCentreChapterExerciseInfoList.do") + @ResponseBody + public JsonResult queryCourseCentreChapterExerciseInfoList(CourseInfoQuery courseInfoQuery, @SCoreUser CoreUser coreUser) { + if (courseInfoQuery.getCourseInfoId() == null) { + return JsonResult.failMessage("课程ID不能为空"); + } + return JsonResult.success(courseInfoService.queryCourseCentreChapterExerciseInfoList(courseInfoQuery.getPageQuery())); + } + //课程中心,授权课,课程列表 @GetMapping(API + "/getCourseCenterResources.do") diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java index d5963c4c..06a14e9d 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionController.java @@ -847,4 +847,19 @@ public class ResourcesQuestionController { public JsonResult getChapterExerciseQuestionList(Long courseInfoId, @SCoreUser CoreUser coreUser) { return JsonResult.success(resourcesQuestionService.getChapterExerciseQuestionList(courseInfoId)); } + + /** + * 课程中心-章节练习试题-授权课程 + * @param courseInfoId + * @param coreUser + * @return + */ + @GetMapping(API + "/getCourseCentreChapterExerciseQuestionList.do") + @ResponseBody + public JsonResult getCourseCentreChapterExerciseQuestionList(Long courseInfoId,Boolean gradeDetails, @SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + } + return JsonResult.success(resourcesQuestionService.getCourseCentreChapterExerciseQuestionList(courseInfoId,gradeDetails)); + } } diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java index 8bcf2cbb..3680be92 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesQuestionSnapshotController.java @@ -217,6 +217,21 @@ public class ResourcesQuestionSnapshotController extends BaseController { return JsonResult.success(resourcesQuestionSnapshotService.getQuestionTestInfoSupplyCenter(dto)); } + /** + * 学生端-课程中心-开课课程章节列表 + * 支持根据来源类型查询 + * + * @param dto 分页参数 + * @param coreUser + * @return + */ + @PostMapping(API + "/getCourseCentreQuestionTestInfoSupplyCenter.do") + public JsonResult getCourseCentreQuestionTestInfoSupplyCenter(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseQuestionTestSimpleInfoDTO dto, + @SCoreUser CoreUser coreUser) { + + return JsonResult.success(resourcesQuestionSnapshotService.getCourseCentreQuestionTestInfoSupplyCenter(dto)); + } + /* 后台页面 */ diff --git a/web/src/main/java/com/ibeetl/jlw/web/StudentChapterQuestionLogController.java b/web/src/main/java/com/ibeetl/jlw/web/StudentChapterQuestionLogController.java new file mode 100644 index 00000000..375dbf1a --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/StudentChapterQuestionLogController.java @@ -0,0 +1,73 @@ +package com.ibeetl.jlw.web; + +import cn.hutool.core.lang.Assert; +import cn.jlw.Interceptor.SCoreUser; +import com.ibeetl.admin.core.entity.CoreUser; +import com.ibeetl.admin.core.web.JsonResult; +import com.ibeetl.jlw.entity.StudentHandsOnTaskLog; +import com.ibeetl.jlw.entity.dto.QuestionLogAddDTO; +import com.ibeetl.jlw.service.StudentChapterQuestionLogService; +import com.ibeetl.jlw.service.StudentHandsOnTaskLogService; +import com.ibeetl.jlw.web.query.StudentHandsOnTaskLogQuery; +import org.beetl.sql.core.engine.PageQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * 学生章节-做题日志 + * 切记不要对非线程安全的静态变量进行写操作 + */ + +@RestController +@Validated +public class StudentChapterQuestionLogController { + + private static final String API = "/api/studentChapterQuestionLog"; + + + @Autowired + private StudentChapterQuestionLogService studentChapterQuestionLogService; + + + + /* 前端接口 */ + + /** + * 课程中心章节练习-学生答题记录 + * @param questionLogAddDTO + * @param coreUser + * @return + */ + @PostMapping(API + "/addStudentChapterQuestionLog.do") + @ResponseBody + public JsonResult addStudentChapterQuestionLog(@RequestBody QuestionLogAddDTO questionLogAddDTO, @SCoreUser CoreUser coreUser) { + if (null == coreUser) { + return JsonResult.failMessage("请登录后再操作"); + } else { + Assert.isTrue(coreUser.isStudent(), "非学生身份,无法提交!"); + studentChapterQuestionLogService.addStudentChapterQuestionLog(questionLogAddDTO,coreUser); + return JsonResult.success(); + } + } + + + /** + * 课程中心章节练习-学生答题统计 + * @param courseInfoId + * @param courseType + * @param coreUser + * @return + */ + @GetMapping(API + "/getStudentChapterGradeTotal.do") + public JsonResult> getStudentChapterGradeTotal(Long courseInfoId, Integer courseType, @SCoreUser CoreUser coreUser) { + if (null == coreUser) { + return JsonResult.failMessage("请登录后再操作"); + } else { + return JsonResult.success(studentChapterQuestionLogService.getStudentChapterGradeTotal(courseInfoId,courseType)); + } + } + +} diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java index 3ff8ae38..87e6a57c 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseQuestionSettingController.java @@ -239,6 +239,22 @@ public class TeacherOpenCourseQuestionSettingController { return JsonResult.success(teacherOpenCourseQuestionSettingService.questionDetailBYCenter(teacherOpenCourseQuestionSettingId, coreUser)); } + /** + * 学生端-课程中心-根据题目配置信息,获取相关的题目,不存快照,并返回答案 + * 每次获取 + * 申请试卷 + * + * @param teacherOpenCourseQuestionSettingId 配置ID + * @return + */ + @PostMapping(API + "/questionCourseCentreDetailBYCenter.do") + public JsonResult questionCourseCentreDetailBYCenter(Long teacherOpenCourseQuestionSettingId,Boolean gradeDetails, @SCoreUser CoreUser coreUser) { + if(null == coreUser){ + return JsonResult.failMessage("请登录后再操作"); + } + return JsonResult.success(teacherOpenCourseQuestionSettingService.questionCourseCentreDetailBYCenter(teacherOpenCourseQuestionSettingId, gradeDetails,coreUser)); + } + /** * 功能描述:
* 错题练习,错题库根据试卷来 diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/StudentChapterQuestionLogQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/StudentChapterQuestionLogQuery.java new file mode 100644 index 00000000..6734e2ec --- /dev/null +++ b/web/src/main/java/com/ibeetl/jlw/web/query/StudentChapterQuestionLogQuery.java @@ -0,0 +1,161 @@ +package com.ibeetl.jlw.web.query; + +import cn.jlw.validate.ValidateConfig; +import com.ibeetl.admin.core.annotation.Query; +import com.ibeetl.admin.core.web.query.PageParam; +import com.ibeetl.jlw.entity.StudentChapterQuestionLog; +import com.ibeetl.jlw.enums.QuestionLogAddTypeEnum; +import lombok.*; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@EqualsAndHashCode(callSuper=false) +public class StudentChapterQuestionLogQuery extends PageParam { + + //学生做题日志ID + @NotNull(message = "ID不能为空", groups = ValidateConfig.UPDATE.class) + @Query(name = "学生做题日志ID", display = false) + private Long studentChapterQuestionLogId; + + //学生提交的答案 + private String questionLogAnswer; + + //附件,学生端上传附件(单文件) + private String questionLogUploadFile; + + //创建时间 + private Date questionLogAddTime; + + //状态(1正常 2删除) + private Integer questionLogStatus; + + // 题目提交类型 + private QuestionLogAddTypeEnum questionLogAddType; + + //学生ID + + private Long studentId; + + //学生得分 + private BigDecimal studentScore; + + + //题型(1单选 2多选 3判断 4填空 5分析) + + private Integer questionType; + + //分值 + + private BigDecimal questionScore; + + //题干 + + private String questionStem; + + //选项A + + private String questionOptionA; + + //选项B + + private String questionOptionB; + + //选项C + + private String questionOptionC; + + //选项D + + private String questionOptionD; + + //选项E + + private String questionOptionE; + + //答案(单选是一个 多选是多个 判断是对错) + + private String questionAnswer; + + //解析 + + private String questionAnalysis; + + //是否收藏 + + private Boolean isTuck; + + //是否收藏到错题库 + + private Boolean isErrorFavorite; + + //修改时间 + + private Date resourcesQuestionLogUpdateTime; + + //用时(秒) + + private Long resourcesQuestionLogFinishTime; + + //评语 + + private String resourcesQuestionLogReply; + + //组织ID + + private Long orgId; + + //用户ID + + private Long userId; + + //课程类型(1教师开课 2系统授权) + private Integer courseType; + + //资源ID + private Long resourcesQuestionId; + + //课程章节id + private Long courseInfoId; + + + public StudentChapterQuestionLog pojo(){ + StudentChapterQuestionLog pojo = new StudentChapterQuestionLog(); + pojo.setStudentChapterQuestionLogId(this.getStudentChapterQuestionLogId()); + pojo.setQuestionLogAnswer(this.getQuestionLogAnswer()); + pojo.setQuestionLogUploadFile(this.getQuestionLogUploadFile()); + pojo.setQuestionLogAddTime(this.getQuestionLogAddTime()); + pojo.setQuestionLogStatus(this.getQuestionLogStatus()); + pojo.setQuestionLogAddType(this.getQuestionLogAddType()); + pojo.setStudentId(this.getStudentId()); + pojo.setStudentScore(this.getStudentScore()); + pojo.setQuestionType(this.getQuestionType()); + pojo.setQuestionScore(this.getQuestionScore()); + pojo.setQuestionStem(this.getQuestionStem()); + pojo.setQuestionOptionA(this.getQuestionOptionA()); + pojo.setQuestionOptionB(this.getQuestionOptionB()); + pojo.setQuestionOptionC(this.getQuestionOptionC()); + pojo.setQuestionOptionD(this.getQuestionOptionD()); + pojo.setQuestionOptionE(this.getQuestionOptionE()); + pojo.setQuestionAnswer(this.getQuestionAnswer()); + pojo.setQuestionAnalysis(this.getQuestionAnalysis()); + pojo.setIsTuck(this.getIsTuck()); + pojo.setIsErrorFavorite(this.getIsErrorFavorite()); + pojo.setResourcesQuestionLogUpdateTime(this.getResourcesQuestionLogUpdateTime()); + pojo.setResourcesQuestionLogFinishTime(this.getResourcesQuestionLogFinishTime()); + pojo.setResourcesQuestionLogReply(this.getResourcesQuestionLogReply()); + pojo.setOrgId(this.getOrgId()); + pojo.setUserId(this.getUserId()); + pojo.setCourseType(this.getCourseType()); + pojo.setResourcesQuestionId(this.getResourcesQuestionId()); + pojo.setCourseInfoId(this.getCourseInfoId()); + return pojo; + } +} diff --git a/web/src/main/resources/sql/jlw/studentChapterQuestionLog.md b/web/src/main/resources/sql/jlw/studentChapterQuestionLog.md new file mode 100644 index 00000000..52e0f1b9 --- /dev/null +++ b/web/src/main/resources/sql/jlw/studentChapterQuestionLog.md @@ -0,0 +1,89 @@ +getValuesByQueryNotWithPermission +=== + +* 根据不为空的参数进行查询(不包含权限) + + select t.* + from student_chapter_question_log t + where 1=1 + @if(!isEmpty(studentChapterQuestionLogId)){ + and t.student_chapter_question_log_id =#studentChapterQuestionLogId# + @} + @if(!isEmpty(questionLogAnswer)){ + and t.question_log_answer =#questionLogAnswer# + @} + @if(!isEmpty(questionLogUploadFile)){ + and t.question_log_upload_file =#questionLogUploadFile# + @} + @if(!isEmpty(questionLogAddTime)){ + and t.question_log_add_time =#questionLogAddTime# + @} + @if(!isEmpty(questionLogStatus)){ + and t.question_log_status =#questionLogStatus# + @} + @if(!isEmpty(studentId)){ + and t.student_id =#studentId# + @} + @if(!isEmpty(questionLogAddType)){ + and t.question_log_add_type =#questionLogAddType# + @} + @if(!isEmpty(studentScore)){ + and t.student_score =#studentScore# + @} + @if(!isEmpty(questionType)){ + and t.question_type =#questionType# + @} + @if(!isEmpty(questionScore)){ + and t.question_score =#questionScore# + @} + @if(!isEmpty(questionStem)){ + and t.question_stem =#questionStem# + @} + @if(!isEmpty(questionOptionA)){ + and t.question_option_a =#questionOptionA# + @} + @if(!isEmpty(questionOptionB)){ + and t.question_option_b =#questionOptionB# + @} + @if(!isEmpty(questionOptionC)){ + and t.question_option_c =#questionOptionC# + @} + @if(!isEmpty(questionOptionD)){ + and t.question_option_d =#questionOptionD# + @} + @if(!isEmpty(questionOptionE)){ + and t.question_option_e =#questionOptionE# + @} + @if(!isEmpty(questionAnswer)){ + and t.question_answer =#questionAnswer# + @} + @if(!isEmpty(questionAnalysis)){ + and t.question_analysis =#questionAnalysis# + @} + @if(!isEmpty(isTuck)){ + and t.is_tuck =#isTuck# + @} + @if(!isEmpty(isErrorFavorite)){ + and t.is_error_favorite =#isErrorFavorite# + @} + @if(!isEmpty(resourcesQuestionLogUpdateTime)){ + and t.resources_question_log_update_time =#resourcesQuestionLogUpdateTime# + @} + @if(!isEmpty(resourcesQuestionLogFinishTime)){ + and t.resources_question_log_finish_time =#resourcesQuestionLogFinishTime# + @} + @if(!isEmpty(resourcesQuestionLogReply)){ + and t.resources_question_log_reply =#resourcesQuestionLogReply# + @} + @if(!isEmpty(userId)){ + and t.user_id =#userId# + @} + @if(!isEmpty(orgId)){ + and t.org_id =#orgId# + @} + @if(!isEmpty(courseType)){ + and t.course_type =#courseType# + @} + @if(!isEmpty(courseInfoId)){ + and t.course_info_id =#courseInfoId# + @} \ No newline at end of file