|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.kiisoo.ic.store.service;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.kiisoo.ic.customer.service.CustomerViewService;
|
|
|
|
|
import com.kiisoo.ic.domain.service.PrivilageDomainService;
|
|
|
|
|
import com.kiisoo.ic.generalize.service.RetailCompanyService;
|
|
|
|
|
import com.kiisoo.ic.store.bean.PoiStoreStaffDTO;
|
|
|
|
@ -13,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 店铺
|
|
|
|
@ -28,6 +30,9 @@ public class PoiStoreService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RetailCompanyService retailCompanyService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CustomerViewService customerViewService;
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域id找到店铺集合
|
|
|
|
|
* @param regionId
|
|
|
|
@ -41,22 +46,25 @@ public class PoiStoreService {
|
|
|
|
|
* 根据区域id找到店铺集合,若没有,则查用户所有店铺
|
|
|
|
|
* @param regionId
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId,Long bigRegionId, Long companyId){
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId,Long regionId, Long companyId){
|
|
|
|
|
List<PoiStore> poiStores = new ArrayList<>();
|
|
|
|
|
//找到店铺集合
|
|
|
|
|
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
|
|
|
|
|
if(companyId != null){
|
|
|
|
|
List<PoiStore> regionPoiStores = retailCompanyService.selectShopByCompany(companyId);
|
|
|
|
|
if(null != regionId){
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectRegionShop(regionId);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if(null != bigRegionId){
|
|
|
|
|
List<PoiStore> regionPoiStores = retailCompanyService.selectShopByBigRegion(bigRegionId);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|
}else if(companyId != null){
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(companyId,userId);
|
|
|
|
|
if(shops.size() > 0){
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectBatchIds(shops);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|