大屏接口

dev_0531
yechenhao 6 years ago
parent 5eb5c0c439
commit 13e7340b9d

@ -25,4 +25,5 @@ public interface OpVipDOMapper extends BaseMapper<OpVip> {
Long selectVipCountNew(); Long selectVipCountNew();
Long selectVipCountByStoreIds(@Param("shopIds")List<Long> shopIdList);
} }

@ -174,6 +174,8 @@ 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);
@ -183,6 +185,7 @@ 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())) {
@ -192,10 +195,12 @@ 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)){
@ -204,8 +209,7 @@ public class CustomerViewService {
//柱状图好友趋势图 //柱状图好友趋势图
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime); List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
//会员总数
Long vipCount = opVipDOMapper.selectVipCountNew();
customerViewVO.setAllVipCount(vipCount); customerViewVO.setAllVipCount(vipCount);
//设置趋势柱状图list //设置趋势柱状图list

@ -43,6 +43,21 @@
</select> </select>
<!--会员总数-->
<select id="selectVipCountByStoreIds" resultType="Long">
select count(t1.id)
from op_vip t1,op_customer t2
<where>
<if test="shopIds != null and shopIds.size > 0">
and t2.register_store_id in
<foreach collection="shopIds" separator="," item="item" index="index" close=")" open="(">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectVipCountNew" resultType="Long"> <select id="selectVipCountNew" resultType="Long">
select count(t1.id) select count(t1.id)
from op_vip t1 from op_vip t1

Loading…
Cancel
Save