|
|
|
@ -134,14 +134,13 @@ public class RetailCompanyService {
|
|
|
|
|
//组织成员的客户个数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper2 = new QueryWrapper<>();
|
|
|
|
|
wrapper2.in("user_id",memberList.stream().map(PrivilageOrganizationalMember::getUserId).collect(Collectors.toList()));
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations = opSellerCustomerRelationDOMapper.selectList(wrapper2);
|
|
|
|
|
long count = opRelations.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
organizationalVO.setAllCustomer((int) count);
|
|
|
|
|
//组织成员的客户有效个数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper4 = new QueryWrapper<>();
|
|
|
|
|
wrapper4.in("user_id",memberList.stream().map(PrivilageOrganizationalMember::getUserId).collect(Collectors.toList()));
|
|
|
|
|
wrapper4.eq("type",2);
|
|
|
|
|
wrapper4.eq("type",1);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations1 = opSellerCustomerRelationDOMapper.selectList(wrapper4);
|
|
|
|
|
long countAble = opRelations1.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
organizationalVO.setEffectiveCustomer((int) countAble);
|
|
|
|
@ -185,26 +184,24 @@ public class RetailCompanyService {
|
|
|
|
|
//最初时间的总客户人数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper2 = new QueryWrapper<>();
|
|
|
|
|
wrapper2.in("user_id",userIds);
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
wrapper2.lt("create_time",startTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations = opSellerCustomerRelationDOMapper.selectList(wrapper2);
|
|
|
|
|
long count = opRelations.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最初时间的有效总客户人数
|
|
|
|
|
wrapper2.in("user_id",userIds);
|
|
|
|
|
wrapper2.eq("type",2);
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
wrapper2.lt("create_time",startTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations2 = opSellerCustomerRelationDOMapper.selectList(wrapper2);
|
|
|
|
|
long count2 = opRelations2.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最后时间的总客户人数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper3 = new QueryWrapper<>();
|
|
|
|
|
wrapper3.in("user_id",userIds);
|
|
|
|
|
wrapper3.eq("type",1);
|
|
|
|
|
wrapper3.lt("create_time",endTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelationsEnd = opSellerCustomerRelationDOMapper.selectList(wrapper3);
|
|
|
|
|
long countEnd = opRelationsEnd.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最后时间的有效总客户人数
|
|
|
|
|
wrapper3.in("user_id",userIds);
|
|
|
|
|
wrapper3.eq("type",2);
|
|
|
|
|
wrapper3.eq("type",1);
|
|
|
|
|
wrapper3.lt("create_time",endTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelationsEnd2 = opSellerCustomerRelationDOMapper.selectList(wrapper3);
|
|
|
|
|
long countEnd2 = opRelationsEnd2.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
@ -223,26 +220,24 @@ public class RetailCompanyService {
|
|
|
|
|
//最初时间的总客户人数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper2 = new QueryWrapper<>();
|
|
|
|
|
wrapper2.in("store_id",storeIds);
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
wrapper2.lt("create_time",startTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations = opSellerCustomerRelationDOMapper.selectList(wrapper2);
|
|
|
|
|
long count = opRelations.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最初时间的有效总客户人数
|
|
|
|
|
wrapper2.in("store_id",storeIds);
|
|
|
|
|
wrapper2.eq("type",2);
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
wrapper2.lt("create_time",startTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelations2 = opSellerCustomerRelationDOMapper.selectList(wrapper2);
|
|
|
|
|
long count2 = opRelations2.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最后时间的总客户人数
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper3 = new QueryWrapper<>();
|
|
|
|
|
wrapper3.in("store_id",storeIds);
|
|
|
|
|
wrapper3.eq("type",1);
|
|
|
|
|
wrapper3.lt("create_time",endTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelationsEnd = opSellerCustomerRelationDOMapper.selectList(wrapper3);
|
|
|
|
|
long countEnd = opRelationsEnd.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
|
//最后时间的有效总客户人数
|
|
|
|
|
wrapper3.in("store_id",storeIds);
|
|
|
|
|
wrapper3.eq("type",2);
|
|
|
|
|
wrapper3.eq("type",1);
|
|
|
|
|
wrapper3.lt("create_time",endTime);
|
|
|
|
|
List<OpSellerCustomerRelation> opRelationsEnd2 = opSellerCustomerRelationDOMapper.selectList(wrapper3);
|
|
|
|
|
long countEnd2 = opRelationsEnd2.stream().map(OpSellerCustomerRelation::getCustomerId).distinct().count();
|
|
|
|
@ -294,12 +289,11 @@ public class RetailCompanyService {
|
|
|
|
|
//查询所有的客户
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq("store_id",li.getShopId());
|
|
|
|
|
wrapper.eq("type",1);
|
|
|
|
|
long count = opSellerCustomerRelationDOMapper.selectCount(wrapper);
|
|
|
|
|
//查询所有的有效客户
|
|
|
|
|
QueryWrapper<OpSellerCustomerRelation> wrapper2 = new QueryWrapper<>();
|
|
|
|
|
wrapper2.eq("store_id",li.getShopId());
|
|
|
|
|
wrapper2.eq("type",2);
|
|
|
|
|
wrapper2.eq("type",1);
|
|
|
|
|
long countAble = opSellerCustomerRelationDOMapper.selectCount(wrapper2);
|
|
|
|
|
//计算新客户数据
|
|
|
|
|
newCustomerStore(startTime,endTime,storeOrganizationalVO, Collections.singletonList(li.getShopId()));
|
|
|
|
|