|
|
|
@ -116,10 +116,7 @@ public class CustomerViewService {
|
|
|
|
|
|
|
|
|
|
//设置柱状图list
|
|
|
|
|
List<OpCustomer> validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList());
|
|
|
|
|
List<OpCustomerSimpleVO> simpleCustomerList = customerList.stream().map(customer -> new OpCustomerSimpleVO(customer.getId(), customer.getRegisterTime())).collect(Collectors.toList());
|
|
|
|
|
List<OpCustomerSimpleVO> simpleValidCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).map(customer -> new OpCustomerSimpleVO(customer.getId(), customer.getRegisterTime())).collect(Collectors.toList());
|
|
|
|
|
customerViewVO.setCustomerList(simpleCustomerList);
|
|
|
|
|
customerViewVO.setValidCustomerList(simpleValidCustomerList);
|
|
|
|
|
handleChartData(customerList, validCustomerList, customerViewVO);
|
|
|
|
|
//设置新增好友,好友总数,拉黑数,vip人数,柱状图list等数据
|
|
|
|
|
setCustomerViewData(customerViewVO, customerCount, validCustomerCount, validDeleteCustomerCount, vipCount, customerList, validCustomerList, selectStartTime, selectEndTime);
|
|
|
|
|
//前十名排行list等
|
|
|
|
@ -230,6 +227,34 @@ public class CustomerViewService {
|
|
|
|
|
return shopOrgInfoList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 柱状图数据
|
|
|
|
|
* @param customerList 好友list
|
|
|
|
|
* @param validCustomerList 好友(去重)list
|
|
|
|
|
* @param customerViewVO 概览VO
|
|
|
|
|
*/
|
|
|
|
|
public void handleChartData(List<OpCustomer> customerList, List<OpCustomer> validCustomerList, CustomerViewVO customerViewVO){
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Map<String, Long> customerSizeMap = customerList.stream().filter(customer -> customer.getRegisterTime() != null).collect(Collectors.groupingBy(customer -> sdf.format(customer.getRegisterTime()), Collectors.counting()));
|
|
|
|
|
Map<String, Long> validCustomerSizeMap = validCustomerList.stream().filter(customer -> customer.getRegisterTime() != null).collect(Collectors.groupingBy(customer -> sdf.format(customer.getRegisterTime()), Collectors.counting()));
|
|
|
|
|
List<OpCustomerSimpleVO> simpleCustomerList = new ArrayList<>();
|
|
|
|
|
List<OpCustomerSimpleVO> simpleValidCustomerList = new ArrayList<>();
|
|
|
|
|
customerSizeMap.forEach((k,v) -> {
|
|
|
|
|
OpCustomerSimpleVO customerSimpleVO = new OpCustomerSimpleVO();
|
|
|
|
|
customerSimpleVO.setRegisterTime(k);
|
|
|
|
|
customerSimpleVO.setCustomerSize(v);
|
|
|
|
|
simpleCustomerList.add(customerSimpleVO);
|
|
|
|
|
});
|
|
|
|
|
validCustomerSizeMap.forEach((k,v) -> {
|
|
|
|
|
OpCustomerSimpleVO validCustomerSimpleVO = new OpCustomerSimpleVO();
|
|
|
|
|
validCustomerSimpleVO.setRegisterTime(k);
|
|
|
|
|
validCustomerSimpleVO.setCustomerSize(v);
|
|
|
|
|
simpleValidCustomerList.add(validCustomerSimpleVO);
|
|
|
|
|
});
|
|
|
|
|
customerViewVO.setCustomerList(simpleCustomerList);
|
|
|
|
|
customerViewVO.setValidCustomerList(simpleValidCustomerList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 零售公司新增排行list
|
|
|
|
|
* @param newCustimerList 新增好友list
|
|
|
|
|