| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.domain.po; | package com.iformall.domain.po; | ||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
| import com.iformall.domain.po.base.BaseTenantEntity; | import com.iformall.domain.po.base.BaseTenantEntity; | ||||
| import lombok.Data; | import lombok.Data; | ||||
| @@ -16,6 +17,8 @@ public class WxCUserTags extends BaseTenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="userId") | @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="userId") | ||||
| private Long userId; | private Long userId; | ||||
| @TableField(exist = false) | |||||
| private List<Long> userIds; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tags") | @io.swagger.annotations.ApiModelProperty(value="",name="tags") | ||||
| private String tags; | private String tags; | ||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| @@ -53,6 +53,8 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | ||||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| List<Long> findVoIdsList(WxCUserBasicInfo wxCUserBasicInfo); | |||||
| List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | ||||
| Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); | Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| @@ -2,6 +2,7 @@ package com.iformall.mapper; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxCUserTags; | import com.iformall.domain.po.WxCUserTags; | ||||
| @@ -16,4 +17,6 @@ public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||||
| @Param("startTime")Date startTime,@Param("endTime")Date endTime); | @Param("startTime")Date startTime,@Param("endTime")Date endTime); | ||||
| void updateNewId(CUserTagNewIdVo record); | void updateNewId(CUserTagNewIdVo record); | ||||
| Map<Long,String> findUserTagsMap(WxCUserTags wxCUserTags); | |||||
| } | } | ||||
| @@ -1220,21 +1220,42 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Override | @Override | ||||
| public List<Object> selectListForExcelExport(Object queryParams, int page) { | public List<Object> selectListForExcelExport(Object queryParams, int page) { | ||||
| Map params = (Map) queryParams; | |||||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||||
| List list = new ArrayList<WxCUserBasicInfoVo>(); | |||||
| basicInfo.setBegin((page-1)*10000); | |||||
| basicInfo.setLimit(10000); | |||||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||||
| //关联微信表查询 | |||||
| list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||||
| }else{ | |||||
| //直接查询本表 | |||||
| basicInfo.undateFinalTenantId(tenantInfo); | |||||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||||
| } | |||||
| return list; | |||||
| Map params = (Map) queryParams; | |||||
| WxCUserBasicInfo basicInfo = (WxCUserBasicInfo) params.get("basicInfo"); | |||||
| TenantEntity tenantInfo = (TenantEntity) params.get("tenantInfo"); | |||||
| List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||||
| basicInfo.setBegin((page-1)*10000); | |||||
| basicInfo.setLimit(10000); | |||||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||||
| //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||||
| }else{ | |||||
| basicInfo.undateFinalTenantId(tenantInfo); | |||||
| } | |||||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||||
| List<Long> userIds = wxCUserBasicInfoMapper.findVoIdsList(basicInfo); | |||||
| if (null != userIds ) { | |||||
| WxCUserTags tq = new WxCUserTags(); | |||||
| tq.setUserIds(userIds); | |||||
| Map<Long,String> userTagsMap = wxCUserTagsMapper.findUserTagsMap(tq); | |||||
| if (null != userTagsMap) { | |||||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||||
| Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||||
| list.stream().forEach(u->{ | |||||
| List<Long> ids = JSONObject.parseArray(userTagsMap.get(u.getId()), Long.class); | |||||
| if (null != ids) { | |||||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||||
| u.setTagNames(tagNames); | |||||
| } | |||||
| }); | |||||
| } | |||||
| } | |||||
| if (null != list ) { | |||||
| List<Object> retList = new ArrayList<Object>(); | |||||
| retList.addAll(list); | |||||
| return retList; | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| } | } | ||||
| @@ -764,6 +764,17 @@ | |||||
| limit #{begin}, #{limit} | limit #{begin}, #{limit} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findVoIdsList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="java.lang.Long"> | |||||
| select id | |||||
| from wx_c_user_basic_info cu | |||||
| <include refid="dynamicVoWhereConditions"/> | |||||
| <if test=" null != begin "> | |||||
| limit #{begin}, #{limit} | |||||
| </if> | |||||
| </select> | |||||
| <select id="findVoList1" resultMap="VoBaseResultMap"> | <select id="findVoList1" resultMap="VoBaseResultMap"> | ||||
| select | select | ||||
| @@ -46,6 +46,14 @@ | |||||
| and `update_date` = #{updateDate} | and `update_date` = #{updateDate} | ||||
| </if> | </if> | ||||
| <if test=" null != userIds "> | |||||
| and user_id in | |||||
| <foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")"> | |||||
| #{userIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and id in | and id in | ||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| @@ -86,5 +94,13 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findUserTagsMap" parameterType="com.iformall.domain.po.WxCUserTags" resultType="map"> | |||||
| select user_id,tags | |||||
| from wx_c_user_tags | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||