| @@ -16,8 +16,7 @@ public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||
| List<WxCUserTags> findList(WxCUserTags wxCUserTags); | |||
| List<Long> findIdList(@Param("tenantId")String tenantId, @Param("tagIdList")List<Long> tagIdList); | |||
| long countUser(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId, | |||
| @Param("startTime")Date startTime,@Param("endTime")Date endTime); | |||
| List<Long> findUserIdList(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId); | |||
| void updateNewId(CUserTagNewIdVo record); | |||
| @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCUserBasicTagVo; | |||
| @@ -78,7 +79,16 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||
| @Override | |||
| public long countUser(TenantEntity tenantEntity, Long tagId, Date startTime, Date endTime ) { | |||
| String str = JSON.toJSONString(tagId); | |||
| return wxCUserTagsMapper.countUser(str, tenantEntity.getFinalTenantId(),tenantEntity.getFinalTenantId(), startTime, endTime); | |||
| List<Long> userIds = wxCUserTagsMapper.findUserIdList(str, tenantEntity.getFinalTenantId()); | |||
| if(startTime == null && endTime == null){ | |||
| return (long)userIds.size(); | |||
| }else{ | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| } | |||
| @@ -76,7 +76,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| @Autowired | |||
| WxLevelConfigMapper wxLevelConfigMapper; | |||
| @Autowired | |||
| WxCUserTagsMapper wxCUserTagsMapper; | |||
| WxCUserTagsService wxCUserTagsService; | |||
| @Lazy | |||
| @Autowired | |||
| @@ -2308,7 +2308,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsMapper.countUser(JSON.toJSONString(tags[i].getCode()), tenantEntity.getFinalTenantId(),tenantEntity.getFinalTenantId(), startTime, endTime)); | |||
| tag.setCount(wxCUserTagsService.countUser(tenantEntity,tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| @@ -2344,7 +2344,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| for (int i = 0; i < tags.length; i++) { | |||
| WxTags tag = new WxTags(); | |||
| tag.setName(tags[i].getMessage()); | |||
| tag.setCount(wxCUserTagsMapper.countUser(JSON.toJSONString(tags[i].getCode()), tenantEntity.getFinalTenantId(),tenantEntity.getFinalTenantId(), startTime, endTime)); | |||
| tag.setCount(wxCUserTagsService.countUser(tenantEntity,tags[i].getCode(), startTime, endTime)); | |||
| tagList.add(tag); | |||
| total -= tag.getCount(); | |||
| } | |||
| @@ -242,6 +242,12 @@ | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != userIds "> | |||
| and user_id in | |||
| <foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")"> | |||
| #{userIdItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <update id="updateMsgCount" parameterType="com.iformall.domain.po.tt.TtCUser"> | |||
| @@ -147,7 +147,7 @@ | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </if> | |||
| </select> | |||
| <select id="findIdList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="Long"> | |||
| @@ -306,6 +306,12 @@ | |||
| <if test="1 == queryImport"> | |||
| and wcubi.create_date like '%00:00:00' | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and wcubi.id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| </select> | |||
| <select id="findCountHistory" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="com.iformall.domain.vo.UserCountVo"> | |||
| @@ -99,7 +99,8 @@ | |||
| </select> | |||
| <select id="countUser" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Integer"> | |||
| select count(DISTINCT ubi.id) from wx_c_user_car uc, wx_c_user_basic_info ubi | |||
| select count(DISTINCT ubi.id) | |||
| from wx_c_user_car uc, wx_c_user_basic_info ubi | |||
| where uc.c_user_id = ubi.id | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and uc.tenant_id = #{tenantId} | |||
| @@ -133,7 +133,8 @@ | |||
| </select> | |||
| <select id="visits" parameterType="com.iformall.domain.vo.WxCUserFromVo" resultType="com.iformall.domain.vo.WxCUserFromVo"> | |||
| select a.from_id fromId,a.from_type fromType,a.from_name fromName,a.from_phone fromPhone,IFNULL(a.visits,0) visits,IFNULL(b.reach_user,0) reachUser,IFNULL(c.new_user,0) newUser from ( | |||
| select a.from_id fromId,a.from_type fromType,a.from_name fromName,a.from_phone fromPhone,IFNULL(a.visits,0) visits,IFNULL(b.reach_user,0) reachUser,IFNULL(c.new_user,0) newUser | |||
| from ( | |||
| select wcuf.from_id,wcuf.from_type, | |||
| <if test=" fromType == 2 ">wcubi.nick_name from_name,wcubi.phone from_phone,</if> | |||
| <if test=" fromType == 5 ">wm.name from_name,wm.link_phone from_phone,</if> | |||
| @@ -16,30 +16,24 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != userId "> | |||
| and `user_id` = #{userId} | |||
| </if> | |||
| <if test=" null != tags "> | |||
| and `tags` like concat('%', #{tags},'%') | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != userIdList "> | |||
| @@ -64,14 +58,6 @@ | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user_tags where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <delete id="deleteById" parameterType="java.util.HashMap"> | |||
| delete from wx_c_user_tags where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserTags" resultMap="BaseResultMap"> | |||
| select | |||
| @@ -79,6 +65,17 @@ | |||
| from wx_c_user_tags | |||
| <include refid="dynamicWhereConditions"/> | |||
| </select> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> | |||
| from wx_c_user_tags | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <delete id="deleteById" parameterType="java.util.HashMap"> | |||
| delete from wx_c_user_tags | |||
| where id = #{id} and tenant_id = #{tenantId} | |||
| </delete> | |||
| <select id="findIdList" parameterType="java.util.HashMap" resultType="java.lang.Long"> | |||
| select id | |||
| @@ -93,25 +90,15 @@ | |||
| and user_id = #{userId} | |||
| </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 | |||
| and cubi.final_tenant_id = #{finalTenantId} | |||
| <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> | |||
| <select id="findUserIdList" resultType="java.lang.Long"> | |||
| select distinct user_id | |||
| from wx_c_user_tags | |||
| where tenant_id = #{tenantId} | |||
| <if test=" null != tagIds"> | |||
| and JSON_CONTAINS(cut.tags,#{tagIds}) | |||
| </if> | |||
| </select> | |||
| </mapper> | |||