| @@ -63,16 +63,15 @@ public class WxUserStructureController extends BaseController { | |||
| public ResultData findUserSexStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserSexStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| //保密 | |||
| dto.setSex(EnumCUserBaseInfoSex.UNKNOWN.getCode()); | |||
| long secrecy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| long secrecy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); | |||
| dto.setSex(EnumCUserBaseInfoSex.MALE.getCode()); | |||
| long boy = wxCUserBasicInfoService.findCountBySex(dto); | |||
| long boy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); | |||
| dto.setSex(EnumCUserBaseInfoSex.FEMALE.getCode()); | |||
| long girl = wxCUserBasicInfoService.findCountBySex(dto); | |||
| long girl = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); | |||
| Long all = secrecy + boy + girl; | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| vos.add(getVo(boy, all, "男", 1)); | |||
| @@ -87,10 +86,9 @@ public class WxUserStructureController extends BaseController { | |||
| public ResultData findUserAgeStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long all = wxCUserBasicInfoService.findCount(dto); | |||
| long all = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for (EnumAgeInfo a : EnumAgeInfo.values()) { | |||
| @@ -99,7 +97,7 @@ public class WxUserStructureController extends BaseController { | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| long count = getCountByAge(a, c, dto); | |||
| long count = getCountByAge(ifParentUpdateTenantInfo(),a, c, dto); | |||
| vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); | |||
| } | |||
| return new ResultData(vos); | |||
| @@ -111,10 +109,10 @@ public class WxUserStructureController extends BaseController { | |||
| public ResultData findUserLevelStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| if(StringUtils.isNotBlank(getTenantInfo().getParentTenantId())){ | |||
| wxLevelConfig.setTenantId(getTenantInfo().getParentTenantId()); | |||
| if(StringUtils.isNotBlank(ifParentUpdateTenantInfo().getParentTenantId())){ | |||
| wxLevelConfig.setTenantId(ifParentUpdateTenantInfo().getParentTenantId()); | |||
| }else{ | |||
| wxLevelConfig.setTenantId(getTenantInfo().getTenantId()); | |||
| wxLevelConfig.setTenantId(ifParentUpdateTenantInfo().getTenantId()); | |||
| } | |||
| wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.findList(wxLevelConfig); | |||
| @@ -122,7 +120,6 @@ public class WxUserStructureController extends BaseController { | |||
| for( int i = 0; i < levelList.size(); i++) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| if (i + 1 < levelList.size()) { | |||
| @@ -132,7 +129,7 @@ public class WxUserStructureController extends BaseController { | |||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||
| } | |||
| long all = wxCUserBasicInfoService.findCountByScore(dto); | |||
| long all = wxCUserBasicInfoService.findCountByScore(ifParentUpdateTenantInfo(),dto); | |||
| levelList.get(i).setCount(all); | |||
| } | |||
| @@ -143,7 +140,7 @@ public class WxUserStructureController extends BaseController { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| other.setCount(wxCUserBasicInfoService.findCount(dto) | |||
| other.setCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto) | |||
| - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); | |||
| levelList.add(other); | |||
| @@ -156,11 +153,10 @@ public class WxUserStructureController extends BaseController { | |||
| public ResultData findCarLevelStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findCarLevelStructure"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); | |||
| dto.updateTenantInfo(getTenantInfo()); | |||
| long userCountWithCar = wxCUserCarService.countUser(dto); | |||
| Map userWithCar = new HashMap(); | |||
| @@ -197,12 +193,12 @@ public class WxUserStructureController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-查询会员手机品牌结构") | |||
| public ResultData findUserPhoneBandStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserPhoneBandStructure"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| TenantEntity tenantEntity = ifParentUpdateTenantInfo(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| @@ -235,12 +231,11 @@ public class WxUserStructureController extends BaseController { | |||
| @SystemControllerLog(description = "会员管理-查询会员活跃结构") | |||
| public ResultData findUserActivityStructure(Date startTime, Date endTime) { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserActivityStructure"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| TenantEntity tenantEntity = ifParentUpdateTenantInfo(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoService.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| @@ -308,7 +303,7 @@ public class WxUserStructureController extends BaseController { | |||
| //微信用户数据 | |||
| long wxTotalCount = wxCUserService.findCount(dto);//总量 | |||
| //微信用户数据 | |||
| long memTotalCount = wxCUserBasicInfoService.findCount(dto);//总量 | |||
| long memTotalCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//总量 | |||
| map.put("wxTotalCount",wxTotalCount); | |||
| map.put("memTotalCount",memTotalCount); | |||
| @@ -321,7 +316,7 @@ public class WxUserStructureController extends BaseController { | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long wxTodayCount = wxCUserService.findCount(dto);//今天新增 | |||
| long memTodayCount = wxCUserBasicInfoService.findCount(dto);//今天新增 | |||
| long memTodayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//今天新增 | |||
| map.put("wxTodayCount",wxTodayCount); | |||
| map.put("memTodayCount",memTodayCount); | |||
| @@ -334,7 +329,7 @@ public class WxUserStructureController extends BaseController { | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long wxYesterdayCount = wxCUserService.findCount(dto); | |||
| long memYesterdayCount = wxCUserBasicInfoService.findCount(dto); | |||
| long memYesterdayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); | |||
| if (wxYesterdayCount > 0) { | |||
| double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100; | |||
| double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| @@ -364,7 +359,7 @@ public class WxUserStructureController extends BaseController { | |||
| List<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto);//每日新增会员数 | |||
| List<UserCountVo> memCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(dto);//每日新增会员数 | |||
| List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 | |||
| SimpleDateFormat sdf; | |||
| SimpleDateFormat fsdf; | |||
| @@ -444,9 +439,8 @@ public class WxUserStructureController extends BaseController { | |||
| && memCountList.get(0).getTotalCount() != null | |||
| && memCountList.get(0).getTotalCount() == 0) { | |||
| WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); | |||
| pdto.updateTenantInfo(tenantEntity); | |||
| pdto.setEndTime(startTime); | |||
| memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(pdto)); | |||
| memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),pdto)); | |||
| } | |||
| for (int i = 1; i < memCountList.size(); i++){ | |||
| if ( memCountList.get(i).getTotalCount() != null && | |||
| @@ -563,7 +557,7 @@ public class WxUserStructureController extends BaseController { | |||
| } | |||
| private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| private long getCountByAge(TenantEntity tenantInfo, EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| if (a.getStart() != 0 || a.getEnd() != 0) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| @@ -579,7 +573,7 @@ public class WxUserStructureController extends BaseController { | |||
| dto.setBirthEndTime(null); | |||
| } | |||
| return wxCUserBasicInfoService.findCountByAge(dto); | |||
| return wxCUserBasicInfoService.findCountByAge(tenantInfo,dto); | |||
| } | |||
| private UserStructureVo getVo(long count, long all, String name, Integer num) { | |||
| @@ -147,9 +147,9 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| wxCUserBasicInfo.setName(null); | |||
| } | |||
| } | |||
| wxCUserBasicInfo.undateFinalTenantId(getTenantInfo());11111 | |||
| wxCUserBasicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | |||
| // wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.ActiveTime_DESC); | |||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); | |||
| PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(ifParentUpdateTenantInfo(),wxCUserBasicInfo, pageNum, pageSize); | |||
| if (page.getSize() > 0) { | |||
| for (WxCUserBasicInfo info : page.getList()) { | |||
| @@ -313,8 +313,8 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| } | |||
| } | |||
| basicInfo.undateFinalTenantId(getTenantInfo());111111 | |||
| int exportDataCount = wxCUserBasicInfoService.exportDataCount(basicInfo); | |||
| basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | |||
| int exportDataCount = wxCUserBasicInfoService.exportDataCount(ifParentUpdateTenantInfo(),basicInfo); | |||
| return new ResultData(exportDataCount); | |||
| @@ -336,8 +336,8 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| } | |||
| } | |||
| basicInfo.undateFinalTenantId(getTenantInfo());1111111 | |||
| wxCUserBasicInfoService.exportData(basicInfo, request, response); | |||
| basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); | |||
| wxCUserBasicInfoService.exportData(ifParentUpdateTenantInfo(),basicInfo, request, response); | |||
| } | |||
| @@ -141,14 +141,13 @@ public class WxCUserDataController extends BaseController { | |||
| //Date startDate = DateUtils.getDateFromString(startdate + " 00:00:00","yyyy-MM-dd HH:mm:ss").getTime(); | |||
| //Date endDate = DateUtils.getDateFromString(systemTime + " 23:59:59","yyyy-MM-dd HH:mm:ss").getTime(); | |||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto(); | |||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | |||
| wxCUserBasicInfoDto.setStartTime(null); | |||
| wxCUserBasicInfoDto.setEndTime(null); | |||
| map.put("growCount", wxCUserBasicInfoService.findGrowUserCount(wxCUserBasicInfoDto)); | |||
| map.put("growCount", wxCUserBasicInfoService.findGrowUserCount(ifParentUpdateTenantInfo())); | |||
| //全部导入的 | |||
| map.put("importCount", wxCUserBasicInfoService.findImportUserCount(wxCUserBasicInfoDto)); | |||
| map.put("importCount", wxCUserBasicInfoService.findImportUserCount(ifParentUpdateTenantInfo())); | |||
| //全部 | |||
| map.put("allHistoryUserCount", wxCUserBasicInfoService.findCount(wxCUserBasicInfoDto)); | |||
| map.put("allHistoryUserCount", wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),wxCUserBasicInfoDto)); | |||
| return new ResultData(map); | |||
| } | |||
| @@ -54,7 +54,7 @@ public class WxLevelConfigController extends BaseController { | |||
| wxLevelConfig.setTenantId(tenantEntity.getTenantId()); | |||
| } | |||
| wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); | |||
| final PageInfo<WxLevelConfig> page = wxLevelConfigService.listAsPage(wxLevelConfig, pageNum, pageSize); | |||
| final PageInfo<WxLevelConfig> page = wxLevelConfigService.listAsPage(tenantEntity,wxLevelConfig, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -93,7 +93,7 @@ public class WxMemController extends BaseController { | |||
| if (userVo.getScore() != null) { | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(userVo.getTenantId()); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(wxCUserBasicInfo.getFinalTenantId()); | |||
| String level = WxLevelConfigService.DEFAULT_LEVEL; | |||
| Long levelId = 0L; | |||
| @@ -785,7 +785,7 @@ public class WxUserGrantController extends BaseController { | |||
| Integer levelScore = 0; | |||
| Integer levelTarget= 0; | |||
| userVo.setLevelName(WxLevelConfigService.DEFAULT_LEVEL); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(getTenantInfo().getTenantId()); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(getTenantInfo()); | |||
| if (levelList.size() > 0) | |||
| levelTarget = levelList.get(0).getPoints(); | |||
| for (int i = 0; i<levelList.size(); i++) { | |||
| @@ -931,7 +931,7 @@ public class WxUserGrantController extends BaseController { | |||
| @ApiOperation(value = "获取用户折扣率", notes = "") | |||
| public ResultData getDiscountInfo() { | |||
| WxCUserBasicInfo member = getMember(); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(getTenantInfo().getTenantId()); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(getTenantInfo()); | |||
| String level = WxLevelConfigService.DEFAULT_LEVEL; | |||
| Long levelId = 0L; | |||
| @@ -721,7 +721,7 @@ public class PosServiceImpl implements PosService { | |||
| if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) { | |||
| String level = WxLevelConfigService.DEFAULT_LEVEL; | |||
| // 1. 会员级别Level | |||
| List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId()); | |||
| List<WxLevelConfig> levelList = levelConfigService.getByTenantInfo(tenantEntity); | |||
| Long levelId = 0L; | |||
| for (WxLevelConfig levelConfig : levelList) { | |||
| if (user.getPoins() >= levelConfig.getPoints()) { | |||
| @@ -3,10 +3,7 @@ package com.iformall.schedule; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxChartDataEntity; | |||
| import com.iformall.domain.po.WxCouponOrder; | |||
| import com.iformall.domain.po.WxMall; | |||
| import com.iformall.domain.po.WxMerchantTradeDaily; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.EnumCarCmd; | |||
| import com.iformall.enums.EnumChartType; | |||
| @@ -46,6 +46,9 @@ public class CouponSendSchedule { | |||
| @Autowired | |||
| private WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCouponSendMapper wxCouponSendMapper; | |||
| @@ -130,10 +133,9 @@ public class CouponSendSchedule { | |||
| if (sendCount > 0) { | |||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = new WxCUserBasicInfoDto(); | |||
| wxCUserBasicInfoDto.updateTenantInfo(tenantEntity); | |||
| wxCUserBasicInfoDto.setLevelStartScore(levelStartScore); | |||
| wxCUserBasicInfoDto.setLevelEndScore(levelEndScore); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoService.findListByScore(tenantEntity,wxCUserBasicInfoDto); | |||
| logger.info("定时发券:给LEVEL[" + l.getLevel() + | |||
| "]积分[" + levelStartScore + "-" + levelEndScore + "]发券" + sendCount + "张"); | |||
| @@ -283,7 +285,7 @@ public class CouponSendSchedule { | |||
| today.add(Calendar.DAY_OF_YEAR, beforeDays); | |||
| Date end = today.getTime(); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoMapper.findBirthdayList(mall.getTenantId(), df.format(begin.getTime()), df.format(end.getTime())); | |||
| List<WxCUserBasicInfo> wxCUserBasicInfoList = wxCUserBasicInfoService.findBirthdayList(tenantEntity, df.format(begin.getTime()), df.format(end.getTime())); | |||
| if (CollectionUtils.isEmpty(wxCUserBasicInfoList)) { | |||
| logger.info("生日发券: {} 满足发券的用户列表为空 wxCUserBasicInfoList = {}, 任务跳过不执行", mall.getName(), wxCUserBasicInfoList); | |||
| return; | |||
| @@ -1,11 +1,13 @@ | |||
| package com.iformall.domain.dto; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.BaseTenantEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @@ -17,9 +19,12 @@ import java.util.List; | |||
| */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCUserBasicInfoDto extends TenantEntity { | |||
| public class WxCUserBasicInfoDto extends BaseEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="如果是集团版的,存集团版的tenantId,如果是商场,则存商场",name="sex") | |||
| private String finalTenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") | |||
| private Date startTime; | |||
| @@ -75,4 +80,12 @@ public class WxCUserBasicInfoDto extends TenantEntity { | |||
| @TableField(exist = false) | |||
| protected List<WxCUserBasicInfoFilterDto> filterList; | |||
| public void undateFinalTenantId(TenantEntity tenantEntity){ | |||
| setFinalTenantId(tenantEntity.getTenantId()); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| setFinalTenantId(tenantEntity.getParentTenantId()); | |||
| } | |||
| } | |||
| } | |||
| @@ -3,19 +3,24 @@ package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | |||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.CUserBaseVo; | |||
| import com.iformall.domain.vo.UserCountVo; | |||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | |||
| long findCountByFilter(WxCUserBasicInfoDto dto); | |||
| long findCountByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findListByFilter(WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo); | |||
| void updateScore(WxCUserBasicInfo record); | |||
| @@ -25,26 +30,40 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| void updateNewId(CUserBaseVo record); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| long findCountBySex1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| long findCountByAge1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| long findCountByScore(WxCUserBasicInfoDto dto); | |||
| long findCountByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByScore(WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findBirthdayList(String tenantId, String begin, String end); | |||
| List<WxCUserBasicInfo> findBirthdayList(@Param("finalTenantId")String finalTenantId, @Param("begin")String begin, @Param("end")String end); | |||
| List<WxCUserBasicInfo> findBirthdayList1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId, @Param("begin")String begin, @Param("end")String end); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| long findCount1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | |||
| Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| Integer countVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | |||
| long findGrowUserCount(WxCUserBasicInfoDto dto); | |||
| long findGrowUserCount(@Param("finalTenantId")String finalTenantId); | |||
| long findGrowUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); | |||
| long findImportUserCount(WxCUserBasicInfoDto dto); | |||
| long findImportUserCount(@Param("finalTenantId")String finalTenantId); | |||
| long findImportUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); | |||
| void incActRecordById(Long id); | |||
| @@ -53,5 +72,7 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| * @return | |||
| */ | |||
| List<WxCUserBasicInfo> selectNotCUserList(); | |||
| } | |||
| @@ -12,7 +12,7 @@ public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||
| List<WxCUserCar> findList(WxCUserCar wxCUserCar); | |||
| Integer countList(WxCUserCar wxCUserCar); | |||
| Integer countUser(WxCUserBasicInfoDto dto); | |||
| Integer countUser(WxCUserCar wxCUserCar); | |||
| long queryCarCount(Map<String,Object> carParams); | |||
| @@ -23,8 +23,11 @@ public interface WxCUserBasicInfoService { | |||
| */ | |||
| List<WxTagsGroupVo> listFilters(TenantEntity tenantEntity); | |||
| long countByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | |||
| List<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList); | |||
| List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList); | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -35,6 +38,7 @@ public interface WxCUserBasicInfoService { | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据实体查询列表 | |||
| @@ -96,6 +100,7 @@ public interface WxCUserBasicInfoService { | |||
| * @return | |||
| */ | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 根据年龄查询数量 | |||
| @@ -105,6 +110,7 @@ public interface WxCUserBasicInfoService { | |||
| */ | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| long findCountByAge(TenantEntity tenantInfo, WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 根据年龄积分查寻数量 | |||
| @@ -113,17 +119,24 @@ public interface WxCUserBasicInfoService { | |||
| * @return | |||
| */ | |||
| long findCountByScore(WxCUserBasicInfoDto dto); | |||
| long findCountByScore(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); | |||
| int exportDataCount(WxCUserBasicInfo basicInfo); | |||
| int exportDataCount(WxCUserBasicInfo basicInfo); | |||
| int exportDataCount(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo); | |||
| void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response); | |||
| void exportData(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response); | |||
| void exportTemplate(HttpServletRequest request, HttpServletResponse response); | |||
| void importOneMem(String importKey, List<WxTags> tagList, CUserBaseInfoT uBase,MallUserInfo mallUserInfo); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| long findCount(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 停车会员记录导出 | |||
| * @param record | |||
| @@ -132,25 +145,28 @@ public interface WxCUserBasicInfoService { | |||
| */ | |||
| void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response); | |||
| long findCountByFilter(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 自然增长用户 | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findGrowUserCount(WxCUserBasicInfoDto dto); | |||
| long findGrowUserCount(TenantEntity tenantEntity); | |||
| /** | |||
| * 导入用户数 | |||
| * @param dto | |||
| * @return | |||
| */ | |||
| long findImportUserCount(WxCUserBasicInfoDto dto); | |||
| long findImportUserCount(TenantEntity tenantEntity); | |||
| ResultData updateStatus(WxCUserBasicInfo wxCUserBasicInfo); | |||
| WxCUserBasicInfo getByObject(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto); | |||
| List<WxCUserBasicInfo> findBirthdayList(TenantEntity tenantEntity, String format, String format1); | |||
| } | |||
| @@ -22,7 +22,7 @@ public interface WxLevelConfigService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxLevelConfig> listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxLevelConfig> listAsPage(TenantEntity tenantEntity,WxLevelConfig record, Integer pageIndex, Integer pageSize); | |||
| List<WxLevelConfig> listByMerchantId(Long merchantId, WxLevelConfig record); | |||
| @@ -295,8 +295,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| } | |||
| } | |||
| private void filtersToDtoID51(WxCUserBasicInfoDto dto, WxCUserBasicInfoFilterDto f) { | |||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantId(dto.getTenantId()); | |||
| private void filtersToDtoID51(TenantEntity tenantEntity, WxCUserBasicInfoDto dto, WxCUserBasicInfoFilterDto f) { | |||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantInfo(tenantEntity); | |||
| if (f.getId().equals(0L)) { | |||
| dto.setLevelStartScore(0); | |||
| if (levels.isEmpty()) | |||
| @@ -413,7 +413,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } else if(f.getTypeId().equals(EnumTagType.ID_50.getCode())) { | |||
| filtersToDtoID50(dto,f); | |||
| } else if (f.getTypeId().equals(EnumTagType.ID_51.getCode())) { | |||
| filtersToDtoID51(dto,f); | |||
| filtersToDtoID51(tenantEntity,dto,f); | |||
| } else if (f.getTypeId().equals(EnumTagType.ID_52.getCode())) { | |||
| filtersToDtoID52(dto,f); | |||
| } else if (f.getTypeId().equals(EnumTagType.ID_53.getCode())) { | |||
| @@ -426,7 +426,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| }); | |||
| if(!tagIdList.isEmpty()) | |||
| dto.setTagIds(tagIdList); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| return dto; | |||
| } | |||
| @@ -446,7 +446,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| type.setId(EnumTagType.ID_51.getCode()); | |||
| List<WxTags> tagsMemberLevel = new ArrayList<>(); | |||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantId(tenantEntity.getTenantId()); | |||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantInfo(tenantEntity); | |||
| WxTags wxTagsBase = new WxTags(); | |||
| wxTagsBase.setName(WxLevelConfigService.DEFAULT_LEVEL); | |||
| @@ -510,13 +510,30 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return listVo; | |||
| } | |||
| @Override | |||
| public long countByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList) { | |||
| return wxCUserBasicInfoMapper.findCountByFilter(filtersToDto(tenantEntity,filterList)); | |||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountByFilter1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| return wxCUserBasicInfoMapper.findCountByFilter(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> filterList) { | |||
| return wxCUserBasicInfoMapper.findListByFilter(filtersToDto(tenantEntity,filterList)); | |||
| WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findListByFilter1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| return wxCUserBasicInfoMapper.findListByFilter(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxCUserBasicInfo> listByFilterList(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterListDto> filterList) { | |||
| @@ -534,6 +551,18 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList1(tenantInfo,wxCUserBasicInfo)); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfo.undateFinalTenantId(tenantInfo); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(wxCUserBasicInfo)); | |||
| } | |||
| } | |||
| @Override | |||
| public int countUser(WxCUserBasicInfo record) { | |||
| return wxCUserBasicInfoMapper.selectCount(new QueryWrapper(record)); | |||
| @@ -548,7 +577,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| if (basicInfos != null && basicInfos.size() > 0) { | |||
| WxCUserBasicInfo wxCUserBasicInfo = basicInfos.get(0); | |||
| if (wxCUserBasicInfo.getPoins() != null) { | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantId(wxCUserBasicInfo.getFinalTenantId()); | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(tenantEntity); | |||
| String level = WxLevelConfigService.DEFAULT_LEVEL; | |||
| for(WxLevelConfig levelConfig: levelList) { | |||
| if (wxCUserBasicInfo.getPoins() >= levelConfig.getPoints()) { | |||
| @@ -637,22 +666,70 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| @Override | |||
| public long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountBySex1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public long findCountByAge(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| @Override | |||
| public long findCountByAge(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountByAge1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public long findCountByScore(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountByScore(dto); | |||
| } | |||
| @Override | |||
| public long findCountByScore(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountByScore1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.findCountByScore(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public int exportDataCount(WxCUserBasicInfo basicInfo) { | |||
| return wxCUserBasicInfoMapper.countVoList(basicInfo); | |||
| } | |||
| @Override | |||
| public int exportDataCount(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.countVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| //直接查询本表 | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.countVoList(basicInfo); | |||
| } | |||
| } | |||
| @Override | |||
| public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| @@ -665,6 +742,27 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| excelService.exportExcel(list, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false); | |||
| } | |||
| @Override | |||
| public void exportData(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| }else{ | |||
| //直接查询本表 | |||
| basicInfo.undateFinalTenantId(tenantInfo); | |||
| list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| } | |||
| List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||
| list.stream().filter(u->u.getTags()!=null).forEach(u->{ | |||
| List<Long> ids = JSONObject.parseArray(u.getTags(), Long.class); | |||
| String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||
| u.setTagNames(tagNames); | |||
| }); | |||
| excelService.exportExcel(list, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false); | |||
| } | |||
| public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCUserBasicInfoVo> list = new ArrayList<>(); | |||
| WxCUserBasicInfoVo u1 = new WxCUserBasicInfoVo(); | |||
| @@ -993,11 +1091,35 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| @Override | |||
| public long findCount(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCount1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountHistory1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.undateFinalTenantId(tenantInfo); | |||
| return wxCUserBasicInfoMapper.findCountHistory(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCarPayRecord> list = wxCarPayRecordMapper.findCarPayList(record); | |||
| @@ -1006,18 +1128,33 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| @Override | |||
| public long findCountByFilter(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCount(dto); | |||
| } | |||
| @Override | |||
| public long findGrowUserCount(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findGrowUserCount(dto); | |||
| public long findGrowUserCount(TenantEntity tenantEntity) { | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findGrowUserCount1(tenantEntity.getTenantId(),tenantEntity.getParentTenantId()); | |||
| }else{ | |||
| //直接查询本表 | |||
| String finalTenantId = tenantEntity.getTenantId(); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| finalTenantId = tenantEntity.getParentTenantId(); | |||
| } | |||
| return wxCUserBasicInfoMapper.findGrowUserCount(finalTenantId); | |||
| } | |||
| } | |||
| @Override | |||
| public long findImportUserCount(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findImportUserCount(dto); | |||
| public long findImportUserCount(TenantEntity tenantEntity) { | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findImportUserCount1(tenantEntity.getTenantId(),tenantEntity.getParentTenantId()); | |||
| }else{ | |||
| //直接查询本表 | |||
| String finalTenantId = tenantEntity.getTenantId(); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| finalTenantId = tenantEntity.getParentTenantId(); | |||
| } | |||
| return wxCUserBasicInfoMapper.findImportUserCount(finalTenantId); | |||
| } | |||
| } | |||
| @Override | |||
| @@ -1036,5 +1173,32 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||
| } | |||
| return null; | |||
| } | |||
| @Override | |||
| public List<WxCUserBasicInfo> findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto) { | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findListByScore1(tenantEntity,wxCUserBasicInfoDto); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfoDto.undateFinalTenantId(tenantEntity); | |||
| return wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); | |||
| } | |||
| } | |||
| @Override | |||
| public List<WxCUserBasicInfo> findBirthdayList(TenantEntity tenantEntity, String format, String format1) { | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findBirthdayList1(tenantEntity.getTenantId(),tenantEntity.getParentTenantId(),format,format1); | |||
| }else{ | |||
| //直接查询本表 | |||
| String finalTenantId = tenantEntity.getTenantId(); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| finalTenantId = tenantEntity.getParentTenantId(); | |||
| } | |||
| return wxCUserBasicInfoMapper.findBirthdayList(finalTenantId,format,format1); | |||
| } | |||
| } | |||
| } | |||
| @@ -15,10 +15,7 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.MarkingDataReportService; | |||
| import com.iformall.service.WxBusinessService; | |||
| import com.iformall.service.WxChartDataService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.kw.KwMerchantMeterService; | |||
| import com.iformall.service.kw.KwMeterDataService; | |||
| import com.iformall.service.kw.KwMeterService; | |||
| @@ -94,6 +91,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| KwMerchantMeterService kwMerchantMeterService; | |||
| @Autowired | |||
| KwMeterService kwMeterService; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @@ -1758,8 +1757,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getMemberTotalCount(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long allCount = wxCUserBasicInfoMapper.findCount(dto);//总量 | |||
| long allCount = wxCUserBasicInfoService.findCount(tenantEntity,dto);//总量 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| @@ -1767,7 +1765,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long todayCount = wxCUserBasicInfoMapper.findCount(dto);//今天新增 | |||
| long todayCount = wxCUserBasicInfoService.findCount(tenantEntity,dto);//今天新增 | |||
| datamap.put("allCount", allCount);//累计会员总数 | |||
| datamap.put("todayCount", todayCount);//今日新增会员数 | |||
| return new ResultData(datamap); | |||
| @@ -1877,7 +1875,6 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getMemberJoinTrade(TenantEntity tenantEntity) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| final int daysBefore = 29; | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| @@ -1893,7 +1890,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count = wxCUserBasicInfoMapper.findCount(dto); | |||
| long count = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| @@ -1907,7 +1904,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| c.add(Calendar.DAY_OF_YEAR, -daysBefore); | |||
| dto.setEndTime(c.getTime()); | |||
| dto.setStartTime(null); | |||
| long firstDay = wxCUserBasicInfoMapper.findCount(dto);//统计的第一天总数 | |||
| long firstDay = wxCUserBasicInfoService.findCount(tenantEntity,dto);//统计的第一天总数 | |||
| int i = 0; | |||
| long sumCount = 0; | |||
| for (UserStructureVo v : newCountVos) { | |||
| @@ -2017,7 +2014,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count = wxCUserBasicInfoMapper.findCount(dto); | |||
| long count = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| @@ -2071,10 +2068,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getMemberSexRate(TenantEntity tenantEntity, String startdate, String enddate) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(DateUtils.stringToDate(startdate)); | |||
| dto.setEndTime(DateUtils.stringToDate(enddate)); | |||
| long all = wxCUserBasicInfoMapper.findCount(dto); | |||
| long all = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for (EnumAgeInfo a : EnumAgeInfo.values()) { | |||
| @@ -2083,7 +2079,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| long count = getCountByAge(a, c, dto); | |||
| long count = getCountByAge(tenantEntity,a, c, dto); | |||
| vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); | |||
| } | |||
| return new ResultData(datamap); | |||
| @@ -2098,10 +2094,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getMemberBindCar(TenantEntity tenantEntity, String startdate, String enddate) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(DateUtils.stringToDate(startdate)); | |||
| dto.setEndTime(DateUtils.stringToDate(enddate)); | |||
| long total = wxCUserBasicInfoMapper.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| long userCountWithCar = wxCUserCarMapper.countUser(dto); | |||
| Map userWithCar = new HashMap(); | |||
| userWithCar.put("title", "已绑定车牌"); | |||
| @@ -2135,10 +2131,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| private ResultData getMemberAgeAnalysis(TenantEntity tenantEntity, String startdate, String enddate) { | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(DateUtils.stringToDate(startdate)); | |||
| dto.setEndTime(DateUtils.stringToDate(enddate)); | |||
| long all = wxCUserBasicInfoMapper.findCount(dto); | |||
| long all = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for (EnumAgeInfo a : EnumAgeInfo.values()) { | |||
| @@ -2147,7 +2142,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| long count = getCountByAge(a, c, dto); | |||
| long count = getCountByAge(tenantEntity,a, c, dto); | |||
| vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); | |||
| } | |||
| return new ResultData(datamap); | |||
| @@ -2168,7 +2163,6 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| for (int i = 0; i < levelList.size(); i++) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| dto.setStartTime(DateUtils.stringToDate(startdate)); | |||
| dto.setEndTime(DateUtils.stringToDate(enddate)); | |||
| if (i + 1 < levelList.size()) { | |||
| @@ -2178,7 +2172,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| dto.setLevelStartScore(levelList.get(i).getPoints()); | |||
| } | |||
| long all = wxCUserBasicInfoMapper.findCountByScore(dto); | |||
| long all = wxCUserBasicInfoService.findCountByScore(tenantEntity,dto); | |||
| levelList.get(i).setCount(all); | |||
| } | |||
| @@ -2186,7 +2180,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| //没有等级的会员 | |||
| other.setLevel("无"); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| other.setCount(wxCUserBasicInfoMapper.findCount(dto) | |||
| other.setCount(wxCUserBasicInfoService.findCount(tenantEntity,dto) | |||
| - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); | |||
| levelList.add(other); | |||
| return new ResultData(levelList); | |||
| @@ -2201,12 +2195,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getMobileBrandAnalysis(TenantEntity tenantEntity, String startdate, String enddate) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| Date startTime = DateUtils.stringToDate(startdate); | |||
| Date endTime = DateUtils.stringToDate(enddate); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoMapper.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| EnumTag[] tags = {EnumTag.ID_49, | |||
| EnumTag.ID_50, | |||
| @@ -2238,12 +2231,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| */ | |||
| private ResultData getMemActivity(TenantEntity tenantEntity, String startdate, String enddate) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| Date startTime = DateUtils.stringToDate(startdate); | |||
| Date endTime = DateUtils.stringToDate(enddate); | |||
| dto.setStartTime(startTime); | |||
| dto.setEndTime(endTime); | |||
| long total = wxCUserBasicInfoMapper.findCount(dto); | |||
| long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); | |||
| List<WxTags> tagList = new ArrayList<>(); | |||
| EnumTag[] tags = { | |||
| EnumTag.ID_112, | |||
| @@ -2618,7 +2610,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| } | |||
| private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| private long getCountByAge(TenantEntity tenantInfo,EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| if (a.getStart() != 0 || a.getEnd() != 0) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| @@ -2634,7 +2626,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| dto.setBirthEndTime(null); | |||
| } | |||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | |||
| return wxCUserBasicInfoService.findCountByAge(tenantInfo,dto); | |||
| } | |||
| private UserStructureVo getVo(long count, long all, String name, Integer num) { | |||
| @@ -14,7 +14,9 @@ import com.iformall.domain.vo.WxLevelMerchantCVo; | |||
| import com.iformall.mapper.WxCUserBasicInfoMapper; | |||
| import com.iformall.mapper.WxLevelConfigMapper; | |||
| import com.iformall.mapper.WxLevelMerchantMapper; | |||
| import com.iformall.service.WxCUserBasicInfoService; | |||
| import com.iformall.service.WxLevelConfigService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -41,8 +43,11 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| @Autowired | |||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Override | |||
| public PageInfo<WxLevelConfig> listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize) { | |||
| public PageInfo<WxLevelConfig> listAsPage(TenantEntity tenantEntity,WxLevelConfig record, Integer pageIndex, Integer pageSize) { | |||
| PageInfo<WxLevelConfig> page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxLevelConfigMapper.findList(record)); | |||
| for (int i=0;i<page.getList().size();i++) | |||
| @@ -59,12 +64,11 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| l.setScale(WxLevelConfig.DEFAULT_SCALE); | |||
| } | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(record); | |||
| dto.setLevelStartScore(l.getPoints()); | |||
| if (i + 1<page.getList().size()) | |||
| dto.setLevelEndScore(page.getList().get(i+1).getPoints()); | |||
| l.setUserCount(wxCUserBasicInfoMapper.findCountByScore(dto)); | |||
| l.setUserCount(wxCUserBasicInfoService.findCountByScore(tenantEntity,dto)); | |||
| } | |||
| return page; | |||
| @@ -125,7 +129,10 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| @Override | |||
| public List<WxLevelConfig> getByTenantInfo(TenantEntity tenantEntity) { | |||
| WxLevelConfig wxLevelConfig = new WxLevelConfig(); | |||
| wxLevelConfig.updateTenantInfo(tenantEntity); | |||
| wxLevelConfig.setTenantId(tenantEntity.getTenantId()); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| wxLevelConfig.setTenantId(tenantEntity.getParentTenantId()); | |||
| } | |||
| wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); | |||
| return wxLevelConfigMapper.findList(wxLevelConfig); | |||
| } | |||
| @@ -13,8 +13,8 @@ | |||
| <result column="tag_id" jdbcType="BIGINT" property="tagId"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <!-- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>--> | |||
| <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||
| @@ -32,10 +32,10 @@ | |||
| <sql id="allColumns"> | |||
| distinct wcubi.`id`,wcubi.`phone`,wcubi.`birthdate`,wcubi.`education`,wcubi.`sex`,wcubi.`email`, | |||
| wcubi.`address`,wcubi.`poins`,wcubi.`tag_id`,wcubi.`create_date`,wcubi.`update_date`, | |||
| wcubi.`tenant_id`,wcubi.`parent_tenant_id`,wcubi.`final_tenant_id`,wcubi.`name`,wcubi.`nick_name`, | |||
| wcubi.`final_tenant_id`,wcubi.`name`,wcubi.`nick_name`, | |||
| wcubi.`avatar_url`,wcubi.`credit`,wcubi.`active_time`,wcubi.`login_count`,wcubi.`act_record` | |||
| ,(select level from wx_level_config | |||
| where poins >= points and tenant_id=wcubi.tenant_id | |||
| where poins >= points and tenant_id=wcubi.final_tenant_id | |||
| order by points desc limit 1 ) level,wcubi.status | |||
| </sql> | |||
| @@ -46,12 +46,6 @@ | |||
| and wcubi.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| @@ -131,7 +125,6 @@ | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| <include refid="dynamicWhereConditions"/> | |||
| ) r where 1=1 | |||
| @@ -140,6 +133,104 @@ | |||
| </if> | |||
| </select> | |||
| <sql id="dynamicWhereConditions1"> | |||
| where 1 = 1 | |||
| <if test=" null != basicInfo.id "> | |||
| and wcubi.`id` = #{basicInfo.id} | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != basicInfo.phone "> | |||
| and wcubi.`phone` like concat('%', #{basicInfo.phone},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.birthdate "> | |||
| and wcubi.`birthdate` = #{basicInfo.birthdate} | |||
| </if> | |||
| <if test=" null != basicInfo.education "> | |||
| and wcubi.`education` like concat('%', #{basicInfo.education},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.sex "> | |||
| and wcubi.`sex` = #{basicInfo.sex} | |||
| </if> | |||
| <if test=" null != basicInfo.email "> | |||
| and wcubi.`email` like concat('%', #{basicInfo.email},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.address "> | |||
| and wcubi.`address` like concat('%', #{basicInfo.address},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.poins "> | |||
| and wcubi.`poins` = #{basicInfo.poins} | |||
| </if> | |||
| <if test=" null != basicInfo.credit "> | |||
| and wcubi.`credit` = #{basicInfo.credit} | |||
| </if> | |||
| <if test=" null != basicInfo.tagId "> | |||
| and wcubi.`tag_id` = #{basicInfo.tagId} | |||
| </if> | |||
| <if test=" null != basicInfo.createDate "> | |||
| and wcubi.`create_date` = #{basicInfo.createDate} | |||
| </if> | |||
| <if test=" null != basicInfo.updateDate "> | |||
| and wcubi.`update_date` = #{basicInfo.updateDate} | |||
| </if> | |||
| <if test=" null != basicInfo.actRecord "> | |||
| and wcubi.`act_record` = #{basicInfo.actRecord} | |||
| </if> | |||
| <if test=" null != basicInfo.name "> | |||
| and wcubi.`name` like concat('%', #{basicInfo.name},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.startTime and null! = basicInfo.endTime"> | |||
| and wcubi.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.status "> | |||
| and wcubi.`status` = #{basicInfo.status} | |||
| </if> | |||
| <if test=" null != basicInfo.ids "> | |||
| and wcubi.id in | |||
| <foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| order by wcubi.`active_time` DESC | |||
| <!-- <if test=" null != sortColumns">order by ${sortColumns}</if>--> | |||
| </sql> | |||
| <select id="findList1" resultMap="BaseResultMap"> | |||
| select r.* from ( | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| <include refid="dynamicWhereConditions1"/> | |||
| ) r where 1=1 | |||
| <if test="null != basicInfo.level and '' != basicInfo.level"> | |||
| and r.level =#{basicInfo.level} | |||
| </if> | |||
| </select> | |||
| <update id="updateScore" parameterType="com.iformall.domain.po.WxCUserBasicInfo"> | |||
| update wx_c_user_basic_info set poins=#{poins} | |||
| where id=#{id} | |||
| @@ -160,27 +251,43 @@ | |||
| <select id="findCountBySex" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where wcubi.sex =#{sex} | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and wcubi.create_date <= #{endTime} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCountBySex1" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where wcubi.sex =#{basicInfo.sex} | |||
| <if test=" null != basicInfo.startTime "> | |||
| and wcubi.create_date >= #{basicInfo.startTime} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != basicInfo.endTime"> | |||
| and wcubi.create_date <= #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCountByAge" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| </if> | |||
| @@ -200,19 +307,46 @@ | |||
| and wcubi.birthdate is null | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCountByAge1" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != basicInfo.startTime "> | |||
| and wcubi.create_date >= #{basicInfo.startTime} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != basicInfo.endTime"> | |||
| and wcubi.create_date <= #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.birthStartTime "> | |||
| and wcubi.birthdate >= #{basicInfo.birthStartTime} | |||
| </if> | |||
| <if test=" null != basicInfo.birthEndTime"> | |||
| and wcubi.birthdate <= #{basicInfo.birthEndTime} | |||
| </if> | |||
| <if test=" null == basicInfo.birthStartTime and null == basicInfo.birthEndTime"> | |||
| and wcubi.birthdate is null | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCountByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| </if> | |||
| @@ -232,27 +366,52 @@ | |||
| and wcubi.poins is null | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCountByScore1" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != basicInfo.startTime "> | |||
| and wcubi.create_date >= #{basicInfo.startTime} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != basicInfo.endTime"> | |||
| and wcubi.create_date <= #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.levelStartScore "> | |||
| and wcubi.poins >= #{basicInfo.levelStartScore} | |||
| </if> | |||
| <if test=" null != basicInfo.levelEndScore"> | |||
| and wcubi.poins < #{basicInfo.levelEndScore} | |||
| </if> | |||
| <if test=" null == basicInfo.levelStartScore and null == basicInfo.levelEndScore"> | |||
| and wcubi.poins is null | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| </select> | |||
| <sql id="allColumnsOfScoreList"> | |||
| distinct cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.email,cub.address,cub.poins,cub.tag_id, | |||
| cub.create_date,cub.update_date,cub.tenant_id,cub.name,cub.level,cub.nick_name,cub.score_date,cub.parent_tenant_id | |||
| cub.create_date,cub.update_date,cub.name,cub.level,cub.nick_name,cub.score_date,cub.final_tenant_id | |||
| </sql> | |||
| <select id="findListByScore" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| select <include refid="allColumnsOfScoreList"/> | |||
| from wx_c_user_basic_info cub | |||
| inner join wx_c_user cu on cu.user_id = cub.id | |||
| where cub.status=0 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cub.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != levelStartScore "> | |||
| and cub.poins >= #{levelStartScore} | |||
| </if> | |||
| @@ -264,14 +423,32 @@ | |||
| <if test=" null == levelStartScore and null == levelEndScore"> | |||
| and cub.poins is null | |||
| </if> | |||
| order by cub.`active_time` DESC | |||
| </select> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cu.`tenant_id` = #{tenantId} | |||
| <select id="findListByScore1" resultMap="BaseResultMap"> | |||
| select <include refid="allColumnsOfScoreList"/> | |||
| from wx_c_user_basic_info cub | |||
| inner join wx_c_user cu on cu.user_id = cub.id | |||
| where cub.status=0 | |||
| <if test=" null != basicInfo.levelStartScore "> | |||
| and cub.poins >= #{basicInfo.levelStartScore} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != basicInfo.levelEndScore"> | |||
| and cub.poins <= #{basicInfo.levelEndScore} | |||
| </if> | |||
| <if test=" null == basicInfo.levelStartScore and null == basicInfo.levelEndScore"> | |||
| and cub.poins is null | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and cu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and cu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| order by cub.`active_time` DESC | |||
| </select> | |||
| <select id="findBirthdayList" resultMap="BaseResultMap"> | |||
| @@ -281,31 +458,62 @@ | |||
| where cub.status = 0 | |||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | |||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cub.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| order by cub.`active_time` DESC | |||
| </select> | |||
| <select id="findBirthdayList1" resultMap="BaseResultMap"> | |||
| select <include refid="allColumnsOfScoreList"/> | |||
| from wx_c_user_basic_info cub | |||
| inner join wx_c_user cu on cu.user_id = cub.id | |||
| where cub.status = 0 | |||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') >= #{begin} | |||
| AND DATE_FORMAT(cub.birthdate,'%m-%d') <= #{end} | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and cu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and cu.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| order by cub.`active_time` DESC | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and wcubi.create_date < #{endTime} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| <if test="1 == queryImport"> | |||
| and wcubi.create_date like '%00:00:00' | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| </select> | |||
| <select id="findCount1" resultType="java.lang.Long"> | |||
| select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != basicInfo.startTime "> | |||
| and wcubi.create_date >= #{basicInfo.startTime} | |||
| </if> | |||
| <if test="1 == queryImport"> | |||
| <if test=" null != basicInfo.endTime"> | |||
| and wcubi.create_date < #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| <if test="1 == basicInfo.queryImport"> | |||
| and wcubi.create_date like '%00:00:00' | |||
| </if> | |||
| </select> | |||
| @@ -335,22 +543,16 @@ | |||
| <if test="3 == reportType "> | |||
| date_format(wcubi.create_date, '%Y') <= reportTime | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| ) as totalCount | |||
| </if> | |||
| from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wcu.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and wcubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| @@ -363,6 +565,59 @@ | |||
| </if> | |||
| </select> | |||
| <select id="findCountHistory1" resultType="com.iformall.domain.vo.UserCountVo"> | |||
| select count(distinct wcubi.id) as incCount, | |||
| <if test="1 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y-%m-%d') as reportTime, | |||
| </if> | |||
| <if test="2 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y-%m') as reportTime, | |||
| </if> | |||
| <if test="3 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y') as reportTime, | |||
| </if> | |||
| <if test="1 == basicInfo.reportType or 2 == basicInfo.reportType or 3 == basicInfo.reportType"> | |||
| (select count(distinct wcubi.id) from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test="1 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y-%m-%d') <= reportTime | |||
| </if> | |||
| <if test="2 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y-%m') <= reportTime | |||
| </if> | |||
| <if test="3 == basicInfo.reportType "> | |||
| date_format(wcubi.create_date, '%Y') <= reportTime | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| ) as totalCount | |||
| </if> | |||
| from wx_c_user_basic_info wcubi | |||
| left join wx_c_user wcu on wcu.user_id = wcubi.id | |||
| where 1=1 | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and wcu.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and wcu.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| <if test=" null != basicInfo.startTime "> | |||
| and wcubi.create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != basicInfo.endTime"> | |||
| and wcubi.create_date < #{endTime} | |||
| </if> | |||
| <if test="1 == basicInfo.reportType or 2 == basicInfo.reportType or 3 == basicInfo.reportType"> | |||
| group by wcubi.reportTime | |||
| </if> | |||
| </select> | |||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.vo.WxCUserBasicInfoVo"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="phone" jdbcType="VARCHAR" property="phone"/> | |||
| @@ -375,8 +630,8 @@ | |||
| <result column="tag_id" jdbcType="BIGINT" property="tagId"/> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/> | |||
| <!-- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>--> | |||
| <!-- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>--> | |||
| <result column="final_tenant_id" jdbcType="VARCHAR" property="finalTenantId"/> | |||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||
| <result column="level" jdbcType="VARCHAR" property="level"/> | |||
| @@ -388,8 +643,8 @@ | |||
| <sql id="allVoColumns"> | |||
| distinct cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_id`, | |||
| cu.`create_date`,cu.`update_date`,cu.`tenant_id`,cu.`name`,cu.`level`,cu.`nick_name`, | |||
| cut.`tags`,cu.`credit`,cu.`active_time`,cu.`act_record`,cu.`parent_tenant_id`,cu.`final_tenant_id` | |||
| cu.`create_date`,cu.`update_date`,cu.`name`,cu.`level`,cu.`nick_name`, | |||
| cut.`tags`,cu.`credit`,cu.`active_time`,cu.`act_record`,cu.`final_tenant_id` | |||
| </sql> | |||
| <sql id="dynamicVoWhereConditions"> | |||
| @@ -399,12 +654,6 @@ | |||
| and cu.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cu.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| @@ -454,38 +703,129 @@ | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| and cu.`name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != startTime and null!=endTime"> | |||
| and cu.`create_date` between #{startTime} and #{endTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| and cu.id in | |||
| <foreach collection="ids" 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 id="dynamicVoWhereConditions1"> | |||
| where 1 = 1 | |||
| <if test=" null != basicInfo.id "> | |||
| and cu.`id` = #{basicInfo.id} | |||
| </if> | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and c.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and c.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| <if test=" null != basicInfo.phone "> | |||
| and cu.`phone` like concat('%', #{basicInfo.phone},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.birthdate "> | |||
| and cu.`birthdate` = #{basicInfo.birthdate} | |||
| </if> | |||
| <if test=" null != basicInfo.education "> | |||
| and cu.`education` like concat('%', #{basicInfo.education},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.sex "> | |||
| and cu.`sex` = #{basicInfo.sex} | |||
| </if> | |||
| <if test=" null != basicInfo.email "> | |||
| and cu.`email` like concat('%', #{basicInfo.email},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.address "> | |||
| and cu.`address` like concat('%', #{basicInfo.address},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.poins "> | |||
| and cu.`poins` = #{basicInfo.poins} | |||
| </if> | |||
| <if test=" null != basicInfo.tagId "> | |||
| and cu.`tag_id` = #{basicInfo.tagId} | |||
| </if> | |||
| <if test=" null != basicInfo.createDate "> | |||
| and cu.`create_date` = #{basicInfo.createDate} | |||
| </if> | |||
| <if test=" null != basicInfo.updateDate "> | |||
| and cu.`update_date` = #{basicInfo.updateDate} | |||
| </if> | |||
| <if test=" null != basicInfo.actRecord "> | |||
| and cu.`act_record` = #{basicInfo.actRecord} | |||
| </if> | |||
| <if test=" null != basicInfo.name "> | |||
| and cu.`name` like concat('%', #{basicInfo.name},'%') | |||
| </if> | |||
| <if test=" null != basicInfo.startTime and null! = basicInfo.endTime"> | |||
| and cu.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.ids "> | |||
| and cu.id in | |||
| <foreach collection="basicInfo.ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <!-- <if test=" null != sortColumns">order by ${sortColumns}</if>--> | |||
| </sql> | |||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultMap="VoBaseResultMap"> | |||
| select | |||
| <include refid="allVoColumns"/> | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| left join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| <include refid="dynamicVoWhereConditions"/> | |||
| order by cu.`active_time` DESC | |||
| </select> | |||
| <select id="findVoList1" resultMap="VoBaseResultMap"> | |||
| select | |||
| <include refid="allVoColumns"/> | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| left join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| <include refid="dynamicVoWhereConditions1"/> | |||
| order by cu.`active_time` DESC | |||
| </select> | |||
| <select id="countVoList" parameterType="com.iformall.domain.po.WxCUserBasicInfo" resultType="java.lang.Integer"> | |||
| select | |||
| count(distinct cu.id) | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| left join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| <include refid="dynamicVoWhereConditions"/> | |||
| </select> | |||
| <select id="countVoList1" resultType="java.lang.Integer"> | |||
| select | |||
| count(distinct cu.id) | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| left join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| <include refid="dynamicVoWhereConditions1"/> | |||
| </select> | |||
| <sql id="msgColumns"> | |||
| distinct cu.`id`,cu.`phone`,cu.`email` | |||
| @@ -493,11 +833,8 @@ | |||
| <sql id="filterWhereConditions"> | |||
| where 1=1 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and c.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and c.`parent_tenant_id` = #{parentTenantId} | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cu.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| @@ -560,30 +897,127 @@ | |||
| </foreach> | |||
| ) | |||
| </if> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <!-- <if test=" null != sortColumns">order by ${sortColumns}</if>--> | |||
| </sql> | |||
| <sql id="filterWhereConditions1"> | |||
| where 1=1 | |||
| <if test=" null != tenantInfo.tenantId and '' != tenantInfo.tenantId"> | |||
| and c.`tenant_id` = #{tenantInfo.tenantId} | |||
| </if> | |||
| <if test=" null != tenantInfo.parentTenantId and '' != tenantInfo.parentTenantId"> | |||
| and c.`parent_tenant_id` = #{tenantInfo.parentTenantId} | |||
| </if> | |||
| <if test=" null != basicInfo.startTime "> | |||
| and cu.create_date >= #{basicInfo.startTime} | |||
| </if> | |||
| <if test=" null != basicInfo.endTime"> | |||
| and cu.create_date <= #{basicInfo.endTime} | |||
| </if> | |||
| <if test=" null != basicInfo.birthStartTime "> | |||
| and cu.birthdate >= #{basicInfo.birthStartTime} | |||
| </if> | |||
| <if test=" null != basicInfo.birthEndTime"> | |||
| and cu.birthdate < #{basicInfo.birthEndTime} | |||
| </if> | |||
| <if test=" null != basicInfo.loginStartTime "> | |||
| and cu.active_time >= #{basicInfo.loginStartTime} | |||
| </if> | |||
| <if test=" null != basicInfo.loginEndTime"> | |||
| and cu.active_time <= #{basicInfo.loginEndTime} | |||
| </if> | |||
| <if test=" null != basicInfo.verifiedStartTime and null != basicInfo.verifiedEndTime "> | |||
| and 0< | |||
| (select count(*) from wx_coupon_order co | |||
| where cu.id = co.c_user_id | |||
| and co.coupon_order_status = 1 | |||
| and co.update_date >= #{basicInfo.verifiedStartTime} | |||
| and co.update_date <= #{basicInfo.verifiedEndTime}) | |||
| </if> | |||
| <if test=" null != basicInfo.phones"> | |||
| and cu.phone in (${basicInfo.phones}) | |||
| </if> | |||
| <if test=" null != basicInfo.levelStartScore and (0 != basicInfo.levelStartScore and '' != basicInfo.levelStartScore)"> | |||
| and cu.poins >= #{basicInfo.levelStartScore} | |||
| <if test=" null != basicInfo.levelEndScore"> | |||
| and cu.poins < #{basicInfo.levelEndScore} | |||
| </if> | |||
| </if> | |||
| <if test=" null != basicInfo.levelStartScore and (0 == basicInfo.levelStartScore or '' == basicInfo.levelStartScore)"> | |||
| and (cu.poins is null or | |||
| (cu.poins >= #{basicInfo.levelStartScore} | |||
| <if test=" null != basicInfo.levelEndScore"> | |||
| and cu.poins < #{basicInfo.levelEndScore} | |||
| </if> | |||
| )) | |||
| </if> | |||
| <if test=" null != basicInfo.tagIds "> | |||
| and JSON_CONTAINS(JSON_ARRAY(cut.tags),JSON_ARRAY | |||
| <foreach collection="basicInfo.tagIds" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| ) | |||
| </if> | |||
| <!-- <if test=" null != sortColumns">order by ${sortColumns}</if>--> | |||
| </sql> | |||
| <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(distinct cu.id) from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| <if test=" null != tagIds "> | |||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| </if> | |||
| <include refid="filterWhereConditions"/> | |||
| </select> | |||
| <select id="findCountByFilter1" resultType="java.lang.Long"> | |||
| select count(distinct cu.id) from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| <if test=" null != basicInfo.tagIds "> | |||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| </if> | |||
| <include refid="filterWhereConditions1"/> | |||
| </select> | |||
| <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||
| select <include refid="msgColumns"/> | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| <if test=" null != tagIds "> | |||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| </if> | |||
| <include refid="filterWhereConditions"/> | |||
| </select> | |||
| <select id="findListByFilter1" resultMap="BaseResultMap"> | |||
| select <include refid="msgColumns"/> | |||
| from wx_c_user_basic_info cu | |||
| left join wx_c_user c on c.user_id = cu.id | |||
| <if test=" null != basicInfo.tagIds "> | |||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||
| </if> | |||
| <include refid="filterWhereConditions1"/> | |||
| </select> | |||
| <select id="findImportUserCount" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| where 1=1 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findImportUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| <select id="findImportUserCount1" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| left join wx_c_user cu on cubi.id=cu.user_id | |||
| where 1=1 | |||
| @@ -595,7 +1029,15 @@ | |||
| </if> | |||
| </select> | |||
| <select id="findGrowUserCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| <select id="findGrowUserCount" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| where 1=1 | |||
| <if test=" null != finalTenantId and '' != finalTenantId"> | |||
| and cubi.`final_tenant_id` = #{finalTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findGrowUserCount1" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi | |||
| left join wx_c_user cu on cubi.id=cu.user_id | |||
| where 1=1 | |||