4 files modified
1 files renamed
| | |
| | | //去新增 |
| | | boolean save = hanlder.userService.save(user2); |
| | | if (save){ |
| | | //异步新增从业记录 |
| | | hanlder.myAsyncService.insertExperience(user2); |
| | | //异步审查 |
| | | hanlder.myAsyncService.checkUserExamineByCardNo(user2); |
| | | } |
| | |
| | | |
| | | //内网同步 |
| | | String s = "insert into sys_experience(id,name,entryTime,departureTime,leaving,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getDeparturetime()) + "'" + |
| | | "," + "'" + experience.getLeaving() + "'" + |
| | |
| | | states = false; |
| | | user.setHold("2"); |
| | | } |
| | | }else { |
| | | states = true; |
| | | } |
| | | |
| | | if (!states) { |
| | |
| | | } |
| | | } |
| | | } |
| | | /** |
| | | * 执行sql 上传 |
| | | * @param s1 sql |
| | | */ |
| | | public static void sqlFileUpload(String s1){ |
| | | String json1 = JSON.toJSONString(s1); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "nsql"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nsql"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nsql"+response1+".json", in1); |
| | | // MysqlCenlint.deletess("nsql"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 解压zip 包 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 执行sql 上传 |
| | | * @param obj sql |
| | | */ |
| | | public static void sqlFileUpload(String obj){ |
| | | String json1 = JSON.toJSONString(obj); |
| | | String response1 = String.valueOf((new Date()).getTime()); |
| | | OutJson.createJsonFile(json1, localPath, "nsql"+response1); |
| | | FileInputStream in1 = null; |
| | | try { |
| | | in1 = new FileInputStream(new File(localPath + "nsql"+response1+".json")); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "nsql"+response1+".json", in1); |
| | | MysqlCenlint.deletess("nsql"+response1+".json"); |
| | | } |
| | | |
| | | /** |
| | | * 执行 对象数据(用户,报名对象信息等) 上传 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", "n"+response1+".json", in1); |
| | | // MysqlCenlint.deletess("n"+response1+".json"); |
| | | MysqlCenlint.deletess("n"+response1+".json"); |
| | | } |
| | | |
| | | |
| File was renamed from src/main/java/org/springblade/modules/FTP/monitor.java |
| | |
| | | |
| | | |
| | | @Component |
| | | public class monitor { |
| | | |
| | | //文件名 |
| | | //private static String fileName = "nsql.json"; |
| | | |
| | | public class Monitor { |
| | | |
| | | @Scheduled(cron = "*/1 * * * * ?") |
| | | public static boolean isFTPFileExist() { |
| | |
| | | |
| | | // 设置编码格式 |
| | | ftp.setControlEncoding("GBK"); |
| | | // 提取绝对地址的目录以及文件名 |
| | | |
| | | //ftpPath = ftpPath.replace("ftp://" + ftpHost + ":" + ftpPort + "/", ""); |
| | | |
| | | //String dir = ftpPath.substring(0, ftpPath.lastIndexOf("/")); |
| | | |
| | | // file = ftpPath.substring(ftpPath.lastIndexOf("/") + 1); |
| | | |
| | | // 进入文件所在目录,注意编码格式,以能够正确识别中文目录 |
| | | |
| | | //ftp.changeWorkingDirectory(new String(dir.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING)); |
| | | |
| | | // 检验文件是否存在 |
| | | ftp.changeWorkingDirectory(ftpPath); |
| | |
| | | } |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | }else if(substring1.equals("o")){ |
| | | //获取对象字符串 |
| | |
| | | DataHanlder.handler(json); |
| | | //删除本地文件 |
| | | MysqlCenlint.deletess(fileName); |
| | | //删除 ftp 文件 |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | } |
| | | //删除本地文件,ftp 文件没有对应读取的不删除 |
| | | MysqlCenlint.deletess(fileName); |
| | | is.close(); |
| | | ftp.completePendingCommand(); |
| | | } |
| | |
| | | MysqlCenlint.deletess(fileName); |
| | | FtpUtil.deleteFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", fileName); |
| | | e.printStackTrace(); |
| | | |
| | | } finally { |
| | | |
| | | if (ftp != null) { |
| | | |
| | | try { |
| | | |
| | | ftp.disconnect(); |
| | | |
| | | } catch (IOException e) { |
| | | |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return false; |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import org.json.JSONArray; |
| | | import org.json.JSONObject; |
| | | import org.springblade.common.utils.DesensitizedUtil; |
| | | import org.springblade.common.utils.InvestigateUtil; |
| | | import org.springblade.modules.experience.entity.Experience; |
| | | import org.springblade.modules.experience.service.IExperienceService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IUserService userService; |
| | | |
| | | @Autowired |
| | | private IDeptService iDeptService; |
| | | |
| | | @Autowired |
| | | private IExperienceService experienceService; |
| | | |
| | | /** |
| | | * FTP |
| | |
| | | */ |
| | | @Async |
| | | public void checkUserExamineByCardNo(User user0){ |
| | | User byId = userService.getById(user0.getId()); |
| | | //如果是保安员 |
| | | if (user0.getRoleId().equals("1412226235153731586")){ |
| | | //读取身份证号 |
| | | String cardid = user0.getCardid(); |
| | | //创建用户对象 |
| | | User user = new User(); |
| | | user.setId(user.getId()); |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 异步新增用户从业记录 |
| | | * @param user |
| | | */ |
| | | @Async |
| | | public void insertExperience(User user) { |
| | | //根据公司名查询单位 |
| | | Dept dept = iDeptService.getById(user.getDeptId()); |
| | | Experience experience = new Experience(); |
| | | experience.setCompanyname(dept.getDeptName()); |
| | | //新增 |
| | | if (null != user.getRtime()) { |
| | | experience.setEntrytime(user.getRtime()); |
| | | } else { |
| | | experience.setEntrytime(new Date()); |
| | | } |
| | | experience.setDeparturetime(new Date()); |
| | | experience.setName(user.getRealName()); |
| | | if (null != user.getReasonForLeav() && !user.getReasonForLeav().equals("")) { |
| | | experience.setLeaving(user.getReasonForLeav()); |
| | | } |
| | | experience.setCardid(user.getCardid()); |
| | | experience.setSecurityid(user.getId().toString()); |
| | | //新增 |
| | | experienceService.save(experience); |
| | | |
| | | // 身份证号脱敏 |
| | | String cardid = DesensitizedUtil.desensitizedIdNumberBy4(user.getCardid()); |
| | | //内网同步 |
| | | String s = "insert into sys_experience(id,name,entryTime,departureTime,leaving,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getDeparturetime()) + "'" + |
| | | "," + "'" + experience.getLeaving() + "'" + |
| | | "," + "'" + cardid + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | | "," + "'" + experience.getSecurityid() + "'" |
| | | + ")"; |
| | | //向外网推送 |
| | | FTP(s); |
| | | } |
| | | } |
| | |
| | | ftpUserName: arsn |
| | | ftpPassword: 123456 |
| | | ftpPath: anbao/ |
| | | localPath: D:\anbao\ |
| | | localPath: E:\anbao\ |
| | | minioPath: D:\ftptp\ |
| | | jsonUrl: D:\anbao\ |
| | | jsonUrl: E:\anbao\ |
| | | sqlUsername: zhbaw |
| | | sqlPassword: Zhba@0426 |
| | | |