|
|
@ -101,7 +101,7 @@ public class CustomerViewService {
|
|
|
|
private RetailCompanyMapper retailCompanyMapper;
|
|
|
|
private RetailCompanyMapper retailCompanyMapper;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 客户概览main
|
|
|
|
* 客户概览main——趋势图
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param selectStartTime 选中开始时间
|
|
|
|
* @param selectStartTime 选中开始时间
|
|
|
|
* @param selectEndTime 选中结束时间
|
|
|
|
* @param selectEndTime 选中结束时间
|
|
|
@ -116,37 +116,60 @@ public class CustomerViewService {
|
|
|
|
if(CollectionUtils.isEmpty(shopIds)){
|
|
|
|
if(CollectionUtils.isEmpty(shopIds)){
|
|
|
|
return customerViewVO;
|
|
|
|
return customerViewVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//柱状图好友list
|
|
|
|
//柱状图好友趋势图
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIds, null, null, startTime, endTime);
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIds, null, null, startTime, endTime);
|
|
|
|
|
|
|
|
|
|
|
|
//会员总数
|
|
|
|
//会员总数
|
|
|
|
//todo 会员数据暂时不能根据店铺查询
|
|
|
|
|
|
|
|
Long vipCount = opVipDOMapper.selectVipCountNew();
|
|
|
|
Long vipCount = opVipDOMapper.selectVipCountNew();
|
|
|
|
|
|
|
|
customerViewVO.setAllVipCount(vipCount);
|
|
|
|
|
|
|
|
|
|
|
|
List<OpCustomer> newCustimerList = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
//零售公司店均新增
|
|
|
|
|
|
|
|
List<CustomerViewCompanyVO> shopAverageNewCustomerList = getOrgShopAvgNewCustomerList(newCustimerList, userId);
|
|
|
|
|
|
|
|
customerViewVO.setCompanyShopAverageNewCustomerList(shopAverageNewCustomerList);
|
|
|
|
|
|
|
|
//设置趋势柱状图list
|
|
|
|
//设置趋势柱状图list
|
|
|
|
List<OpCustomer> validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList());
|
|
|
|
List<OpCustomer> validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList());
|
|
|
|
handleChartData(customerList, validCustomerList, customerViewVO);
|
|
|
|
handleChartData(customerList, validCustomerList, customerViewVO);
|
|
|
|
//设置新增好友,好友总数,拉黑数,vip人数
|
|
|
|
|
|
|
|
setCustomerViewData(customerViewVO, vipCount, customerList, validCustomerList, selectStartTime, selectEndTime);
|
|
|
|
//设置新增好友,新增好友(去重),vip人数
|
|
|
|
|
|
|
|
setCustomerViewData(customerViewVO, customerList, validCustomerList, selectStartTime, selectEndTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 客户概览——Top榜
|
|
|
|
|
|
|
|
* @param userId 用户id
|
|
|
|
|
|
|
|
* @param selectStartTime 选中开始时间
|
|
|
|
|
|
|
|
* @param selectEndTime 选中结束时间
|
|
|
|
|
|
|
|
* @return 客户概览VO
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public CustomerViewVO selectCustomerViewMainDate(Long userId, String selectStartTime, String selectEndTime){
|
|
|
|
|
|
|
|
CustomerViewVO customerViewVO = new CustomerViewVO();
|
|
|
|
|
|
|
|
//shopIds
|
|
|
|
|
|
|
|
List<Long> shopIds = getShopIds(userId);
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(shopIds)){
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//柱状图好友list
|
|
|
|
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIds, null, null, selectStartTime, selectEndTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//零售公司店均新增
|
|
|
|
|
|
|
|
List<CustomerViewCompanyVO> shopAverageNewCustomerList = getOrgShopAvgNewCustomerList(customerList, userId);
|
|
|
|
|
|
|
|
customerViewVO.setCompanyShopAverageNewCustomerList(shopAverageNewCustomerList);
|
|
|
|
|
|
|
|
|
|
|
|
//前十名排行list等
|
|
|
|
//前十名排行list等
|
|
|
|
List<CustomerViewCompanyVO> orgNewCustomerList = getOrgNewCustomerList(newCustimerList);
|
|
|
|
List<CustomerViewCompanyVO> orgNewCustomerList = getOrgNewCustomerList(customerList);
|
|
|
|
List<CustomerViewShopVO> shopNewCustomerList = getShopNewCustomerList(newCustimerList);
|
|
|
|
List<CustomerViewShopVO> shopNewCustomerList = getShopNewCustomerList(customerList);
|
|
|
|
List<CustomerViewZeroExtendVO> zeroExtendList = getZeroExtendList(newCustimerList, shopIds);
|
|
|
|
List<CustomerViewZeroExtendVO> zeroExtendList = getZeroExtendList(customerList, shopIds);
|
|
|
|
customerViewVO.setOrgNewCustomerList(orgNewCustomerList);
|
|
|
|
customerViewVO.setOrgNewCustomerList(orgNewCustomerList);
|
|
|
|
customerViewVO.setShopNewCustomerList(shopNewCustomerList);
|
|
|
|
customerViewVO.setShopNewCustomerList(shopNewCustomerList);
|
|
|
|
customerViewVO.setZeroExtendList(zeroExtendList);
|
|
|
|
customerViewVO.setZeroExtendList(zeroExtendList);
|
|
|
|
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
return customerViewVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取拉黑
|
|
|
|
* 客户概览——拉黑数
|
|
|
|
* @param userId
|
|
|
|
* @param userId 用户id
|
|
|
|
* @return
|
|
|
|
* @return 客户概览VO
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public CustomerViewVO getDelNum(Long userId){
|
|
|
|
public CustomerViewVO getDelNum(Long userId){
|
|
|
|
List<Long> shopIds = getShopIds(userId);
|
|
|
|
List<Long> shopIds = getShopIds(userId);
|
|
|
@ -173,13 +196,12 @@ public class CustomerViewService {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增好友,好友总数,拉黑数,vip人数
|
|
|
|
* 新增好友,好友总数,拉黑数,vip人数
|
|
|
|
* @param customerViewVO 客户概览VO
|
|
|
|
* @param customerViewVO 客户概览VO
|
|
|
|
* @param vipCount 会员总数
|
|
|
|
|
|
|
|
* @param customerList 新增好友list
|
|
|
|
* @param customerList 新增好友list
|
|
|
|
* @param validCustomerList 新增好友(去重)list
|
|
|
|
* @param validCustomerList 新增好友(去重)list
|
|
|
|
* @param selectStartTime 选中开始时间
|
|
|
|
* @param selectStartTime 选中开始时间
|
|
|
|
* @param selectEndTime 选中结束时间
|
|
|
|
* @param selectEndTime 选中结束时间
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setCustomerViewData(CustomerViewVO customerViewVO, Long vipCount,List<OpCustomer> customerList,
|
|
|
|
public void setCustomerViewData(CustomerViewVO customerViewVO, List<OpCustomer> customerList,
|
|
|
|
List<OpCustomer> validCustomerList, String selectStartTime, String selectEndTime){
|
|
|
|
List<OpCustomer> validCustomerList, String selectStartTime, String selectEndTime){
|
|
|
|
//新增好友
|
|
|
|
//新增好友
|
|
|
|
Long newCustomerCount = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
|
|
|
|
Long newCustomerCount = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
|
|
|
@ -187,8 +209,6 @@ public class CustomerViewService {
|
|
|
|
//新增好友(去重)
|
|
|
|
//新增好友(去重)
|
|
|
|
Long newValidCustomerCount = validCustomerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
|
|
|
|
Long newValidCustomerCount = validCustomerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
|
|
|
|
customerViewVO.setNewValidCustomer(newValidCustomerCount);
|
|
|
|
customerViewVO.setNewValidCustomer(newValidCustomerCount);
|
|
|
|
//会员总数
|
|
|
|
|
|
|
|
customerViewVO.setAllVipCount(vipCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|