|
|
@ -174,8 +174,6 @@ public class CustomerViewService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public CustomerViewVO selectCustomerViewMain(Long userId, String selectStartTime, String selectEndTime, String startTime, String endTime){
|
|
|
|
public CustomerViewVO selectCustomerViewMain(Long userId, String selectStartTime, String selectEndTime, String startTime, String endTime){
|
|
|
|
CustomerViewVO customerViewVO = new CustomerViewVO();
|
|
|
|
CustomerViewVO customerViewVO = new CustomerViewVO();
|
|
|
|
//会员总数
|
|
|
|
|
|
|
|
Long vipCount = 0L;
|
|
|
|
|
|
|
|
//shopIds
|
|
|
|
//shopIds
|
|
|
|
List<Long> shopIdList = new ArrayList<>();
|
|
|
|
List<Long> shopIdList = new ArrayList<>();
|
|
|
|
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
|
|
|
|
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
|
|
|
@ -185,7 +183,6 @@ public class CustomerViewService {
|
|
|
|
//店长
|
|
|
|
//店长
|
|
|
|
if(privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
if(privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectByUserId(userId);
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectByUserId(userId);
|
|
|
|
vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//运营人员
|
|
|
|
//运营人员
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_YYRY.getRoleCode())) {
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_YYRY.getRoleCode())) {
|
|
|
@ -195,12 +192,10 @@ public class CustomerViewService {
|
|
|
|
//查询零售公司的门店
|
|
|
|
//查询零售公司的门店
|
|
|
|
List<PoiStore> list1 = retailCompanyService.selectShopByCompany(pm.get(0).getOrgId());
|
|
|
|
List<PoiStore> list1 = retailCompanyService.selectShopByCompany(pm.get(0).getOrgId());
|
|
|
|
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
|
|
|
|
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
|
|
|
|
vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//管理员/总运营人员
|
|
|
|
//管理员/总运营人员
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectAllShopId(null,null);
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectAllShopId(null,null);
|
|
|
|
vipCount = opVipDOMapper.selectVipCountNew();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(shopIdList)){
|
|
|
|
if(CollectionUtils.isEmpty(shopIdList)){
|
|
|
@ -209,17 +204,10 @@ public class CustomerViewService {
|
|
|
|
//柱状图好友趋势图
|
|
|
|
//柱状图好友趋势图
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
|
|
|
|
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customerViewVO.setAllVipCount(vipCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置趋势柱状图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, customerList, validCustomerList, selectStartTime, selectEndTime);
|
|
|
|
|
|
|
|
//新增好友
|
|
|
|
|
|
|
|
// Long newCustomerCount = customerList.stream().filter(customerDO -> filterCustomerByRegisterTime(customerDO, selectStartTime, selectEndTime)).count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer newCustomerCount = opCustomerDOMapper.countCustomerByDate(shopIdList,selectStartTime, selectEndTime);
|
|
|
|
Integer newCustomerCount = opCustomerDOMapper.countCustomerByDate(shopIdList,selectStartTime, selectEndTime);
|
|
|
|
customerViewVO.setNewCustomer(new Long(newCustomerCount));
|
|
|
|
customerViewVO.setNewCustomer(new Long(newCustomerCount));
|
|
|
@ -229,6 +217,52 @@ public class CustomerViewService {
|
|
|
|
return customerViewVO;
|
|
|
|
return customerViewVO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 客户概览main——vip
|
|
|
|
|
|
|
|
* @param userId 用户id
|
|
|
|
|
|
|
|
* @return 客户概览VO
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public CustomerViewVO getMainVipCount(Long userId){
|
|
|
|
|
|
|
|
CustomerViewVO customerViewVO = new CustomerViewVO();
|
|
|
|
|
|
|
|
//会员总数
|
|
|
|
|
|
|
|
Long vipCount = 0L;
|
|
|
|
|
|
|
|
//shopIds
|
|
|
|
|
|
|
|
List<Long> shopIdList = new ArrayList<>();
|
|
|
|
|
|
|
|
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
|
|
|
|
|
|
|
|
if(privilageRoleDO == null){
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//店长
|
|
|
|
|
|
|
|
if(privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_DZ.getRoleCode())) {
|
|
|
|
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectByUserId(userId);
|
|
|
|
|
|
|
|
vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//运营人员
|
|
|
|
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_YYRY.getRoleCode())) {
|
|
|
|
|
|
|
|
QueryWrapper<PrivilageOrganizationalMember> wrapper1 = new QueryWrapper<>();
|
|
|
|
|
|
|
|
wrapper1.eq("user_id", userId);
|
|
|
|
|
|
|
|
List<PrivilageOrganizationalMember> pm = organizationalMemberMapper.selectList(wrapper1);
|
|
|
|
|
|
|
|
//查询零售公司的门店
|
|
|
|
|
|
|
|
List<PoiStore> list1 = retailCompanyService.selectShopByCompany(pm.get(0).getOrgId());
|
|
|
|
|
|
|
|
shopIdList = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
vipCount = opVipDOMapper.selectVipCountByStoreIds(shopIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//管理员/总运营人员
|
|
|
|
|
|
|
|
else if (privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_GLY.getRoleCode()) || privilageRoleDO.getCode().equals(RoleEnum.ROLE_CODE_ALL_YYRY.getRoleCode())) {
|
|
|
|
|
|
|
|
shopIdList = poiStoreStaffDOMapper.selectAllShopId(null,null);
|
|
|
|
|
|
|
|
vipCount = opVipDOMapper.selectVipCountNew();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(shopIdList)){
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customerViewVO.setAllVipCount(vipCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return customerViewVO;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 客户概览——Top榜
|
|
|
|
* 客户概览——Top榜
|
|
|
|
* @param userId 用户id
|
|
|
|
* @param userId 用户id
|
|
|
|