|
@@ -802,6 +802,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
//合计
|
|
|
List<String> sumRow = new ArrayList<String>();
|
|
|
//sumRow.add("合计");
|
|
|
+ //sumRow.add("合计");
|
|
|
sumRow.add(MessageUtils.message("entry.total"));
|
|
|
sumRow.add("");
|
|
|
if(functionTimeList.size()>0){
|
|
@@ -913,11 +914,13 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("TOKEN")).getCompanyId();
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
List<HashMap> userMapList = new ArrayList<>();
|
|
|
+ List<HashMap> deptMapList = new ArrayList<>();
|
|
|
//通讯录查询人员
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
if (StringUtils.isNotBlank(keyword) && wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
|
|
|
HashMap<String, List> result = wxCorpInfoService.getOpenId(wxCorpInfo.getCorpid(), keyword, cursor,0,20);
|
|
|
List users = result.get("user");
|
|
|
+ List depts = result.get("dept");
|
|
|
if (users.size()!=0){
|
|
|
List<User> realUser = userMapper.selectList(new QueryWrapper<User>().in("corpwx_userid", users));
|
|
|
if (realUser.size()!=0){
|
|
@@ -948,6 +951,26 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
return msg;
|
|
|
}
|
|
|
}
|
|
|
+ if (depts.size()!=0){
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().in("corpwx_deptid", depts));
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("company_id", companyId));
|
|
|
+ //结果列表
|
|
|
+ List<DepartmentVO> list = new ArrayList<>();
|
|
|
+ List<Department> rootDepartments = departmentList.stream().filter(dept -> dept.getSuperiorId() == null).collect(Collectors.toList());
|
|
|
+ rootDepartments.forEach(root->{
|
|
|
+ DepartmentVO rootDeptVO = formatDepartmentToVO(root, departmentOtherManagerList);
|
|
|
+ list.add(rootDeptVO);
|
|
|
+ fillSubDepartmentList(departmentList, rootDeptVO, departmentOtherManagerList);
|
|
|
+ });
|
|
|
+ //处理部门下人员列表
|
|
|
+ List<DepartmentVO> userListWithDept = getUserListWithDept(userList, list);
|
|
|
+ HashMap<String, Object> data = new HashMap<>();
|
|
|
+ data.put("data",userListWithDept);
|
|
|
+ data.put("nextCursor","");
|
|
|
+ msg.data = data;
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
ArrayList<Object> emptyList = new ArrayList<>();
|
|
|
msg.data = emptyList;
|
|
|
return msg;
|
|
@@ -975,6 +998,25 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public List<DepartmentVO> getUserListWithDept(List<User> userList,List<DepartmentVO> departmentVOList ){
|
|
|
+ if(departmentVOList!=null&&departmentVOList.size()>0){
|
|
|
+ for (DepartmentVO departmentVO : departmentVOList) {
|
|
|
+ List<HashMap> userMapList = new ArrayList<>();
|
|
|
+ List<User> collect = userList.stream().filter(ul -> ul.getDepartmentId() != null && ul.getDepartmentId().equals(departmentVO.getId())).collect(Collectors.toList());
|
|
|
+ for (User u : collect) {
|
|
|
+ HashMap<String, Object> user = new HashMap<String, Object>();
|
|
|
+ user.put("id", u.getId());
|
|
|
+ user.put("name", u.getName());
|
|
|
+ user.put("departmentId", u.getDepartmentId());
|
|
|
+ userMapList.add(user);
|
|
|
+ }
|
|
|
+ departmentVO.setUserList(userMapList);
|
|
|
+ getUserListWithDept(userList,departmentVO.getChildren());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return departmentVOList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg listMyMembs(HttpServletRequest request) {
|
|
|
User currentUser = userMapper.selectById(request.getHeader("TOKEN"));
|