| | |
| | | } |
| | | |
| | | /** |
| | | * 获取保安员证编号 |
| | | * @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); |
| | | } |
| | | |
| | | /** |
| | | * 培训报名数据处理 |
| | | * @param json |
| | | */ |
| | |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nt"+response1+".json", in1); |
| | | MysqlCenlint.deletess("nt"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 向外网发送保安员证编号位数数据 |
| | | * @param map1 |
| | | */ |
| | | public static void objectFileUploadSecurityNumberCount(Object obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "ns"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "ns"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "ns"+response1+".json", in1); |
| | | MysqlCenlint.deletess("ns"+response1+".json"); |
| | | } |
| | | } |
| | |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("s")){ |
| | | //获取保安员证编号数据 |
| | | //获取对象字符串 |
| | | String json = OutJson.TestJson(fileName); |
| | | //数据处理 |
| | | DataHanlder.handlerSecurityNumerBit(json); |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | } |
| | | else if(substring1.equals("f")){ |
| | | //把文件下载到本地(图片文件类),测试内外网使用同一台服务器 |
| | |
| | | * @return |
| | | */ |
| | | int getUserAge(@Param("id") long id); |
| | | |
| | | /** |
| | | * 查询保安证编号位数 |
| | | * @param pre |
| | | * @return |
| | | */ |
| | | Integer getSecurityPaperCount(@Param("pre") String pre); |
| | | } |
| | |
| | | <select id="getUserAge" resultType="java.lang.Integer"> |
| | | select ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(cardid, 7, 8), CURDATE()),0) AS age from blade_user where id = #{id} |
| | | </select> |
| | | <!--查询保安员证编号前缀--> |
| | | <select id="getSecurityPaperCount" resultType="java.lang.Integer"> |
| | | select ifnull(max(0+RIGHT(securitynumber,5)),0) from blade_user |
| | | where securitynumber like concat('%',#{pre},'%') |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | int getUserAge(long id); |
| | | |
| | | /** |
| | | * 查询保安证编号位数 |
| | | * @param pre |
| | | * @return |
| | | */ |
| | | Integer getSecurityPaperCount(String pre); |
| | | } |
| | |
| | | public int getUserAge(long id) { |
| | | return baseMapper.getUserAge(id); |
| | | } |
| | | |
| | | /** |
| | | * 查询保安证编号位数 |
| | | * @param pre |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Integer getSecurityPaperCount(String pre) { |
| | | return baseMapper.getSecurityPaperCount(pre); |
| | | } |
| | | } |