20 files modified
8 files added
| | |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.training.vo.TrainingRegistrationVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | @RequestMapping("/apply") |
| | | public class ApplyController { |
| | | |
| | | // @Autowired |
| | | private final ApplyService applyService; |
| | | |
| | | // @Autowired |
| | | private final ExamPaperService examPaperService; |
| | | |
| | | // @Autowired |
| | | private final IUserService userService; |
| | | |
| | | // @Autowired |
| | | private final ExamScoreService examScoreService; |
| | | |
| | | /** |
| | |
| | | examScore.setExamId(apply.getExamId().toString()); |
| | | examScore.setUserId(apply.getUserId().toString()); |
| | | examScore.setApplyId(apply.getId()); |
| | | examScore.setCandidateNo(apply.getCandidateNo()); |
| | | examScore.setExamTime(new Date()); |
| | | //新增考试成绩 |
| | | examScoreService.save(examScore); |
| | | //内网同步 |
| | | Long sid = examScore.getId(); |
| | | String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examScore.getExamTime()); |
| | | String s = "insert into exam_score(id,exam_time,user_id,exam_id,apply_id) " + |
| | | "values(" + "'" + sid + "'" + "," + "'" + |
| | | format + "'" + "," + "'" + |
| | | examScore.getUserId() +"'" + "," +"'" + |
| | | examScore.getExamId() +"'" + "," +"'" + |
| | | examScore.getApplyId() + "'" + ")"; |
| | | String s = "insert into exam_score(id,candidate_no,exam_time,user_id,exam_id,apply_id) " + |
| | | "values(" + "'" + sid + "'" + |
| | | "," + "'" + examScore.getCandidateNo() + "'" + |
| | | "," + "'" + format + "'" + |
| | | "," + "'" + examScore.getUserId() +"'" + |
| | | "," +"'" + examScore.getExamId() +"'" + |
| | | "," +"'" + examScore.getApplyId() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s); |
| | | return examScore; |
| | | } |
| | |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | * @author zhongrj |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements ApplyService { |
| | | |
| | | @Autowired |
| | | private ExamPaperService examPaperService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | private final IUserService userService; |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | @Autowired |
| | | private TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | /** |
| | | * 自定义分页数据 |
| New file |
| | |
| | | package org.springblade.modules.exam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.exam.entity.ExamSubjectOption; |
| | | import org.springblade.modules.exam.service.ExamSubjectOptionService; |
| | | import org.springblade.modules.exam.vo.ExamSubjectOptionVO; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | | * @time 2021-09-30 |
| | | * @desc 试卷 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/examExaminationSubject") |
| | | public class ExamExaminationSubjectController { |
| | | } |
| | |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.vo.ExamPaperSubjectVO; |
| | | import org.springblade.modules.exam.vo.ExamPaperVO; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.exam.wrapper.ExamPaperWrapper; |
| | | import org.springblade.modules.training.entity.TrainExam; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | |
| | | @GetMapping("/queryRandomSubject") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "考试题目绑定", notes = "传入exam") |
| | | public R<List> queryRandomSubject(@ApiParam(value = "主键集合") ExamPaper exam) { |
| | | List<ExamPaperSubjectVO> subject = examPaperService.queryRandomSubject(exam); |
| | | public R<List> queryRandomSubject(@ApiParam(value = "主键集合") ExamPaperVO exam) { |
| | | List<ExamSubjectChoicesVO> subject = examPaperService.queryRandomSubject(exam); |
| | | return R.data(subject); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 考试中页面刷新,1查询所有的答题信息,2查询所有的已答信息 3其他信息 |
| | | * @param examPaperVO 必须包含 scoreId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getExamRefreshInfo") |
| | | public R getExamRefreshInfo(ExamPaperVO examPaperVO){ |
| | | return R.data(examPaperService.getExamRefreshInfo(examPaperVO)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | return R.status(status); |
| | | } |
| | | |
| | | /** |
| | | * 考试重置(重考) |
| | | * @param updateParamVo |
| | | */ |
| | | @PostMapping("/refreshTrainExamInfo") |
| | | public R refreshTrainExamInfo(@RequestBody UpdateParamVo updateParamVo) { |
| | | return R.status(examScoreService.refreshTrainExamInfo(updateParamVo)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | //判断当前题目的答题结果 |
| | | if (examSubjectChoices.getPreSubJectId()!=null) { |
| | | if (null!=examSubjectChoices.getPreResult() && examSubjectChoices.getPreResult()!="" && !examSubjectChoices.getPreResult().equals("")) { |
| | | detail.setResult(examSubjectChoicesService.getAnswerResult(examSubjectChoices.getPreSubJectId(), examSubjectChoices.getPreResult())); |
| | | detail.setResult(examSubjectChoicesService.getAnswerResult(examSubjectChoices.getPreSubJectId(),examSubjectChoices.getPreResult(),examSubjectChoices.getScoreId())); |
| | | }else { |
| | | //无 |
| | | detail.setResult(3); |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * |
| | | * 答题记录表 |
| | | * @author zhongrj |
| | | * @since 2021-9-30 |
| | | */ |
| | | @Data |
| | | @TableName("exam_answer_record") |
| | | public class ExamAnswerRecord implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 题目id |
| | | */ |
| | | @TableField("subject_choices_id") |
| | | private Long subjectChoicesId; |
| | | |
| | | /** |
| | | * 题目类型 0:单选题 1:多选题 2:判断题 3:实操题(排 |
| | | */ |
| | | @TableField("subject_choices_type") |
| | | private Integer subjectChoicesType; |
| | | |
| | | /** |
| | | * 选项id |
| | | */ |
| | | @TableField("subject_option_id") |
| | | private Long subjectOptionId; |
| | | |
| | | /** |
| | | * 提交的选项 A,B,C.... |
| | | */ |
| | | @TableField("answer_option") |
| | | private String answerOption; |
| | | |
| | | /** |
| | | * 正确答案 |
| | | */ |
| | | private String answer; |
| | | |
| | | /** |
| | | * 答题时间 |
| | | */ |
| | | @TableField("answer_time") |
| | | private Date answerTime; |
| | | |
| | | |
| | | /** |
| | | * 本题得分 |
| | | */ |
| | | @TableField("answer_score") |
| | | private Integer answerScore; |
| | | |
| | | |
| | | /** |
| | | * 答题结果 1:答对 2:答错 |
| | | */ |
| | | @TableField("answer_result") |
| | | private Integer answerResult; |
| | | |
| | | /** |
| | | * 用户Id |
| | | */ |
| | | @TableField("user_id") |
| | | private String userId; |
| | | |
| | | /** |
| | | * 考试id (对应 ksxt_exam 表的id) |
| | | */ |
| | | @TableField("exam_id") |
| | | private Long examId; |
| | | |
| | | /** |
| | | * 报名id |
| | | */ |
| | | @TableField("apply_id") |
| | | private Long applyId; |
| | | |
| | | |
| | | /** |
| | | * 成绩id |
| | | */ |
| | | @TableField("score_id") |
| | | private Long scoreId; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 试卷id |
| | | * 成绩id |
| | | */ |
| | | @TableField("examination_id") |
| | | private String examinationId; |
| | | private Long examinationId; |
| | | |
| | | /** |
| | | * 分类 |
| | |
| | | * 题目id |
| | | */ |
| | | @TableField("subject_id") |
| | | private String subjectId; |
| | | private Long subjectId; |
| | | |
| | | |
| | | /** |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springblade.modules.exam.entity.ExamAnswerRecord; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface ExamAnswerRecordMapper extends BaseMapper<ExamAnswerRecord> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springblade.modules.exam.entity.ExamExaminationSubject; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface ExamExaminationSubjectMapper extends BaseMapper<ExamExaminationSubject> { |
| | | } |
| | |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.vo.ExamPaperSubjectVO; |
| | | import org.springblade.modules.exam.vo.ExamPaperVO; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | ExamPaperSubjectVO queryPagerSubject(@Param("paper") ExamPaper paper); |
| | | |
| | | List<ExamPaperSubjectVO> queryRandomSubject(@Param("paper") ExamPaper paper); |
| | | List<ExamSubjectChoicesVO> queryRandomSubject(@Param("paper") ExamPaper paper); |
| | | |
| | | ExamPaperSubjectVO PagerSubject(@Param("paper") ExamPaper paper); |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<Apply> getApplyDetail(@Param("userId")String userId); |
| | | |
| | | /** |
| | | * 查询当前人员当前考试的考试题目信息 |
| | | * @param examPaperVO |
| | | * @return |
| | | */ |
| | | List<ExamSubjectChoicesVO> getExaminationSubjectList(@Param("examPaper")ExamPaperVO examPaperVO); |
| | | } |
| | |
| | | ) |
| | | </select> |
| | | |
| | | <!--查询当前人员当前考试的考试题目信息--> |
| | | <select id="getExaminationSubjectList" resultType="org.springblade.modules.exam.vo.ExamSubjectChoicesVO"> |
| | | SELECT esc.* FROM exam_subject_choices esc |
| | | left join |
| | | exam_examination_subject ees |
| | | on |
| | | esc.id = ees.subject_id |
| | | where 1=1 |
| | | and ees.examination_id = #{examPaper.scoreId} |
| | | </select> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright exam, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * exam, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.exam.entity.ExamAnswerRecord; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface ExamAnswerRecordService extends IService<ExamAnswerRecord> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright exam, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * exam, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.exam.entity.ExamExaminationSubject; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface ExamExaminationSubjectService extends IService<ExamExaminationSubject> { |
| | | } |
| | |
| | | import org.springblade.modules.exam.vo.ExamPaperSubjectVO; |
| | | import org.springblade.modules.exam.vo.ExamPaperVO; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | ExamPaperSubjectVO queryPagerSubject(ExamPaper paper); |
| | | |
| | | List<ExamPaperSubjectVO> queryRandomSubject(ExamPaper paper); |
| | | List<ExamSubjectChoicesVO> queryRandomSubject(ExamPaperVO paper); |
| | | |
| | | /** |
| | | * 计算成绩返回答案接口 |
| | |
| | | * @return |
| | | */ |
| | | List<Apply> getApplyDetail(String userId); |
| | | |
| | | /** |
| | | * 考试中页面刷新,1查询所有的答题信息,2查询所有的已答信息 3其他信息 |
| | | * @param examPaperVO 必须包含 scoreId |
| | | * @return |
| | | */ |
| | | Map<String,Object> getExamRefreshInfo(ExamPaperVO examPaperVO); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 考试成绩及状态修改 |
| | | * @param examScore |
| | | * @param updateParamVo |
| | | */ |
| | | boolean updateExamScore(UpdateParamVo updateParamVo); |
| | | |
| | | /** |
| | | * 考试重置 |
| | | * @param updateParamVo |
| | | * @return |
| | | */ |
| | | boolean refreshTrainExamInfo(UpdateParamVo updateParamVo); |
| | | } |
| | |
| | | * @param preResult 提交的结果 |
| | | * @return |
| | | */ |
| | | Integer getAnswerResult(Long preSubJectId, String preResult); |
| | | Integer getAnswerResult(Long preSubJectId, String preResult,Long scoreId); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.exam.entity.ExamAnswerRecord; |
| | | import org.springblade.modules.exam.mapper.ExamAnswerRecordMapper; |
| | | import org.springblade.modules.exam.service.ExamAnswerRecordService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Service |
| | | public class ExamAnswerRecordServiceImpl extends ServiceImpl<ExamAnswerRecordMapper, ExamAnswerRecord> implements ExamAnswerRecordService { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.exam.entity.ExamExaminationSubject; |
| | | import org.springblade.modules.exam.mapper.ExamExaminationSubjectMapper; |
| | | import org.springblade.modules.exam.service.ExamExaminationSubjectService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Service |
| | | public class ExamExaminationSubjectServiceImpl extends ServiceImpl<ExamExaminationSubjectMapper, ExamExaminationSubject> implements ExamExaminationSubjectService { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.exam.entity.ExamPaper; |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.entity.*; |
| | | import org.springblade.modules.exam.mapper.ExamPaperMapper; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.*; |
| | | import org.springblade.modules.exam.vo.ExamPaperSubjectVO; |
| | | import org.springblade.modules.exam.vo.ExamPaperVO; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | */ |
| | | @Service |
| | | public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper> implements ExamPaperService { |
| | | |
| | | @Autowired |
| | | private ExamExaminationSubjectService examExaminationSubjectService; |
| | | |
| | | @Autowired |
| | | private ExamAnswerRecordService examAnswerRecordService; |
| | | |
| | | @Autowired |
| | | private ExamSubjectChoicesService examSubjectChoicesService; |
| | | |
| | | @Autowired |
| | | private ExamScoreService examScoreService; |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ExamPaperSubjectVO> queryRandomSubject(ExamPaper paper) { |
| | | //随机分类信息 |
| | | return baseMapper.queryRandomSubject(paper); |
| | | public List<ExamSubjectChoicesVO> queryRandomSubject(ExamPaperVO paper) { |
| | | //保存题目信息 |
| | | if (null!=paper.getScoreId()){ |
| | | //随机分类信息 |
| | | List<ExamSubjectChoicesVO> examSubjectChoicesVOS = baseMapper.queryRandomSubject(paper); |
| | | examSubjectChoicesVOS.forEach(examSubjectChoicesVO -> { |
| | | //新增个人对应每场考试成绩试卷 |
| | | ExamExaminationSubject ksxtSginup = new ExamExaminationSubject(); |
| | | ksxtSginup.setExaminationId(paper.getScoreId()); |
| | | ksxtSginup.setCategoryId(examSubjectChoicesVO.getChoicesType()); |
| | | ksxtSginup.setSubjectId(examSubjectChoicesVO.getId()); |
| | | //新增 |
| | | examExaminationSubjectService.save(ksxtSginup); |
| | | }); |
| | | //新增试卷关联信息 |
| | | return examSubjectChoicesVOS; |
| | | } |
| | | //返回 |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | |
| | | public List<Apply> getApplyDetail(String userId) { |
| | | return baseMapper.getApplyDetail(userId); |
| | | } |
| | | |
| | | /** |
| | | * 考试中页面刷新,1查询所有的答题信息,2查询所有的已答信息 3.下一题信息 3其他信息 |
| | | * @param examPaperVO 必须包含 scoreId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, Object> getExamRefreshInfo(ExamPaperVO examPaperVO) { |
| | | if (null!=examPaperVO.getScoreId()) { |
| | | Map<String, Object> map = new HashMap<>(4); |
| | | //1.查询当前人员当前考试的考试题目信息 |
| | | List<ExamSubjectChoicesVO> examSubjectChoicesVOSList = baseMapper.getExaminationSubjectList(examPaperVO); |
| | | |
| | | //2.查询当前人员已答的题目信息 |
| | | ExamAnswerRecord examAnswerRecord = new ExamAnswerRecord(); |
| | | examAnswerRecord.setScoreId(examPaperVO.getScoreId()); |
| | | List<ExamAnswerRecord> examAnswerRecordList = examAnswerRecordService.list(Condition.getQueryWrapper(examAnswerRecord)); |
| | | |
| | | //3.查询正在答题的信息 |
| | | int count = examAnswerRecordList.size(); |
| | | //查询下一题题目信息 |
| | | ExamSubjectChoicesVO examSubjectChoicesVO = new ExamSubjectChoicesVO(); |
| | | ExamSubjectChoices examSubjectChoices = new ExamSubjectChoices(); |
| | | if (count>0) { |
| | | examSubjectChoices.setId(examSubjectChoicesVOSList.get(count).getId()); |
| | | examSubjectChoicesVO = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | } |
| | | if (count==0) { |
| | | examSubjectChoices.setId(examSubjectChoicesVOSList.get(0).getId()); |
| | | examSubjectChoicesVO = examSubjectChoicesService.selectExamSubjectChoicesInfo(examSubjectChoices); |
| | | } |
| | | |
| | | //4.其他信息 |
| | | ExamScore examScore = examScoreService.getById(examPaperVO.getScoreId()); |
| | | |
| | | |
| | | //5.数据封装 |
| | | map.put("examSubjectChoicesVOSList",examSubjectChoicesVOSList); |
| | | map.put("examAnswerRecordList",examAnswerRecordList); |
| | | map.put("examSubjectChoicesVO",examSubjectChoicesVO); |
| | | map.put("examScore",examScore); |
| | | |
| | | //6.返回数据 |
| | | return map; |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | import org.springblade.modules.system.vo.UserVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | * @author zhongrj |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ExamScoreServiceImpl extends ServiceImpl<ExamScoreMapper, ExamScore> implements ExamScoreService { |
| | | |
| | | private final IUserService userService; |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | private final ExamSubjectChoicesService examSubjectChoicesService; |
| | | @Autowired |
| | | private ExamSubjectChoicesService examSubjectChoicesService; |
| | | |
| | | private final ExamPaperService examPaperService; |
| | | @Autowired |
| | | private ExamPaperService examPaperService; |
| | | |
| | | private final ApplyService applyService; |
| | | @Autowired |
| | | private ApplyService applyService; |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | @Autowired |
| | | private TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | private final IRoleService roleService; |
| | | @Autowired |
| | | private IRoleService roleService; |
| | | |
| | | /** |
| | | * 自定义分页数据 |
| | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 考试重置 |
| | | * @param updateParamVo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean refreshTrainExamInfo(UpdateParamVo updateParamVo) { |
| | | if (null!=updateParamVo.getScoreId()){ |
| | | ExamScore examScore = this.getById(updateParamVo.getScoreId()); |
| | | //获取成绩数据,准考证号,用户id,报名培训id,考试id |
| | | if (null!=examScore){ |
| | | ExamPaper paper = examPaperService.getById(examScore.getExamId()); |
| | | //判断考试类型 |
| | | //考试 |
| | | if (paper.getExamType()==1){ |
| | | //1.修改培训报名信息 |
| | | Apply apply = new Apply(); |
| | | apply.setId(examScore.getApplyId()); |
| | | apply.setIsExam(1); |
| | | //修改 |
| | | applyService.updateById(apply); |
| | | |
| | | //2.修改用户考试状态 |
| | | User user = new User(); |
| | | user.setIsTrain(1); |
| | | user.setId(Long.parseLong(examScore.getUserId())); |
| | | //修改 |
| | | userService.updateById(user); |
| | | |
| | | //3.删除当前考试成绩信息 |
| | | this.removeById(updateParamVo.getScoreId()); |
| | | |
| | | //4.内网数据同步 |
| | | String s1 = |
| | | "update sys_apply set is_exam = " + "'" + apply.getIsExam() + "'" + |
| | | " " + "where id = " + "'" + apply.getId() + "';"+ |
| | | "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" + |
| | | " " + "where id = " + "'" + user.getId() + "';"+ |
| | | "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | |
| | | return true; |
| | | } |
| | | //培训考试 |
| | | if (paper.getExamType()==2){ |
| | | //1.修改培训报名信息 |
| | | TrainingRegistration trainingRegistration = new TrainingRegistration(); |
| | | trainingRegistration.setId(examScore.getApplyId()); |
| | | trainingRegistration.setIsExam(1); |
| | | //修改 |
| | | trainingRegistrationService.updateById(trainingRegistration); |
| | | |
| | | //2.修改用户考试状态 |
| | | User user = new User(); |
| | | user.setIsTrain(1); |
| | | user.setId(Long.parseLong(examScore.getUserId())); |
| | | //修改 |
| | | userService.updateById(user); |
| | | |
| | | //3.删除当前考试成绩信息 |
| | | this.removeById(updateParamVo.getScoreId()); |
| | | |
| | | //4.内网数据同步 |
| | | String s1 = |
| | | "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" + |
| | | " " + "where id = " + "'" + trainingRegistration.getId() + "';"+ |
| | | "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" + |
| | | " " + "where id = " + "'" + user.getId() + "';"+ |
| | | "delete from exam_score where id = " + "'" + updateParamVo.getScoreId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.modules.exam.entity.ExamAnswerRecord; |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.entity.ExamSubjectOption; |
| | | import org.springblade.modules.exam.excel.ExamSubjectExcel; |
| | | import org.springblade.modules.exam.mapper.ExamSubjectChoicesMapper; |
| | | import org.springblade.modules.exam.service.ExamAnswerRecordService; |
| | | import org.springblade.modules.exam.service.ExamSubjectChoicesService; |
| | | import org.springblade.modules.exam.service.ExamSubjectOptionService; |
| | | import org.springblade.modules.exam.vo.ExamSubjectChoicesVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | * @author zhongrj |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class ExamSubjectChoicesServiceImpl extends ServiceImpl<ExamSubjectChoicesMapper, ExamSubjectChoices> implements ExamSubjectChoicesService { |
| | | |
| | | private final ExamSubjectOptionService examSubjectOptionService; |
| | | @Autowired |
| | | private ExamSubjectOptionService examSubjectOptionService; |
| | | |
| | | @Autowired |
| | | private ExamAnswerRecordService examAnswerRecordService; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ExamSubjectChoicesVO> selectExamSubjectChoicesPage(IPage<ExamSubjectChoicesVO> page, ExamSubjectChoicesVO examSubjectChoices) { |
| | |
| | | * 判断当前题目的答题结果 |
| | | * @param preSubJectId 题目Id |
| | | * @param preResult 提交的结果 |
| | | * @param scoreId 成绩id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getAnswerResult(Long preSubJectId, String preResult) { |
| | | public Integer getAnswerResult(Long preSubJectId, String preResult,Long scoreId) { |
| | | //查询题目信息 |
| | | ExamSubjectChoices choices = this.getById(preSubJectId); |
| | | //对比答案 |
| | | if (choices.getChoicesType() == 2 || choices.getChoicesType() == 3){ |
| | | //保存答题记录 |
| | | boolean result = preResult.equals(choices.getAnswer()); |
| | | int status = 0; |
| | | //判断题逻辑 |
| | | if (preResult.equals(choices.getAnswer())) { |
| | | return 1; |
| | | if (result){ |
| | | status = 1; |
| | | }else { |
| | | return 2; |
| | | status = 2; |
| | | } |
| | | //新增答题记录 |
| | | saveExamAns(choices,preSubJectId,preResult,scoreId,result); |
| | | //返回 |
| | | return status; |
| | | }else if(choices.getChoicesType() == 0 || choices.getChoicesType() == 1){ |
| | | //处理多选题的答案排序 |
| | | String[] split = preResult.split(","); |
| | |
| | | Arrays.sort(arrayCh); |
| | | String sub0 = Arrays.toString(arrayCh); |
| | | String sub = sub0.substring(1,sub0.length()-1).replaceAll(" ",""); |
| | | if (sub.equals(choices.getAnswer())) { |
| | | return 1; |
| | | |
| | | //保存答题记录 |
| | | boolean result = sub.equals(choices.getAnswer()); |
| | | int status = 0; |
| | | //判断题逻辑 |
| | | if (result){ |
| | | status = 1; |
| | | }else { |
| | | return 2; |
| | | status = 2; |
| | | } |
| | | //新增答题记录 |
| | | saveExamAns(choices,preSubJectId,preResult,scoreId,result); |
| | | //返回 |
| | | return status; |
| | | } |
| | | return 2; |
| | | } |
| | | |
| | | /** |
| | | * 新增答题记录 |
| | | * @param choices |
| | | * @param preSubJectId |
| | | * @param preResult |
| | | * @param scoreId |
| | | * @param result |
| | | */ |
| | | private void saveExamAns(ExamSubjectChoices choices, Long preSubJectId, String preResult, Long scoreId,boolean result) { |
| | | ExamAnswerRecord examAnswerRecord = new ExamAnswerRecord(); |
| | | examAnswerRecord.setScoreId(scoreId); |
| | | examAnswerRecord.setAnswerOption(preResult); |
| | | examAnswerRecord.setSubjectChoicesId(preSubJectId); |
| | | examAnswerRecord.setAnswer(choices.getAnswer()); |
| | | examAnswerRecord.setSubjectChoicesType(choices.getChoicesType()); |
| | | examAnswerRecord.setAnswerTime(new Date()); |
| | | int status = 0; |
| | | //判断题逻辑 |
| | | if (result){ |
| | | status = 1; |
| | | examAnswerRecord.setAnswerScore(choices.getScore()); |
| | | }else { |
| | | status = 2; |
| | | examAnswerRecord.setAnswerScore(0); |
| | | } |
| | | examAnswerRecord.setAnswerResult(status); |
| | | //新增 |
| | | examAnswerRecordService.save(examAnswerRecord); |
| | | |
| | | //内网数据同步... |
| | | } |
| | | } |
| | |
| | | * 申请人部门id |
| | | */ |
| | | private String deptId; |
| | | |
| | | /** |
| | | * 得分 |
| | | */ |
| | | private Long scoreId; |
| | | } |
| | |
| | | * 上一题的答题结果,对,错 1:对 2:错 |
| | | */ |
| | | private Integer result; |
| | | |
| | | /** |
| | | * 成绩id |
| | | */ |
| | | private Long scoreId; |
| | | } |
| | |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 考试重置vo |
| | | */ |
| | | @Data |
| | | public class UpdateParamVo implements Serializable { |
| | | |
| | | private Integer type; |
| | | |
| | | private Long scoreId; |
| | | |
| | | } |
| | |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | //内网同步 |
| | | List<Long> list = Func.toLongList(ids); |
| | | list.forEach(id -> { |
| | | String s1 = "delete from sys_member where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }); |
| | | return R.status(memberService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * 保安公司主要出资人信息 |
| | | * |
| | | * @author BladeX |
| | | * @since 2021-07-06 |
| | |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | //内网同步 |
| | | List<Long> list = Func.toLongList(ids); |
| | | list.forEach(id -> { |
| | | String s1 = "delete from sys_shareholder where id = " + "'" + id + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | }); |
| | | return R.status(shareholderService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | |
| | | ke.id = sr.train_exam_id |
| | | WHERE |
| | | 1=1 |
| | | and bu.status = 1 |
| | | and bu.is_deleted = 0 |
| | | <if test="trainingRegistration.isExam!=null"> |
| | | and is_exam = #{trainingRegistration.isExam} |
| | | </if> |