| | |
| | | import org.springblade.common.utils.DesensitizedUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.FTP.Monitor; |
| | | import org.springblade.modules.FTP.Result; |
| | | import org.springblade.modules.apply.entity.Apply; |
| | | import org.springblade.modules.apply.service.ApplyService; |
| | | import org.springblade.modules.exam.entity.*; |
| | |
| | | public Boolean saveExamScore(ExamScoreVO examScore) { |
| | | //取出考试结果 |
| | | if (examScore.getExamResultVOS().size() > 0) { |
| | | ExamScore score = this.getById(examScore.getId()); |
| | | List<ExamResultVO> examResultVOS = examScore.getExamResultVOS(); |
| | | //获取试卷的内容(题号,答案) |
| | | // ExamPaper examPaper = new ExamPaper(); |
| | |
| | | } |
| | | //培训考试 |
| | | if (paper.getExamType() == 2) { |
| | | TrainingRegistration trainingRegistration = new TrainingRegistration(); |
| | | trainingRegistration.setCandidateNo(examScore.getCandidateNo()); |
| | | trainingRegistration.setCancel(1); |
| | | TrainingRegistration trainingRegistration1 = trainingRegistrationService.getOne(Condition.getQueryWrapper(trainingRegistration)); |
| | | // TrainingRegistration trainingRegistration = new TrainingRegistration(); |
| | | // trainingRegistration.setCandidateNo(examScore.getCandidateNo()); |
| | | // trainingRegistration.setCancel(1); |
| | | // TrainingRegistration trainingRegistration1 = trainingRegistrationService.getOne(Condition.getQueryWrapper(trainingRegistration)); |
| | | TrainingRegistration trainingRegistration1 = trainingRegistrationService.getById(score.getApplyId()); |
| | | //查询用户年龄,根据年龄计算总分 |
| | | user = userService.getUserAgeById(Long.parseLong(trainingRegistration1.getUserId())); |
| | | //修改用户的培训状态,理论考试结束 |
| | |
| | | //去生成保安证编号 |
| | | String pre = SecurityPaperUtil.getSecurityPaper(); |
| | | //查询当前年份已有的保安证编号 |
| | | int count = userService.getSecurityPaperCount(pre); |
| | | // int count = userService.getSecurityPaperCount(pre); |
| | | //需调用内网查询 |
| | | //生成随机数 |
| | | String uuid = UUID.randomUUID().toString(); |
| | | |
| | | //数据推送 |
| | | Map<String, Object> map = new HashMap<>(1); |
| | | map.put(uuid,pre); |
| | | myAsyncService.FTPSecurityNumberBit(map); |
| | | |
| | | int count = 0; |
| | | Result result0 = new Result(); |
| | | //调用ftp获取返回数据 |
| | | while (true){ |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //调用ftp获取返回数据 |
| | | result0 = Monitor.getSecurityNumberBit(uuid); |
| | | //如果返回true,就退处 |
| | | if (result0.getCode()==200){ |
| | | break; |
| | | }else{ |
| | | //计数 |
| | | count++; |
| | | //如果超过100s 没有读取到,则退出 |
| | | if (count == 100) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | int max = Integer.parseInt(result0.getMsg()); |
| | | String result = null; |
| | | if (count == 0) { |
| | | if (max == 0) { |
| | | result = pre + "00001"; |
| | | } else { |
| | | //格式化 |
| | | DecimalFormat decimalFormat = new DecimalFormat("00000"); |
| | | count++; |
| | | result = pre + (decimalFormat.format(count)); |
| | | max++; |
| | | result = pre + (decimalFormat.format(max)); |
| | | } |
| | | //脱敏处理 |
| | | user.setSecuritynumber(DesensitizedUtil.desensitizedSecurityNumber(result)); |
| | |
| | | securityPaper.setApplyId(examScore.getApplyId()); |
| | | securityPaper.setSource(1); |
| | | //内网对象 |
| | | SecurityPaper paper = securityPaper; |
| | | SecurityPaper paper = Objects.requireNonNull(BeanUtil.copy(securityPaper,SecurityPaper.class)); |
| | | //新增保安员证信息 |
| | | securityPaper.setNumber(DesensitizedUtil.desensitizedSecurityNumber(result)); |
| | | securityPaper.setIdCardNo(""); |