| @@ -1,46 +0,0 @@ | |||||
| package com.iformall.schedule; | |||||
| import com.iformall.mapper.WxCUserMapper; | |||||
| import com.iformall.service.MailService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| @Component | |||||
| public class WxCUserCheckSchedule { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private boolean isFmException; | |||||
| @Autowired | |||||
| private String fmExceptionEmails; | |||||
| @Autowired | |||||
| private MailService mailService; | |||||
| @Autowired | |||||
| private WxCUserMapper cUserMapper; | |||||
| //@Scheduled(cron = "0 0 8 * * ?") // 每天凌晨08:00对c_user扫描查重 | |||||
| // @Scheduled(cron = "0 */1 * * * ?") // 测试1分钟一次 | |||||
| // public void cuserCheckDuplicate() { | |||||
| // | |||||
| // List<Map<String, Object>> mapList = cUserMapper.checkCountByTenantOpenId(); | |||||
| // if(mapList.size()> 0) { | |||||
| // String message = "wx_c_user异常,有重复数据"; | |||||
| // logger.error(message); | |||||
| // if(isFmException) { | |||||
| // String[] receivers = fmExceptionEmails.split(","); | |||||
| // //发送邮件 | |||||
| // mailService.sendSimpleMail(receivers, message, message); | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| } | |||||
| @@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author Stormeye | * @author Stormeye | ||||
| @@ -32,6 +33,9 @@ public class BaseCUserEntity extends TenantEntity { | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| protected static EnumAppPlat appPlat; | protected static EnumAppPlat appPlat; | ||||
| @TableField(exist = false) | |||||
| private List<Long> userIds; | |||||
| /** | /** | ||||
| * 是否是会员 | * 是否是会员 | ||||
| @@ -88,4 +92,13 @@ public class BaseCUserEntity extends TenantEntity { | |||||
| public void setAppPlat(EnumAppPlat appPlat) { | public void setAppPlat(EnumAppPlat appPlat) { | ||||
| this.appPlat = appPlat; | this.appPlat = appPlat; | ||||
| } | } | ||||
| public List<Long> getUserIds() { | |||||
| return userIds; | |||||
| } | |||||
| public void setUserIds(List<Long> userIds) { | |||||
| this.userIds = userIds; | |||||
| } | |||||
| } | } | ||||
| @@ -29,8 +29,6 @@ public interface TtCUserMapper extends CommonMapper<TtCUser, Long> { | |||||
| long countByChannel(TtCUser ttCUser); | long countByChannel(TtCUser ttCUser); | ||||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||||
| void updateUserId(TtCUser record); | void updateUserId(TtCUser record); | ||||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | ||||
| @@ -62,6 +62,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId, | void cuserOldToNew(@Param(value = "oldCuserId")Long oldCuserId, @Param(value = "newCuserId")Long newCuserId, | ||||
| @Param("tableIndex")Integer tableIndex,@Param("finalTableIndex")Integer finalTableIndex); | @Param("tableIndex")Integer tableIndex,@Param("finalTableIndex")Integer finalTableIndex); | ||||
| List<String> findOpenIdByFilter(WxCUserBasicInfoDto wxCUserBasicInfoDto); | |||||
| List<Long> findIdByFilter(WxCUserBasicInfoDto wxCUserBasicInfoDto); | |||||
| } | } | ||||
| @@ -29,8 +29,6 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||||
| long countByChannel(WxCUser wxCUser); | long countByChannel(WxCUser wxCUser); | ||||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||||
| void updateUserId(WxCUser record); | void updateUserId(WxCUser record); | ||||
| void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | void delForUserIdOnly(@Param("id")Long id, @Param("userId")Long userId,@Param("tenantId")String tenantId); | ||||
| @@ -14,6 +14,7 @@ public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||||
| WxCUserTags selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | WxCUserTags selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| List<WxCUserTags> findList(WxCUserTags wxCUserTags); | 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, | long countUser(@Param("tagIds")String tagIds,@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId, | ||||
| @Param("startTime")Date startTime,@Param("endTime")Date endTime); | @Param("startTime")Date startTime,@Param("endTime")Date endTime); | ||||
| @@ -21,4 +22,5 @@ public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { | |||||
| void updateNewId(CUserTagNewIdVo record); | void updateNewId(CUserTagNewIdVo record); | ||||
| int deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | int deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| } | } | ||||
| @@ -103,4 +103,12 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<WxCouponOrder> findUserTradeList(WxCouponOrder wxCouponOrder); | List<WxCouponOrder> findUserTradeList(WxCouponOrder wxCouponOrder); | ||||
| /** | |||||
| * 获取时间范围内核销的用户(参数不能为null) | |||||
| * @param tenantId | |||||
| * @param verifiedStartTime | |||||
| * @param verifiedStartTime1 | |||||
| * @return | |||||
| */ | |||||
| List<Long> findVerifiedUserIds(@Param("tenantId")String tenantId, @Param("verifiedStartTime")Date verifiedStartTime, @Param("verifiedEndTime")Date verifiedEndTime); | |||||
| } | } | ||||
| @@ -29,7 +29,7 @@ public interface WxCUserBasicInfoService { | |||||
| List<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | List<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | ||||
| List<String> findOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | |||||
| List<Long> findIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | |||||
| List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList); | List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList); | ||||
| @@ -43,7 +43,6 @@ public interface WxCUserBasicInfoService { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | ||||
| PageInfo<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize); | |||||
| List<WxCUserBasicInfo> listPhoneAndNameByIds(WxCUserBasicInfo record); | List<WxCUserBasicInfo> listPhoneAndNameByIds(WxCUserBasicInfo record); | ||||
| /** | /** | ||||
| @@ -96,7 +96,6 @@ public interface WxCUserService { | |||||
| /** | /** | ||||
| * 统计数量 | * 统计数量 | ||||
| * @param dto | * @param dto | ||||
| * @param tenantEntitys | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| long findCount(WxCUserBasicInfoDto dto); | long findCount(WxCUserBasicInfoDto dto); | ||||
| @@ -112,7 +111,6 @@ public interface WxCUserService { | |||||
| /** | /** | ||||
| * 通过渠道获取会员信息 | * 通过渠道获取会员信息 | ||||
| * @param user | * @param user | ||||
| * @param tenantEntitys | |||||
| * @param pageIndex | * @param pageIndex | ||||
| * @param pageSize | * @param pageSize | ||||
| * @return | * @return | ||||
| @@ -123,7 +121,6 @@ public interface WxCUserService { | |||||
| /** | /** | ||||
| * 登录后发消息 | * 登录后发消息 | ||||
| * @param user | |||||
| */ | */ | ||||
| void actionMsgAfterLogin(WxCUserFrom wxCUserFrom); | void actionMsgAfterLogin(WxCUserFrom wxCUserFrom); | ||||
| @@ -10,6 +10,7 @@ import com.iformall.service.tags.TagsDeveloper; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| public interface WxCUserTagsService { | public interface WxCUserTagsService { | ||||
| @@ -53,4 +54,11 @@ public interface WxCUserTagsService { | |||||
| void updateTagByUserId(Long cUserId,TenantEntity tenantinfo, List<Long> tags); | void updateTagByUserId(Long cUserId,TenantEntity tenantinfo, List<Long> tags); | ||||
| /** | |||||
| * 获取标签id------标签name map | |||||
| * @param tenantInfo | |||||
| * @param tagIds | |||||
| * @return | |||||
| */ | |||||
| Map<Long, String> findIdTagNames(TenantEntity tenantInfo, List<Long> tagIds); | |||||
| } | } | ||||
| @@ -1,6 +1,5 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| @@ -46,6 +45,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Autowired | @Autowired | ||||
| WxCUserTagsMapper wxCUserTagsMapper; | WxCUserTagsMapper wxCUserTagsMapper; | ||||
| @Autowired | |||||
| WxCouponOrderMapper wxCouponOrderMapper; | |||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | ||||
| @@ -402,6 +404,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| Date.from( | Date.from( | ||||
| localDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay().atZone(zone).toInstant())); | localDate.plusMonths(1).with(TemporalAdjusters.firstDayOfMonth()).atStartOfDay().atZone(zone).toInstant())); | ||||
| } | } | ||||
| if(dto.getVerifiedStartTime() != null && dto.getVerifiedEndTime() != null){ | |||||
| List<Long> userIds = wxCouponOrderMapper.findVerifiedUserIds(dto.getTenantId(),dto.getVerifiedStartTime(),dto.getVerifiedEndTime()); | |||||
| if(!userIds.isEmpty()){ | |||||
| dto.setIds(userIds); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| private WxCUserBasicInfoDto filtersToDto(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList){ | private WxCUserBasicInfoDto filtersToDto(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList){ | ||||
| @@ -429,8 +438,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| tagIdList.add(f.getId()); | tagIdList.add(f.getId()); | ||||
| } | } | ||||
| }); | }); | ||||
| if(!tagIdList.isEmpty()) | |||||
| dto.setTagIds(tagIdList); | |||||
| if(!tagIdList.isEmpty()){ | |||||
| List<Long> tagIds = wxCUserTagsMapper.findIdList(tenantEntity.getTenantId(),tagIdList); | |||||
| if(!tagIds.isEmpty()){ | |||||
| dto.setTagIds(tagIds); | |||||
| } | |||||
| } | |||||
| return dto; | return dto; | ||||
| } | } | ||||
| @@ -534,11 +547,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| } | } | ||||
| @Override | @Override | ||||
| public List<String> findOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList) { | |||||
| public List<Long> findIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList) { | |||||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); | WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); | ||||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | ||||
| wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); | wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); | ||||
| return wxCUserBasicInfoMapper.findOpenIdByFilter(wxCUserBasicInfoDto); | |||||
| return wxCUserBasicInfoMapper.findIdByFilter(wxCUserBasicInfoDto); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -550,9 +563,16 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Override | @Override | ||||
| public List<String> listOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList) { | public List<String> listOpenIdByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList) { | ||||
| HashSet<String> openSet = new HashSet<>(); | |||||
| filterList.stream().forEach(f->openSet.addAll(findOpenIdByFilter(tenantEntity,f.getTagList()))); | |||||
| return new ArrayList<>(openSet); | |||||
| HashSet<Long> idSet = new HashSet<>(); | |||||
| filterList.stream().forEach(f->idSet.addAll(findIdByFilter(tenantEntity,f.getTagList()))); | |||||
| if(idSet.isEmpty()){ | |||||
| return new ArrayList<String>(); | |||||
| } | |||||
| WxCUser cuser = new WxCUser(); | |||||
| cuser.updateTenantInfo(tenantEntity); | |||||
| cuser.setUserIds(new ArrayList<>(idSet)); | |||||
| List<String> openList = wxCUserMapper.listOpenId(cuser); | |||||
| return openList; | |||||
| } | } | ||||
| @@ -564,13 +584,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize) { | |||||
| wxCUserBasicInfo.setTenantId(tenantInfo.getTenantId()); | |||||
| wxCUserBasicInfo.undateFinalTenantId(tenantInfo); | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(wxCUserBasicInfo)); | |||||
| } | |||||
| @Override | @Override | ||||
| public int countUser(WxCUserBasicInfo record) { | public int countUser(WxCUserBasicInfo record) { | ||||
| return wxCUserBasicInfoMapper.selectCount(new QueryWrapper(record)); | return wxCUserBasicInfoMapper.selectCount(new QueryWrapper(record)); | ||||
| @@ -1220,14 +1233,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| basicInfo.setBegin((page-1)*20000); | basicInfo.setBegin((page-1)*20000); | ||||
| basicInfo.setLimit(20000); | basicInfo.setLimit(20000); | ||||
| basicInfo.undateFinalTenantId(tenantInfo); | |||||
| basicInfo.undateFinalTenantId(tenantInfo); | basicInfo.undateFinalTenantId(tenantInfo); | ||||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | list = wxCUserBasicInfoMapper.findVoList(basicInfo); | ||||
| if (null == list || list.size() <= 0 ) { | if (null == list || list.size() <= 0 ) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| // List<Long> userIds = wxCUserBasicInfoMapper.findVoIdsList1(tenantInfo,basicInfo); | |||||
| // List<Long> userIds = list.stream().map(cc -> cc.getId()).collect(Collectors.toList()); | |||||
| // if (null != userIds && userIds.size() > 0 ) { | // if (null != userIds && userIds.size() > 0 ) { | ||||
| // WxCreditHistory chaddq = new WxCreditHistory(); | // WxCreditHistory chaddq = new WxCreditHistory(); | ||||
| // chaddq.setUserIdList(userIds); | // chaddq.setUserIdList(userIds); | ||||
| @@ -1250,41 +1262,14 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| // if(null != chless){ | // if(null != chless){ | ||||
| // chlesMap = chless.stream().collect(Collectors.toMap(WxCreditHistory::getCUserId, WxCreditHistory::getCreditNum)); | // chlesMap = chless.stream().collect(Collectors.toMap(WxCreditHistory::getCUserId, WxCreditHistory::getCreditNum)); | ||||
| // } | // } | ||||
| // | |||||
| //// WxCUserTags tq = new WxCUserTags(); | |||||
| //// tq.setUserIdList(userIds); | |||||
| //// tq.setTenantId(tenantInfo.getFinalTenantId()); | |||||
| //// List<WxCUserTags> userTagList = wxCUserTagsMapper.findList(tq); | |||||
| //// Map<Long, String> tagMap = new HashMap<>(); | |||||
| //// Map<Long, String> userTagsMap = new HashMap<>(); | |||||
| //// if (null != userTagList) { | |||||
| //// List<WxTags> tagList = wxTagsMapper.findListAll(); | |||||
| //// tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||||
| //// userTagsMap = userTagList.stream().collect(Collectors.toMap(WxCUserTags::getUserId, WxCUserTags::getTags)); | |||||
| //// | |||||
| //// } | |||||
| // | |||||
| List<WxTags> tagList = wxTagsMapper.findListAll(tenantInfo.getTenantId()); | |||||
| // | |||||
| // Map<Long, Integer> finalChaddMap = chaddMap; | |||||
| // Map<Long, Integer> finalChlesMap = chlesMap; | |||||
| //// Map<Long, String> finalUserTagsMap = userTagsMap; | |||||
| Map<Long, String> finalTagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName));; | |||||
| //处理会员标签 | |||||
| List<Long> tagIds = list.stream().map(cc -> cc.getTagId()).collect(Collectors.toList()); | |||||
| Map<Long, String> tagIdName = wxCUserTagsService.findIdTagNames(tenantInfo,tagIds); | |||||
| list.stream().forEach(u->{ | list.stream().forEach(u->{ | ||||
| // u.setAddCredit(finalChaddMap.get(u.getId())); | // u.setAddCredit(finalChaddMap.get(u.getId())); | ||||
| // u.setLesCredit(finalChlesMap.get(u.getId())); | // u.setLesCredit(finalChlesMap.get(u.getId())); | ||||
| if(StringUtils.isNotBlank(u.getTags())){ | |||||
| List<Long> ids = JSONObject.parseArray(u.getTags(), Long.class); | |||||
| if (null != ids) { | |||||
| String tagNames = StringUtils.join(ids.stream().map(id-> finalTagMap.get(id)).collect(Collectors.toList()),"/"); | |||||
| u.setTagNames(tagNames); | |||||
| } | |||||
| } | |||||
| // List<Long> ids = JSONObject.parseArray(finalUserTagsMap.get(u.getId()), Long.class); | |||||
| // if (null != ids) { | |||||
| // String tagNames = StringUtils.join(ids.stream().map(id-> finalTagMap.get(id)).collect(Collectors.toList()),"/"); | |||||
| // u.setTagNames(tagNames); | |||||
| // } | |||||
| u.setTagNames(tagIdName.get(u.getTagId())); | |||||
| }); | }); | ||||
| // | // | ||||
| // } | // } | ||||
| @@ -27,6 +27,7 @@ import java.math.RoundingMode; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.regex.Pattern; | import java.util.regex.Pattern; | ||||
| import java.util.stream.Collectors; | |||||
| @Service | @Service | ||||
| public class WxCUserTagsServiceImpl implements WxCUserTagsService { | public class WxCUserTagsServiceImpl implements WxCUserTagsService { | ||||
| @@ -319,7 +320,32 @@ public class WxCUserTagsServiceImpl implements WxCUserTagsService { | |||||
| } | } | ||||
| } | } | ||||
| public Long getTagId(List<Long> tagList, Long id, WxTags wxTags) { | |||||
| @Override | |||||
| public Map<Long, String> findIdTagNames(TenantEntity tenantInfo, List<Long> tagIds) { | |||||
| Map<Long, String> tagIdName = new HashMap<>(); | |||||
| if(tagIds == null || tagIds.isEmpty()){ | |||||
| return tagIdName; | |||||
| } | |||||
| WxCUserTags userTagsQ = new WxCUserTags(); | |||||
| userTagsQ.updateTenantInfo(tenantInfo); | |||||
| userTagsQ.setIds(tagIds); | |||||
| List<WxCUserTags> userTagsList = wxCUserTagsMapper.findList(userTagsQ); | |||||
| List<WxTags> tagList = wxTagsMapper.findListAll(tenantInfo.getTenantId()); | |||||
| Map<Long, String> finalTagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||||
| for (WxCUserTags wct:userTagsList) { | |||||
| if(StringUtils.isNotBlank(wct.getTags())){ | |||||
| List<Long> ids = JSONObject.parseArray(wct.getTags(), Long.class); | |||||
| if (null != ids) { | |||||
| String tagNames = StringUtils.join(ids.stream().map(id-> finalTagMap.get(id)).collect(Collectors.toList()),"/"); | |||||
| tagIdName.put(wct.getId(),tagNames); | |||||
| } | |||||
| } | |||||
| } | |||||
| return tagIdName; | |||||
| } | |||||
| public Long getTagId(List<Long> tagList, Long id, WxTags wxTags) { | |||||
| List<WxTags> list = wxTagsMapper.findList(wxTags); | List<WxTags> list = wxTagsMapper.findList(wxTags); | ||||
| for (WxTags tag : list) { | for (WxTags tag : list) { | ||||
| boolean flag = false; | boolean flag = false; | ||||
| @@ -391,11 +391,6 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="checkCountByTenantOpenId" resultType="hashmap" > | |||||
| select * from (select tenant_id, open_id, count(tenant_id+open_id) as u_count from tt_c_user group by tenant_id, open_id) t where t.u_count >= 2 | |||||
| </select> | |||||
| <update id="updateUserId" parameterType="com.iformall.domain.po.tt.TtCUser"> | <update id="updateUserId" parameterType="com.iformall.domain.po.tt.TtCUser"> | ||||
| update tt_c_user | update tt_c_user | ||||
| set user_id=#{userId} | set user_id=#{userId} | ||||
| @@ -100,23 +100,17 @@ | |||||
| <if test=" null != name "> | <if test=" null != name "> | ||||
| and wcubi.`name` like concat('%', #{name},'%') | and wcubi.`name` like concat('%', #{name},'%') | ||||
| </if> | </if> | ||||
| <if test=" null != startTime and null!=endTime"> | |||||
| <if test=" null != startTime and null != endTime"> | |||||
| and wcubi.`create_date` between #{startTime} and #{endTime} | and wcubi.`create_date` between #{startTime} and #{endTime} | ||||
| </if> | </if> | ||||
| <if test=" null != activeStartTime and null!=activeEndTime"> | |||||
| <if test=" null != activeStartTime and null != activeEndTime"> | |||||
| and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime} | and wcubi.`active_time` between #{activeStartTime} and #{activeEndTime} | ||||
| </if> | </if> | ||||
| <if test=" null != status "> | <if test=" null != status "> | ||||
| and wcubi.`status` = #{status} | and wcubi.`status` = #{status} | ||||
| </if> | </if> | ||||
| <if test=" null != carNumber and '' != carNumber"> | |||||
| and wcubi.id in (select c_user_id from wx_c_user_car | |||||
| where (`tenant_id` = #{finalTenantId} or `parent_tenant_id` = #{finalTenantId}) | |||||
| and car_number like concat('%', #{carNumber},'%')) | |||||
| </if> | |||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and wcubi.id in | and wcubi.id in | ||||
| @@ -131,7 +125,10 @@ | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | ||||
| select <include refid="allColumns"/> from wx_c_user_basic_info wcubi where wcubi.id =#{id} and wcubi.final_tenant_id = #{finalTenantId} | |||||
| select <include refid="allColumns"/> | |||||
| from wx_c_user_basic_info wcubi | |||||
| where wcubi.id =#{id} | |||||
| and wcubi.final_tenant_id = #{finalTenantId} | |||||
| </select> | </select> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap"> | ||||
| @@ -146,7 +143,7 @@ | |||||
| from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != ids "> | <if test=" null != ids "> | ||||
| and wcubi.id in | |||||
| and wcubi.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| @@ -160,26 +157,31 @@ | |||||
| </select> | </select> | ||||
| <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | ||||
| update wx_c_user_basic_info set poins=#{poins} | |||||
| where id=#{id} | |||||
| update wx_c_user_basic_info | |||||
| set poins = #{poins} | |||||
| where id = #{id} | |||||
| </update> | </update> | ||||
| <update id="updateUpScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | <update id="updateUpScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | ||||
| update wx_c_user_basic_info set poins=poins+#{poins} | |||||
| where id=#{id} | |||||
| update wx_c_user_basic_info | |||||
| set poins = poins+#{poins} | |||||
| where id = #{id} | |||||
| </update> | </update> | ||||
| <update id="updateDownScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | <update id="updateDownScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | ||||
| update wx_c_user_basic_info set poins=poins-#{poins} | |||||
| where id=#{id} | |||||
| update wx_c_user_basic_info | |||||
| set poins = poins-#{poins} | |||||
| where id = #{id} | |||||
| </update> | </update> | ||||
| <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo"> | <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserBaseVo"> | ||||
| update wx_c_user_basic_info set id=#{newId} , credit=#{credit} , poins=#{poins} | |||||
| where id = #{id} | |||||
| update wx_c_user_basic_info | |||||
| set id = #{newId} , credit = #{credit} , poins = #{poins} | |||||
| where id = #{id} | |||||
| </update> | </update> | ||||
| <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| select count(wcubi.id) from wx_c_user_basic_info wcubi | |||||
| select count(wcubi.id) | |||||
| from wx_c_user_basic_info wcubi | |||||
| where wcubi.sex =#{sex} | where wcubi.sex =#{sex} | ||||
| and wcubi.`final_tenant_id` = #{finalTenantId} | and wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| @@ -222,7 +224,8 @@ | |||||
| </select> | </select> | ||||
| <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| select count(wcubi.id) from wx_c_user_basic_info wcubi | |||||
| select count(wcubi.id) | |||||
| from wx_c_user_basic_info wcubi | |||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | ||||
| @@ -288,7 +291,8 @@ | |||||
| </select> | </select> | ||||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| select count(wcubi.id) from wx_c_user_basic_info wcubi | |||||
| select count(wcubi.id) | |||||
| from wx_c_user_basic_info wcubi | |||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | ||||
| @@ -436,10 +440,8 @@ | |||||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="VoBaseResultMap"> | <select id="findVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="VoBaseResultMap"> | ||||
| select | select | ||||
| wcubi.`id`,wcubi.`name`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`phone`,wcubi.`nick_name`,wcubi.`education`,wcubi.`birthdate`,wcubi.`address`, | wcubi.`id`,wcubi.`name`,wcubi.`sex`,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.`phone`,wcubi.`nick_name`,wcubi.`education`,wcubi.`birthdate`,wcubi.`address`, | ||||
| wcubi.`active_time`,wcubi.`create_date`,wcubi.`poins`,wcubi.`credit`, | |||||
| wcut.`tags` | |||||
| wcubi.`active_time`,wcubi.`create_date`,wcubi.`poins`,wcubi.`credit`,wcubi.`tag_id` | |||||
| from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
| left join wx_c_user_tags${basicInfo.shardFinalTableSuffix} wcut on wcut.`id` = wcubi.`tag_id` | |||||
| <include refid="dynamicVoWhereConditions"/> | <include refid="dynamicVoWhereConditions"/> | ||||
| <if test=" null != begin "> | <if test=" null != begin "> | ||||
| limit #{begin}, #{limit} | limit #{begin}, #{limit} | ||||
| @@ -484,15 +486,6 @@ | |||||
| and wcubi.active_time <= #{loginEndTime} | and wcubi.active_time <= #{loginEndTime} | ||||
| </if> | </if> | ||||
| <if test=" null != verifiedStartTime and null != verifiedEndTime "> | |||||
| and 0 < | |||||
| (select count(*) from wx_coupon_order wco | |||||
| where wcubi.id = wco.c_user_id | |||||
| and wco.coupon_order_status = 1 | |||||
| and wco.update_date >= #{verifiedStartTime} | |||||
| and wco.update_date <= #{verifiedEndTime}) | |||||
| </if> | |||||
| <if test=" null != phones"> | <if test=" null != phones"> | ||||
| and wcubi.phone in (${phones}) | and wcubi.phone in (${phones}) | ||||
| </if> | </if> | ||||
| @@ -513,21 +506,26 @@ | |||||
| )) | )) | ||||
| </if> | </if> | ||||
| <if test=" null != ids "> | |||||
| and wcubi.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != tagIds "> | <if test=" null != tagIds "> | ||||
| and JSON_CONTAINS(JSON_ARRAY(wcut.tags),JSON_ARRAY | |||||
| and wcubi.`tag_id` in | |||||
| <foreach collection="tagIds" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="tagIds" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| ) | ) | ||||
| </if> | </if> | ||||
| <!-- <if test=" null != sortColumns">order by ${sortColumns}</if>--> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | </sql> | ||||
| <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | ||||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||||
| <if test=" null != tagIds "> | |||||
| join wx_c_user_tags wcut on wcut.`id` = wcubi.`tag_id` | |||||
| </if> | |||||
| select count(distinct wcubi.id) | |||||
| from wx_c_user_basic_info wcubi | |||||
| <include refid="filterWhereConditions"/> | <include refid="filterWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -535,25 +533,18 @@ | |||||
| <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | ||||
| select wcubi.`id`,wcubi.`phone`,wcubi.`email` | select wcubi.`id`,wcubi.`phone`,wcubi.`email` | ||||
| from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
| <if test=" null != tagIds "> | |||||
| join wx_c_user_tags wcut on wcut.`id` = wcubi.`tag_id` | |||||
| </if> | |||||
| <include refid="filterWhereConditions"/> | <include refid="filterWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findOpenIdByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="String"> | |||||
| select distinct open_id from wx_c_user where user_id in ( | |||||
| <select id="findIdByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||||
| select id | select id | ||||
| from wx_c_user_basic_info wcubi | from wx_c_user_basic_info wcubi | ||||
| <if test=" null != tagIds "> | |||||
| join wx_c_user_tags wcut on wcut.`id` = wcubi.`tag_id` | |||||
| </if> | |||||
| <include refid="filterWhereConditions"/> | <include refid="filterWhereConditions"/> | ||||
| ) | |||||
| </select> | </select> | ||||
| <select id="findGrowUserCount" resultType="java.lang.Long"> | <select id="findGrowUserCount" resultType="java.lang.Long"> | ||||
| SELECT count(wcubi.id) FROM wx_c_user_basic_info wcubi | |||||
| SELECT count(wcubi.id) | |||||
| FROM wx_c_user_basic_info wcubi | |||||
| where wcubi.`final_tenant_id` = #{finalTenantId} | where wcubi.`final_tenant_id` = #{finalTenantId} | ||||
| <if test=" null != tenantId and '' != tenantId"> | <if test=" null != tenantId and '' != tenantId"> | ||||
| and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') | ||||
| @@ -242,6 +242,12 @@ | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | <if test=" null != parentTenantId and '' != parentTenantId"> | ||||
| and `parent_tenant_id` = #{parentTenantId} | and `parent_tenant_id` = #{parentTenantId} | ||||
| </if> | </if> | ||||
| <if test=" null != userIds "> | |||||
| and user_id in | |||||
| <foreach collection="userIds" index="index" item="userIdItem" open="(" separator="," close=")"> | |||||
| #{userIdItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | </select> | ||||
| <update id="updateMsgCount" parameterType="com.iformall.domain.po.WxCUser"> | <update id="updateMsgCount" parameterType="com.iformall.domain.po.WxCUser"> | ||||
| @@ -392,11 +398,6 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="checkCountByTenantOpenId" resultType="hashmap" > | |||||
| select * from (select tenant_id, open_id, count(tenant_id+open_id) as u_count from wx_c_user group by tenant_id, open_id) t where t.u_count >= 2 | |||||
| </select> | |||||
| <update id="updateUserId" parameterType="com.iformall.domain.po.WxCUser"> | <update id="updateUserId" parameterType="com.iformall.domain.po.WxCUser"> | ||||
| update wx_c_user | update wx_c_user | ||||
| set user_id=#{userId} | set user_id=#{userId} | ||||
| @@ -15,18 +15,13 @@ | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | |||||
| where `tenant_id` = #{tenantId} | |||||
| <if test=" null != id "> | <if test=" null != id "> | ||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != userId "> | <if test=" null != userId "> | ||||
| and `user_id` = #{userId} | and `user_id` = #{userId} | ||||
| @@ -60,6 +55,13 @@ | |||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| <if test=" null != tagIdList "> | |||||
| and JSON_CONTAINS(JSON_ARRAY(tags),JSON_ARRAY | |||||
| <foreach collection="tagIdList" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| ) | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| @@ -78,6 +80,12 @@ | |||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="java.util.HashMap" resultType="java.lang.Long"> | |||||
| select id | |||||
| from wx_c_user_tags | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserTagNewIdVo"> | <update id="updateNewId" parameterType="com.iformall.domain.vo.CUserTagNewIdVo"> | ||||
| update wx_c_user_tags | update wx_c_user_tags | ||||
| set user_id=#{newUserId} | set user_id=#{newUserId} | ||||
| @@ -1124,7 +1124,13 @@ | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| <if test=" null == sortColumns">order by co.create_date desc</if> | <if test=" null == sortColumns">order by co.create_date desc</if> | ||||
| </select> | </select> | ||||
| <select id="findVerifiedUserIds" parameterType="java.util.HashMap" resultType="java.lang.Long"> | |||||
| select distinct c_user_id from wx_coupon_order | |||||
| where `tenant_id` = #{tenantId} | |||||
| and wco.coupon_order_status = 1 | |||||
| and wco.update_date >= #{verifiedStartTime} | |||||
| and wco.update_date <= #{verifiedEndTime} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||