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 476ea33..b464986 100644 --- a/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java +++ b/src/main/java/com/kiisoo/ic/customer/service/CustomerViewService.java @@ -118,17 +118,9 @@ public class CustomerViewService { } //柱状图好友list List customerList = opCustomerDOMapper.selectCustomerList(shopIds, null, null, startTime, endTime); - //好友总数 - Long customerCount = opCustomerDOMapper.selectCustomerCount(shopIds, null, null, null); - //好友总数(去重) - Long validCustomerCount = opCustomerDOMapper.selectCustomerCount(shopIds, VALID, null, null); - //删除拉黑数 - Long validDeleteCustomerCount = poiCustomerContactDataStatMapper.selectDeleteCustomer(shopIds).stream() - .filter(contactDO -> contactDO.getNegativeFeedbackCnt() != null) - .map(PoiCustomerContactDataStat::getNegativeFeedbackCnt).mapToLong(a -> a).sum(); + //会员总数 //todo 会员数据暂时不能根据店铺查询 -// Long vipCount = opVipDOMapper.selectVipCount(shopIds, null, null); Long vipCount = opVipDOMapper.selectVipCountNew(); List newCustimerList = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).collect(Collectors.toList()); @@ -139,7 +131,7 @@ public class CustomerViewService { List validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList()); handleChartData(customerList, validCustomerList, customerViewVO); //设置新增好友,好友总数,拉黑数,vip人数 - setCustomerViewData(customerViewVO, customerCount, validCustomerCount, validDeleteCustomerCount, vipCount, customerList, validCustomerList, selectStartTime, selectEndTime); + setCustomerViewData(customerViewVO, vipCount, customerList, validCustomerList, selectStartTime, selectEndTime); //前十名排行list等 List orgNewCustomerList = getOrgNewCustomerList(newCustimerList); List shopNewCustomerList = getShopNewCustomerList(newCustimerList); @@ -150,6 +142,24 @@ public class CustomerViewService { return customerViewVO; } + + /** + * 获取拉黑 + * @param userId + * @return + */ + public CustomerViewVO getDelNum(Long userId){ + List shopIds = getShopIds(userId); + //删除拉黑数 + Long validDeleteCustomerCount = poiCustomerContactDataStatMapper.selectDeleteCustomer(shopIds).stream() + .filter(contactDO -> contactDO.getNegativeFeedbackCnt() != null) + .map(PoiCustomerContactDataStat::getNegativeFeedbackCnt).mapToLong(a -> a).sum(); + //返回对象 + CustomerViewVO result = new CustomerViewVO(); + result.setValidDeleteCustomer(validDeleteCustomerCount); + return result; + } + /** * shopIds * @param userId 用户id @@ -163,29 +173,20 @@ public class CustomerViewService { /** * 新增好友,好友总数,拉黑数,vip人数 * @param customerViewVO 客户概览VO - * @param customerCount 好友总数 - * @param validCustomerCount 好友总数(去重) - * @param validDeleteCustomerCount 删除来黑数(累计去重) * @param vipCount 会员总数 * @param customerList 新增好友list * @param validCustomerList 新增好友(去重)list * @param selectStartTime 选中开始时间 * @param selectEndTime 选中结束时间 */ - public void setCustomerViewData(CustomerViewVO customerViewVO, Long customerCount, Long validCustomerCount, Long validDeleteCustomerCount, Long vipCount, - List customerList, List validCustomerList, String selectStartTime, String selectEndTime){ + public void setCustomerViewData(CustomerViewVO customerViewVO, Long vipCount,List customerList, + List validCustomerList, String selectStartTime, String selectEndTime){ //新增好友 Long newCustomerCount = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count(); customerViewVO.setNewCustomer(newCustomerCount); //新增好友(去重) Long newValidCustomerCount = validCustomerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count(); customerViewVO.setNewValidCustomer(newValidCustomerCount); - //好友总数 - customerViewVO.setAllCustomer(customerCount); - //好友总数(去重) - customerViewVO.setAllValidCustomer(validCustomerCount); - //删除拉黑数(累计去重) - customerViewVO.setValidDeleteCustomer(validDeleteCustomerCount); //会员总数 customerViewVO.setAllVipCount(vipCount);