| | |
| | | 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.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.training.entity.TrainExam; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | import org.springblade.modules.training.service.TrainingRegistrationService; |
| | |
| | | |
| | | |
| | | private final TrainingRegistrationService trainingRegistrationService; |
| | | |
| | | |
| | | private final IUserService userService; |
| | | |
| | | |
| | | /** |
| | |
| | | @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); |
| | | } |
| | | |
| | |
| | | return R.data(examPaperService.getExamDetail(userId)); |
| | | } |
| | | |
| | | /** |
| | | * 考试名单确认 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping("/applyConfirm") |
| | | public R applyConfirm(@RequestBody ExamPaper exam) { |
| | | exam.setConfirmTime(new Date()); |
| | | boolean status = examPaperService.updateById(exam); |
| | | //内网数据同步 |
| | | String s1 = |
| | | "update ksxt_exam set confirm_user = " + "'" + exam.getConfirmUser()+ "'" |
| | | + ",confirm_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(exam.getConfirmTime())+ "'" |
| | | + " " +"where id = " + "'" + exam.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //返回数据 |
| | | return R.data(status); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 审核修改 |
| | |
| | | */ |
| | | @PostMapping("/update-audit") |
| | | public R updateAudit(@RequestBody ExamPaper examPaper){ |
| | | examPaper.setAuditTime(new Date()); |
| | | //修改考试审核状态 |
| | | boolean status = examPaperService.updateById(examPaper); |
| | | //数据同步 |
| | | String s1 = |
| | | "update ksxt_exam set audit_status = " + "'" + examPaper.getAuditStatus()+ "'" |
| | | + ",audit_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getAuditTime())+ "'" |
| | | + " " +"where id = " + "'" + examPaper.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //查询当前考试已报名的人员培训报名数据集合 |
| | | List<TrainingRegistration> trainingRegistrations = examPaperService.getTrainList(examPaper.getId()); |
| | | // System.out.println("trainingRegistrations = " + trainingRegistrations); |
| | | if (trainingRegistrations.size()>0) { |
| | | trainingRegistrations.forEach(trainingRegistration -> { |
| | | //生成准考证号 |
| | | trainingRegistration.setCandidateNo(getCandidateNo(examPaper)); |
| | | //审核通过 |
| | | if (examPaper.getAuditStatus()==1) { |
| | | trainingRegistration.setAuditStatus(1); |
| | | } |
| | | //审核不通过 |
| | | if (examPaper.getAuditStatus()==2) { |
| | | trainingRegistration.setAuditStatus(2); |
| | | } |
| | | //待审核 |
| | | if (examPaper.getAuditStatus()==3) { |
| | | trainingRegistration.setAuditStatus(3); |
| | | } |
| | | //修改培训报名信息 |
| | | trainingRegistrationService.updateById(trainingRegistration); |
| | | //查询之前的审核状态,如果审核状态没有发生改变,则不会去修改审核信息 |
| | | ExamPaper paper = examPaperService.getById(examPaper.getId()); |
| | | if (null!=paper.getAuditStatus()){ |
| | | //审核状态发生改变 |
| | | if (!paper.getAuditStatus().equals(examPaper.getAuditStatus())){ |
| | | examPaper.setAuditTime(new Date()); |
| | | //修改考试审核状态 |
| | | boolean status = examPaperService.updateById(examPaper); |
| | | //数据同步 |
| | | String s2 = |
| | | "update sys_training_registration set candidate_no = " + "'" + trainingRegistration.getCandidateNo()+ "'" |
| | | + ",audit_status = " + "'" + trainingRegistration.getAuditStatus() + "'" |
| | | + " " +"where id = " + "'" + trainingRegistration.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s2); |
| | | }); |
| | | String s1 = |
| | | "update ksxt_exam set audit_status = " + "'" + examPaper.getAuditStatus()+ "'" |
| | | + ",audit_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getAuditTime())+ "'" |
| | | + " " +"where id = " + "'" + examPaper.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | //查询当前考试已报名的人员培训报名数据集合 |
| | | List<TrainingRegistration> trainingRegistrations = examPaperService.getTrainList(examPaper.getId()); |
| | | // System.out.println("trainingRegistrations = " + trainingRegistrations); |
| | | if (trainingRegistrations.size()>0) { |
| | | trainingRegistrations.forEach(trainingRegistration -> { |
| | | //审核通过,则生成准考证号 |
| | | if (examPaper.getAuditStatus()==1) { |
| | | trainingRegistration.setAuditStatus(1); |
| | | //查询当前用户审核状态,如果异常,则审核不通过 |
| | | User user = userService.getById(trainingRegistration.getUserId()); |
| | | if (null!=user){ |
| | | if (null!=user.getExaminationType() && !user.getExaminationType().equals("")){ |
| | | if (user.getExaminationType().equals("1")){ |
| | | //审核不通过 |
| | | trainingRegistration.setAuditStatus(2); |
| | | } |
| | | } |
| | | } |
| | | //生成准考证号 |
| | | trainingRegistration.setCandidateNo(getCandidateNo(examPaper)); |
| | | } |
| | | //审核不通过 |
| | | if (examPaper.getAuditStatus()==2) { |
| | | trainingRegistration.setAuditStatus(2); |
| | | } |
| | | //待审核 |
| | | if (examPaper.getAuditStatus()==3) { |
| | | trainingRegistration.setAuditStatus(3); |
| | | } |
| | | //修改培训报名信息 |
| | | trainingRegistrationService.updateById(trainingRegistration); |
| | | //数据同步 |
| | | String s2 = |
| | | "update sys_training_registration set candidate_no = " + "'" + trainingRegistration.getCandidateNo()+ "'" |
| | | + ",audit_status = " + "'" + trainingRegistration.getAuditStatus() + "'" |
| | | + " " +"where id = " + "'" + trainingRegistration.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s2); |
| | | }); |
| | | } |
| | | return R.status(status); |
| | | } |
| | | } |
| | | //返回 |
| | | return R.status(status); |
| | | return R.status(false); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | if (month<=9){ |
| | | months = "0" + month; |
| | | }else { |
| | | months = String.valueOf(month); |
| | | } |
| | | if (day<=9){ |
| | | days = "0" + day; |
| | |
| | | type = "m"; |
| | | } |
| | | //获取考试名称前缀,去除数字,字母 |
| | | String examName |
| | | = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1); |
| | | // String examName |
| | | // = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1); |
| | | |
| | | //前缀 = 年的最后两位 + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C) |
| | | // String result = year |
| | |
| | | // + quarter; |
| | | |
| | | //前缀 = 年的最后两位 + 月份(两位) + 日 (两位) + 考试类型 正式考试 z 模拟考试 m |
| | | String result = year |
| | | String pre = year |
| | | + months |
| | | + days |
| | | + type; |
| | | //查询是当前前缀已生成的数量 |
| | | int count = examPaperService.getCandidateNoCount(result); |
| | | if (count==0){ |
| | | return result + "0000"; |
| | | } |
| | | //查询是当前前缀已生成准考证号码最大的一位 |
| | | int count = examPaperService.getCandidateNoCount(pre); |
| | | String result = null; |
| | | //格式化 |
| | | DecimalFormat decimalFormat = new DecimalFormat("0000"); |
| | | count++; |
| | | result = pre + (decimalFormat.format(count)); |
| | | //返回 |
| | | return result + (decimalFormat.format(count++)); |
| | | return result; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 考试中页面刷新,1查询所有的答题信息,2查询所有的已答信息 3其他信息 |
| | | * @param examPaperVO 必须包含 scoreId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getExamRefreshInfo") |
| | | public R getExamRefreshInfo(ExamPaperVO examPaperVO){ |
| | | return R.data(examPaperService.getExamRefreshInfo(examPaperVO)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |