店铺名称查询优化

master
wyj2080 6 years ago
parent 64b23c60d8
commit a97112276c

@ -277,15 +277,21 @@ public class CustomerViewService {
List<CustomerViewShopVO> getShopNewCustomerList(List<OpCustomer> newCustimerList){
//店铺分组
Map<Long, List<OpCustomer>> shopIdMap = newCustimerList.stream().collect(Collectors.groupingBy(OpCustomer::getShopId));
List<Long> shopIds = newCustimerList.stream().map(customer -> customer.getShopId()).collect(Collectors.toList());
if(shopIds.size() == 0){
return new ArrayList<>();
}
Map<Long, String> shopNameMap = poiStoreDOMapper.selectBatchIds(shopIds).stream().collect(Collectors.toMap(shopDO -> shopDO.getId(), shopDO -> shopDO.getName()));
List<CustomerViewShopVO> shopViewList = new ArrayList<>();
shopIdMap.forEach((k,v) -> {
CustomerViewShopVO shopVO = new CustomerViewShopVO();
shopVO.setShopId(k);
shopVO.setNewCustomerCount(v.size());
PoiStore shopDO = poiStoreDOMapper.selectById(k);
if(shopDO != null){
shopVO.setShopName(shopDO.getName());
}
shopVO.setShopName(shopNameMap.get(k));
//PoiStore shopDO = poiStoreDOMapper.selectById(k);
//if(shopDO != null){
// shopVO.setShopName(shopDO.getName());
//}
shopViewList.add(shopVO);
});
//排序

Loading…
Cancel
Save