从业记录新增同步sql 修改,用户新增审查逻辑修改,外网部门只更新状态,不更新审查明细,内网状态和明细都更新
| | |
| | | import java.sql.DriverManager; |
| | | import java.sql.PreparedStatement; |
| | | import java.sql.SQLException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Component |
| | |
| | | public static void inster(String sql) { |
| | | sqlConnect(sql,2); |
| | | try { |
| | | Thread.sleep(300); |
| | | Thread.sleep(500); |
| | | //对比 sql 字符串,如果是是往用户表里插入保安员数据,则调用公安审查接口 |
| | | String insertUserSql = "insert into blade_user"; |
| | | if (sql.contains(insertUserSql)){ |
| | |
| | | && res.getJSONObject(i).get("zdrylbjh").toString() != "" |
| | | && res.getJSONObject(i).get("zdrylbjh").toString() != "null" |
| | | ) { |
| | | user.setExaminationMx(res.getJSONObject(i).get("zdrylbjh").toString()); |
| | | // user.setExaminationMx(res.getJSONObject(i).get("zdrylbjh").toString()); |
| | | //更新用户数据 |
| | | mysqlCenlint.userService.updateById(user); |
| | | //同步内网 |
| | | String sql = "update blade_user set examination_type = " + user.getExaminationType() + " " |
| | | + ",examination_mx = " + "'" + res.getJSONObject(i).get("zdrylbjh").toString() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "'"; |
| | | update(sql); |
| | | break; |
| | | } |
| | | if (res.getJSONObject(i).get("zdryxlmc").toString() != null |
| | | && res.getJSONObject(i).get("zdryxlmc").toString() != "" |
| | | && res.getJSONObject(i).get("zdryxlmc").toString() != "null" |
| | | ) { |
| | | user.setExaminationMx(res.getJSONObject(i).get("zdryxlmc").toString()); |
| | | // user.setExaminationMx(res.getJSONObject(i).get("zdryxlmc").toString()); |
| | | //更新用户数据 |
| | | mysqlCenlint.userService.updateById(user); |
| | | //同步内网 |
| | | String sql = "update blade_user set examination_type = " + user.getExaminationType() + " " |
| | | + ",examination_mx = " + "'" + res.getJSONObject(i).get("zdryxlmc").toString() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "'"; |
| | | update(sql); |
| | | break; |
| | | } |
| | | if (res.getJSONObject(i).get("ztrylx").toString() != null |
| | | && res.getJSONObject(i).get("ztrylx").toString() != "" |
| | | && res.getJSONObject(i).get("ztrylx").toString() != "null" |
| | | ) { |
| | | user.setExaminationMx(res.getJSONObject(i).get("ztrylx").toString()); |
| | | // user.setExaminationMx(res.getJSONObject(i).get("ztrylx").toString()); |
| | | //更新用户数据 |
| | | mysqlCenlint.userService.updateById(user); |
| | | //同步内网 |
| | | String sql = "update blade_user set examination_type = " + user.getExaminationType() + " " |
| | | + ",examination_mx = " + "'" + res.getJSONObject(i).get("ztrylx").toString() + "'" |
| | | + ",update_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "'" |
| | | + " " + "where id = " + "'" + user.getId() + "'"; |
| | | update(sql); |
| | | break; |
| | | } |
| | | // if (res.getJSONObject(i).get("ajlbmc").toString() != null |
| | |
| | | //内网同步 |
| | | String s = "insert into sys_experience(id,name,post,department,responsibilities,entryTime,departureTime,leaving," + |
| | | "cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "'" + experience.getDepartment() + "'" + "," + |
| | | "'" + experience.getResponsibilities() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + experience.getPost() + "'" + |
| | | "," + "'" + experience.getDepartment() + "'" + |
| | | "," + "'" + experience.getResponsibilities() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getDeparturetime()) + "'" + |
| | | "," + "'" + experience.getLeaving() + "'" + |
| | |
| | | in, in.available(), -1) |
| | | .headers(headers) |
| | | .build()); |
| | | InputStream inputStream = new ByteArrayInputStream(b); |
| | | FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | // InputStream inputStream = new ByteArrayInputStream(b); |
| | | // FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | in.close(); |
| | | //外围url |
| | | String urls = FileConfig.url + "/zhba/" + newName; |
| | |
| | | "id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," + |
| | | "role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," + |
| | | "politicaloutlook,healstats,height,address,registered,rtime," + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,guncode,create_time,cell) " + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,guncode,create_time,update_time,cell) " + |
| | | "values(" + "'" + user.getId() + "'" + |
| | | "," + "'" + user.getTenantId() + "'" + |
| | | "," + "'" + user.getAccount() + "'" + |
| | |
| | | "," + "'" + user.getDispatch() + "'" + |
| | | "," + "'" + user.getGuncode() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" + |
| | | "," + "'" + user.getCell() + "'" + ");" + |
| | | "insert into sys_experience(id,name,post,entryTime," + |
| | | "cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "insert into sys_experience(id,name,post,entryTime,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + experience.getPost() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | | "," + "'" + experience.getSecurityid() + "'" |
| | | + ")"; |
| | | "," + "'" + experience.getSecurityid() + "'" + ")"; |
| | | myAsyncService.dataSync(s); |
| | | } |
| | | |
| | |
| | | "id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," + |
| | | "role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," + |
| | | "politicaloutlook,healstats,height,address,registered," + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time) " + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,update_time) " + |
| | | "values(" + "'" + user.getId() + "'" + |
| | | "," + "'" + user.getTenantId() + "'" + |
| | | "," + "'" + user.getAccount() + "'" + |
| | |
| | | "," + "'" + user.getStatus() + "'" + |
| | | "," + "'" + user.getIsDeleted() + "'" + |
| | | "," + "'" + user.getDispatch() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" + ")"; |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" + |
| | | ")"; |
| | | //拼接 |
| | | builder = builder.append(sql).append(";"); |
| | | List<String> list = Arrays.asList(builder.toString().split(";")); |
| | |
| | | //遍历,拼接sql ,同步数据到内网 |
| | | for (Experience experience : experienceList) { |
| | | String sql1 = "insert into sys_experience(id,name,post,entryTime,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + experience.getPost() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | |
| | | "id,tenant_id,account,password,name,real_name,avatar,email,phone,sex," + |
| | | "role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," + |
| | | "politicaloutlook,healstats,height,address,registered," + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,guncode) " + |
| | | "securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time,update_time,guncode) " + |
| | | "values(" + "'" + user.getId() + "'" + |
| | | "," + "'" + user.getTenantId() + "'" + |
| | | "," + "'" + user.getAccount() + "'" + |
| | |
| | | "," + "'" + user.getIsDeleted() + "'" + |
| | | "," + "'" + user.getDispatch() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getCreateTime()) + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getUpdateTime()) + "'" + |
| | | "," + "'" + user.getGuncode() + "'" + ");"+ |
| | | "insert into sys_experience(id,name,post,entryTime," + |
| | | "cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + experience.getPost() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |
| | |
| | | //遍历,拼接sql ,同步数据到内网 |
| | | for (Experience experience : experienceList) { |
| | | String sql1 = "insert into sys_experience(id,name,post,entryTime,cardId,companyname,securityId) " + |
| | | "values(" + "'" + experience.getId() + "'" + "," + |
| | | "'" + experience.getName() + "'" + "," + |
| | | "'" + experience.getPost() + "'" + "," + |
| | | "values(" + "'" + experience.getId() + "'" + |
| | | "," + "'" + experience.getName() + "'" + |
| | | "," + "'" + experience.getPost() + "'" + |
| | | "," + "'" + new SimpleDateFormat("yyyy-MM-dd").format(experience.getEntrytime()) + "'" + |
| | | "," + "'" + experience.getCardid() + "'" + |
| | | "," + "'" + experience.getCompanyname() + "'" + |