| @@ -7,6 +7,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.vo.UserStructureVo; | import com.iformall.domain.vo.UserStructureVo; | ||||
| import com.iformall.enums.EnumAgeInfo; | import com.iformall.enums.EnumAgeInfo; | ||||
| import com.iformall.enums.EnumCUserBaseInfoSex; | import com.iformall.enums.EnumCUserBaseInfoSex; | ||||
| import com.iformall.enums.EnumTag; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -43,6 +44,9 @@ public class WxUserStructureController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserCarService wxCUserCarService; | private WxCUserCarService wxCUserCarService; | ||||
| @Autowired | |||||
| private WxCUserTagsService wxCUserTagsService; | |||||
| @Autowired | @Autowired | ||||
| private WxUserChannelService wxUserChannelService; | private WxUserChannelService wxUserChannelService; | ||||
| @@ -171,6 +175,42 @@ public class WxUserStructureController extends BaseController { | |||||
| } | } | ||||
| @ApiOperation("查询会员手机品牌结构") | |||||
| @GetMapping("/findUserPhoneBandStructure") | |||||
| public ResultData findUserPhoneBandStructure(Date startTime, Date endTime) { | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||||
| dto.setTenantId(getTenantId()); | |||||
| dto.setStartTime(startTime); | |||||
| dto.setEndTime(endTime); | |||||
| long total = wxCUserBasicInfoService.findCount(dto); | |||||
| List<WxTags> tagList = new ArrayList<>(); | |||||
| EnumTag[] tags = {EnumTag.ID_49, | |||||
| EnumTag.ID_50, | |||||
| EnumTag.ID_51, | |||||
| EnumTag.ID_52, | |||||
| EnumTag.ID_53, | |||||
| EnumTag.ID_54}; | |||||
| for (int i = 0; i < tags.length; i++) { | |||||
| WxTags tag = new WxTags(); | |||||
| tag.setName(tags[i].getMessage()); | |||||
| tag.setCount(wxCUserTagsService.countUser(getTenantId(), tags[i].getCode(), startTime, endTime)); | |||||
| tagList.add(tag); | |||||
| total -= tag.getCount(); | |||||
| } | |||||
| WxTags tag = new WxTags(); | |||||
| tag.setName("暂未获取"); | |||||
| tag.setCount(total); | |||||
| tagList.add(tag); | |||||
| return new ResultData(tagList); | |||||
| } | |||||
| /********************************会员数据**************************************/ | /********************************会员数据**************************************/ | ||||
| @ApiOperation("查询会员数量") | @ApiOperation("查询会员数量") | ||||
| @GetMapping("/findUserDataCount") | @GetMapping("/findUserDataCount") | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| @@ -19,5 +20,8 @@ public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||||
| List<Long> findCUserByTags(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId); | List<Long> findCUserByTags(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId); | ||||
| long countUser(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId, | |||||
| @Param("startTime")Date startTime,@Param("endTime")Date endTime); | |||||
| void updateNewId(CUserTagVo record); | void updateNewId(CUserTagVo record); | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import java.util.Date; | |||||
| import java.util.List; | import java.util.List; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -61,6 +62,7 @@ public interface WxCUserTagsService { | |||||
| List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds); | List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds); | ||||
| long countUser(String tenantId, Long tagId, Date startTime, Date endTime ); | |||||
| List<WxTags> findTagList(String tenantId, List<Long> tagIds); | List<WxTags> findTagList(String tenantId, List<Long> tagIds); | ||||
| List<WxTags> findTagListFromCUser(String tenantId, List<Long> tagIds); | List<WxTags> findTagListFromCUser(String tenantId, List<Long> tagIds); | ||||
| @@ -91,6 +91,12 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| return wxCUserTagsMapper.findCUserCountByTags(str,tenantId); | return wxCUserTagsMapper.findCUserCountByTags(str,tenantId); | ||||
| } | } | ||||
| @Override | |||||
| public long countUser(String tenantId, Long tagId, Date startTime, Date endTime ) { | |||||
| String str = JSON.toJSONString(tagId); | |||||
| return wxCUserTagsMapper.countUser(str, tenantId, startTime, endTime); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds) { | public List<WxCUser> findCUserByTag(String tenantId, List<Long> tagIds) { | ||||
| if (tagIds == null || tagIds.isEmpty()) | if (tagIds == null || tagIds.isEmpty()) | ||||
| @@ -96,4 +96,22 @@ | |||||
| and user_id = #{userId} | and user_id = #{userId} | ||||
| </update> | </update> | ||||
| <select id="countUser" resultType="java.lang.Long"> | |||||
| select count(cut.user_id) from wx_c_user_tags cut, wx_c_user_basic_info cubi | |||||
| where cut.user_id = cubi.id | |||||
| <if test="null != tenantId"> | |||||
| and cut.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != startTime "> | |||||
| and cubi.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and cubi.create_date < #{endTime} | |||||
| </if> | |||||
| <if test=" null != tagIds"> | |||||
| and JSON_CONTAINS(cut.tags,#{tagIds}) | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||