智慧保安后台管理-外网项目备份
从业记录新增同步sql 修改,用户新增审查逻辑修改,外网部门只更新状态,不更新审查明细,内网状态和明细都更新
4 files modified
83 ■■■■■ changed files
src/main/java/org/springblade/modules/dataSync/MysqlCenlint.java 27 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/experience/controller/ExperienceController.java 10 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserController.java 19 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/dataSync/MysqlCenlint.java
@@ -15,6 +15,7 @@
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Component
@@ -85,7 +86,7 @@
    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)){
@@ -145,27 +146,45 @@
                        && 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
src/main/java/org/springblade/modules/experience/controller/ExperienceController.java
@@ -178,11 +178,11 @@
            //内网同步
            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() + "'" +
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -688,8 +688,8 @@
                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;
@@ -1307,7 +1307,7 @@
                "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() + "'" +
@@ -1340,17 +1340,16 @@
                "," + "'" + 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);
        }
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -1124,7 +1124,7 @@
                    "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() + "'" +
@@ -1154,7 +1154,9 @@
                    "," + "'" + 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(";"));
@@ -1182,9 +1184,9 @@
            //遍历,拼接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() + "'" +
@@ -1375,7 +1377,7 @@
                    "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() + "'" +
@@ -1406,12 +1408,13 @@
                    "," + "'" + 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() + "'" +
@@ -2110,9 +2113,9 @@
            //遍历,拼接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() + "'" +