| | |
| | | } |
| | | |
| | | /** |
| | | * 获取保安员证编号 |
| | | * 生成保安员证编号 |
| | | * @param json |
| | | */ |
| | | public static void handlerSecurityNumerBit(String json) { |
| | | Map map = JSON.parseObject(json, Map.class); |
| | | //取出 key(uuid) |
| | | String key = map.keySet().toArray()[0].toString(); |
| | | //编号前缀 |
| | | String pre = map.get(key).toString(); |
| | | Integer max = hanlder.userService.getSecurityPaperCount(pre); |
| | | Result result = new Result(200, null, max.toString(),null); |
| | | Map<String, Object> map1 = new HashMap<>(1); |
| | | map1.put(key, result); |
| | | //向外网发送数据 |
| | | FtpUtil.objectFileUploadSecurityNumberCount(map1); |
| | | //获取考试信息 |
| | | String value = map.get(key).toString(); |
| | | ExamScore examScore = JSON.parseObject(value, ExamScore.class); |
| | | //查询用户 |
| | | User user = hanlder.userService.getById(examScore.getUserId()); |
| | | if (null!=user) { |
| | | //如果已有保安证编号,不更新用户信息 |
| | | if (null == user.getSecuritynumber() || user.getSecuritynumber().equals("")) { |
| | | //去生成保安证编号 |
| | | String pre = SecurityPaperUtil.getSecurityPaper(); |
| | | //查询当前年份已有的保安证编号 |
| | | int count = hanlder.userService.getSecurityPaperCount(pre); |
| | | String result = null; |
| | | if (count == 0) { |
| | | result = pre + "00001"; |
| | | } else { |
| | | //格式化 |
| | | DecimalFormat decimalFormat = new DecimalFormat("00000"); |
| | | count++; |
| | | result = pre + (decimalFormat.format(count)); |
| | | } |
| | | //脱敏处理 |
| | | user.setSecuritynumber(DesensitizedUtil.desensitizedSecurityNumber(result)); |
| | | //修改为持证保安 |
| | | user.setHold("1"); |
| | | user.setUpdateTime(new Date()); |
| | | //更新保安数据 |
| | | hanlder.userService.updateById(user); |
| | | |
| | | //生成保安证的同时向保安证管理表中插入一条数据 |
| | | SecurityPaper securityPaper = new SecurityPaper(); |
| | | securityPaper.setUserId(user.getId()); |
| | | securityPaper.setNumber(result); |
| | | securityPaper.setCreateTime(new Date()); |
| | | securityPaper.setIdCardNo(user.getCardid()); |
| | | securityPaper.setPeopleName(user.getRealName()); |
| | | securityPaper.setExamId(Long.parseLong(examScore.getExamId())); |
| | | securityPaper.setApplyId(examScore.getApplyId()); |
| | | securityPaper.setSource(1); |
| | | hanlder.securityPaperService.save(securityPaper); |
| | | |
| | | //内网同步 |
| | | String s1 = "update blade_user set hold = " + "'" + user.getHold() + "'" + |
| | | ",securitynumber = " + "'" + DesensitizedUtil.desensitizedSecurityNumber(result) + "'" + |
| | | ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" + |
| | | ",user_type = " + "'" + user.getUserType() + "'" + |
| | | " " + "where id = " + "'" + user.getId() + "'"; |
| | | hanlder.myAsyncService.FTP(s1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |