|
|
|
@ -279,6 +279,20 @@ public class RetailCompanyService {
|
|
|
|
|
return poiStoreDOMapper.selectShopByCustomerIds(new ArrayList<>(customerIds));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询零售公司下的店铺
|
|
|
|
|
*
|
|
|
|
|
* @param orgId 零售公司id
|
|
|
|
|
* @return 门店ID集合
|
|
|
|
|
* @author dexiang.jiang
|
|
|
|
|
* @date 2020/05/17 12:07
|
|
|
|
|
*/
|
|
|
|
|
public List<Long> selectStoreIdListByCompanyId(Long orgId) {
|
|
|
|
|
//查询客户
|
|
|
|
|
List<Long> storeIds = poiStoreDOMapper.selectShopIdByCustomerId(orgId);
|
|
|
|
|
return storeIds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询零售公司下的店铺
|
|
|
|
|
*
|
|
|
|
@ -334,8 +348,7 @@ public class RetailCompanyService {
|
|
|
|
|
organizationalVO.setRetailCompany(org.getName());
|
|
|
|
|
|
|
|
|
|
//查询零售公司的门店
|
|
|
|
|
List<PoiStore> list1 = selectShopByCompany(org.getId());
|
|
|
|
|
List<Long> stores = list1.stream().map(PoiStore::getId).collect(Collectors.toList());
|
|
|
|
|
List<Long> stores = selectStoreIdListByCompanyId(org.getId());
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(stores)){
|
|
|
|
|
organizationalVO.setAllCustomer(0);
|
|
|
|
@ -346,6 +359,7 @@ public class RetailCompanyService {
|
|
|
|
|
organizationalVO.setAvgNewEffectiveCustomer(0);
|
|
|
|
|
organizationalVO.setNewCustomer(0);
|
|
|
|
|
organizationalVO.setNewEffectiveCustomer(0);
|
|
|
|
|
organizationalVO.setAvgStoreCustomer(0);
|
|
|
|
|
list.add(organizationalVO);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -364,24 +378,26 @@ public class RetailCompanyService {
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper4 = new QueryWrapper<>();
|
|
|
|
|
wrapper4.in("store_id", stores);
|
|
|
|
|
wrapper4.eq("type", 1);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations1 = opSellerCustomerRelationDOMapper.selectList(wrapper4);
|
|
|
|
|
long countAble = opRelations1.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
organizationalVO.setEffectiveCustomer((int) countAble);
|
|
|
|
|
Integer countAble = opSellerCustomerRelationDOMapper.selectCount(wrapper4);
|
|
|
|
|
// long countAble = opRelations1.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
organizationalVO.setEffectiveCustomer(countAble);
|
|
|
|
|
|
|
|
|
|
//计算新增客户数据
|
|
|
|
|
newCustomerStore(startTime, endTime, organizationalVO, stores);
|
|
|
|
|
|
|
|
|
|
//被拉黑的客户数
|
|
|
|
|
QueryWrapper<PoiCustomerContactDataStat> wrapper3 = new QueryWrapper<>();
|
|
|
|
|
if (stores.isEmpty()) {
|
|
|
|
|
stores.add(-1L);
|
|
|
|
|
if (!stores.isEmpty()) {
|
|
|
|
|
// stores.add(-1L);
|
|
|
|
|
QueryWrapper<PoiCustomerContactDataStat> wrapper3 = new QueryWrapper<>();
|
|
|
|
|
wrapper3.in("store_id", stores);
|
|
|
|
|
Integer allAge = poiCustomerContactDataStatMapper.sumNegativeFeedbackCntByStoreIds(stores);
|
|
|
|
|
|
|
|
|
|
organizationalVO.setDelCustomer(allAge);
|
|
|
|
|
organizationalVO.setDelRate(check(new Long(allAge), count));
|
|
|
|
|
}
|
|
|
|
|
wrapper3.in("store_id", stores);
|
|
|
|
|
List<PoiCustomerContactDataStat> dataStats = poiCustomerContactDataStatMapper.selectList(wrapper3);
|
|
|
|
|
long allAge = dataStats.stream().mapToLong(PoiCustomerContactDataStat::getNegativeFeedbackCnt).sum();
|
|
|
|
|
|
|
|
|
|
organizationalVO.setDelCustomer((int) allAge);
|
|
|
|
|
organizationalVO.setDelRate(check(allAge, count));
|
|
|
|
|
Integer avgStoreCustomer = organizationalVO.getAllCustomer() / stores.size();
|
|
|
|
|
organizationalVO.setAvgStoreCustomer(avgStoreCustomer);
|
|
|
|
|
list.add(organizationalVO);
|
|
|
|
|
});
|
|
|
|
|
OrganizationVO vo = new OrganizationVO();
|
|
|
|
|