From 04a0ca5527f1e378c5b68fc859a62f55b45e9ac4 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 7 Aug 2020 15:24:19 +0800 Subject: [PATCH] bug --- .../datatower/WxUserStructureController.java | 52 +- .../mem/WxCUserBasicInfoController.java | 12 +- .../controller/mem/WxCUserDataController.java | 7 +- .../mem/WxLevelConfigController.java | 2 +- .../iformall/controller/WxMemController.java | 2 +- .../controller/WxUserGrantController.java | 4 +- .../iformall/service/impl/PosServiceImpl.java | 2 +- .../iformall/schedule/ChartDataSchedule.java | 5 +- .../iformall/schedule/CouponSendSchedule.java | 8 +- .../domain/dto/WxCUserBasicInfoDto.java | 15 +- .../mapper/WxCUserBasicInfoMapper.java | 27 +- .../com/iformall/mapper/WxCUserCarMapper.java | 2 +- .../service/WxCUserBasicInfoService.java | 26 +- .../service/WxLevelConfigService.java | 2 +- .../impl/WxCUserBasicInfoServiceImpl.java | 200 +++++- .../service/impl/WxChartServiceImpl.java | 48 +- .../impl/WxLevelConfigServiceImpl.java | 15 +- .../mapper/WxCUserBasicInfoMapper.xml | 592 +++++++++++++++--- 18 files changed, 834 insertions(+), 187 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java index b800d0df9..e97bc9aa2 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java @@ -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 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 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 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 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 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 wxCountList = new ArrayList<>();//每日新增会员数 List wxCounts = wxCUserService.findCountHistory(dto);//每日新增会员数 List memCountList = new ArrayList<>();//每日新增会员数 - List memCounts = wxCUserBasicInfoService.findCountHistory(dto);//每日新增会员数 + List 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) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java index dcc335c87..aa55a6aa4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -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 page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); + PageInfo 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); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java index 5360e5b67..a499d4768 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java @@ -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); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java index 48425e291..3299d65e4 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java @@ -54,7 +54,7 @@ public class WxLevelConfigController extends BaseController { wxLevelConfig.setTenantId(tenantEntity.getTenantId()); } wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); - final PageInfo page = wxLevelConfigService.listAsPage(wxLevelConfig, pageNum, pageSize); + final PageInfo page = wxLevelConfigService.listAsPage(tenantEntity,wxLevelConfig, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxMemController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxMemController.java index e1373ce87..53c914cc8 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxMemController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxMemController.java @@ -93,7 +93,7 @@ public class WxMemController extends BaseController { if (userVo.getScore() != null) { - List levelList = wxLevelConfigService.getByTenantId(userVo.getTenantId()); + List levelList = wxLevelConfigService.getByTenantId(wxCUserBasicInfo.getFinalTenantId()); String level = WxLevelConfigService.DEFAULT_LEVEL; Long levelId = 0L; diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java index 9a9951319..2cf94050a 100755 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java @@ -785,7 +785,7 @@ public class WxUserGrantController extends BaseController { Integer levelScore = 0; Integer levelTarget= 0; userVo.setLevelName(WxLevelConfigService.DEFAULT_LEVEL); - List levelList = wxLevelConfigService.getByTenantId(getTenantInfo().getTenantId()); + List levelList = wxLevelConfigService.getByTenantInfo(getTenantInfo()); if (levelList.size() > 0) levelTarget = levelList.get(0).getPoints(); for (int i = 0; i levelList = wxLevelConfigService.getByTenantId(getTenantInfo().getTenantId()); + List levelList = wxLevelConfigService.getByTenantInfo(getTenantInfo()); String level = WxLevelConfigService.DEFAULT_LEVEL; Long levelId = 0L; diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 7c063dcef..8da81c41d 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -721,7 +721,7 @@ public class PosServiceImpl implements PosService { if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) { String level = WxLevelConfigService.DEFAULT_LEVEL; // 1. 会员级别Level - List levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId()); + List levelList = levelConfigService.getByTenantInfo(tenantEntity); Long levelId = 0L; for (WxLevelConfig levelConfig : levelList) { if (user.getPoins() >= levelConfig.getPoints()) { diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java index 8bd310fb7..c5f36c230 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/ChartDataSchedule.java @@ -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; diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java index 97d27d286..e5678a031 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/CouponSendSchedule.java @@ -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 wxCUserBasicInfoList = wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); + List 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 wxCUserBasicInfoList = wxCUserBasicInfoMapper.findBirthdayList(mall.getTenantId(), df.format(begin.getTime()), df.format(end.getTime())); + List wxCUserBasicInfoList = wxCUserBasicInfoService.findBirthdayList(tenantEntity, df.format(begin.getTime()), df.format(end.getTime())); if (CollectionUtils.isEmpty(wxCUserBasicInfoList)) { logger.info("生日发券: {} 满足发券的用户列表为空 wxCUserBasicInfoList = {}, 任务跳过不执行", mall.getName(), wxCUserBasicInfoList); return; diff --git a/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java b/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java index f3d6e4c22..6fd500578 100644 --- a/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java +++ b/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java @@ -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 filterList; + + + public void undateFinalTenantId(TenantEntity tenantEntity){ + setFinalTenantId(tenantEntity.getTenantId()); + if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ + setFinalTenantId(tenantEntity.getParentTenantId()); + } + } } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java index 55800c4b6..ed2546897 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java @@ -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 { long findCountByFilter(WxCUserBasicInfoDto dto); + long findCountByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); List findListByFilter(WxCUserBasicInfoDto dto); + List findListByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); List findList(WxCUserBasicInfo wxCUserBasicInfo); + List findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo); void updateScore(WxCUserBasicInfo record); @@ -25,26 +30,40 @@ public interface WxCUserBasicInfoMapper extends CommonMapper findListByScore(WxCUserBasicInfoDto dto); + List findListByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); + - List findBirthdayList(String tenantId, String begin, String end); + List findBirthdayList(@Param("finalTenantId")String finalTenantId, @Param("begin")String begin, @Param("end")String end); + List 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 findCountHistory(WxCUserBasicInfoDto dto); + List findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); List findVoList(WxCUserBasicInfo wxCUserBasicInfo); + List 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 selectNotCUserList(); + + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java index 8f9b90d88..9810dfe45 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserCarMapper.java @@ -12,7 +12,7 @@ public interface WxCUserCarMapper extends CommonMapper { List findList(WxCUserCar wxCUserCar); Integer countList(WxCUserCar wxCUserCar); - Integer countUser(WxCUserBasicInfoDto dto); + Integer countUser(WxCUserCar wxCUserCar); long queryCarCount(Map carParams); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java index b0f6dcdfd..363637141 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java @@ -23,8 +23,11 @@ public interface WxCUserBasicInfoService { */ List listFilters(TenantEntity tenantEntity); + long countByFilter(TenantEntity tenantEntity, List filterList); + List listByFilter(TenantEntity tenantEntity, List filterList); + List listByFilterList(TenantEntity tenantEntity, List filterList); /** * 根据实体查询分页列表 @@ -35,6 +38,7 @@ public interface WxCUserBasicInfoService { * @return */ PageInfo listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); + PageInfo 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 tagList, CUserBaseInfoT uBase,MallUserInfo mallUserInfo); long findCount(WxCUserBasicInfoDto dto); + long findCount(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); + List findCountHistory(WxCUserBasicInfoDto dto); + List 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 findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto); + + List findBirthdayList(TenantEntity tenantEntity, String format, String format1); } diff --git a/mallinkService/src/main/java/com/iformall/service/WxLevelConfigService.java b/mallinkService/src/main/java/com/iformall/service/WxLevelConfigService.java index 332c9a86b..897b43597 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxLevelConfigService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxLevelConfigService.java @@ -22,7 +22,7 @@ public interface WxLevelConfigService { * @param pageSize * @return */ - PageInfo listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize); + PageInfo listAsPage(TenantEntity tenantEntity,WxLevelConfig record, Integer pageIndex, Integer pageSize); List listByMerchantId(Long merchantId, WxLevelConfig record); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index 422b3315c..47166eca9 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -295,8 +295,8 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } } } - private void filtersToDtoID51(WxCUserBasicInfoDto dto, WxCUserBasicInfoFilterDto f) { - List levels = wxLevelConfigService.getByTenantId(dto.getTenantId()); + private void filtersToDtoID51(TenantEntity tenantEntity, WxCUserBasicInfoDto dto, WxCUserBasicInfoFilterDto f) { + List 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 tagsMemberLevel = new ArrayList<>(); - List levels = wxLevelConfigService.getByTenantId(tenantEntity.getTenantId()); + List 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 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 listByFilter(TenantEntity tenantEntity, List 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 listByFilterList(TenantEntity tenantEntity, List filterList) { @@ -534,6 +551,18 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(record)); } + @Override + public PageInfo 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 levelList = wxLevelConfigService.getByTenantId(wxCUserBasicInfo.getFinalTenantId()); + List 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 list = wxCUserBasicInfoMapper.findVoList(basicInfo); List 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 list = new ArrayList(); + if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ + //关联微信表查询 + list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); + }else{ + //直接查询本表 + basicInfo.undateFinalTenantId(tenantInfo); + list = wxCUserBasicInfoMapper.findVoList(basicInfo); + } + List tagList = wxTagsMapper.findListAll(); + Map tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); + list.stream().filter(u->u.getTags()!=null).forEach(u->{ + List 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 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 findCountHistory(WxCUserBasicInfoDto dto) { return wxCUserBasicInfoMapper.findCountHistory(dto); } + @Override + public List 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 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 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 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); + } + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index a23afaf93..356c0ba7c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -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 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 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 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 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 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 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 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 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) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java index 2514f637f..4da539116 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java @@ -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 listAsPage(WxLevelConfig record, Integer pageIndex, Integer pageSize) { + public PageInfo listAsPage(TenantEntity tenantEntity,WxLevelConfig record, Integer pageIndex, Integer pageSize) { PageInfo page = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxLevelConfigMapper.findList(record)); for (int i=0;i 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); } diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 757cf1eb5..6e8bc3688 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -13,8 +13,8 @@ - - + @@ -32,10 +32,10 @@ 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 @@ -46,12 +46,6 @@ and wcubi.`id` = #{id} - - and wcu.`tenant_id` = #{tenantId} - - - and wcu.`parent_tenant_id` = #{parentTenantId} - and wcubi.`final_tenant_id` = #{finalTenantId} @@ -131,7 +125,6 @@ select from wx_c_user_basic_info wcubi - left join wx_c_user wcu on wcu.user_id = wcubi.id ) r where 1=1 @@ -140,6 +133,104 @@ + + where 1 = 1 + + + and wcubi.`id` = #{basicInfo.id} + + + + and wcu.`tenant_id` = #{tenantId} + + + and wcu.`parent_tenant_id` = #{parentTenantId} + + + + and wcubi.`phone` like concat('%', #{basicInfo.phone},'%') + + + + and wcubi.`birthdate` = #{basicInfo.birthdate} + + + + and wcubi.`education` like concat('%', #{basicInfo.education},'%') + + + + and wcubi.`sex` = #{basicInfo.sex} + + + + and wcubi.`email` like concat('%', #{basicInfo.email},'%') + + + + and wcubi.`address` like concat('%', #{basicInfo.address},'%') + + + + and wcubi.`poins` = #{basicInfo.poins} + + + + and wcubi.`credit` = #{basicInfo.credit} + + + + and wcubi.`tag_id` = #{basicInfo.tagId} + + + + and wcubi.`create_date` = #{basicInfo.createDate} + + + + and wcubi.`update_date` = #{basicInfo.updateDate} + + + + and wcubi.`act_record` = #{basicInfo.actRecord} + + + + and wcubi.`name` like concat('%', #{basicInfo.name},'%') + + + and wcubi.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} + + + + and wcubi.`status` = #{basicInfo.status} + + + + and wcubi.id in + + #{idItem} + + + order by wcubi.`active_time` DESC + + + + + + update wx_c_user_basic_info set poins=#{poins} where id=#{id} @@ -160,27 +251,43 @@ + + + + + + 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 - - and cu.`tenant_id` = #{tenantId} + + + + + @@ -335,22 +543,16 @@ date_format(wcubi.create_date, '%Y') <= reportTime - - and wcu.`tenant_id` = #{tenantId} - - - and wcu.`parent_tenant_id` = #{parentTenantId} + + and wcubi.`final_tenant_id` = #{finalTenantId} ) as totalCount from wx_c_user_basic_info wcubi left join wx_c_user wcu on wcu.user_id = wcubi.id where 1=1 - - and wcu.`tenant_id` = #{tenantId} - - - and wcu.`parent_tenant_id` = #{parentTenantId} + + and wcubi.`final_tenant_id` = #{finalTenantId} and wcubi.create_date >= #{startTime} @@ -363,6 +565,59 @@ + + @@ -375,8 +630,8 @@ - - + + @@ -388,8 +643,8 @@ 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` @@ -399,12 +654,6 @@ and cu.`id` = #{id} - - and c.`tenant_id` = #{tenantId} - - - and c.`parent_tenant_id` = #{parentTenantId} - and cu.`final_tenant_id` = #{finalTenantId} @@ -454,38 +703,129 @@ - and `name` like concat('%', #{name},'%') + and cu.`name` like concat('%', #{name},'%') and cu.`create_date` between #{startTime} and #{endTime} - and id in + and cu.id in #{idItem} - order by ${sortColumns} + + + + + where 1 = 1 + + + and cu.`id` = #{basicInfo.id} + + + + and c.`tenant_id` = #{tenantInfo.tenantId} + + + and c.`parent_tenant_id` = #{tenantInfo.parentTenantId} + + + + and cu.`phone` like concat('%', #{basicInfo.phone},'%') + + + + and cu.`birthdate` = #{basicInfo.birthdate} + + + + and cu.`education` like concat('%', #{basicInfo.education},'%') + + + + and cu.`sex` = #{basicInfo.sex} + + + + and cu.`email` like concat('%', #{basicInfo.email},'%') + + + + and cu.`address` like concat('%', #{basicInfo.address},'%') + + + + and cu.`poins` = #{basicInfo.poins} + + + + and cu.`tag_id` = #{basicInfo.tagId} + + + + and cu.`create_date` = #{basicInfo.createDate} + + + + and cu.`update_date` = #{basicInfo.updateDate} + + + + and cu.`act_record` = #{basicInfo.actRecord} + + + + and cu.`name` like concat('%', #{basicInfo.name},'%') + + + and cu.`create_date` between #{basicInfo.startTime} and #{basicInfo.endTime} + + + and cu.id in + + #{idItem} + + + + + + + distinct cu.`id`,cu.`phone`,cu.`email` @@ -493,11 +833,8 @@ where 1=1 - - and c.`tenant_id` = #{tenantId} - - - and c.`parent_tenant_id` = #{parentTenantId} + + and cu.`final_tenant_id` = #{finalTenantId} @@ -560,30 +897,127 @@ ) - order by ${sortColumns} + + + + + where 1=1 + + and c.`tenant_id` = #{tenantInfo.tenantId} + + + and c.`parent_tenant_id` = #{tenantInfo.parentTenantId} + + + + and cu.create_date >= #{basicInfo.startTime} + + + + and cu.create_date <= #{basicInfo.endTime} + + + + and cu.birthdate >= #{basicInfo.birthStartTime} + + + + and cu.birthdate < #{basicInfo.birthEndTime} + + + + and cu.active_time >= #{basicInfo.loginStartTime} + + + + and cu.active_time <= #{basicInfo.loginEndTime} + + + + 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}) + + + + and cu.phone in (${basicInfo.phones}) + + + + and cu.poins >= #{basicInfo.levelStartScore} + + and cu.poins < #{basicInfo.levelEndScore} + + + + + and (cu.poins is null or + (cu.poins >= #{basicInfo.levelStartScore} + + and cu.poins < #{basicInfo.levelEndScore} + + )) + + + + and JSON_CONTAINS(JSON_ARRAY(cut.tags),JSON_ARRAY + + #{idItem} + + ) + + + + + + + + - 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 @@ - + SELECT count(distinct cubi.id) FROM wx_c_user_basic_info cubi + where 1=1 + + and cubi.`final_tenant_id` = #{finalTenantId} + + + +