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(重名时优先“威狮国际”直属部门)
|
// 现有机构:部门名称 -> deptId(重名时优先“威狮国际”直属部门)
|
||||||
List<SysDept> bmsDepts = orgSyncWriter.readSyncDepts();
|
List<SysDept> bmsDepts = orgSyncWriter.readSyncDepts();
|
||||||
Map<String, Long> bmsDeptIdByName = new HashMap<String, Long>();
|
Map<String, Long> bmsDeptIdByName = new HashMap<String, Long>();
|
||||||
|
Map<Long, String> bmsDeptNameById = new HashMap<Long, String>();
|
||||||
for (SysDept d : bmsDepts)
|
for (SysDept d : bmsDepts)
|
||||||
{
|
{
|
||||||
String name = clean(d.getDeptName());
|
String name = clean(d.getDeptName());
|
||||||
@@ -144,6 +145,7 @@ public class OrgSyncService
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
bmsDeptNameById.put(d.getDeptId(), name);
|
||||||
Long exist = bmsDeptIdByName.get(name);
|
Long exist = bmsDeptIdByName.get(name);
|
||||||
if (exist == null
|
if (exist == null
|
||||||
|| (d.getParentId() != null && d.getParentId().longValue() == ROOT_DEPT_ID
|
|| (d.getParentId() != null && d.getParentId().longValue() == ROOT_DEPT_ID
|
||||||
@@ -267,6 +269,18 @@ public class OrgSyncService
|
|||||||
|
|
||||||
orgSyncWriter.insertNewUsers(toInsert);
|
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;
|
long cost = System.currentTimeMillis() - t0;
|
||||||
String summary = String.format(
|
String summary = String.format(
|
||||||
"TMS 用户同步完成:读取 TMS 员工 %d 人,已存在保持不变 %d 人(工号匹配 %d / 姓名+机构匹配 %d),新增 %d 人(其中机构未匹配挂“%s”%d 人),跳过 %d 条,耗时 %dms。新用户默认密码 123456,未分配角色。",
|
"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("orgFallbackCount", orgFallback);
|
||||||
result.put("skipCount", skipped);
|
result.put("skipCount", skipped);
|
||||||
result.put("costMs", cost);
|
result.put("costMs", cost);
|
||||||
|
result.put("createdUsers", createdUsers);
|
||||||
result.put("summary", summary);
|
result.put("summary", summary);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,43 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- TMS 用户同步结果:展示本次新增用户及同步统计 -->
|
||||||
|
<el-dialog title="TMS 用户同步结果" v-model="syncResultVisible" width="980px" append-to-body>
|
||||||
|
<el-descriptions :column="3" border size="small" class="sync-result-summary">
|
||||||
|
<el-descriptions-item label="TMS员工数">{{ syncResult.total }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="已存在用户">{{ syncResult.existCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="本次新增">{{ syncResult.insertCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="跳过记录">{{ syncResult.skipCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="部门未匹配">{{ syncResult.orgFallbackCount }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="耗时">{{ syncResult.costMs }} ms</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<el-alert
|
||||||
|
class="sync-result-tip"
|
||||||
|
title="下表展示本次新建的用户;已存在和跳过的记录可查看上方统计。"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
/>
|
||||||
|
<el-table :data="syncResult.createdUsers" border stripe max-height="480">
|
||||||
|
<el-table-column prop="userName" label="工号" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="nickName" label="用户昵称" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="deptName" label="归属部门" min-width="180" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="phonenumber" label="手机号码" min-width="130" />
|
||||||
|
<el-table-column label="状态" width="100" align="center">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-tag :type="row.status === '0' ? 'success' : 'info'">
|
||||||
|
{{ row.status === '0' ? '正常' : '停用' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="syncResultVisible = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 用户详情抽屉 -->
|
<!-- 用户详情抽屉 -->
|
||||||
<user-view-drawer ref="userViewRef" />
|
<user-view-drawer ref="userViewRef" />
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
@@ -179,6 +216,8 @@ const { sys_normal_disable, sys_user_sex } = useDict("sys_normal_disable", "sys_
|
|||||||
|
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
const syncLoading = ref(false)
|
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 open = ref(false)
|
||||||
const title = ref("")
|
const title = ref("")
|
||||||
const deptOptions = ref(undefined)
|
const deptOptions = ref(undefined)
|
||||||
@@ -276,7 +315,17 @@ function handleSyncFromOracle() {
|
|||||||
syncLoading.value = true
|
syncLoading.value = true
|
||||||
return syncUsersFromOracle()
|
return syncUsersFromOracle()
|
||||||
}).then(res => {
|
}).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()
|
getDeptTree()
|
||||||
tableRef.value.refresh()
|
tableRef.value.refresh()
|
||||||
}).catch(() => {}).finally(() => {
|
}).catch(() => {}).finally(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user