Commit 1f39ed25 by 徐高华

群加gic企业id参数

parent 6ab222ee
......@@ -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;
}
......
......@@ -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