Commit 9f6a40a6 by 徐高华

Merge branch 'feature/xgh/202506迭代' into 'developer'

Feature/xgh/202506迭代

See merge request !3006
parents f1055891 e28b6701
......@@ -27,12 +27,21 @@ public class OwnerSearchQDTO implements Serializable {
// 1查询在职 2查离职
private int status = 1;
// 选择的企业id
// 选择的企业id(过滤条件)
private String paramsEnterpriseId ;
// 显示门店名称的企业
private String showNameEnterpriseId ;
// 是否需要显示门店名称
private int showStoreNames ;
public String getShowNameEnterpriseId() {
return showNameEnterpriseId;
}
public void setShowNameEnterpriseId(String showNameEnterpriseId) {
this.showNameEnterpriseId = showNameEnterpriseId;
}
public int getShowStoreNames() {
return showStoreNames;
}
......
......@@ -1122,6 +1122,40 @@ public class GroupChatServiceImpl implements GroupChatService {
PageHelper.startPage(basePageInfo);
List<GroupChatOwnerDTO> list = this.groupChatOwnerMapper.listOwner(qdto);
Page<GroupChatOwnerDTO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatOwnerDTO.class);
// 拼门店名称
if(CollectionUtils.isNotEmpty(retPage.getResult()) && qdto.getShowStoreNames()==1 && StringUtils.isNotBlank(qdto.getShowNameEnterpriseId())) {
List<String> staffIdList = retPage.getResult().stream().map(GroupChatOwnerDTO::getStaffId).collect(Collectors.toList());
List<StaffClerkRelationDTO> staffList = this.staffClerkRelationService.listByWxEnterpriseIdAndStaffId(qdto.getWxEnterpriseId(),staffIdList.stream().collect(Collectors.toSet())) ;
Map<String,List<StaffClerkRelationDTO>> staffMap = staffList.stream().collect(Collectors.groupingBy(StaffClerkRelationDTO::getEnterpriseId)) ;
staffList = staffList.stream().filter(o->o.getEnterpriseId().equals(qdto.getShowNameEnterpriseId()) && StringUtils.isNotBlank(o.getStoreId())).collect(Collectors.toList());
Map<String,String> storeNameMap = new HashMap<>() ;
if(CollectionUtils.isNotEmpty(staffList)) {
List<String> storeIdList = staffList.stream().filter(o->StringUtils.isNotEmpty(o.getStoreId())).map(o->o.getStoreId()).collect(Collectors.toList()) ;
if(CollectionUtils.isNotEmpty(storeIdList)) {
String[] arr = new String[storeIdList.size()] ;
for(int i=0;i<storeIdList.size();i++) {
arr[i] = storeIdList.get(i) ;
}
List<StoreDTO> storeList = this.storeService.getStores(arr) ;
if(CollectionUtils.isNotEmpty(storeList)) {
storeNameMap = storeList.stream().collect(Collectors.toMap(StoreDTO::getStoreId, o->o.getStoreName(),(k1,k2)->k1)) ;
}
}
}
for(GroupChatOwnerDTO item : retPage.getResult()) {
String staffId = item.getStaffId() ;
List<StaffClerkRelationDTO> relationList = staffMap.get(staffId) ;
List<String> storeNameList = new ArrayList<>() ;
if(CollectionUtils.isNotEmpty(relationList)) {
for (StaffClerkRelationDTO relation : relationList) {
if(StringUtils.isNotBlank(relation.getStoreId()) && storeNameMap.containsKey(relation.getStoreId())) {
storeNameList.add(storeNameMap.get(relation.getStoreId()));
}
}
}
item.setStoreNames(String.join(",", storeNameList));
}
}
return retPage;
}
......
......@@ -53,7 +53,10 @@
<select id="listOwner" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO">
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`
FROM tab_haoban_group_chat_owner a LEFT JOIN tab_haoban_staff b ON a.`staff_id` = b.`staff_id`
<if test="null != paramsEnterpriseId and ''!=paramsEnterpriseId ">
left join tab_haoban_staff_enterprise_related d on a.staff_id = d.staff_id and d.status_flag = 1
</if>
<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>
......@@ -64,6 +67,9 @@
#{id,jdbcType=VARCHAR}
</foreach>
</if>
<if test="null != paramsEnterpriseId and ''!=paramsEnterpriseId ">
and d.enterprise_id = #{paramsEnterpriseId}
</if>
<if test="null != searchParams and ''!=searchParams ">
and b.staff_name like #{searchParams}
</if>
......
......@@ -276,6 +276,7 @@ public class GroupChatController {
String paramsEnterpriseId = qdto.getParamsEnterpriseId() ;
if(StringUtils.isNotBlank(paramsEnterpriseId)) {
qdto.setShowStoreNames(1);
qdto.setShowNameEnterpriseId(paramsEnterpriseId);
}else {
List<EnterpriseDetailDTO> list = this.wxEnterpriseRelatedApiService.listEnterpriseByWxEnterpriseId(loginUser.getWxEnterpriseId(),loginUser.getPhoneNumber(),false) ;
if(CollectionUtils.isEmpty(list)) {
......@@ -283,8 +284,8 @@ public class GroupChatController {
}
if(list.size()==1) {
qdto.setShowStoreNames(1);
qdto.setShowNameEnterpriseId(list.get(0).getEnterpriseId());
}
qdto.setParamsEnterpriseId(list.get(0).getEnterpriseId());
}
ServiceResponse<Page<GroupChatOwnerDTO>> resp = this.groupChatApiService.listOwnerPage(qdto, basePageInfo);
return RestResponse.successResult(resp.getResult());
......
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