首页性能优化

master
wyj2080 6 years ago
parent b14c17bfb9
commit 854fe8c124

@ -2,8 +2,6 @@ package com.kiisoo.ic.customer.entity;
import lombok.Data;
import java.util.Date;
/**
* @Description: VO
* @Author: wangyinjia
@ -11,21 +9,13 @@ import java.util.Date;
*/
@Data
public class OpCustomerSimpleVO {
/**
* ID
*/
private Long id;
/**
*
*/
private Date registerTime;
private String registerTime;
/**
*
*
*/
public OpCustomerSimpleVO(Long id, Date registerTime){
this.id = id;
this.registerTime = registerTime;
}
private Long customerSize;
}

@ -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

Loading…
Cancel
Save