|
|
|
@ -53,40 +53,43 @@ public class PoiStoreService {
|
|
|
|
|
private PrivilageOrganizationalDomainMapper privilageOrganizationalDomainMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private RetailCompanyMapper retailCompanyMapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域id找到店铺集合
|
|
|
|
|
*
|
|
|
|
|
* @param regionId
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStore> getRegionShop(long regionId){
|
|
|
|
|
public List<PoiStore> getRegionShop(long regionId) {
|
|
|
|
|
List<PoiStore> poiStores = poiStoreDOMapper.selectRegionShop(regionId);
|
|
|
|
|
return poiStores;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域id找到店铺集合,若没有,则查用户所有店铺
|
|
|
|
|
*
|
|
|
|
|
* @param regionId
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId,List<Long> customerIds){
|
|
|
|
|
public List<PoiStore> getRegionShop(long userId, List<Long> customerIds) {
|
|
|
|
|
List<PoiStore> poiStores = new ArrayList<>();
|
|
|
|
|
//找到店铺集合
|
|
|
|
|
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
|
|
|
|
|
if(null != customerIds && customerIds.size()>0){
|
|
|
|
|
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)){
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(customerId, userId);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(shops)) {
|
|
|
|
|
shopIds.addAll(shops);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if(shopIds.size() > 0){
|
|
|
|
|
if (shopIds.size() > 0) {
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectBatchIds(shopIds);
|
|
|
|
|
for(PoiStore item : regionPoiStores){
|
|
|
|
|
if(shopsIds.contains(item.getId())){
|
|
|
|
|
for (PoiStore item : regionPoiStores) {
|
|
|
|
|
if (shopsIds.contains(item.getId())) {
|
|
|
|
|
poiStores.add(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
poiStores = poiStoreDOMapper.selectBatchIds(shopsIds);
|
|
|
|
|
}
|
|
|
|
|
return poiStores;
|
|
|
|
@ -94,12 +97,13 @@ public class PoiStoreService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域id找到店铺集合,若没有,则查用户所有店铺
|
|
|
|
|
*
|
|
|
|
|
* @param regionId
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStoreDTO> getRegionShopDTO(long userId,List<Long> customerIds){
|
|
|
|
|
public List<PoiStoreDTO> getRegionShopDTO(long userId, List<Long> customerIds) {
|
|
|
|
|
List<PoiStoreDTO> poiStores = new ArrayList<>();
|
|
|
|
|
//找到店铺集合
|
|
|
|
|
if(null != customerIds && customerIds.size()>0){
|
|
|
|
|
if (null != customerIds && customerIds.size() > 0) {
|
|
|
|
|
Set<Long> cs = new HashSet<>();
|
|
|
|
|
cs.addAll(customerIds);
|
|
|
|
|
Set<Long> childs = retailCompanyMapper.selectChildList(cs);
|
|
|
|
@ -107,14 +111,15 @@ public class PoiStoreService {
|
|
|
|
|
Set<Long> domainIds = domains.stream().map(PrivilageOrganizationalDomain::getDomainId).collect(Collectors.toSet());
|
|
|
|
|
List<PrivilageDomainEntityDO> entityDOS = privilageDomainEntityDOMapper.selectList(Wrappers.<PrivilageDomainEntityDO>lambdaQuery().in(PrivilageDomainEntityDO::getDomainId, domainIds).eq(PrivilageDomainEntityDO::getType, 3).select(PrivilageDomainEntityDO::getEntityId));
|
|
|
|
|
Set<Long> shopIds = entityDOS.stream().map(PrivilageDomainEntityDO::getEntityId).collect(Collectors.toSet());
|
|
|
|
|
if(shopIds.size() > 0){
|
|
|
|
|
if (shopIds.size() > 0) {
|
|
|
|
|
poiStores = poiStoreDOMapper.selectDTOBatchIds(shopIds);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
poiStores = poiStoreDOMapper.selectDTOBatchIds(privilageDomainService.listUserDatePermission(userId));
|
|
|
|
|
}
|
|
|
|
|
return poiStores;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询所有店铺
|
|
|
|
|
*
|
|
|
|
@ -127,22 +132,29 @@ public class PoiStoreService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据区域id找到店铺集合,若没有,则查用户所有店铺
|
|
|
|
|
*
|
|
|
|
|
* @param companyId 零售公司ID
|
|
|
|
|
*/
|
|
|
|
|
public List<PoiStore> getStoreByCompanyId(long userId,Long companyId){
|
|
|
|
|
public List<PoiStore> getStoreByCompanyId(long userId, Long companyId) {
|
|
|
|
|
List<PoiStore> poiStores = new ArrayList<>();
|
|
|
|
|
//找到店铺集合
|
|
|
|
|
List<Long> shopsIds = privilageDomainService.listUserDatePermission(userId);
|
|
|
|
|
if(!companyId.equals(0L)){
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(companyId,userId);
|
|
|
|
|
if(shops.size() > 0){
|
|
|
|
|
if (!companyId.equals(0L)) {
|
|
|
|
|
Set<Long> shops = customerViewService.getCompanyShop(companyId, userId);
|
|
|
|
|
if (shops.size() > 0) {
|
|
|
|
|
List<PoiStore> regionPoiStores = poiStoreDOMapper.selectBatchIds(shops);
|
|
|
|
|
List<PoiStore> intersection = regionPoiStores.stream().filter(item -> shops.contains(item.getId())).collect(toList());
|
|
|
|
|
return intersection;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
poiStores = poiStoreDOMapper.selectBatchIds(shopsIds);
|
|
|
|
|
}
|
|
|
|
|
return poiStores;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<PoiStore> organizationalList(String organizationalIdList) {
|
|
|
|
|
|
|
|
|
|
return poiStoreDOMapper.organizationalList(organizationalIdList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|