You need to sign in or sign up before continuing.
Commit cf54279f authored by 刘帅's avatar 刘帅

1.优化外部数据同步接口

parent adf968e4
package com.maintain.web.controller.system; package com.maintain.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission; import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.secure.BCrypt; import cn.dev33.satoken.secure.BCrypt;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.Tree;
......
...@@ -337,11 +337,14 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService { ...@@ -337,11 +337,14 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
String res = com.zxw.util.tm.HttpTmEncryptUtil.sendPostRequest("http://10.100.102.67:22220/api/basis/deptInfoExtRepair", null, null); String res = com.zxw.util.tm.HttpTmEncryptUtil.sendPostRequest("http://10.100.102.67:22220/api/basis/deptInfoExtRepair", null, null);
Map map = JSONUtil.toBean(res, Map.class); Map map = JSONUtil.toBean(res, Map.class);
List<ExternalDept> departmentList = JSONUtil.toList(JSONUtil.toJsonStr(map.get("data")), ExternalDept.class); List<ExternalDept> departmentList = JSONUtil.toList(JSONUtil.toJsonStr(map.get("data")), ExternalDept.class);
List<SysDept> sysDeptList = baseMapper.selectList();
departmentList.forEach(department -> { departmentList.forEach(department -> {
SysDept selectOne = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getExternalDeptCode, department.getDeptCode()));
// 查询是否已存在系统 // 查询是否已存在系统
if (null == selectOne) { System.out.println("编号:"+department.getDeptCode()+",部门" + department.getDeptName());
SysDept dept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>().eq(SysDept::getExternalDeptCode, department.getUpperDeptCode())); if (sysDeptList.stream().noneMatch(item -> null != item.getExternalDeptCode() && item.getExternalDeptCode().equals(department.getDeptCode()))) {
SysDept dept = sysDeptList.stream().filter(item -> item.getExternalDeptCode().equals(department.getUpperDeptCode()))
.findFirst()
.orElseThrow(() -> new RuntimeException("未找到部门=" + department.getUpperDeptCode()));
if (dept != null) { if (dept != null) {
SysDept sysDept = new SysDept(); SysDept sysDept = new SysDept();
sysDept.setAncestors(dept.getAncestors() + StringUtils.SEPARATOR + dept.getDeptId()); sysDept.setAncestors(dept.getAncestors() + StringUtils.SEPARATOR + dept.getDeptId());
......
...@@ -321,7 +321,7 @@ export default { ...@@ -321,7 +321,7 @@ export default {
clickSync() { clickSync() {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: '数据同步中,预计需要5-30秒', text: '数据同步中,预计需要5-10秒',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
......
...@@ -658,7 +658,7 @@ export default { ...@@ -658,7 +658,7 @@ export default {
clickSync() { clickSync() {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
text: '数据同步中,预计需要5-30秒', text: '数据同步中,预计需要5-10秒',
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment