| | |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | 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.*; |
| | |
| | | //去生成保安证编号 |
| | | 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)); |