Commit 5f43808d by 徐高华

群主查询

parent ba131d6f
package com.gic.haoban.manage.api.dto.qdto.chat;
import java.io.Serializable;
import java.util.List;
/**
*
......@@ -22,8 +23,17 @@ public class OwnerSearchQDTO implements Serializable {
private String wxEnterpriseId;
private String searchParams;
private String departmentId ;
private List<String> departmentIdList ;
// 1查询在职 2查离职
private int status = 1;
public List<String> getDepartmentIdList() {
return departmentIdList;
}
public void setDepartmentIdList(List<String> departmentIdList) {
this.departmentIdList = departmentIdList;
}
public String getDepartmentId() {
return departmentId;
......
......@@ -25,6 +25,7 @@ import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
......@@ -43,6 +44,7 @@ import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerHistoryMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatUserMapper;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
......@@ -54,6 +56,7 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwner;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwnerHistory;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatBO;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
......@@ -109,6 +112,8 @@ public class GroupChatServiceImpl implements GroupChatService {
private GroupChatHmService groupChatHmService;
@Autowired
private GroupChatHmRelationMapper groupChatHmRelationMapper;
@Autowired
private DepartmentService departmentService;
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
......@@ -486,15 +491,15 @@ public class GroupChatServiceImpl implements GroupChatService {
.collect(Collectors.toMap(TabGroupChatUser::getUserId, o -> o, ((k1, k2) -> k1)));
List<TabGroupChatUser> needAddUserList = new ArrayList<>();
int totalMemberCount = 0;
List<GroupChatUserIdDTO> adminList = detail.getAdmin_list() ;
List<String> adminIdList = adminList.stream().map(dto->dto.getUserid()).collect(Collectors.toList()) ;
List<GroupChatUserIdDTO> adminList = detail.getAdmin_list();
List<String> adminIdList = adminList.stream().map(dto -> dto.getUserid()).collect(Collectors.toList());
for (GroupChatDetailMemberDTO member : memberList) {
String userId = member.getUserid();
TabGroupChatUser user = userMap.get(userId);
user.setAdminFlag(0);
if(member.getUserid().equals(owner)) {
if (member.getUserid().equals(owner)) {
user.setAdminFlag(1);
}else if(adminIdList.contains(member.getUserid())) {
} else if (adminIdList.contains(member.getUserid())) {
user.setAdminFlag(2);
}
if (null != user) {
......@@ -721,6 +726,23 @@ public class GroupChatServiceImpl implements GroupChatService {
@Override
public Page<GroupChatOwnerDTO> listOwnerPage(OwnerSearchQDTO qdto, BasePageInfo basePageInfo) {
List<String> departmentIdList = new ArrayList<>();
String departmentId = qdto.getDepartmentId();
if (StringUtils.isNotBlank(departmentId)) {
TabHaobanDepartment department = this.departmentService.selectById(departmentId);
if (department != null) {
String parentDepartmentId = department.getParentDepartmentId();
if (!"0".equals(parentDepartmentId)) {
String chainId = department.getChainId() + Constant.ID_SEPARATOR + departmentId;
departmentIdList.add(departmentId);
List<TabHaobanDepartment> tabList = departmentService.listByChainId(chainId,
qdto.getWxEnterpriseId());
List<String> departmentIds = tabList.stream().map(TabHaobanDepartment::getDepartmentId)
.collect(Collectors.toList());
departmentIdList.addAll(departmentIds);
}
}
}
PageHelper.startPage(basePageInfo);
List<GroupChatOwnerDTO> list = this.groupChatOwnerMapper.listOwner(qdto);
Page<GroupChatOwnerDTO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatOwnerDTO.class);
......
......@@ -22,7 +22,7 @@ public class GroupChatUserServiceImpl implements GroupChatUserService {
@Override
public Page<GroupChatUserDTO> listPage(GroupChatUserSearchQDTO qdto, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
PageHelper.startPage(basePageInfo);
List<GroupChatUserDTO> list = this.groupChatUserMapper.listPage(qdto);
Page<GroupChatUserDTO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatUserDTO.class);
return retPage;
......
......@@ -54,7 +54,16 @@
SELECT a.staff_id staffId , b.`staff_name` staffName , a.wx_enterprise_id wxEnterpriseId ,
b.wx_user_id wxUserId , b.wx_open_user_id wxOpenUserId
FROM tab_haoban_group_chat_owner a LEFT JOIN tab_haoban_staff b ON a.`staff_id` = b.`staff_id`
<if test="departmentIdList != null and departmentIdList.size() > 0">
left join tab_haoban_staff_department_related c on a.staff_id = c.staff_id and c.status_flag = 1
</if>
where a.wx_enterprise_id=#{wxEnterpriseId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
and c.department_id IN
<foreach collection="departmentIdList" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
<if test="null != searchParams">
and b.staff_name like '%${searchParams}%'
</if>
......@@ -64,5 +73,9 @@
<if test="status==2">
and b.status_flag = 0
</if>
<if test="departmentIdList != null and departmentIdList.size() > 0">
group by a.statff_id
</if>
</select>
</mapper>
\ No newline at end of file
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