|
|
|
@ -330,17 +330,18 @@ public class CustomerViewService {
|
|
|
|
|
* 零推广list
|
|
|
|
|
* @param newCustimerList 新增好友list
|
|
|
|
|
* @param shopIds 管辖店铺ids
|
|
|
|
|
* @param regionId 区域
|
|
|
|
|
* @param companyId 零售公司
|
|
|
|
|
* @param customerId 客户组织
|
|
|
|
|
* @return 零推广list
|
|
|
|
|
*/
|
|
|
|
|
List<CustomerViewZeroExtendVO> getZeroExtendList2(List<OpCustomer> newCustimerList, List<Long> shopIds, int pageNum, int pageSize){
|
|
|
|
|
List<CustomerViewZeroExtendVO> getZeroExtendList2(List<OpCustomer> newCustimerList, List<Long> shopIds, int pageNum, int pageSize, Long regionId , Long companyId, Long customerId){
|
|
|
|
|
//有推广的店铺ids
|
|
|
|
|
List<Long> notZeroShopIds = newCustimerList.stream().map(OpCustomer::getShopId).distinct().collect(Collectors.toList());
|
|
|
|
|
//无推广id
|
|
|
|
|
shopIds.removeAll(notZeroShopIds);
|
|
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
|
|
|
List<CustomerViewZeroExtendVO> list = opCustomerDOMapper.selectOrgInfoByShopIds(shopIds);
|
|
|
|
|
//区域,公司信息
|
|
|
|
|
getShopRegionInfo(list);
|
|
|
|
|
List<CustomerViewZeroExtendVO> list = opCustomerDOMapper.selectOrgInfoByShopIds(shopIds, regionId, companyId, customerId);
|
|
|
|
|
AtomicInteger number = new AtomicInteger(1 + ((pageNum-1) * pageSize));
|
|
|
|
|
//求分页总数
|
|
|
|
|
Page<CustomerViewZeroExtendVO> pageList = (Page<CustomerViewZeroExtendVO>)list;
|
|
|
|
@ -383,7 +384,7 @@ public class CustomerViewService {
|
|
|
|
|
}
|
|
|
|
|
//柱状图好友list
|
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(new ArrayList<>(shopIds), null, null, startTime, endTime);
|
|
|
|
|
List<CustomerViewZeroExtendVO> zeroExtendList = getZeroExtendList2(customerList, new ArrayList<>(shopIds),pageNum,pageSize);
|
|
|
|
|
List<CustomerViewZeroExtendVO> zeroExtendList = getZeroExtendList2(customerList, new ArrayList<>(shopIds),pageNum,pageSize, regionId, companyId, customerId);
|
|
|
|
|
return zeroExtendList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -406,46 +407,5 @@ public class CustomerViewService {
|
|
|
|
|
return shopIds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 零推广店铺区域信息
|
|
|
|
|
* @param shopList 店铺list
|
|
|
|
|
*/
|
|
|
|
|
public void getShopRegionInfo(List<CustomerViewZeroExtendVO> shopList){
|
|
|
|
|
if(shopList.size() == 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//零售公司信息
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|