Merge branch 'feature/20200402_init_dev'

dev
kevin jiang 5 years ago
commit 68ba8d704e

@ -55,6 +55,23 @@ public class CustomerViewController extends BaseController {
}
}
/**
* mainvip
* @param userId id
* @return VO
*/
@ResponseBody
@RequestMapping(value = "/main/vip", method = RequestMethod.GET)
public Map<String,Object> getMainVipCount(@RequestParam("userId")Long userId){
try{
CustomerViewVO result = customerViewService.getMainVipCount(userId);
return data(result);
}catch (Exception e){
log.error("查询vip数据出错", e);
return fail();
}
}
/**
* Top
* @param userId id

@ -174,8 +174,6 @@ public class CustomerViewService {
*/
public CustomerViewVO selectCustomerViewMain(Long userId, String selectStartTime, String selectEndTime, String startTime, String endTime){
CustomerViewVO customerViewVO = new CustomerViewVO();
//会员总数
Long vipCount = 0L;
//shopIds
List<Long> shopIdList = new ArrayList<>();
PrivilageRoleDO privilageRoleDO = privilageRoleDOMapper.selectRoleByUserId(userId);
@ -185,7 +183,6 @@ public class CustomerViewService {
//店长
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())) {
@ -195,12 +192,10 @@ public class CustomerViewService {
//查询零售公司的门店
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)){
@ -209,17 +204,10 @@ public class CustomerViewService {
//柱状图好友趋势图
List<OpCustomer> customerList = opCustomerDOMapper.selectCustomerList(shopIdList, null, null, startTime, endTime);
customerViewVO.setAllVipCount(vipCount);
//设置趋势柱状图list
List<OpCustomer> validCustomerList = customerList.stream().filter(customerDO -> VALID.equals(customerDO.getValidType())).collect(Collectors.toList());
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);
customerViewVO.setNewCustomer(new Long(newCustomerCount));
@ -229,6 +217,52 @@ public class CustomerViewService {
return customerViewVO;
}
/**
* mainvip
* @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
* @param userId id

@ -28,6 +28,7 @@ import com.kiisoo.ic.store.entity.*;
import com.kiisoo.ic.store.mapper.PoiStoreDOMapper;
import com.kiisoo.ic.store.mapper.PrivilageCpUserStoreDOMapper;
import com.kiisoo.ic.store.mapper.StorePromotionDataDOMapper;
import com.kiisoo.ic.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.WxCpService;
@ -526,6 +527,7 @@ public class StorePromotionDataService {
if (storeId == null) {
return storePromotionDataDO;
}
endDate = DateUtils.addDay(endDate,1);
switch (roleCode) {
// 店长
case Constants.WX_USER_ROLE_SHOP_MANAGER:

@ -293,10 +293,10 @@
SELECT count(t.customer_id) from op_seller_customer_relation t
WHERE t.store_id = #{storeId}
<if test="startDate != null">
and date(t.create_time) &gt;= #{startDate}
and t.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t.create_time) &lt;= #{endDate}
and t.create_time &lt; #{endDate}
</if>
group by t.store_id
</select>
@ -308,10 +308,10 @@
AND t2.user_id = #{userId}
</if>
<if test="startDate != null">
and date(t1.create_time) &gt;= #{startDate}
and t1.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t1.create_time) &lt;= #{endDate}
and t1.create_time &lt; #{endDate}
</if>
group by t1.user_id
</select>
@ -329,10 +329,10 @@
WHERE
t. store_id = #{storeId}
<if test="startDate != null">
and date(t.create_time) &gt;= #{startDate}
and t.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t.create_time) &lt;= #{endDate}
and t.create_time &lt; #{endDate}
</if>
GROUP BY
t.user_id
@ -368,10 +368,10 @@
`op_seller_customer_relation` t2
where 1=1
<if test="startDate != null">
and date(t2.create_time) &gt;= #{startDate}
and t2.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t2.create_time) &lt;= #{endDate}
and t2.create_time &lt; #{endDate}
</if>
GROUP BY
t2.store_id
@ -390,10 +390,10 @@
poi_store_staff t1, `op_seller_customer_relation` t2
where t1.id = t2.user_id
<if test="startDate != null">
and date(t2.create_time) &gt;= #{startDate}
and t2.create_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and date(t2.create_time) &lt;= #{endDate}
and t2.create_time &lt; #{endDate}
</if>
and t1.store_id = #{storeId}
and t1.type = 4

Loading…
Cancel
Save