diff --git a/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java b/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java index 700746e..c2abfe5 100644 --- a/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java +++ b/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java @@ -96,13 +96,18 @@ public class CustomerViewService { */ public CustomerViewVO selectCustomerViewMain(Long userId, String selectStartTime, String selectEndTime, String startTime, String endTime){ CustomerViewVO customerViewVO = new CustomerViewVO(); + Date s1 = new Date(); //shopIds List shopIds = getShopIds(userId); if(CollectionUtils.isEmpty(shopIds)){ return customerViewVO; } + Date s2 = new Date(); + System.out.println("shopIds:" + (s2.getTime()-s1.getTime())); //柱状图好友list List customerList = opCustomerDOMapper.selectCustomerList(shopIds, null, null, startTime, endTime); + Date s3 = new Date(); + System.out.println("customerList:" + (s3.getTime()-s2.getTime())); //好友总数 Long customerCount = opCustomerDOMapper.selectCustomerCount(shopIds, null, null, null); //好友总数(去重) @@ -113,6 +118,8 @@ public class CustomerViewService { .map(PoiCustomerContactDataStat::getNegativeFeedbackCnt).mapToLong(a -> a).sum(); //会员总数 Long vipCount = opVipDOMapper.selectVipCount(shopIds, null, null); + Date s4 = new Date(); + System.out.println("总数:" + (s4.getTime()-s3.getTime())); //设置柱状图list List validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList()); @@ -123,8 +130,14 @@ public class CustomerViewService { //前十名排行list等 List newCustimerList = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).collect(Collectors.toList()); List orgNewCustomerList = getOrgNewCustomerList(newCustimerList); + Date s5 = new Date(); + System.out.println("公司:" + (s5.getTime()-s4.getTime())); List shopNewCustomerList = getShopNewCustomerList(newCustimerList); + Date s6 = new Date(); + System.out.println("店铺:" + (s6.getTime()-s5.getTime())); List zeroExtendList = getZeroExtendList(newCustimerList, shopIds); + Date s7 = new Date(); + System.out.println("零推广:" + (s7.getTime()-s6.getTime())); customerViewVO.setOrgNewCustomerList(orgNewCustomerList); customerViewVO.setShopNewCustomerList(shopNewCustomerList); customerViewVO.setZeroExtendList(zeroExtendList); @@ -277,21 +290,17 @@ public class CustomerViewService { List getShopNewCustomerList(List newCustimerList){ //店铺分组 Map> shopIdMap = newCustimerList.stream().collect(Collectors.groupingBy(OpCustomer::getShopId)); - List shopIds = newCustimerList.stream().map(customer -> customer.getShopId()).collect(Collectors.toList()); + List shopIds = newCustimerList.stream().map(OpCustomer::getShopId).collect(Collectors.toList()); if(shopIds.size() == 0){ return new ArrayList<>(); } - Map shopNameMap = poiStoreDOMapper.selectBatchIds(shopIds).stream().collect(Collectors.toMap(shopDO -> shopDO.getId(), shopDO -> shopDO.getName())); + Map shopNameMap = poiStoreDOMapper.selectBatchIds(shopIds).stream().collect(Collectors.toMap(PoiStore::getId, PoiStore::getName)); List shopViewList = new ArrayList<>(); shopIdMap.forEach((k,v) -> { CustomerViewShopVO shopVO = new CustomerViewShopVO(); shopVO.setShopId(k); shopVO.setNewCustomerCount(v.size()); shopVO.setShopName(shopNameMap.get(k)); - //PoiStore shopDO = poiStoreDOMapper.selectById(k); - //if(shopDO != null){ - // shopVO.setShopName(shopDO.getName()); - //} shopViewList.add(shopVO); }); //排序