Commit c9f567fd authored by huyuchen's avatar huyuchen

派单审核导出问题修改

parent 687570ee
...@@ -40,8 +40,6 @@ public interface SysDeptMapper extends BaseMapper<SysDept> { ...@@ -40,8 +40,6 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
*/ */
List<SysDept> listDepts(); List<SysDept> listDepts();
List<String> selectDnList();
SysDept selectCountId(@Param("deptId")Long deptId); SysDept selectCountId(@Param("deptId")Long deptId);
int updateDeptById(@Param("dept") SysDept dept); int updateDeptById(@Param("dept") SysDept dept);
......
...@@ -183,15 +183,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -183,15 +183,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
@Override @Override
public R<Boolean> updateDeptByLdap() { public R<Boolean> updateDeptByLdap() {
List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay(); List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay();
//获取ldap所有的dn
List<String> entryDnList = entryList.stream().map(SearchResultEntry::getDN).collect(Collectors.toList());
//获取本地dept表中所有的dn
List<String> dnList = baseMapper.selectDnList();
List<String> delList = dnList.stream().filter(p-> !entryDnList.contains(p)).collect(Collectors.toList());
//删除ldap中不存在的dn的数据
if (!delList.isEmpty()) {
baseMapper.delete(Wrappers.<SysDept>query().lambda().in(SysDept::getDeptDn, delList));
}
List<Map<String,Object>> updUserList = new ArrayList<>(); List<Map<String,Object>> updUserList = new ArrayList<>();
for (SearchResultEntry entry : entryList) { for (SearchResultEntry entry : entryList) {
String dn = entry.getDN(); String dn = entry.getDN();
......
...@@ -437,15 +437,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -437,15 +437,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
} }
} }
List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay(); List<SearchResultEntry> entryList = ldapUtil.getAllPersonNamesWithTraditionalWay();
//获取ldap所有的dn
List<String> entryDnList = entryList.stream().map(SearchResultEntry::getDN).collect(Collectors.toList());
//获取本地dept表中所有的dn
List<String> dnList = sysDeptMapper.selectDnList();
List<String> delList = dnList.stream().filter(p-> !entryDnList.contains(p)).collect(Collectors.toList());
//删除ldap中不存在的dn的数据
if (!delList.isEmpty()) {
sysDeptMapper.delete(Wrappers.<SysDept>query().lambda().in(SysDept::getDeptDn, delList));
}
List<Map<String,Object>> updUserList = new ArrayList<>(); List<Map<String,Object>> updUserList = new ArrayList<>();
for (SearchResultEntry entry : entryList) { for (SearchResultEntry entry : entryList) {
String dn = entry.getDN(); String dn = entry.getDN();
...@@ -474,6 +465,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -474,6 +465,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
} }
insertSysDept.setDelFlag(CommonConstants.ZERO_STRING);
sysDeptMapper.insert(insertSysDept); sysDeptMapper.insert(insertSysDept);
} }
} }
...@@ -482,7 +474,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -482,7 +474,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
sysDeptMapper.updateDeptById(sysDept); sysDeptMapper.updateDeptById(sysDept);
} }
} else { } else {
SysDept sysDept = sysDeptMapper.selectOne(Wrappers.<SysDept>query().lambda().eq(SysDept::getDeptDn, dn.substring(dn.indexOf("ou=", 2), dn.length()))); SysDept sysDept = sysDeptMapper.selectDeptDn(dn.substring(dn.indexOf("ou=", 2), dn.length()));
if (null != sysDept) { if (null != sysDept) {
SysDept sysDeptCount = sysDeptMapper.selectDeptDn(dn); SysDept sysDeptCount = sysDeptMapper.selectDeptDn(dn);
if (null == sysDeptCount) { if (null == sysDeptCount) {
...@@ -501,6 +493,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl ...@@ -501,6 +493,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) { if (Common.isNotNull(entry.getAttributeValue("x-ouid"))) {
insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid"))); insertSysDept.setDeptId(Long.valueOf(entry.getAttributeValue("x-ouid")));
} }
insertSysDept.setDelFlag(CommonConstants.ZERO_STRING);
sysDeptMapper.insert(insertSysDept); sysDeptMapper.insert(insertSysDept);
} }
} }
......
...@@ -31,14 +31,6 @@ ...@@ -31,14 +31,6 @@
<result column="del_flag" property="delFlag"/> <result column="del_flag" property="delFlag"/>
</resultMap> </resultMap>
<!--查询所有dn-->
<select id="selectDnList" resultType="String">
SELECT a.dept_dn
FROM sys_dept a
WHERE a.del_flag = 0
AND a.dept_dn IS NOT NULL
</select>
<select id="selectCountId" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept"> <select id="selectCountId" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
SELECT SELECT
* *
...@@ -63,6 +55,7 @@ ...@@ -63,6 +55,7 @@
<if test="dept.name != null">name=#{dept.name},</if> <if test="dept.name != null">name=#{dept.name},</if>
<if test="dept.parentId != null">parent_id=#{dept.parentId},</if> <if test="dept.parentId != null">parent_id=#{dept.parentId},</if>
<if test="dept.deptDn != null">dept_dn=#{dept.deptDn},</if> <if test="dept.deptDn != null">dept_dn=#{dept.deptDn},</if>
del_flag = '0',
update_time = now() update_time = now()
</trim> </trim>
WHERE dept_id=#{dept.deptId} WHERE dept_id=#{dept.deptId}
......
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