Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS into test
This commit is contained in:
@@ -137,6 +137,7 @@ public class OrgSyncService
|
||||
// 现有机构:部门名称 -> deptId(重名时优先“威狮国际”直属部门)
|
||||
List<SysDept> bmsDepts = orgSyncWriter.readSyncDepts();
|
||||
Map<String, Long> bmsDeptIdByName = new HashMap<String, Long>();
|
||||
Map<Long, String> bmsDeptNameById = new HashMap<Long, String>();
|
||||
for (SysDept d : bmsDepts)
|
||||
{
|
||||
String name = clean(d.getDeptName());
|
||||
@@ -144,6 +145,7 @@ public class OrgSyncService
|
||||
{
|
||||
continue;
|
||||
}
|
||||
bmsDeptNameById.put(d.getDeptId(), name);
|
||||
Long exist = bmsDeptIdByName.get(name);
|
||||
if (exist == null
|
||||
|| (d.getParentId() != null && d.getParentId().longValue() == ROOT_DEPT_ID
|
||||
@@ -267,6 +269,18 @@ public class OrgSyncService
|
||||
|
||||
orgSyncWriter.insertNewUsers(toInsert);
|
||||
|
||||
List<Map<String, Object>> createdUsers = new ArrayList<Map<String, Object>>();
|
||||
for (SysUser user : toInsert)
|
||||
{
|
||||
Map<String, Object> createdUser = new LinkedHashMap<String, Object>();
|
||||
createdUser.put("userName", user.getUserName());
|
||||
createdUser.put("nickName", user.getNickName());
|
||||
createdUser.put("deptName", bmsDeptNameById.getOrDefault(user.getDeptId(), ROOT_DEPT_NAME));
|
||||
createdUser.put("phonenumber", user.getPhonenumber());
|
||||
createdUser.put("status", user.getStatus());
|
||||
createdUsers.add(createdUser);
|
||||
}
|
||||
|
||||
long cost = System.currentTimeMillis() - t0;
|
||||
String summary = String.format(
|
||||
"TMS 用户同步完成:读取 TMS 员工 %d 人,已存在保持不变 %d 人(工号匹配 %d / 姓名+机构匹配 %d),新增 %d 人(其中机构未匹配挂“%s”%d 人),跳过 %d 条,耗时 %dms。新用户默认密码 123456,未分配角色。",
|
||||
@@ -283,6 +297,7 @@ public class OrgSyncService
|
||||
result.put("orgFallbackCount", orgFallback);
|
||||
result.put("skipCount", skipped);
|
||||
result.put("costMs", cost);
|
||||
result.put("createdUsers", createdUsers);
|
||||
result.put("summary", summary);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user