| | |
| | | * 提交时间 |
| | | */ |
| | | private Date createTime; |
| | | /** |
| | | * 考试次数 |
| | | */ |
| | | private Integer counts; |
| | | |
| | | |
| | | private Integer taskExamId; |
| | | |
| | |
| | | public void setTaskExamId(Integer taskExamId) { |
| | | this.taskExamId = taskExamId; |
| | | } |
| | | public Integer getCounts() { |
| | | return counts; |
| | | } |
| | | |
| | | public void setCounts(Integer counts) { |
| | | this.counts = counts; |
| | | } |
| | | } |
| | |
| | | import com.mindskip.xzs.domain.ExamPaperAnswer; |
| | | import com.mindskip.xzs.domain.ExamTemplatesUserCount; |
| | | import com.mindskip.xzs.domain.other.KeyValue; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<ExamPaperAnswer> selectByPaperName(@Param("paperName") String paperName); |
| | | |
| | | List<ExamPaperAnswer> getByExamPaperIdAndUserId(@Param("examTemplatesUserCount")List<ExamTemplatesUserCount> examTemplatesUserCount); |
| | | |
| | | List<ExamPaperAnswer> adminPageByGrade(ExamPaperGradePageRequestVM grade); |
| | | } |
| | |
| | | package com.mindskip.xzs.service; |
| | | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.domain.ExamPaperAnswer; |
| | | import com.mindskip.xzs.domain.ExamPaperAnswerInfo; |
| | | import com.mindskip.xzs.domain.ExamTemplatesUserCount; |
| | | import com.mindskip.xzs.domain.User; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<ExamPaperAnswer> getByExamPaperIdAndUserId(List<ExamTemplatesUserCount> examTemplatesUserCount); |
| | | |
| | | PageInfo<ExamPaperAnswer> adminPageByGrade(ExamPaperGradePageRequestVM grade); |
| | | } |
| | |
| | | package com.mindskip.xzs.service.impl; |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.domain.*; |
| | | import com.mindskip.xzs.domain.enums.ExamPaperAnswerStatusEnum; |
| | | import com.mindskip.xzs.domain.enums.ExamPaperTypeEnum; |
| | | import com.mindskip.xzs.domain.enums.QuestionTypeEnum; |
| | | import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject; |
| | | import com.mindskip.xzs.domain.other.KeyValue; |
| | | import com.mindskip.xzs.domain.other.ExamPaperAnswerUpdate; |
| | | import com.mindskip.xzs.domain.other.KeyValue; |
| | | import com.mindskip.xzs.domain.task.TaskItemAnswerObject; |
| | | import com.mindskip.xzs.repository.*; |
| | | import com.mindskip.xzs.repository.ExamPaperAnswerMapper; |
| | | import com.mindskip.xzs.repository.ExamPaperMapper; |
| | | import com.mindskip.xzs.repository.QuestionMapper; |
| | |
| | | import com.mindskip.xzs.utility.DateTimeUtil; |
| | | import com.mindskip.xzs.utility.ExamUtil; |
| | | import com.mindskip.xzs.utility.JsonUtil; |
| | | import com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.mindskip.xzs.domain.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | public List<ExamPaperAnswer> getByExamPaperIdAndUserId(List<ExamTemplatesUserCount> examTemplatesUserCount) { |
| | | return examPaperAnswerMapper.getByExamPaperIdAndUserId(examTemplatesUserCount); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<ExamPaperAnswer> adminPageByGrade(ExamPaperGradePageRequestVM grade) { |
| | | return PageHelper.startPage(grade.getPageIndex(), grade.getPageSize(), "user_score desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.adminPageByGrade(grade)); |
| | | } |
| | | } |
| | |
| | | private final UserDepartmentMapper userDepartmentMapper; |
| | | private final DepartmentService departmentService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService, ExamPaperDepartmentService examPaperDepartmentService, ExamPaperSubjectService examPaperSubjectService, QuestionSubjectService questionSubjectService, ExamPaperUserService examPaperUserService, UserService userService, UserDepartmentMapper userDepartmentMapper, DepartmentService departmentService) { |
| | | super(examPaperMapper); |
| | |
| | | Integer multipleChoice = examPaperEditRequestVM.getQuestionTypeVMS().stream().mapToInt(QuestionTypeVM::getMultipleChoice).sum(); |
| | | //判断 |
| | | Integer judgment = examPaperEditRequestVM.getQuestionTypeVMS().stream().mapToInt(QuestionTypeVM::getTrueFalse).sum(); |
| | | if ((singleChoice * 2 + multipleChoice * 2 + judgment * 2) != new Integer(20)) { |
| | | |
| | | |
| | | if ((singleChoice * 2 + multipleChoice * 2 + judgment * 2) != new Integer(100)) { |
| | | throw new QuestionException(); |
| | | } |
| | | |
| | |
| | | Map<Integer, Integer> multipleMap = list.stream() |
| | | .filter(e -> e.getQuestionType().equals(QuestionTypeEnum.MultipleChoice.getCode())) |
| | | .collect(Collectors.toMap(Question::getId, Question::getScore)); |
| | | Integer multipleSource = questionTypeVM.getMultipleChoice() * 5; |
| | | Integer multipleSource = questionTypeVM.getMultipleChoice() * 2; |
| | | selectRandomScores(multiple, multipleMap, questionTypeVM.getMultipleChoice(), multipleSource); |
| | | |
| | | |
| | |
| | | package com.mindskip.xzs.viewmodel.admin.exam; |
| | | |
| | | |
| | | |
| | | import com.mindskip.xzs.domain.ExamPaperDepartment; |
| | | import com.mindskip.xzs.domain.ExamPaperSubject; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
New file |
| | |
| | | package com.mindskip.xzs.viewmodel.admin.paper; |
| | | |
| | | import com.mindskip.xzs.base.BasePage; |
| | | |
| | | public class ExamPaperGradePageRequestVM extends BasePage { |
| | | private Integer subjectId; |
| | | |
| | | private String userName; |
| | | |
| | | private String paperName; |
| | | |
| | | private Integer counts; |
| | | |
| | | |
| | | |
| | | public Integer getSubjectId() { |
| | | return subjectId; |
| | | } |
| | | |
| | | public void setSubjectId(Integer subjectId) { |
| | | this.subjectId = subjectId; |
| | | } |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getPaperName() { |
| | | return paperName; |
| | | } |
| | | |
| | | public void setPaperName(String paperName) { |
| | | this.paperName = paperName; |
| | | } |
| | | |
| | | public Integer getCounts() { |
| | | return counts; |
| | | } |
| | | |
| | | public void setCounts(Integer counts) { |
| | | this.counts = counts; |
| | | } |
| | | } |
| | |
| | | |
| | | private Double avgSource; |
| | | |
| | | private Integer counts; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setAvgSource(Double avgSource) { |
| | | this.avgSource = avgSource; |
| | | } |
| | | public Integer getCounts() { |
| | | return counts; |
| | | } |
| | | |
| | | public void setCounts(Integer counts) { |
| | | this.counts = counts; |
| | | } |
| | | } |
| | |
| | | <result column="create_user" jdbcType="INTEGER" property="createUser" /> |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" /> |
| | | </resultMap> |
| | | <result column="counts" jdbcType="INTEGER" property="counts"/></resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, |
| | | paper_score, question_correct, question_count, do_time, status, create_user, create_time, |
| | |
| | | id, exam_paper_id, paper_name, paper_type, subject_id, system_score, TRUNCATE(user_score/10,0) as user_score, |
| | | TRUNCATE(paper_score/10,0) as paper_score, question_correct, question_count, do_time, status, create_user, create_time, |
| | | task_exam_id |
| | | </sql> |
| | | <sql id="Base_Column_List2"> |
| | | id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, |
| | | paper_score, question_correct, question_count, do_time, status, create_user, create_time, |
| | | task_exam_id,counts |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
| | | select |
| | |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="adminPageByGrade" resultMap="BaseResultMap" parameterType="com.mindskip.xzs.viewmodel.admin.paper.ExamPaperGradePageRequestVM"> |
| | | select |
| | | <include refid="Base_Column_List2" /> |
| | | from t_exam_paper_answer |
| | | <where> |
| | | <if test="subjectId != null"> |
| | | and subject_id = #{subjectId} |
| | | </if> |
| | | <if test="paperName != null and paperName != ''"> |
| | | and paper_name like concat('%',#{paperName},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |