|
|
@ -11,6 +11,7 @@ import com.kiisoo.ic.domain.service.PrivilageDomainService;
|
|
|
|
import com.kiisoo.ic.generalize.entity.PoiCustomerContactDataStat;
|
|
|
|
import com.kiisoo.ic.generalize.entity.PoiCustomerContactDataStat;
|
|
|
|
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
|
|
|
|
import com.kiisoo.ic.generalize.entity.PrivilageOrganizational;
|
|
|
|
import com.kiisoo.ic.generalize.mapper.PoiCustomerContactDataStatMapper;
|
|
|
|
import com.kiisoo.ic.generalize.mapper.PoiCustomerContactDataStatMapper;
|
|
|
|
|
|
|
|
import com.kiisoo.ic.generalize.mapper.RetailCompanyMapper;
|
|
|
|
import com.kiisoo.ic.generalize.service.RetailCompanyService;
|
|
|
|
import com.kiisoo.ic.generalize.service.RetailCompanyService;
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStore;
|
|
|
|
import com.kiisoo.ic.store.entity.PoiStore;
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
|
|
|
|
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
|
|
|
@ -72,6 +73,12 @@ public class CustomerViewService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private OpVipDOMapper opVipDOMapper;
|
|
|
|
private OpVipDOMapper opVipDOMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 组织mapper
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private RetailCompanyMapper retailCompanyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 客户概览main
|
|
|
|
* 客户概览main
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param userId 用户id
|
|
|
@ -291,7 +298,8 @@ public class CustomerViewService {
|
|
|
|
shopIds.removeAll(notZeroShopIds);
|
|
|
|
shopIds.removeAll(notZeroShopIds);
|
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
|
|
List<CustomerViewZeroExtendVO> list = opCustomerDOMapper.selectOrgInfoByShopIds(shopIds);
|
|
|
|
List<CustomerViewZeroExtendVO> list = opCustomerDOMapper.selectOrgInfoByShopIds(shopIds);
|
|
|
|
|
|
|
|
//区域,公司信息
|
|
|
|
|
|
|
|
getShopRegionInfo(list);
|
|
|
|
AtomicInteger number = new AtomicInteger(1 + ((pageNum-1) * pageSize));
|
|
|
|
AtomicInteger number = new AtomicInteger(1 + ((pageNum-1) * pageSize));
|
|
|
|
//求分页总数
|
|
|
|
//求分页总数
|
|
|
|
Page<CustomerViewZeroExtendVO> pageList = (Page<CustomerViewZeroExtendVO>)list;
|
|
|
|
Page<CustomerViewZeroExtendVO> pageList = (Page<CustomerViewZeroExtendVO>)list;
|
|
|
@ -348,7 +356,7 @@ public class CustomerViewService {
|
|
|
|
//找到公司店铺
|
|
|
|
//找到公司店铺
|
|
|
|
List<PoiStore> shops = new ArrayList<>();
|
|
|
|
List<PoiStore> shops = new ArrayList<>();
|
|
|
|
minCompany.forEach(item -> {
|
|
|
|
minCompany.forEach(item -> {
|
|
|
|
shops.addAll(retailCompanyService.selectShopByCompany(companyId));
|
|
|
|
shops.addAll(retailCompanyService.selectShopByCompany(item));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//公司店铺和权限做交集
|
|
|
|
//公司店铺和权限做交集
|
|
|
|
Set<Long> shopIds = shops.stream().map(p -> p.getId()).collect(Collectors.toSet());
|
|
|
|
Set<Long> shopIds = shops.stream().map(p -> p.getId()).collect(Collectors.toSet());
|
|
|
@ -357,4 +365,43 @@ public class CustomerViewService {
|
|
|
|
return shopIds;
|
|
|
|
return shopIds;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 零推广店铺区域信息
|
|
|
|
|
|
|
|
* @param shopList 店铺list
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void getShopRegionInfo(List<CustomerViewZeroExtendVO> shopList){
|
|
|
|
|
|
|
|
//零售公司信息
|
|
|
|
|
|
|
|
List<Long> orgIds = shopList.stream().map(CustomerViewZeroExtendVO::getParentId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if(orgIds.size() == 0){
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryWrapper<PrivilageOrganizational> orgWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
orgWrapper.in("id", orgIds);
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> companyList = retailCompanyMapper.selectList(orgWrapper);
|
|
|
|
|
|
|
|
shopList.forEach(zeroExtendVO -> {
|
|
|
|
|
|
|
|
Long companyId = zeroExtendVO.getParentId();
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> tmpCompanyList = companyList.stream().filter(companyDO -> companyDO.getId().equals(companyId)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if(tmpCompanyList.size() > 0){
|
|
|
|
|
|
|
|
zeroExtendVO.setRegionId(tmpCompanyList.get(0).getParentId());
|
|
|
|
|
|
|
|
zeroExtendVO.setCompany(tmpCompanyList.get(0).getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
//区域信息
|
|
|
|
|
|
|
|
List<Long> regionIds = companyList.stream().map(PrivilageOrganizational::getParentId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if(regionIds.size() == 0){
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QueryWrapper<PrivilageOrganizational> regionWrapper = new QueryWrapper<>();
|
|
|
|
|
|
|
|
regionWrapper.in("id", regionIds);
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> regionList = retailCompanyMapper.selectList(regionWrapper);
|
|
|
|
|
|
|
|
shopList.forEach(zeroExtendVO -> {
|
|
|
|
|
|
|
|
Long regionId = zeroExtendVO.getRegionId();
|
|
|
|
|
|
|
|
//区域
|
|
|
|
|
|
|
|
List<PrivilageOrganizational> tmpRegionList = regionList.stream().filter(regionDO -> regionDO.getId().equals(regionId)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if(tmpRegionList.size() > 0){
|
|
|
|
|
|
|
|
zeroExtendVO.setRegion(tmpRegionList.get(0).getName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|