浏览代码

白马合同的同步人员问题

liuyc 2 年之前
父节点
当前提交
7e6e099369

+ 79 - 61
blade-service/blade-user/src/main/java/org/springblade/system/user/controller/UserController.java

@@ -504,7 +504,7 @@ public class UserController {
         JSONObject json = new JSONObject();
         json.put("fn", "all");
 
-        // 测试数据
+        //测试数据
         String url = "http://js.cegc.com.cn:13426/login/japi/synUser";
         String encoding = "utf-8";
         String da = AesInfoUtil.sendPost(url, json, encoding);
@@ -525,12 +525,9 @@ public class UserController {
 
                         /*这里实际接口返回的数据都是companyName对应的公司名称*/
                         String companyName = jsonObject.getString("companyName"); //公司名称
-                        /*String constructionCompany = jsonObject.getString("constructionCompany"); //公司名称
-                        String projectName = jsonObject.getString("projectName") + ""; //公司名称*/
-
+                        //String constructionCompany = jsonObject.getString("constructionCompany"); //公司名称
+                        //String projectName = jsonObject.getString("projectName") + ""; //公司名称*/
                         String status = jsonObject.getString("status"); //状态(1:启用  2:冻结  3:删除)
-                        User newUser = new User();
-
                         /*修改需求前*/
                         /*if (projectName.contains("白马项目")
                                 || constructionCompany.equals("重庆白马航运发展有限公司")
@@ -539,16 +536,7 @@ public class UserController {
                                 || companyName.equals("重庆白马航运发展有限公司")//二期一期(业主)
                                 || companyName.equals("中国水利水电第八工程局有限公司")
                                 || companyName.equals("中国水利水电第四工程局中电建路桥集团联合体")
-                        ) */
-
-                        /*2023年8月4日16:29:14,修改需求,匹配到对应合同段中去*/
-                        if (companyName.contains("重庆白马航运发展有限公司")
-                                || companyName.contains("四川二滩国际工程咨询有限责任公司")
-                                || companyName.contains("中国水利水电第四工程局中电建路桥集团联合体")
-                                || companyName.contains("中铁长江交通设计集团有限公司")
-                                || companyName.contains("中铁八局集团有限公司")) {
-                            User sysUser = userService.getOne(Wrappers.<User>lambdaQuery().eq(User::getSysId, id).eq(User::getSysType, 2));
-                            if (sysUser != null) {
+                        ) if (sysUser != null) {
                                 newUser = sysUser;
                             } else {
                                 newUser.setId(SnowFlakeUtil.getId());
@@ -570,62 +558,92 @@ public class UserController {
                             newUser.setName(name);
                             newUser.setStatus(Integer.parseInt(status));
                             newUser.setIdNumber(idCard);
-                            newUser.setCompanyName(companyName);
-
-                            /*2023年8月4日16:29:14,修改需求,匹配到对应合同段中去*/
-                            //所有合同段(白马)
-                            if (companyName.contains("重庆白马航运发展有限公司")) {
-                                List<ContractInfo> contractInfos = jdbcTemplate.query("select id from m_contract_info where p_id = 1612329251049537537 and is_deleted = 0 and status = 1", new BeanPropertyRowMapper<>(ContractInfo.class));
-                                for (ContractInfo contractInfo : contractInfos) {
-                                    Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and project_id = 1612329251049537537 " + " and contract_id = " + contractInfo.getId() + " and post_id is null " + " and status = 1 and is_deleted = 0", Long.class);
+                            newUser.setCompanyName(companyName);*/
+
+                        /*2023年8月4日16:29:14,修改需求,匹配到对应合同段中去*/
+                        if (companyName.contains("重庆白马航运发展有限公司")
+                                || companyName.contains("四川二滩国际工程咨询有限责任公司")
+                                || companyName.contains("中国水利水电第四工程局中电建路桥集团联合体")
+                                || companyName.contains("中铁长江交通设计集团有限公司")
+                                || companyName.contains("中铁八局集团有限公司")) {
+                            Long sysUser = userService.getBaseMapper().selectCount(Wrappers.<User>lambdaQuery().eq(User::getSysId, id).eq(User::getSysType, 2));
+                            /*只有本系统不存在时才去新增*/
+                            if (sysUser == 0L) {
+                                User newUser = new User();
+                                newUser.setId(SnowFlakeUtil.getId());
+                                newUser.setDeptId("1588069957940674562"); //白马部门
+                                newUser.setSysType(2);
+                                newUser.setIsDeleted(0);
+                                newUser.setCreateUser(Long.parseLong("1541381503819694081"));
+                                newUser.setUpdateUser(Long.parseLong("1541381503819694081"));
+                                newUser.setTenantId("000000");
+                                newUser.setSysId(id);
+                                newUser.setUpdateTime(new Date());
+                                newUser.setCreateTime(new Date());
+                                newUser.setUserType("1,2");
+                                newUser.setAccount(account);
+                                newUser.setRealName(name);
+                                newUser.setName(name);
+                                newUser.setPassword("10470c3b4b1fed12c3baac014be15fac67c6e815");
+                                newUser.setName(name);
+                                newUser.setStatus(Integer.parseInt(status));
+                                newUser.setIdNumber(idCard);
+                                newUser.setCompanyName(companyName);
+
+                                //所有合同段(白马)
+                                if (companyName.contains("重庆白马航运发展有限公司")) {
+                                    List<ContractInfo> contractInfos = jdbcTemplate.query("select id from m_contract_info where p_id = 1612329251049537537 and is_deleted = 0 and status = 1", new BeanPropertyRowMapper<>(ContractInfo.class));
+                                    for (ContractInfo contractInfo : contractInfos) {
+                                        Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and project_id = 1612329251049537537 " + " and contract_id = " + contractInfo.getId() + " and post_id is null " + " and status = 1 and is_deleted = 0", Long.class);
+                                        if (count == null || count == 0L) {
+                                            //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;所有合同段id:contractInfo.getId();角色施工-资料员id:1537249581371707394
+                                            saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, contractInfo.getId(), 1537249581371707394L);
+                                            newUser.setRoleId("1537249581371707394");
+                                        }
+                                    }
+                                }
+
+                                //二期合同段(八局、二滩、长江设计单位)
+                                if (companyName.contains("中铁八局集团有限公司") || companyName.contains("四川二滩国际工程咨询有限责任公司") || companyName.contains("中铁长江交通设计集团有限公司")) {
+                                    Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1612335077269143554 and post_id is null and status = 1 and is_deleted = 0", Long.class);
                                     if (count == null || count == 0L) {
-                                        //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;所有合同段id:contractInfo.getId();角色施工-资料员id:1537249581371707394
-                                        saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, contractInfo.getId(), 1537249581371707394L);
+                                        //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第二期合同段id:1612335077269143554;角色施工-资料员id:1537249581371707394
+                                        saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1612335077269143554L, 1537249581371707394L);
                                         newUser.setRoleId("1537249581371707394");
                                     }
                                 }
-                            }
 
-                            //二期合同段(八局、二滩、长江设计单位)
-                            if (companyName.contains("中铁八局集团有限公司") || companyName.contains("四川二滩国际工程咨询有限责任公司") || companyName.contains("中铁长江交通设计集团有限公司")) {
-                                Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1612335077269143554 and post_id is null and status = 1 and is_deleted = 0", Long.class);
-                                if (count == null || count == 0L) {
-                                    //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第二期合同段id:1612335077269143554;角色施工-资料员id:1537249581371707394
-                                    saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1612335077269143554L, 1537249581371707394L);
-                                    newUser.setRoleId("1537249581371707394");
+                                //一期合同段(四局、长江设计单位)
+                                if (companyName.contains("中国水利水电第四工程局中电建路桥集团联合体") || companyName.contains("中铁长江交通设计集团有限公司")) {
+                                    Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1613022750656921601 and post_id is null and status = 1 and is_deleted = 0", Long.class);
+                                    if (count == null || count == 0L) {
+                                        //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第一期合同段id:1613022750656921601;角色施工-资料员id:1537249581371707394
+                                        saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1613022750656921601L, 1537249581371707394L);
+                                        newUser.setRoleId("1537249581371707394");
+                                    }
                                 }
-                            }
 
-                            //一期合同段(四局、长江设计单位)
-                            if (companyName.contains("中国水利水电第四工程局中电建路桥集团联合体") || companyName.contains("中铁长江交通设计集团有限公司")) {
-                                Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1613022750656921601 and post_id is null and status = 1 and is_deleted = 0", Long.class);
-                                if (count == null || count == 0L) {
-                                    //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第一期合同段id:1613022750656921601;角色施工-资料员id:1537249581371707394
-                                    saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1613022750656921601L, 1537249581371707394L);
-                                    newUser.setRoleId("1537249581371707394");
+                                //二监办合同段(二滩)
+                                if (companyName.contains("四川二滩国际工程咨询有限责任公司")) {
+                                    Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1687370619295309826 and post_id is null and status = 1 and is_deleted = 0", Long.class);
+                                    if (count == null || count == 0L) {
+                                        //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;二监办合同段id:1687370619295309826;角色施工-资料员id:1537249581371707394
+                                        saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1687370619295309826L, 1537249581371707394L);
+                                        newUser.setRoleId("1537249581371707394");
+                                    }
                                 }
-                            }
 
-                            //二监办合同段(二滩)
-                            if (companyName.contains("四川二滩国际工程咨询有限责任公司")) {
-                                Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1687370619295309826 and post_id is null and status = 1 and is_deleted = 0", Long.class);
+                                /*修改需求前*/
+                                /*Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1612335077269143554 and post_id is null and status = 1 and is_deleted = 0", Long.class);
                                 if (count == null || count == 0L) {
-                                    //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;二监办合同段id:1687370619295309826;角色施工-资料员id:1537249581371707394
-                                    saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1687370619295309826L, 1537249581371707394L);
-                                    newUser.setRoleId("1537249581371707394");
-                                }
-                            }
-
-                            /*修改需求前*/
-                            /*Long count = jdbcTemplate.queryForObject("select count(1) from m_project_assignment_user where user_id = " + newUser.getId() + " and  project_id = 1612329251049537537 and contract_id = 1612335077269143554 and post_id is null and status = 1 and is_deleted = 0", Long.class);
-                            if (count == null || count == 0L) {
-                                //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第二期合同段id:1612335077269143554;角色施工-资料员id:1537249581371707394
-                                saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1612335077269143554L, 1537249581371707394L);
-                                newUser.setRoleId("1537249581371707394"); //角色施工-资料员id:1537249581371707394
-                            }*/
+                                    //绑定项目,设置默认角色信息 白马项目id:1612329251049537537;第二期合同段id:1612335077269143554;角色施工-资料员id:1537249581371707394
+                                    saveUserInfoByProjectClient.saveInfoRelation(newUser.getId(), 1612329251049537537L, 1612335077269143554L, 1537249581371707394L);
+                                    newUser.setRoleId("1537249581371707394"); //角色施工-资料员id:1537249581371707394
+                                }*/
 
-                            userService.saveOrUpdate(newUser);
-                            userService.submitUserDept(newUser);
+                                userService.saveOrUpdate(newUser);
+                                userService.submitUserDept(newUser);
+                            }
                         }
                     }
                 }