|
|
|
@ -9,10 +9,12 @@ import com.kiisoo.ic.store.entity.PoiStore;
|
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStoreStaff;
|
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
|
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreStaffDOMapper;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
@ -46,21 +48,20 @@ public class PoiStoreService {
|
|
|
|
|
* 根据区域id找到店铺集合,若没有,则查用户所有店铺
|
|
|
|
|
* @param regionId
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId,Long regionId, Long companyId){
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId,List<Long> customerIds){
|
|
|
|
|
List<PoiStore> poiStores = new ArrayList<>();
|
|
|
|
|
//找到店铺集合
|
|
|
|
|
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
|
|
|
|
|
if(null != regionId){
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectRegionShop(regionId);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|
}
|
|
|
|
|
if(null != customerIds && customerIds.size()>0){
|
|
|
|
|
Set<Long> shopIds = new HashSet<>();
|
|
|
|
|
customerIds.forEach(customerId -> {
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(customerId,userId);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(shops)){
|
|
|
|
|
shopIds.addAll(shops);
|
|
|
|
|
}
|
|
|
|
|
}else if(companyId != null){
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(companyId,userId);
|
|
|
|
|
if(shops.size() > 0){
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectBatchIds(shops);
|
|
|
|
|
});
|
|
|
|
|
if(shopIds.size() > 0){
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectBatchIds(shopIds);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|