From 99cdfd86d36e409f132e14dc11639f0cc66c4908 Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Wed, 11 Nov 2026 14:44:41 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=B1=95=E7=A4=BATMS=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bms/system/orgsync/OrgSyncService.java | 15 ++++++ bms-front/src/views/system/user/index.vue | 51 ++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/bms-back/bms-system/src/main/java/com/bms/system/orgsync/OrgSyncService.java b/bms-back/bms-system/src/main/java/com/bms/system/orgsync/OrgSyncService.java index 9994c4ae..a11dd794 100644 --- a/bms-back/bms-system/src/main/java/com/bms/system/orgsync/OrgSyncService.java +++ b/bms-back/bms-system/src/main/java/com/bms/system/orgsync/OrgSyncService.java @@ -137,6 +137,7 @@ public class OrgSyncService // 现有机构:部门名称 -> deptId(重名时优先“威狮国际”直属部门) List bmsDepts = orgSyncWriter.readSyncDepts(); Map bmsDeptIdByName = new HashMap(); + Map bmsDeptNameById = new HashMap(); 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> createdUsers = new ArrayList>(); + for (SysUser user : toInsert) + { + Map createdUser = new LinkedHashMap(); + 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; } diff --git a/bms-front/src/views/system/user/index.vue b/bms-front/src/views/system/user/index.vue index 80c16a75..843cdfc0 100644 --- a/bms-front/src/views/system/user/index.vue +++ b/bms-front/src/views/system/user/index.vue @@ -154,6 +154,43 @@ + + + + {{ syncResult.total }} + {{ syncResult.existCount }} + {{ syncResult.insertCount }} + {{ syncResult.skipCount }} + {{ syncResult.orgFallbackCount }} + {{ syncResult.costMs }} ms + + + + + + + + + + + + + + @@ -179,6 +216,8 @@ const { sys_normal_disable, sys_user_sex } = useDict("sys_normal_disable", "sys_ const tableRef = ref() const syncLoading = ref(false) +const syncResultVisible = ref(false) +const syncResult = ref({ total: 0, existCount: 0, insertCount: 0, skipCount: 0, orgFallbackCount: 0, costMs: 0, createdUsers: [] }) const open = ref(false) const title = ref("") const deptOptions = ref(undefined) @@ -276,7 +315,17 @@ function handleSyncFromOracle() { syncLoading.value = true return syncUsersFromOracle() }).then(res => { - proxy.$modal.msgSuccess(res.msg || '同步成功') + const result = res.data || {} + syncResult.value = { + total: result.total || 0, + existCount: result.existCount || 0, + insertCount: result.insertCount || 0, + skipCount: result.skipCount || 0, + orgFallbackCount: result.orgFallbackCount || 0, + costMs: result.costMs || 0, + createdUsers: Array.isArray(result.createdUsers) ? result.createdUsers : [] + } + syncResultVisible.value = true getDeptTree() tableRef.value.refresh() }).catch(() => {}).finally(() => {