映射表字段对齐+增加账号信息同步
This commit is contained in:
parent
c8fcd8bd73
commit
d59a473028
|
|
@ -235,4 +235,27 @@ public class EmployeeRelationController {
|
|||
return actionMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工管理-测试映射字段
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/checkMappingCum")
|
||||
@WeaPermission(publicPermission = true)
|
||||
public Map<String, Object> checkMappingCum(@RequestParam("id") String id){
|
||||
Map<String, Object> actionMap = new HashMap<>();
|
||||
// 根据表名查询所有字段
|
||||
Map<String, Object> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
//更新个人信息表
|
||||
|
|
|
|||
|
|
@ -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<String, Object> 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)){
|
||||
|
|
|
|||
|
|
@ -22,4 +22,6 @@ public interface EmployeeRelationService {
|
|||
Map<String, Object> getEmployeeColumns(String id);
|
||||
|
||||
Map<String, Object> updateEmployeeColumns(String id,String glzzid);
|
||||
|
||||
Map<String, Object> checkMappingCum(String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -496,6 +496,65 @@ public class EmployeeRelationServiceImpl implements EmployeeRelationService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> checkMappingCum(String id) {
|
||||
//根据ygxxid查询源数据
|
||||
String sql = "select * from uf_jcl_employee_information where id='" + id+ "' and delete_type='0' ";
|
||||
Map<String, Object> rs2 = databaseUtils.execute("LOGIC", "weaver-ebuilder-form-service", sql);
|
||||
List<Map<String, Object>> employee_infos = databaseUtils.getDataSourceList(rs2);
|
||||
log.error("checkMappingCum.employee_infos:{}", employee_infos.get(0));
|
||||
//就1条
|
||||
Map<String, Object> employee_info = employee_infos.get(0);
|
||||
/**
|
||||
* 映射表数据
|
||||
*/
|
||||
Map<String, Object> mapping = getMapping();
|
||||
log.error("checkMappingCum.mapping:{}", mapping);
|
||||
//3查询个人信息表
|
||||
List<Map<String, Object>> userInfoColumns = getTableColumnsOfTableName("hr_userinfo");
|
||||
List<String> listOfUserInfoColumns = userInfoColumns.stream()
|
||||
.map(map -> map.get("column_name").toString())
|
||||
.collect(Collectors.toList());
|
||||
// 遍历并移除(不包含则移除掉)
|
||||
Map<String, Object> 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<String,Object> getMapping(){
|
||||
String sql = "select ygxxzdkey,rlxtzdkey from uf_jcl_zdtbysb";
|
||||
List<Map<String, Object>> recordList = databaseUtils.getSqlList(sql);
|
||||
Map<String, Object> resultMap = recordList.stream().collect(Collectors.toMap(e->e.get("rlxtzdkey").toString(),e -> e.get("ygxxzdkey").toString()));
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public void insert(String tableName, Map<String, Object> setMap){
|
||||
log.info("insert-setMap{}",setMap);
|
||||
if (StringUtils.isBlank(tableName) || null==setMap || setMap.size() <= 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue