From d59a473028e7fdd94f83d0376b7738ab806a09de Mon Sep 17 00:00:00 2001 From: Administrator <704728292@qq.com> Date: Thu, 24 Apr 2025 11:47:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=A0=E5=B0=84=E8=A1=A8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E9=BD=90+=E5=A2=9E=E5=8A=A0=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EmployeeRelationController.java | 23 +++++ .../esb/SyncAllOrgPersonInfo.java | 31 ++++--- .../esb/SyncOrganizationPersonInfo.java | 86 ++++++++++++------- .../service/EmployeeRelationService.java | 2 + .../impl/EmployeeRelationServiceImpl.java | 59 +++++++++++++ 5 files changed, 158 insertions(+), 43 deletions(-) diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java index a808045..587f602 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/controller/EmployeeRelationController.java @@ -235,4 +235,27 @@ public class EmployeeRelationController { return actionMap; } + /** + * 员工管理-测试映射字段 + * @return + */ + @GetMapping("/checkMappingCum") + @WeaPermission(publicPermission = true) + public Map checkMappingCum(@RequestParam("id") String id){ + Map actionMap = new HashMap<>(); + // 根据表名查询所有字段 + Map mapList = employeeRelationService.checkMappingCum(id); + if(mapList.size()>0){ + log.error("checkMappingCum.mapList:{}", mapList); + actionMap.put("code","200"); + actionMap.put("msg","接口调用成功!"); + }else{ + actionMap.put("code","201"); + actionMap.put("msg","返回数据为空!"); + } + actionMap.put("mapList",mapList); + log.error("checkMappingCum.actionMap:{}", actionMap); + return actionMap; + } + } \ No newline at end of file diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncAllOrgPersonInfo.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncAllOrgPersonInfo.java index af1a230..015076f 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncAllOrgPersonInfo.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncAllOrgPersonInfo.java @@ -142,10 +142,13 @@ public class SyncAllOrgPersonInfo implements EsbServerlessRpcRemoteInterface { }else{ employee_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - employee_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfoAll.mapping.containsKey3232:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + employee_new.put(key,ignoreCase); } } //key为id的要移除掉,防止串改组织人员id 导致对应不上员工关系表的:关联组织人员id @@ -187,18 +190,20 @@ public class SyncAllOrgPersonInfo implements EsbServerlessRpcRemoteInterface { userInfo_new.put(key,"0"); String ignoreCase = getIgnoreCase(employee_info, key); log.error("SyncOrganizationPersonInfoAll2222.delete_type:{}", ignoreCase); + }else if(key.equalsIgnoreCase("native_place")){ + //籍贯字段处理 + log.error("SyncOrganizationPersonInfo.native_place333:{}", key); + userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); }else{ userInfo_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - userInfo_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } - //籍贯字段处理 - if(key.equalsIgnoreCase("native_place")){ - log.error("SyncOrganizationPersonInfo.native_place333:{}", key); - userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfoAll.mapping.containsKey3232:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + userInfo_new.put(key,ignoreCase); } } //更新个人信息表 diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncOrganizationPersonInfo.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncOrganizationPersonInfo.java index c11fdee..601f6d8 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncOrganizationPersonInfo.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/esb/SyncOrganizationPersonInfo.java @@ -55,6 +55,7 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa int code2 = 200; int code3; int code4 = 200; + int code5 = 200; String ygxxid = null!=params.get("ygxxid")?String.valueOf(params.get("ygxxid").toString()):""; String glzzyg = null!=params.get("glzzyg")?String.valueOf(params.get("glzzyg").toString()):""; log.error("SyncOrganizationPersonInfo.ygxxid : [{}].glzzyg:[{}]",ygxxid,glzzyg); @@ -140,11 +141,13 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa }else{ employee_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - log.error("SyncOrganizationPersonInfo.mapping.containsKey:{}", key); - employee_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfo.mapping.containsKey:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + employee_new.put(key,ignoreCase); } } //增加一个关联自定义表的formdata @@ -188,19 +191,20 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa if (containsKeyIgnoreCase(employee_info,key)) { if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){ userInfo_new.put(key,"0"); + }else if(key.equalsIgnoreCase("native_place")){ + //籍贯字段处理 + log.error("SyncOrganizationPersonInfo.native_place:{}", key); + userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); }else{ userInfo_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - log.error("SyncOrganizationPersonInfo.mapping_key:{}", key); - userInfo_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } - //籍贯字段处理 - if(key.equalsIgnoreCase("native_place")){ - log.error("SyncOrganizationPersonInfo.native_place:{}", key); - userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfo.mapping.containsKey888:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + userInfo_new.put(key,ignoreCase); } } //增加必填字段 @@ -225,6 +229,24 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa userInfoCustomize_new.put("TENANT_KEY",getIgnoreCase(employee_info, "TENANT_KEY")); log.error("SyncOrganizationPersonInfo.userInfoCustomize_new:{}", userInfoCustomize_new); code4 = insert(tableUserName,userInfoCustomize_new); + /** + * 账户信息部分同步直接写死 + */ + Map user_Info = new HashMap<>(); + user_Info.put("id",getIgnoreCase(employee_info, "id")); + user_Info.put("account",containsKeyIgnoreCase(employee_info,"zh")?getIgnoreCase(employee_info, "zh"):""); + user_Info.put("employeeid",getIgnoreCase(employee_info, "id")); + user_Info.put("password",containsKeyIgnoreCase(employee_info,"mm")?getIgnoreCase(employee_info, "mm"):""); + user_Info.put("status","6"); + user_Info.put("TENANTKEY",getIgnoreCase(employee_info, "TENANTKEY")); + user_Info.put("username",getIgnoreCase(employee_info, "username")); + user_Info.put("email",containsKeyIgnoreCase(employee_info,"email")?getIgnoreCase(employee_info, "email"):""); + user_Info.put("mobile",containsKeyIgnoreCase(employee_info,"mobile")?getIgnoreCase(employee_info, "mobile"):""); + user_Info.put("createtime",nowData); + user_Info.put("update_time",nowData); + user_Info.put("create_time",nowData); + log.error("SyncOrganizationPersonInfo.user_Info:{}", user_Info); + code5 = insert("user_info",user_Info); /** * 员工信息明细表数据同步处理 */ @@ -248,10 +270,13 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa }else{ employee_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - employee_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfo.mapping.containsKey4545:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + employee_new.put(key,ignoreCase); } } //key为id的要移除掉,防止串改组织人员id 导致对应不上员工关系表的:关联组织人员id @@ -290,19 +315,20 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa if (containsKeyIgnoreCase(employee_info,key)) { if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){ userInfo_new.put(key,"0"); + }else if(key.equalsIgnoreCase("native_place")){ + //籍贯字段处理 + log.error("SyncOrganizationPersonInfo.native_place2222:{}", key); + userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); }else{ userInfo_new.put(key,getIgnoreCase(employee_info, key)); } - //补充映射表字段 - if (containsKeyIgnoreCase(mapping,key)) { - log.error("SyncOrganizationPersonInfo.mapping_key222:{}", key); - userInfo_new.put(key,getIgnoreCase(employee_info, String.valueOf(mapping.get(key)))); - } - //籍贯字段处理 - if(key.equalsIgnoreCase("native_place")){ - log.error("SyncOrganizationPersonInfo.native_place2222:{}", key); - userInfo_new.put(key,getNativePlaceName(getIgnoreCase(employee_info, key))); - } + } + //补充映射表字段 + if (containsKeyIgnoreCase(mapping,key)) { + log.error("SyncOrganizationPersonInfo.mapping.containsKey3232:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + userInfo_new.put(key,ignoreCase); } } //更新个人信息表 @@ -327,7 +353,7 @@ public class SyncOrganizationPersonInfo implements EsbServerlessRpcRemoteInterfa updateAllYgxxDetailInfo(ygxxid); } //判断新增/更新数据是否都成功 - if(code==200&&code2==200&&code3==200&code4==200){ + if(code==200&&code2==200&&code3==200&&code4==200&&code5==200){ result.put("code",200); result.put("msg","同步组织数据成功!"); if(StringUtils.isNotBlank(glzzyg)){ diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java index 4c58fcf..f77719f 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/EmployeeRelationService.java @@ -22,4 +22,6 @@ public interface EmployeeRelationService { Map getEmployeeColumns(String id); Map updateEmployeeColumns(String id,String glzzid); + + Map checkMappingCum(String id); } diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java index 394cae4..ec95c14 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/EmployeeRelationServiceImpl.java @@ -496,6 +496,65 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService { return result; } + @Override + public Map checkMappingCum(String id) { + //根据ygxxid查询源数据 + String sql = "select * from uf_jcl_employee_information where id='" + id+ "' and delete_type='0' "; + Map rs2 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql); + List> employee_infos = databaseUtils.getDataSourceList(rs2); + log.error("checkMappingCum.employee_infos:{}", employee_infos.get(0)); + //就1条 + Map employee_info = employee_infos.get(0); + /** + * 映射表数据 + */ + Map mapping = getMapping(); + log.error("checkMappingCum.mapping:{}", mapping); + //3查询个人信息表 + List> userInfoColumns = getTableColumnsOfTableName("hr_userinfo"); + List listOfUserInfoColumns = userInfoColumns.stream() + .map(map -> map.get("column_name").toString()) + .collect(Collectors.toList()); + // 遍历并移除(不包含则移除掉) + Map userInfo_new = new HashMap<>(); + log.error("checkMappingCum.listOfUserInfoColumns:{}", listOfUserInfoColumns); + for (String key : listOfUserInfoColumns) { + if (containsKeyIgnoreCase(employee_info,key)) { + if("delete_type".equalsIgnoreCase(key)||"IS_DELETE".equalsIgnoreCase(key)){ + userInfo_new.put(key,"0"); + }else{ + userInfo_new.put(key,getIgnoreCase(employee_info, key)); + } + } + if (containsKeyIgnoreCase(mapping,key)) { + log.error("checkMappingCum.mapping_key2222:{}", key); + String s = getIgnoreCase(mapping,key); + String ignoreCase = getIgnoreCase(employee_info, s); + userInfo_new.put(key,ignoreCase); + } + } + //增加必填字段 + userInfo_new.put("USER", getIgnoreCase(employee_info, "id")); + userInfo_new.put("FORM_DATA",getIgnoreCase(employee_info, "id")); + userInfo_new.put("CREATE_TIME",nowData); + userInfo_new.put("update_time",nowData); + userInfo_new.put("mapping",mapping); + userInfo_new.put("employee_info",employee_info); + userInfo_new.put("listOfUserInfoColumns",listOfUserInfoColumns); + return userInfo_new; + } + /** + * 获得key名映射 + * @return + */ + public Map getMapping(){ + String sql = "select ygxxzdkey,rlxtzdkey from uf_jcl_zdtbysb"; + List> recordList = databaseUtils.getSqlList(sql); + Map resultMap = recordList.stream().collect(Collectors.toMap(e->e.get("rlxtzdkey").toString(),e -> e.get("ygxxzdkey").toString())); + + return resultMap; + } + public void insert(String tableName, Map setMap){ log.info("insert-setMap{}",setMap); if (StringUtils.isBlank(tableName) || null==setMap || setMap.size() <= 0) {