| | |
| | | //默认为未考试状态 |
| | | trainingRegistration1.setIsExam(1); |
| | | //未提交考试审核 |
| | | trainingRegistration.setAuditStatus(4); |
| | | trainingRegistration1.setAuditStatus(4); |
| | | trainingRegistration1.setTrainingTime(new Date()); |
| | | trainingRegistration1.setUserId(userId); |
| | | trainingRegistration1.setTrainingUnitId(trainingRegistration.getTrainingUnitId()); |
| | |
| | | //默认为未考试状态 |
| | | trainingRegistration1.setIsExam(1); |
| | | //未提交考试审核 |
| | | trainingRegistration.setAuditStatus(4); |
| | | trainingRegistration1.setAuditStatus(4); |
| | | trainingRegistration1.setTrainingTime(new Date()); |
| | | trainingRegistration1.setUserId(userId); |
| | | trainingRegistration1.setTrainingUnitId(trainingRegistration.getTrainingUnitId()); |
| | |
| | | * 生成准考证号码 |
| | | * @param trainingRegistration 考试报名信息对象 |
| | | */ |
| | | private String getCandidateNo(TrainingRegistration trainingRegistration) { |
| | | //获取考试信息 |
| | | ExamPaper examPaper = examPaperService.getById(trainingRegistration.getTrainExamId()); |
| | | if (null!=examPaper.getStartTime()){ |
| | | String format = new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime()); |
| | | String year = format.substring(2,4); |
| | | String quarter = null; |
| | | String months = null; |
| | | String days = null; |
| | | int month = Integer.parseInt(format.substring(5,7)); |
| | | int day = Integer.parseInt(format.substring(8,10)); |
| | | if (month>0 && month<=3){ |
| | | quarter = "C"; |
| | | } |
| | | if (month>3 && month<=6){ |
| | | quarter = "X"; |
| | | } |
| | | if (month>6 && month<=9){ |
| | | quarter = "Q"; |
| | | } |
| | | if (month>9 && month<=12){ |
| | | quarter = "D"; |
| | | } |
| | | if (month<=9){ |
| | | months = "0" + month; |
| | | } |
| | | if (day<=9){ |
| | | days = "0" + day; |
| | | } |
| | | //获取考试名称前缀,去除数字,字母 |
| | | String examName |
| | | = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1); |
| | | |
| | | //前缀 = 年的最后两位 + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C) |
| | | String result = year |
| | | + months |
| | | + toFirstChar(examName).toUpperCase() |
| | | + examPaper.getExamType() |
| | | + quarter; |
| | | //查询是当前前缀已生成的数量 |
| | | int count = trainingRegistrationService.getCandidateNoCount(result); |
| | | if (count==0){ |
| | | return result + "0000"; |
| | | } |
| | | //格式化 |
| | | DecimalFormat decimalFormat = new DecimalFormat("0000"); |
| | | //返回 |
| | | return result + (decimalFormat.format(count++)); |
| | | } |
| | | return null; |
| | | } |
| | | // private String getCandidateNo(TrainingRegistration trainingRegistration) { |
| | | // //获取考试信息 |
| | | // ExamPaper examPaper = examPaperService.getById(trainingRegistration.getTrainExamId()); |
| | | // if (null!=examPaper.getStartTime()){ |
| | | // String format = new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime()); |
| | | // String year = format.substring(2,4); |
| | | // String quarter = null; |
| | | // String months = null; |
| | | // String days = null; |
| | | // int month = Integer.parseInt(format.substring(5,7)); |
| | | // int day = Integer.parseInt(format.substring(8,10)); |
| | | // if (month>0 && month<=3){ |
| | | // quarter = "C"; |
| | | // } |
| | | // if (month>3 && month<=6){ |
| | | // quarter = "X"; |
| | | // } |
| | | // if (month>6 && month<=9){ |
| | | // quarter = "Q"; |
| | | // } |
| | | // if (month>9 && month<=12){ |
| | | // quarter = "D"; |
| | | // } |
| | | // if (month<=9){ |
| | | // months = "0" + month; |
| | | // } |
| | | // if (day<=9){ |
| | | // days = "0" + day; |
| | | // } |
| | | // //获取考试名称前缀,去除数字,字母 |
| | | // String examName |
| | | // = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1); |
| | | // |
| | | // //前缀 = 年的最后两位 + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C) |
| | | // String result = year |
| | | // + months |
| | | // + toFirstChar(examName).toUpperCase() |
| | | // + examPaper.getExamType() |
| | | // + quarter; |
| | | // //查询是当前前缀已生成的数量 |
| | | // int count = trainingRegistrationService.getCandidateNoCount(result); |
| | | // if (count==0){ |
| | | // return result + "0000"; |
| | | // } |
| | | // //格式化 |
| | | // DecimalFormat decimalFormat = new DecimalFormat("0000"); |
| | | // //返回 |
| | | // return result + (decimalFormat.format(count++)); |
| | | // } |
| | | // return null; |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | /** |
| | | * 生成试卷,报名 |
| | | * 生成试卷,报名,考试申请 |
| | | * @param trainingRegistrationVo 考试开始时 |
| | | */ |
| | | @PostMapping("/batchExam") |
| | |
| | | int day = instance.get(Calendar.DAY_OF_MONTH); |
| | | String examName = year + "年" + month+ "月"+ day +"日" +"保安员证培训考试"; |
| | | examPaper.setExamName(examName); |
| | | examPaper.setCreator(trainingRegistrationVo.getCreator()); |
| | | //待审核 |
| | | examPaper.setAuditStatus(3); |
| | | //创建时间 |
| | | examPaper.setCreatorDate(new Date()); |
| | | //生成考试 |
| | | examPaperService.save(examPaper); |
| | | |
| | | Long sid = examPaper.getId(); |
| | | String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime()); |
| | | String endTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getEndTime()); |
| | | String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,end_time,audit_status) " + |
| | | String creatorTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getCreatorDate()); |
| | | String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,end_time,creator,creator_date,audit_status) " + |
| | | "values(" + "'" + sid + "'" + |
| | | "," + "'" + examPaper.getExamName() + "'" + |
| | | "," + "'" + examPaper.getExamType() +"'" + |
| | | "," + "'" + format +"'" + |
| | | "," + "'" + endTimeFormat +"'" + |
| | | "," + "'" + examPaper.getCreator() +"'" + |
| | | "," + "'" + creatorTimeFormat +"'" + |
| | | "," +"'" + examPaper.getAuditStatus() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s); |
| | | |
| | | |
| | | //修改报名信息 |
| | | applyIds.forEach(trainingRegistration ->{ |
| | | if(null==trainingRegistration.getTrainExamId() && trainingRegistration.getTrainExamId()=="") { |
| | | if(null==trainingRegistration.getTrainExamId() || trainingRegistration.getTrainExamId()=="") { |
| | | trainingRegistration.setTrainExamId(examPaper.getId().toString()); |
| | | //提交考试审核 |
| | | trainingRegistration.setAuditStatus(3); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成试卷,报名,考试申请 |
| | | * @param trainingRegistrationVo 考试开始时 |
| | | */ |
| | | @PostMapping("/batchTrainExam") |
| | | public R batchTrainExam(@RequestBody TrainingRegistrationVo trainingRegistrationVo){ |
| | | //查询已报名未关联试卷的人员,同步报名列表 |
| | | String ids = trainingRegistrationVo.getIds(); |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | if (list.size()>0){ |
| | | //生成考试 |
| | | ExamPaper examPaper = new ExamPaper(); |
| | | //考试类型 |
| | | examPaper.setExamType(2); |
| | | //考试开始时间,考试开始截止时间 |
| | | examPaper.setStartTime(trainingRegistrationVo.getStartTime()); |
| | | examPaper.setEndTime(trainingRegistrationVo.getEndTime()); |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.setTime(trainingRegistrationVo.getStartTime()); |
| | | int year = instance.get(Calendar.YEAR); |
| | | int month = instance.get(Calendar.MONTH)+1; |
| | | int day = instance.get(Calendar.DAY_OF_MONTH); |
| | | String examName = year + "年" + month+ "月"+ day +"日" +"保安员证培训考试"; |
| | | //考试名称 |
| | | examPaper.setExamName(examName); |
| | | //考试申请人 |
| | | examPaper.setCreator(trainingRegistrationVo.getCreator()); |
| | | //待审核 |
| | | examPaper.setAuditStatus(3); |
| | | //创建时间 |
| | | examPaper.setCreatorDate(new Date()); |
| | | //生成考试 |
| | | examPaperService.save(examPaper); |
| | | //内网数据同步 |
| | | Long sid = examPaper.getId(); |
| | | String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime()); |
| | | String endTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getEndTime()); |
| | | String creatorTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getCreatorDate()); |
| | | String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time,end_time,creator,creator_date,audit_status) " + |
| | | "values(" + "'" + sid + "'" + |
| | | "," + "'" + examPaper.getExamName() + "'" + |
| | | "," + "'" + examPaper.getExamType() +"'" + |
| | | "," + "'" + format +"'" + |
| | | "," + "'" + endTimeFormat +"'" + |
| | | "," + "'" + examPaper.getCreator() +"'" + |
| | | "," + "'" + creatorTimeFormat +"'" + |
| | | "," +"'" + examPaper.getAuditStatus() + "'" + ")"; |
| | | FtpUtil.sqlFileUpload(s); |
| | | |
| | | //修改报名信息 |
| | | list.forEach(id ->{ |
| | | //根据id查询培训信息 |
| | | TrainingRegistration trainingRegistration = trainingRegistrationService.getById(id); |
| | | if (trainingRegistration.getAuditStatus()==4 && trainingRegistration.getCancel()==1) { |
| | | if (null == trainingRegistration.getTrainExamId() || trainingRegistration.getTrainExamId() == "") { |
| | | trainingRegistration.setTrainExamId(examPaper.getId().toString()); |
| | | //提交考试审核 |
| | | trainingRegistration.setAuditStatus(3); |
| | | trainingRegistrationService.updateById(trainingRegistration); |
| | | |
| | | String s1 = |
| | | "update sys_training_registration set train_exam_id = " + "'" + trainingRegistration.getTrainExamId() + "'" |
| | | + ",audit_status = " + "'" + trainingRegistration.getAuditStatus() + "'" |
| | | + " " + "where id = " + "'" + trainingRegistration.getId() + "'"; |
| | | FtpUtil.sqlFileUpload(s1); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | return null; |
| | | } |
| | | } |