diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java index 37d7924ed..9c403fa6d 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java @@ -76,7 +76,23 @@ public class BaseController { } /** - * 处理集团新增修改所需租户信息(广场独立修改,集团修改全部) + * 处理集团新增修改所需租户信息(只能取集团数据,积分/成长值/等级) + * 处理集团版 tenantId为空,parentTenantId为集团tenantId + * ifParentUpdateTenantInfo + */ + public TenantEntity getFinalTenantInfo() { + TenantEntity info = this.getTenantInfo(); + String tenantId = info.getTenantId(); + if(StringUtils.isNotBlank(info.getParentTenantId())){ + tenantId = info.getParentTenantId(); + } + TenantEntity tenantEntity = new TenantEntity(); + tenantEntity.setTenantId(tenantId); + return tenantEntity; + } + + /** + * 处理集团新增修改所需租户信息(广场独立修改,集团能修改各广场、自己信息) * 处理集团版 tenantId为空,parentTenantId为集团tenantId * ifParentUpdateTenantInfo */ diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java index 4720420d8..e126fde50 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java @@ -9,6 +9,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -71,6 +72,10 @@ public class WxChartDataController extends BaseController { String chart = params.get("chart"); logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart); TenantEntity tenantEntity = getTenantInfo(); + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } params.put("tenantId",tenantEntity.getTenantId()); params.put("parentTenantId", tenantEntity.getParentTenantId()); ResultData data = wxChartDataService.queryData(params); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java index 920416df4..d832e92f1 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java @@ -11,6 +11,7 @@ import com.iformall.service.*; import com.iformall.service.cuser.CUserServiceFactory; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -44,16 +45,19 @@ public class WxUserStatisticsController extends BaseController { if(plat == null){ plat = EnumAppPlat.WX.getCode(); } - TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); //昨日同比 Map map = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); dto.setEndTime(new Date()); //微信用户数据 - long wxTotalCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto,tenantEntitys);//总量 + long wxTotalCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto);//总量 map.put("wxTotalCount",wxTotalCount); @@ -64,7 +68,7 @@ public class WxUserStatisticsController extends BaseController { Date today = c.getTime(); dto.setStartTime(today); dto.setEndTime(null); - long wxTodayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys);//今天新增 + long wxTodayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto);//今天新增 map.put("wxTodayCount",wxTodayCount); @@ -75,7 +79,7 @@ public class WxUserStatisticsController extends BaseController { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long wxYesterdayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); + long wxYesterdayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); if (wxYesterdayCount > 0) { double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100; double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -86,54 +90,6 @@ public class WxUserStatisticsController extends BaseController { return new ResultData(map); } - @ApiOperation("查询会员数量") - @GetMapping("/findBasicUserCount") - @SystemControllerLog(description = "查询会员数量") - public ResultData findBasicUserCount() { - logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserCount"); - - TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); - //昨日同比 - Map map = new HashMap<>(); - WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); - dto.updateTenantInfo(tenantEntity); - dto.setEndTime(new Date()); - //会员用户数据 - long memTotalCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//总量 - - map.put("memTotalCount",memTotalCount); - - Calendar c = Calendar.getInstance(); - c.set(Calendar.HOUR_OF_DAY, 0); - c.set(Calendar.MINUTE, 0); - c.set(Calendar.SECOND, 0); - Date today = c.getTime(); - dto.setStartTime(today); - dto.setEndTime(null); - long memTodayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//今天新增 - - map.put("memTodayCount",memTodayCount); - - //昨日同比 - c.clear(); - c.setTime(today); - c.add(Calendar.DAY_OF_YEAR, -1); - dto.setStartTime(c.getTime()); - c.add(Calendar.DAY_OF_YEAR, 1); - dto.setEndTime(c.getTime()); - long memYesterdayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); - if (memYesterdayCount > 0) { - double yesterday = (double) (memTodayCount - memYesterdayCount) / memYesterdayCount * 100; - double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - map.put("memhb", zrhb + "%"); - } else { - map.put("memhb", "--%"); - } - - return new ResultData(map); - } - @ApiOperation("查询微信用户趋势") @GetMapping("/findWxUserTrend") @SystemControllerLog(description = "查询微信用户趋势") @@ -143,7 +99,11 @@ public class WxUserStatisticsController extends BaseController { plat = EnumAppPlat.WX.getCode(); } TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); @@ -159,8 +119,13 @@ public class WxUserStatisticsController extends BaseController { dto.setEndTime(endTime); dto.setReportType(reportType); - List wxCountList = new ArrayList<>();//每日新增会员数 - List wxCounts = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCountHistory(dto,tenantEntitys);//每日新增会员数 + List wxCountList = new ArrayList<>(); + List wxCounts = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCountHistory(dto);//获取每日/每月/每年新增微信用户数 + + dto.setEndTime(startTime); + dto.setStartTime(null); + dto.setReportType(null); + long startTotal = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto);//获取开始时间之前的所有微信用户数量 SimpleDateFormat sdf; SimpleDateFormat fsdf; @@ -206,26 +171,65 @@ public class WxUserStatisticsController extends BaseController { }while (curTime.before(endTime) || curTime.equals(endTime)); - - if (wxCountList.size() > 0 - && wxCountList.get(0).getTotalCount() != null - && wxCountList.get(0).getTotalCount() == 0) { - WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); - pdto.updateTenantInfo(tenantEntity); - pdto.setEndTime(startTime); - wxCountList.get(0).setTotalCount(cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(pdto, tenantEntitys)); - } - for (int i = 1; i < wxCountList.size(); i++){ - if (wxCountList.get(i).getTotalCount() != null && - wxCountList.get(i-1).getTotalCount() != null && - wxCountList.get(i).getTotalCount() < wxCountList.get(i-1).getTotalCount()){ - wxCountList.get(i).setTotalCount(wxCountList.get(i-1).getTotalCount()); + for (UserCountVo ucv:wxCountList) { + if(ucv.getIncCount() == null){ + ucv.setTotalCount(0l); } + startTotal += ucv.getIncCount(); + ucv.setTotalCount(startTotal); } return new ResultData(wxCountList); } + @ApiOperation("查询会员数量") + @GetMapping("/findBasicUserCount") + @SystemControllerLog(description = "查询会员数量") + public ResultData findBasicUserCount() { + logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserCount"); + + TenantEntity tenantEntity = getTenantInfo(); +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + //昨日同比 + Map map = new HashMap<>(); + WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantEntity); + dto.setEndTime(new Date()); + //会员用户数据 + long memTotalCount = wxCUserBasicInfoService.findCount(dto);//总量 + + map.put("memTotalCount",memTotalCount); + + Calendar c = Calendar.getInstance(); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.SECOND, 0); + Date today = c.getTime(); + dto.setStartTime(today); + dto.setEndTime(null); + long memTodayCount = wxCUserBasicInfoService.findCount(dto);//今天新增 + + map.put("memTodayCount",memTodayCount); + + //昨日同比 + c.clear(); + c.setTime(today); + c.add(Calendar.DAY_OF_YEAR, -1); + dto.setStartTime(c.getTime()); + c.add(Calendar.DAY_OF_YEAR, 1); + dto.setEndTime(c.getTime()); + long memYesterdayCount = wxCUserBasicInfoService.findCount(dto); + if (memYesterdayCount > 0) { + double yesterday = (double) (memTodayCount - memYesterdayCount) / memYesterdayCount * 100; + double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + map.put("memhb", zrhb + "%"); + } else { + map.put("memhb", "--%"); + } + + return new ResultData(map); + } + @ApiOperation("查询会员趋势") @GetMapping("/findBasicUserTrend") @SystemControllerLog(description = "查询会员趋势") @@ -233,7 +237,7 @@ public class WxUserStatisticsController extends BaseController { logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserTrend"); TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); @@ -250,7 +254,7 @@ public class WxUserStatisticsController extends BaseController { dto.setReportType(reportType); List memCountList = new ArrayList<>();//每日新增会员数 - List memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 + List memCounts = wxCUserBasicInfoService.findCountHistory(dto);//每日新增会员数 SimpleDateFormat sdf; SimpleDateFormat fsdf; @@ -300,8 +304,9 @@ public class WxUserStatisticsController 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(ifParentUpdateTenantInfo(),pdto)); + memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(pdto)); } for (int i = 1; i < memCountList.size(); i++){ if ( memCountList.get(i).getTotalCount() != null && 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 5b6474cd1..2e9127255 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java @@ -65,16 +65,18 @@ public class WxUserStructureController extends BaseController { @SystemControllerLog(description = "会员管理-查询会员性别结构") public ResultData findUserSexStructure(Date startTime, Date endTime) { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserSexStructure"); + TenantEntity tenantInfo = getTenantInfo(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantInfo); dto.setStartTime(startTime); dto.setEndTime(endTime); //保密 dto.setSex(EnumCUserBaseInfoSex.UNKNOWN.getCode()); - long secrecy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); + long secrecy = wxCUserBasicInfoService.findCountBySex(dto); dto.setSex(EnumCUserBaseInfoSex.MALE.getCode()); - long boy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); + long boy = wxCUserBasicInfoService.findCountBySex(dto); dto.setSex(EnumCUserBaseInfoSex.FEMALE.getCode()); - long girl = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto); + long girl = wxCUserBasicInfoService.findCountBySex(dto); Long all = secrecy + boy + girl; List vos = new ArrayList<>(); vos.add(getVo(boy, all, "男", 1)); @@ -88,10 +90,12 @@ public class WxUserStructureController extends BaseController { @SystemControllerLog(description = "会员管理-查询会员年龄结构") public ResultData findUserAgeStructure(Date startTime, Date endTime) { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); + TenantEntity tenantInfo = getTenantInfo(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantInfo); dto.setStartTime(startTime); dto.setEndTime(endTime); - long all = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); + long all = wxCUserBasicInfoService.findCount(dto); List vos = new ArrayList<>(); Calendar c = Calendar.getInstance(); for (EnumAgeInfo a : EnumAgeInfo.values()) { @@ -100,7 +104,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(ifParentUpdateTenantInfo(),a, c, dto); + long count = getCountByAge(a, c, dto); vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); } return new ResultData(vos); @@ -111,18 +115,18 @@ public class WxUserStructureController extends BaseController { @SystemControllerLog(description = "会员管理-查询会员成长值结构") public ResultData findUserLevelStructure(Date startTime, Date endTime) { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserAgeStructure"); + WxLevelConfig wxLevelConfig = new WxLevelConfig(); - if(StringUtils.isNotBlank(ifParentUpdateTenantInfo().getParentTenantId())){ - wxLevelConfig.setTenantId(ifParentUpdateTenantInfo().getParentTenantId()); - }else{ - wxLevelConfig.setTenantId(ifParentUpdateTenantInfo().getTenantId()); - } + wxLevelConfig.updateTenantInfo(getFinalTenantInfo()); wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); List levelList = wxLevelConfigService.findList(wxLevelConfig); + TenantEntity tenantInfo = getTenantInfo(); + for( int i = 0; i < levelList.size(); i++) { WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantInfo); dto.setStartTime(startTime); dto.setEndTime(endTime); if (i + 1 < levelList.size()) { @@ -132,7 +136,7 @@ public class WxUserStructureController extends BaseController { dto.setLevelStartScore(levelList.get(i).getPoints()); } - long all = wxCUserBasicInfoService.findCountByScore(ifParentUpdateTenantInfo(),dto); + long all = wxCUserBasicInfoService.findCountByScore(dto); levelList.get(i).setCount(all); } @@ -141,9 +145,10 @@ public class WxUserStructureController extends BaseController { //没有等级的会员 other.setLevel(WxLevelConfigService.DEFAULT_LEVEL); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantInfo); dto.setStartTime(startTime); dto.setEndTime(endTime); - other.setCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto) + other.setCount(wxCUserBasicInfoService.findCount(dto) - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); levelList.add(other); @@ -158,9 +163,10 @@ public class WxUserStructureController extends BaseController { TenantEntity tenantInfo = getTenantInfo(); // List tenantEntitys = wxMallService.getTenantEntitys(tenantInfo); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantInfo); dto.setStartTime(startTime); dto.setEndTime(endTime); - long total = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); + long total = wxCUserBasicInfoService.findCount(dto); dto.updateTenantInfo(tenantInfo); dto.setFinalTenantId(tenantInfo.getFinalTenantId()); @@ -199,11 +205,12 @@ public class WxUserStructureController extends BaseController { @SystemControllerLog(description = "会员管理-查询会员手机品牌结构") public ResultData findUserPhoneBandStructure(Date startTime, Date endTime) { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserPhoneBandStructure"); - TenantEntity tenantEntity = ifParentUpdateTenantInfo(); + TenantEntity tenantEntity = getTenantInfo(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantEntity); dto.setStartTime(startTime); dto.setEndTime(endTime); - long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long total = wxCUserBasicInfoService.findCount(dto); List tagList = new ArrayList<>(); @@ -236,11 +243,12 @@ public class WxUserStructureController extends BaseController { @SystemControllerLog(description = "会员管理-查询会员活跃结构") public ResultData findUserActivityStructure(Date startTime, Date endTime) { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserActivityStructure"); - TenantEntity tenantEntity = ifParentUpdateTenantInfo(); + TenantEntity tenantEntity = getTenantInfo(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantEntity); dto.setStartTime(startTime); dto.setEndTime(endTime); - long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long total = wxCUserBasicInfoService.findCount(dto); List tagList = new ArrayList<>(); @@ -299,16 +307,21 @@ public class WxUserStructureController extends BaseController { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + //昨日同比 Map map = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); dto.setEndTime(new Date()); //微信用户数据 - long wxTotalCount = wxCUserService.findCount(dto,tenantEntitys);//总量 - //微信用户数据 - long memTotalCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//总量 + long wxTotalCount = wxCUserService.findCount(dto);//总量 + //会员数据 + long memTotalCount = wxCUserBasicInfoService.findCount(dto);//总量 map.put("wxTotalCount",wxTotalCount); map.put("memTotalCount",memTotalCount); @@ -320,8 +333,8 @@ public class WxUserStructureController extends BaseController { Date today = c.getTime(); dto.setStartTime(today); dto.setEndTime(null); - long wxTodayCount = wxCUserService.findCount(dto, tenantEntitys);//今天新增 - long memTodayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto);//今天新增 + long wxTodayCount = wxCUserService.findCount(dto);//今天新增 + long memTodayCount = wxCUserBasicInfoService.findCount(dto);//今天新增 map.put("wxTodayCount",wxTodayCount); map.put("memTodayCount",memTodayCount); @@ -333,8 +346,8 @@ public class WxUserStructureController extends BaseController { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long wxYesterdayCount = wxCUserService.findCount(dto, tenantEntitys); - long memYesterdayCount = wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),dto); + long wxYesterdayCount = wxCUserService.findCount(dto); + long memYesterdayCount = wxCUserBasicInfoService.findCount(dto); if (wxYesterdayCount > 0) { double yesterday = (double) (wxTodayCount - wxYesterdayCount) / wxYesterdayCount * 100; double zrhb = new BigDecimal(yesterday).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); @@ -361,10 +374,10 @@ public class WxUserStructureController extends BaseController { dto.setEndTime(endTime); dto.setReportType(reportType); - List wxCountList = new ArrayList<>();//每日新增会员数 - List wxCounts = wxCUserService.findCountHistory(dto,tenantEntitys);//每日新增会员数 + List wxCountList = new ArrayList<>(); + List wxCounts = wxCUserService.findCountHistory(dto);//获取每日/每月/每年新增微信用户数 List memCountList = new ArrayList<>();//每日新增会员数 - List memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 + List memCounts = wxCUserBasicInfoService.findCountHistory(dto);//每日新增会员数 SimpleDateFormat sdf; SimpleDateFormat fsdf; @@ -424,35 +437,25 @@ public class WxUserStructureController extends BaseController { }while (curTime.before(endTime) || curTime.equals(endTime)); - if (wxCountList.size() > 0 - && wxCountList.get(0).getTotalCount() != null - && wxCountList.get(0).getTotalCount() == 0) { - WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); - pdto.updateTenantInfo(tenantEntity); - pdto.setEndTime(startTime); - wxCountList.get(0).setTotalCount(wxCUserService.findCount(pdto, tenantEntitys)); - } - for (int i = 1; i < wxCountList.size(); i++){ - if (wxCountList.get(i).getTotalCount() != null && - wxCountList.get(i-1).getTotalCount() != null && - wxCountList.get(i).getTotalCount() < wxCountList.get(i-1).getTotalCount()){ - wxCountList.get(i).setTotalCount(wxCountList.get(i-1).getTotalCount()); + dto.setEndTime(startTime); + dto.setStartTime(null); + dto.setReportType(null); + long wxstartTotal = wxCUserService.findCount(dto);//获取开始时间之前的所有微信用户数量 + long memstartTotal = wxCUserBasicInfoService.findCount(dto); + for (UserCountVo ucv:wxCountList) { + if(ucv.getIncCount() == null){ + ucv.setTotalCount(0l); } + wxstartTotal += ucv.getIncCount(); + ucv.setTotalCount(wxstartTotal); } - if (memCountList.size() > 0 - && memCountList.get(0).getTotalCount() != null - && memCountList.get(0).getTotalCount() == 0) { - WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto(); - pdto.setEndTime(startTime); - memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),pdto)); - } - for (int i = 1; i < memCountList.size(); i++){ - if ( memCountList.get(i).getTotalCount() != null && - memCountList.get(i-1).getTotalCount() != null && - memCountList.get(i).getTotalCount() < memCountList.get(i-1).getTotalCount()){ - memCountList.get(i).setTotalCount(memCountList.get(i-1).getTotalCount()); + for (UserCountVo ucv:memCountList) { + if(ucv.getIncCount() == null){ + ucv.setTotalCount(0l); } + memstartTotal += ucv.getIncCount(); + ucv.setTotalCount(memstartTotal); } map.put("wxCountList", wxCountList);//累计/新增用户列表( 日期和数量list) @@ -473,8 +476,12 @@ public class WxUserStructureController extends BaseController { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserByChannel"); List sceneList = null; TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); - + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + wxCUser.updateTenantInfo(tenantEntity); if (StringUtils.isNotBlank(wxCUser.getChannelName())) { WxUserChannel c = new WxUserChannel(); c.setChannelName(wxCUser.getChannelName()); @@ -487,7 +494,7 @@ public class WxUserStructureController extends BaseController { } } wxCUser.setSceneList(sceneList); - PageInfo page = wxCUserService.listByChannel(wxCUser,tenantEntitys, pageNum, pageSize); + PageInfo page = wxCUserService.listByChannel(wxCUser, pageNum, pageSize); for (WxCUser u : page.getList()) { WxUserChannel c = new WxUserChannel(); c.setSceneAddress(u.getSceneAddress()); @@ -511,8 +518,9 @@ public class WxUserStructureController extends BaseController { logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserStructureByChannel"); List channelStructureList = new ArrayList<>(); List senceStructureList = new ArrayList<>(); - - List tenantEntitys = wxMallService.getTenantEntitys(getTenantInfo()); + TenantEntity tenantInfo = getTenantInfo(); + wxCUser.updateTenantInfo(wxCUser); +// List tenantEntitys = wxMallService.getTenantEntitys(getTenantInfo()); List channels = wxUserChannelService.findDistinctChannel(); for (WxUserChannel w : channels) { @@ -527,7 +535,7 @@ public class WxUserStructureController extends BaseController { wxCUser.setSceneList(scene); WxUserChannel senceStructure = new WxUserChannel(); senceStructure.setDescription(uc.getDescription()); - senceStructure.setCount(wxCUserService.countByChannel(tenantEntitys,wxCUser)); + senceStructure.setCount(wxCUserService.countByChannel(wxCUser)); senceStructureList.add(senceStructure); sceneList.add(uc.getSceneAddress()); } @@ -535,7 +543,7 @@ public class WxUserStructureController extends BaseController { wxCUser.setSceneList(sceneList); WxUserChannel channelStructure = new WxUserChannel(); channelStructure.setChannelName(w.getChannelName()); - channelStructure.setCount(wxCUserService.countByChannel(tenantEntitys,wxCUser)); + channelStructure.setCount(wxCUserService.countByChannel(wxCUser)); channelStructureList.add(channelStructure); } } @@ -567,7 +575,7 @@ public class WxUserStructureController extends BaseController { } - private long getCountByAge(TenantEntity tenantInfo, EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { + private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { if (a.getStart() != 0 || a.getEnd() != 0) { c.add(Calendar.YEAR, -a.getEnd()); Date startTime = c.getTime(); @@ -583,7 +591,7 @@ public class WxUserStructureController extends BaseController { dto.setBirthEndTime(null); } - return wxCUserBasicInfoService.findCountByAge(tenantInfo,dto); + return wxCUserBasicInfoService.findCountByAge(dto); } private UserStructureVo getVo(long count, long all, String name, Integer num) { diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java index 08aca96b0..47f3f08f1 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java @@ -29,7 +29,7 @@ public class FengNiaoMapController extends BaseController { @ApiOperation("查询地图配置") @GetMapping("/getConfig") public ResultData getConfig() { - String tenantId = ifParentUpdateTenantInfo().getTenantId(); + String tenantId = getTenantInfo().getTenantId(); if (!StringUtils.isBlank(tenantId)) { try { FengNiaoMapConfig config = fengNiaoMapService.getConfigByTenantId(tenantId); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java index 47aa916d2..149072699 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java @@ -57,7 +57,7 @@ public class WxCampaignController extends BaseController { if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) { wxCampaign.setStatus(null); } - wxCampaign.updateTenantInfo(ifParentUpdateTenantInfo()); + wxCampaign.updateTenantInfo(getTenantInfo()); wxCampaign.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC); final PageInfo page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); return new ResultData(page); @@ -166,6 +166,7 @@ public class WxCampaignController extends BaseController { WxCampaign wxCampaign = wxCampaignService.getById(id); if (wxCampaign != null) { WxCouponChannel wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.updateTenantInfo(wxCampaign); wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); wxCouponChannel.setSubTargetId(wxCampaign.getId()); wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java index 6db793090..fe01450ae 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java @@ -57,9 +57,6 @@ public class WxCouponController extends BaseController { private WxMallService wxMallService; @Autowired RedisLock redisLock; - - @Autowired - private WxPayAccountService wxPayAccountService; @ApiOperation("分页列表接口") @GetMapping("list") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java index eea61baaf..b03abb4c8 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java @@ -41,7 +41,7 @@ public class UserBasicInfoAddressController extends BaseController { if(userBasicInfoAddress.getUserId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "用户ID为空"); } - userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo()); + userBasicInfoAddress.undateFinalTenantId(getTenantInfo()); PageInfo page = userBasicInfoAddressService.listAsPage(userBasicInfoAddress, pageNum, pageSize); return new ResultData(page); } @@ -56,7 +56,7 @@ public class UserBasicInfoAddressController extends BaseController { if(userBasicInfoAddress.getUserId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } - userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo()); + userBasicInfoAddress.undateFinalTenantId(getTenantInfo()); userBasicInfoAddressService.saveOrUpdate(userBasicInfoAddress); return new ResultData(); } @@ -71,7 +71,7 @@ public class UserBasicInfoAddressController extends BaseController { if(userBasicInfoAddress.getId() == null || userBasicInfoAddress.getUserId() == null){ return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "用户ID或者Id为空"); } - userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo()); + userBasicInfoAddress.undateFinalTenantId(getTenantInfo()); userBasicInfoAddressService.updateDefault(userBasicInfoAddress); return new ResultData(); } @@ -87,7 +87,7 @@ public class UserBasicInfoAddressController extends BaseController { } UserBasicInfoAddress userBasicInfoAddress = new UserBasicInfoAddress(); userBasicInfoAddress.setId(id); - userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo()); + userBasicInfoAddress.undateFinalTenantId(getTenantInfo()); userBasicInfoAddressService.deleteById(userBasicInfoAddress); return new ResultData(Result.SUCCESS, "删除成功", null); } @@ -103,7 +103,7 @@ public class UserBasicInfoAddressController extends BaseController { } UserBasicInfoAddress userBasicInfoAddress = new UserBasicInfoAddress(); userBasicInfoAddress.setId(id); - userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo()); + userBasicInfoAddress.undateFinalTenantId(getTenantInfo()); userBasicInfoAddressService.findById(userBasicInfoAddress); return new ResultData(Result.SUCCESS, "查询成功", null); } 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 8d5235503..143a94425 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -97,7 +97,7 @@ public class WxCUserBasicInfoController extends BaseController { WxCouponMerchantMapper wxCouponMerchantMapper; private void updateLevelParam(WxCUserBasicInfo info) { - List levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo()); + List levelList = wxLevelConfigService.getByTenantInfo(getFinalTenantInfo()); levelList = levelList.stream() .sorted(Comparator.comparing(WxLevelConfig::getPoints)) .collect(Collectors.toList()); @@ -119,7 +119,7 @@ public class WxCUserBasicInfoController extends BaseController { info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); } else { info.setLevel(WxLevelConfigService.DEFAULT_LEVEL); - List levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo()); + List levelList = wxLevelConfigService.getByTenantInfo(getFinalTenantInfo()); for (WxLevelConfig levelConfig : levelList) { if (info.getPoins() >= levelConfig.getPoints()) { info.setLevel(levelConfig.getLevel()); @@ -195,9 +195,9 @@ public class WxCUserBasicInfoController extends BaseController { updateLevelParam(wxCUserBasicInfo); } } - wxCUserBasicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); + wxCUserBasicInfo.undateFinalTenantId(getTenantInfo()); wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.wcubiActiveTime_DESC); - PageInfo page = wxCUserBasicInfoService.listAsPage(ifParentUpdateTenantInfo(),wxCUserBasicInfo, pageNum, pageSize); + PageInfo page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); if (page.getSize() > 0) { for (WxCUserBasicInfo info : page.getList()) { @@ -372,9 +372,10 @@ public class WxCUserBasicInfoController extends BaseController { basicInfo.setName(null); } } - - basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); - int exportDataCount = wxCUserBasicInfoService.exportDataCount(ifParentUpdateTenantInfo(),basicInfo); + TenantEntity tenantInfo = getTenantInfo(); + basicInfo.setTenantId(tenantInfo.getTenantId()); + basicInfo.setFinalTenantId(tenantInfo.getFinalTenantId()); + int exportDataCount = wxCUserBasicInfoService.exportDataCount(basicInfo); return new ResultData(exportDataCount); @@ -395,9 +396,10 @@ public class WxCUserBasicInfoController extends BaseController { basicInfo.setName(null); } } - - basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo()); - wxCUserBasicInfoService.exportData(getTenantInfo(),basicInfo, request, response); + TenantEntity tenantInfo = getTenantInfo(); + basicInfo.setTenantId(tenantInfo.getTenantId()); + basicInfo.setFinalTenantId(tenantInfo.getFinalTenantId()); + wxCUserBasicInfoService.exportData(basicInfo, request, response); } @RequestMapping("/exportTemplate") @@ -630,14 +632,18 @@ public class WxCUserBasicInfoController extends BaseController { @SystemControllerLog(description = "会员管理-迁移数据") public ResultData cuserOldToNew(@RequestBody Map map) { logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::cuserOldToNew"); + TenantEntity tenantInfo = getTenantInfo(); + if(StringUtils.isBlank(tenantInfo.getTenantId())){ + return new ResultData(ErrorCode.SYS_AUTH_ERROR); + } String oldCuserPhone = (String) map.get("oldCuserPhone"); String newCuserPhone = (String) map.get("newCuserPhone"); if(StringUtils.isNotBlank(oldCuserPhone) && StringUtils.isNotBlank(newCuserPhone)){ - WxCUserBasicInfo oldCuser = wxCUserBasicInfoService.findInfoByPhone(ifParentUpdateTenantInfo(), oldCuserPhone); - WxCUserBasicInfo newCuser = wxCUserBasicInfoService.findInfoByPhone(ifParentUpdateTenantInfo(), newCuserPhone); + WxCUserBasicInfo oldCuser = wxCUserBasicInfoService.findInfoByPhone(tenantInfo, oldCuserPhone); + WxCUserBasicInfo newCuser = wxCUserBasicInfoService.findInfoByPhone(tenantInfo, newCuserPhone); if(null != oldCuser && null != newCuser){ if(!oldCuserPhone.equals(newCuserPhone)){ - wxCUserBasicInfoService.cuserOldToNew(oldCuser.getId(),newCuser.getId(),ifParentUpdateTenantInfo()); + wxCUserBasicInfoService.cuserOldToNew(oldCuser.getId(),newCuser.getId(),tenantInfo); return new ResultData(); }else{ return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"同一个用户"); 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 155dc3543..470ef2b7e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java @@ -61,10 +61,14 @@ public class WxCUserDataController extends BaseController { plat = EnumAppPlat.WX.getCode(); } TenantEntity tenantEntity = getTenantInfo(); - List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); + if(StringUtils.isBlank(tenantEntity.getTenantId())){ + //todo 集团版查询数据待重构 + return new ResultData("集团版查询数据待重构"); + } +// List tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); - long allCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); + long allCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); @@ -84,7 +88,7 @@ public class WxCUserDataController extends BaseController { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto, tenantEntitys); + long count = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); @@ -143,13 +147,14 @@ 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(ifParentUpdateTenantInfo())); + map.put("growCount", wxCUserBasicInfoService.findGrowUserCount(tenantEntity)); //全部导入的 - map.put("importCount", wxCUserBasicInfoService.findImportUserCount(ifParentUpdateTenantInfo())); + map.put("importCount", wxCUserBasicInfoService.findImportUserCount(tenantEntity)); //全部 - map.put("allHistoryUserCount", wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),wxCUserBasicInfoDto)); + map.put("allHistoryUserCount", wxCUserBasicInfoService.findCount(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 7dafae748..479bb51c7 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java @@ -47,14 +47,9 @@ public class WxLevelConfigController extends BaseController { public ResultData list(@ModelAttribute WxLevelConfig wxLevelConfig, Integer pageNum, Integer pageSize) { logger.debug("[" + getIpAddr() + "] WxLevelConfigController::list"); if (null == wxLevelConfig) wxLevelConfig = new WxLevelConfig(); - TenantEntity tenantEntity = ifParentUpdateTenantInfo(); - if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - wxLevelConfig.setTenantId(tenantEntity.getParentTenantId()); - }else{ - wxLevelConfig.setTenantId(tenantEntity.getTenantId()); - } + wxLevelConfig.updateTenantInfo(getFinalTenantInfo()); wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC); - final PageInfo page = wxLevelConfigService.listAsPage(tenantEntity,wxLevelConfig, pageNum, pageSize); + final PageInfo page = wxLevelConfigService.listAsPage(getTenantInfo(),wxLevelConfig, pageNum, pageSize); return new ResultData(page); } @@ -67,7 +62,7 @@ public class WxLevelConfigController extends BaseController { if (StringUtils.isNotBlank(ifParentUpdateTenantInfo().getParentTenantId())) { return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); } - wxLevelConfigService.batchSave(ifParentUpdateTenantInfo(), levelConfigs); + wxLevelConfigService.batchSave(getTenantInfo(), levelConfigs); } catch (Exception e) { logger.error(e.getMessage()); return new ResultData(ErrorCode.DB_FAIL); @@ -84,7 +79,7 @@ public class WxLevelConfigController extends BaseController { if (StringUtils.isNotBlank(ifParentUpdateTenantInfo().getParentTenantId())) { return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "广场用户无此权限"); } - wxLevelConfigService.batchUpdateCapabilities(ifParentUpdateTenantInfo(), levelConfigs); + wxLevelConfigService.batchUpdateCapabilities(getTenantInfo(), levelConfigs); } catch (Exception e) { logger.error(e.getMessage()); return new ResultData(ErrorCode.DB_FAIL); diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java index 4ec4a677e..fb0552d08 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java @@ -37,7 +37,7 @@ public class WxScoreRulesController extends BaseController { @SystemControllerLog(description = "成长值-配置") public ResultData list() { logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list"); - WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(ifParentUpdateTenantInfo()); + WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getFinalTenantInfo()); if (scoreRules.getCreditLocked() == null) { scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode()); } diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java index 80b3fe640..9b98b5522 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java @@ -150,6 +150,7 @@ public class WxCouponChannelController extends BaseController { wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); List targetAds = new ArrayList<>(); targetAds.add(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); + targetAds.add(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode()); targetAds.add(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode()); targetAds.add(EnumCouponChannelType.COUPON_CHANNEL_ID_CARD.getCode()); targetAds.add(EnumCouponChannelType.COUPON_CHANNEL_ID_PRESS.getCode()); 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 faa65993f..8e47e1b01 100644 --- a/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java +++ b/mallinkService/src/main/java/com/iformall/domain/dto/WxCUserBasicInfoDto.java @@ -21,9 +21,6 @@ import java.util.List; public class WxCUserBasicInfoDto extends TenantEntity { protected Long id; - - @io.swagger.annotations.ApiModelProperty(value="如果是集团版的,存集团版的tenantId,如果是商场,则存商场",name="sex") - private String finalTenantId; @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime") private Date startTime; @@ -80,10 +77,4 @@ 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/domain/po/base/BaseTenantEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java index 610520691..06b8f2fb0 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/BaseTenantEntity.java @@ -28,9 +28,10 @@ public class BaseTenantEntity extends BaseEntity { public String getFinalTenantId() { if (StringUtils.isNotBlank(parentTenantId)) { - return parentTenantId; + finalTenantId = parentTenantId; } - return tenantId; + finalTenantId = tenantId; + return finalTenantId; } public void setFinalTenantId(String finalTenantId) { @@ -49,20 +50,19 @@ public class BaseTenantEntity extends BaseEntity { } public void updateTenantInfo(TenantEntity info) { - log.info("info.tenantId:"+info.getTenantId()+". info.parentTenantId:"+info.getParentTenantId()+"."); - setTenantId(info.getTenantId()); - setParentTenantId(null); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } + getFinalTenantId(); } public void updateTenantInfo(BaseTenantEntity info) { - setTenantId(info.getTenantId()); - setParentTenantId(null); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } + getFinalTenantId(); } // public TenantEntity getTenantInfo() { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java index 4736492f3..ef9986643 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntity.java @@ -28,28 +28,27 @@ public class TenantEntity extends BaseEntity { protected String shardTableSuffix; public void updateTenantInfo(TenantEntity info) { - setTenantId(info.getTenantId()); - setParentTenantId(null); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } - setFinalTenantId(getFinalTenantId()); + getFinalTenantId(); } public void updateTenantInfo(BaseTenantEntity info) { - setTenantId(info.getTenantId()); - setParentTenantId(null); - if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); - } - setFinalTenantId(getFinalTenantId()); + tenantId = info.getTenantId(); + if (StringUtils.isNotBlank(info.getParentTenantId())) { + parentTenantId = info.getParentTenantId(); + } + getFinalTenantId(); } public String getFinalTenantId() { - if (!StringUtils.isBlank(parentTenantId)) { - return parentTenantId; + if (StringUtils.isNotBlank(parentTenantId)) { + finalTenantId = parentTenantId; } - return tenantId; + finalTenantId = tenantId; + return finalTenantId; } public String getShardTableSuffix() { @@ -65,7 +64,6 @@ public class TenantEntity extends BaseEntity { public void setTenantId(String tenantId) { this.tenantId = tenantId; - setFinalTenantId(getFinalTenantId()); } public String getParentTenantId() { @@ -74,7 +72,6 @@ public class TenantEntity extends BaseEntity { public void setParentTenantId(String parentTenantId) { this.parentTenantId = parentTenantId; - setFinalTenantId(getFinalTenantId()); } public void setFinalTenantId(String finalTenantId) { diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntityWithoutFinalTenantId.java b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntityWithoutFinalTenantId.java index 741d21cca..c6d9db89e 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntityWithoutFinalTenantId.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantEntityWithoutFinalTenantId.java @@ -18,16 +18,16 @@ public class TenantEntityWithoutFinalTenantId extends BaseEntity { protected String parentTenantId; public void updateTenantInfo(TenantEntityWithoutFinalTenantId info) { - setTenantId(info.getTenantId()); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } } public void updateTenantInfo(BaseTenantEntity info) { - setTenantId(info.getTenantId()); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantVEntity.java b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantVEntity.java index 47ee07caf..0d5ee1434 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/base/TenantVEntity.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/base/TenantVEntity.java @@ -26,18 +26,16 @@ public class TenantVEntity extends BaseEntity { private TenantEntity tenantInfo; public void updateTenantInfo(TenantEntity info) { - setTenantId(info.getTenantId()); - setParentTenantId(null); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } } public void updateTenantInfo(TenantVEntity info) { - setTenantId(info.getTenantId()); - setParentTenantId(null); + tenantId = info.getTenantId(); if (StringUtils.isNotBlank(info.getParentTenantId())) { - setParentTenantId(info.getParentTenantId()); + parentTenantId = info.getParentTenantId(); } } diff --git a/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java b/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java index 622f0c2be..173658d6e 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java @@ -23,11 +23,11 @@ public interface TtCUserMapper extends CommonMapper { long findCount(WxCUserBasicInfoDto basicDto); - List findCountHistory(@Param("tenantEntitys")List tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); + List findCountHistory(WxCUserBasicInfoDto basicDto); - List listByChannel(@Param("tenantEntitys")List tenantEntitys, @Param("ttCUser")TtCUser ttCUser); + List listByChannel(TtCUser ttCUser); - long countByChannel(@Param("tenantEntitys")List tenantEntitys, @Param("ttCUser")TtCUser ttCUser); + long countByChannel(TtCUser ttCUser); //List> checkCountByTenantOpenId(); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java index 1df34b105..6b497b702 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserBasicInfoMapper.java @@ -14,13 +14,10 @@ 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); List findListPhoneAndNameByIds(WxCUserBasicInfo wxCUserBasicInfo); List findIdList(WxCUserBasicInfo wxCUserBasicInfo); @@ -35,43 +32,24 @@ public interface WxCUserBasicInfoMapper extends CommonMapper findListByScore(WxCUserBasicInfoDto dto); - List findListByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); - - List findBirthdayList(@Param("finalTenantId")String finalTenantId, @Param("begin")String begin, @Param("end")String end); - List findBirthdayList1(@Param("finalTenantId")String finalTenantId,@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId, @Param("begin")String begin, @Param("end")String end); + List findBirthdayList(@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId, @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 findVoIdsList(WxCUserBasicInfo wxCUserBasicInfo); - - List findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); - List findVoIdsList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); Integer countVoList(WxCUserBasicInfo wxCUserBasicInfo); - Integer countVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); - - - long findGrowUserCount(@Param("finalTenantId")String finalTenantId); - long findGrowUserCount1(@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId); - //long findImportUserCount(@Param("finalTenantId")String finalTenantId); - //long findImportUserCount1(@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId); + long findGrowUserCount(@Param("tenantId")String tenantId,@Param("finalTenantId")String finalTenantId); void incActRecordById(@Param("id")Long id,@Param("finalTenantId")String finalTenantId); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java index d63d435e6..c6ae09bb1 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java @@ -23,11 +23,11 @@ public interface WxCUserMapper extends CommonMapper { long findCount(WxCUserBasicInfoDto basicDto); - List findCountHistory(@Param("tenantEntitys")List tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); + List findCountHistory(WxCUserBasicInfoDto basicDto); - List listByChannel(@Param("tenantEntitys")List tenantEntitys, @Param("wxCUser")WxCUser wxCUser); + List listByChannel(WxCUser wxCUser); - long countByChannel(@Param("tenantEntitys")List tenantEntitys, @Param("wxCUser")WxCUser wxCUser); + long countByChannel(WxCUser wxCUser); //List> checkCountByTenantOpenId(); diff --git a/mallinkService/src/main/java/com/iformall/service/TtCUserService.java b/mallinkService/src/main/java/com/iformall/service/TtCUserService.java index ee969dcdd..301c64dac 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtCUserService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtCUserService.java @@ -88,32 +88,29 @@ public interface TtCUserService { * @param tenantEntitys * @return */ - long findCount(WxCUserBasicInfoDto dto, List tenantEntitys); + long findCount(WxCUserBasicInfoDto dto); /** * 统计数量 * @param dto - * @param tenantEntitys * @return */ - List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys); + List findCountHistory(WxCUserBasicInfoDto dto); /** * 通过渠道获取会员信息 * @param user - * @param tenantEntitys * @param pageIndex * @param pageSize * @return */ - PageInfo listByChannel(TtCUser user, List tenantEntitys, Integer pageIndex, Integer pageSize); + PageInfo listByChannel(TtCUser user, Integer pageIndex, Integer pageSize); - long countByChannel(List tenantEntitys, TtCUser user); + long countByChannel(TtCUser user); /** * 登录后发消息 - * @param user */ void actionMsgAfterLogin(WxCUserFrom wxCUserFrom); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java index fac4a46f3..8b9df2a50 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java @@ -105,7 +105,6 @@ public interface WxCUserBasicInfoService { * @return */ long findCountBySex(WxCUserBasicInfoDto dto); - long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto); /** * 根据年龄查询数量 @@ -115,7 +114,6 @@ public interface WxCUserBasicInfoService { */ long findCountByAge(WxCUserBasicInfoDto dto); - long findCountByAge(TenantEntity tenantInfo, WxCUserBasicInfoDto dto); /** * 根据年龄积分查寻数量 @@ -124,13 +122,10 @@ public interface WxCUserBasicInfoService { * @return */ long findCountByScore(WxCUserBasicInfoDto dto); - long findCountByScore(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); 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); @@ -138,10 +133,8 @@ public interface WxCUserBasicInfoService { 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 diff --git a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java index ebbf5a22f..d4bfae4a3 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCUserService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCUserService.java @@ -99,15 +99,14 @@ public interface WxCUserService { * @param tenantEntitys * @return */ - long findCount(WxCUserBasicInfoDto dto, List tenantEntitys); + long findCount(WxCUserBasicInfoDto dto); /** * 统计数量 * @param dto - * @param tenantEntitys * @return */ - List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys); + List findCountHistory(WxCUserBasicInfoDto dto); /** @@ -118,9 +117,9 @@ public interface WxCUserService { * @param pageSize * @return */ - PageInfo listByChannel(WxCUser user, List tenantEntitys, Integer pageIndex, Integer pageSize); + PageInfo listByChannel(WxCUser user, Integer pageIndex, Integer pageSize); - long countByChannel(List tenantEntitys, WxCUser user); + long countByChannel(WxCUser user); /** * 登录后发消息 diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java index 735be37c5..b276d4516 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java @@ -42,9 +42,9 @@ public interface CUserServiceApapter { void updateMsgCount(CUser user); - long findCount(WxCUserBasicInfoDto dto, List tenantEntitys); + long findCount(WxCUserBasicInfoDto dto); - List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys); + List findCountHistory(WxCUserBasicInfoDto dto); void actionAfterLogin(CUser user); diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java index 24d726d04..572af0a36 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java @@ -245,12 +245,12 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { + public long findCount(WxCUserBasicInfoDto dto) { return 0l; } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { + public List findCountHistory(WxCUserBasicInfoDto dto) { return null; } diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java index b1b12520c..8717b950e 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java @@ -300,19 +300,13 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { - long count = 0l; - for (TenantEntity tenantEntity:tenantEntitys) { - dto.updateTenantInfo(tenantEntity); - long count1 = ttCUserMapper.findCount(dto); - count += count1; - } - return count; + public long findCount(WxCUserBasicInfoDto dto) { + return ttCUserMapper.findCount(dto); } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { - return ttCUserMapper.findCountHistory(tenantEntitys,dto); + public List findCountHistory(WxCUserBasicInfoDto dto) { + return ttCUserMapper.findCountHistory(dto); } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java index 5713e5ca6..fd22f9dd3 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java @@ -245,12 +245,12 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { + public long findCount(WxCUserBasicInfoDto dto) { return 0l; } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { + public List findCountHistory(WxCUserBasicInfoDto dto) { return null; } diff --git a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java index bfed86c4f..b6f63afec 100644 --- a/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java +++ b/mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java @@ -308,19 +308,13 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { - long count = 0l; - for (TenantEntity tenantEntity:tenantEntitys) { - dto.updateTenantInfo(tenantEntity); - long count1 = wxCUserMapper.findCount(dto); - count += count1; - } - return count; + public long findCount(WxCUserBasicInfoDto dto) { + return wxCUserMapper.findCount(dto); } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { - return wxCUserMapper.findCountHistory(tenantEntitys,dto); + public List findCountHistory(WxCUserBasicInfoDto dto) { + return wxCUserMapper.findCountHistory(dto); } @Override diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java index 0792fb6ab..a2d53a2a5 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java @@ -162,29 +162,23 @@ public class TtCUserServiceImpl implements TtCUserService { // } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { - long count = 0l; - for (TenantEntity tenantEntity:tenantEntitys) { - dto.updateTenantInfo(tenantEntity); - long count1 = ttCUserMapper.findCount(dto); - count += count1; - } - return count; + public long findCount(WxCUserBasicInfoDto dto) { + return ttCUserMapper.findCount(dto); } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { - return ttCUserMapper.findCountHistory(tenantEntitys,dto); + public List findCountHistory(WxCUserBasicInfoDto dto) { + return ttCUserMapper.findCountHistory(dto); } @Override - public PageInfo listByChannel(TtCUser user, List tenantEntitys, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCUserMapper.listByChannel(tenantEntitys,user)); + public PageInfo listByChannel(TtCUser user, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCUserMapper.listByChannel(user)); } @Override - public long countByChannel(List tenantEntitys, TtCUser user) { - return ttCUserMapper.countByChannel(tenantEntitys, user); + public long countByChannel(TtCUser user) { + return ttCUserMapper.countByChannel(user); } @Override 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 234fc07bc..123eac584 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -518,29 +518,19 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc @Override public long countByFilter(TenantEntity tenantEntity, List filterList) { WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); - if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findCountByFilter1(tenantEntity,wxCUserBasicInfoDto); - }else{ - //直接查询本表 - wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); - wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); - return wxCUserBasicInfoMapper.findCountByFilter(wxCUserBasicInfoDto); - } + + wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); + wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); + return wxCUserBasicInfoMapper.findCountByFilter(wxCUserBasicInfoDto); } @Override public List listByFilter(TenantEntity tenantEntity, List filterList) { WxCUserBasicInfoDto wxCUserBasicInfoDto = filtersToDto(tenantEntity, filterList); - if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findListByFilter1(tenantEntity,wxCUserBasicInfoDto); - }else{ - //直接查询本表 - wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); - wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); - return wxCUserBasicInfoMapper.findListByFilter(wxCUserBasicInfoDto); - } + + wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); + wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); + return wxCUserBasicInfoMapper.findListByFilter(wxCUserBasicInfoDto); } @Override @@ -576,14 +566,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc @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)); - } + wxCUserBasicInfo.setTenantId(tenantInfo.getTenantId()); + wxCUserBasicInfo.undateFinalTenantId(tenantInfo); + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(wxCUserBasicInfo)); } @Override @@ -782,72 +767,21 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc return wxCUserBasicInfoMapper.findCountBySex(dto); } - @Override - public long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { - if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findCountBySex1(tenantInfo,dto); - }else{ - //直接查询本表 - dto.setTenantId(tenantInfo.getFinalTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - 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.setTenantId(tenantInfo.getFinalTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - 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.setTenantId(tenantInfo.getFinalTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - 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); @@ -861,31 +795,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc excelService.exportBigExcel(this,basicInfo, 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); - Map params = new HashMap(); - params.put("tenantInfo", tenantInfo); - params.put("basicInfo", basicInfo); - excelService.exportBigExcel(this,params, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false); - } - public void exportTemplate(HttpServletRequest request, HttpServletResponse response) { List list = new ArrayList<>(); WxCUserBasicInfoVo u1 = new WxCUserBasicInfoVo(); @@ -1221,37 +1130,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc return wxCUserBasicInfoMapper.findCount(dto); } - @Override - public long findCount(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { - if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findCount1(tenantInfo,dto); - }else{ - //直接查询本表 - dto.setTenantId(tenantInfo.getFinalTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - 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.setTenantId(tenantInfo.getFinalTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - return wxCUserBasicInfoMapper.findCountHistory(dto); - } - } - @Override public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { List list = wxCarPayRecordMapper.findCarPayList(record); @@ -1261,17 +1144,12 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc @Override public long findGrowUserCount(TenantEntity tenantEntity) { + String tenantId = tenantEntity.getTenantId(); + String finalTenantId = tenantEntity.getTenantId(); if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findGrowUserCount1(tenantEntity.getTenantId(),tenantEntity.getFinalTenantId()); - }else{ - //直接查询本表 - String finalTenantId = tenantEntity.getTenantId(); - if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - finalTenantId = tenantEntity.getParentTenantId(); - } - return wxCUserBasicInfoMapper.findGrowUserCount(finalTenantId); + finalTenantId = tenantEntity.getParentTenantId(); } + return wxCUserBasicInfoMapper.findGrowUserCount(tenantId,finalTenantId); } @Override @@ -1309,30 +1187,19 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc @Override public List findListByScore(TenantEntity tenantEntity, WxCUserBasicInfoDto wxCUserBasicInfoDto) { - if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findListByScore1(tenantEntity,wxCUserBasicInfoDto); - }else{ - //直接查询本表 - wxCUserBasicInfoDto.setTenantId(tenantEntity.getFinalTenantId()); - wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); - return wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); - } + wxCUserBasicInfoDto.setTenantId(tenantEntity.getTenantId()); + wxCUserBasicInfoDto.setFinalTenantId(tenantEntity.getFinalTenantId()); + return wxCUserBasicInfoMapper.findListByScore(wxCUserBasicInfoDto); } @Override public List findBirthdayList(TenantEntity tenantEntity, String format, String format1) { + String tenantId = tenantEntity.getTenantId(); + String finalTenantId = tenantEntity.getTenantId(); if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ - //关联微信表查询 - return wxCUserBasicInfoMapper.findBirthdayList1(tenantEntity.getFinalTenantId(),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); + finalTenantId = tenantEntity.getParentTenantId(); } + return wxCUserBasicInfoMapper.findBirthdayList(tenantId,finalTenantId,format,format1); } @Override @@ -1352,13 +1219,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc List list = new ArrayList(); basicInfo.setBegin((page-1)*20000); basicInfo.setLimit(20000); -// if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ -// //list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); -// }else{ -// basicInfo.undateFinalTenantId(tenantInfo); -// } - list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); + basicInfo.undateFinalTenantId(tenantInfo); + basicInfo.undateFinalTenantId(tenantInfo); + list = wxCUserBasicInfoMapper.findVoList(basicInfo); if (null == list || list.size() <= 0 ) { return null; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java index 4f4567845..37304d5d4 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java @@ -224,29 +224,23 @@ public class WxCUserServiceImpl implements WxCUserService { // } @Override - public long findCount(WxCUserBasicInfoDto dto, List tenantEntitys) { - long count = 0l; - for (TenantEntity tenantEntity:tenantEntitys) { - dto.updateTenantInfo(tenantEntity); - long count1 = wxCUserMapper.findCount(dto); - count += count1; - } - return count; + public long findCount(WxCUserBasicInfoDto dto) { + return wxCUserMapper.findCount(dto); } @Override - public List findCountHistory(WxCUserBasicInfoDto dto, List tenantEntitys) { - return wxCUserMapper.findCountHistory(tenantEntitys,dto); + public List findCountHistory(WxCUserBasicInfoDto dto) { + return wxCUserMapper.findCountHistory(dto); } @Override - public PageInfo listByChannel(WxCUser user, List tenantEntitys, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(tenantEntitys,user)); + public PageInfo listByChannel(WxCUser user, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(user)); } @Override - public long countByChannel(List tenantEntitys, WxCUser user) { - return wxCUserMapper.countByChannel(tenantEntitys, user); + public long countByChannel(WxCUser user) { + return wxCUserMapper.countByChannel(user); } @Override 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 b6c109f23..6af25ba38 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -1403,11 +1403,11 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getNewUserCount(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); - long allCount = wxCUserService.findCount(dto,tenantEntitys);//总数 + long allCount = wxCUserService.findCount(dto);//总数 Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); @@ -1418,7 +1418,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long todayCount = wxCUserService.findCount(dto,tenantEntitys); + long todayCount = wxCUserService.findCount(dto); datamap.put("allCount", allCount);//会员总数 datamap.put("todayCount", todayCount);//今日新增会员数 return new ResultData(datamap); @@ -1495,7 +1495,7 @@ public class WxChartServiceImpl implements WxChartDataService { } private ResultData getNewMemberCount(TenantEntity tenantEntity, int days, String returnName) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); @@ -1512,7 +1512,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = wxCUserService.findCount(dto,tenantEntitys); + long count = wxCUserService.findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); vo.setSortNum(sortNum++); @@ -1812,12 +1812,12 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getMemeberWechatTotal(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); dto.updateTenantInfo(tenantEntity); //微信用户数据 - long wxallCount = wxCUserService.findCount(dto,tenantEntitys);//总量 + long wxallCount = wxCUserService.findCount(dto);//总量 Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); @@ -1825,7 +1825,7 @@ public class WxChartServiceImpl implements WxChartDataService { Date today = c.getTime(); dto.setStartTime(today); dto.setEndTime(null); - long wxtodayCount = wxCUserService.findCount(dto,tenantEntitys);//今天新增 + long wxtodayCount = wxCUserService.findCount(dto);//今天新增 datamap.put("wxallCount", wxallCount);//累计会员总数 datamap.put("wxtodayCount", wxtodayCount);//今日新增会员数 return new ResultData(datamap); @@ -1839,7 +1839,8 @@ public class WxChartServiceImpl implements WxChartDataService { private ResultData getMemberTotalCount(TenantEntity tenantEntity) { HashMap datamap = new HashMap<>(); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); - long allCount = wxCUserBasicInfoService.findCount(tenantEntity,dto);//总量 + dto.updateTenantInfo(tenantEntity); + long allCount = wxCUserBasicInfoService.findCount(dto);//总量 Calendar c = Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); @@ -1847,7 +1848,7 @@ public class WxChartServiceImpl implements WxChartDataService { Date today = c.getTime(); dto.setStartTime(today); dto.setEndTime(null); - long todayCount = wxCUserBasicInfoService.findCount(tenantEntity,dto);//今天新增 + long todayCount = wxCUserBasicInfoService.findCount(dto);//今天新增 datamap.put("allCount", allCount);//累计会员总数 datamap.put("todayCount", todayCount);//今日新增会员数 return new ResultData(datamap); @@ -1859,7 +1860,7 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getMemberWechatJoinTrade(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); final int daysBefore = 29; WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); @@ -1878,7 +1879,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = wxCUserService.findCount(dto,tenantEntitys); + long count = wxCUserService.findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setSortNum(j); j++; @@ -1892,7 +1893,7 @@ public class WxChartServiceImpl implements WxChartDataService { c.add(Calendar.DAY_OF_YEAR, -daysBefore); dto.setEndTime(c.getTime()); dto.setStartTime(null); - long firstDay = wxCUserService.findCount(dto,tenantEntitys);//统计的第一天总数 + long firstDay = wxCUserService.findCount(dto);//统计的第一天总数 int i = 0; long sumCount = 0; for (UserStructureVo v : wxnewCountVos) { @@ -1962,6 +1963,7 @@ 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); @@ -1977,7 +1979,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long count = wxCUserBasicInfoService.findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setSortNum(j); j++; @@ -1991,7 +1993,7 @@ public class WxChartServiceImpl implements WxChartDataService { c.add(Calendar.DAY_OF_YEAR, -daysBefore); dto.setEndTime(c.getTime()); dto.setStartTime(null); - long firstDay = wxCUserBasicInfoService.findCount(tenantEntity,dto);//统计的第一天总数 + long firstDay = wxCUserBasicInfoService.findCount(dto);//统计的第一天总数 int i = 0; long sumCount = 0; for (UserStructureVo v : newCountVos) { @@ -2013,7 +2015,7 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getFromChannelAnalysis(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); List channelStructureList = new ArrayList<>(); WxCUser wxCUser = new WxCUser(); @@ -2034,7 +2036,7 @@ public class WxChartServiceImpl implements WxChartDataService { wxCUser.setSceneList(sceneList); WxUserChannel channelStructure = new WxUserChannel(); channelStructure.setChannelName(w.getChannelName()); - channelStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys,wxCUser)); + channelStructure.setCount(wxCUserMapper.countByChannel(wxCUser)); channelStructureList.add(channelStructure); } } @@ -2048,7 +2050,7 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getWechatMemberTrade(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); final int daysBefore = 29; WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); @@ -2067,7 +2069,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = wxCUserService.findCount(dto,tenantEntitys); + long count = wxCUserService.findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setSortNum(j); j++; @@ -2103,7 +2105,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setStartTime(c.getTime()); c.add(Calendar.DAY_OF_YEAR, 1); dto.setEndTime(c.getTime()); - long count = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long count = wxCUserBasicInfoService.findCount(dto); UserStructureVo vo = new UserStructureVo(); vo.setSortNum(j); j++; @@ -2121,7 +2123,7 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getSceneAnalysis(TenantEntity tenantEntity) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); HashMap datamap = new HashMap<>(); List senceStructureList = new ArrayList<>(); WxCUser wxCUser = new WxCUser(); @@ -2138,7 +2140,7 @@ public class WxChartServiceImpl implements WxChartDataService { wxCUser.setSceneList(scene); WxUserChannel senceStructure = new WxUserChannel(); senceStructure.setDescription(uc.getDescription()); - senceStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys, wxCUser)); + senceStructure.setCount(wxCUserMapper.countByChannel(wxCUser)); senceStructureList.add(senceStructure); } } @@ -2158,9 +2160,10 @@ 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 = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long all = wxCUserBasicInfoService.findCount(dto); List vos = new ArrayList<>(); Calendar c = Calendar.getInstance(); for (EnumAgeInfo a : EnumAgeInfo.values()) { @@ -2169,7 +2172,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(tenantEntity,a, c, dto); + long count = getCountByAge(a, c, dto); vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); } return new ResultData(datamap); @@ -2183,13 +2186,12 @@ public class WxChartServiceImpl implements WxChartDataService { * @return */ private ResultData getMemberBindCar(TenantEntity tenantEntity, String startdate, String enddate) { - List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); +// List tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantEntity); dto.setStartTime(DateUtils.stringToDate(startdate)); dto.setEndTime(DateUtils.stringToDate(enddate)); - long total = wxCUserBasicInfoService.findCount(tenantEntity,dto); - dto.updateTenantInfo(tenantEntity); - dto.setFinalTenantId(tenantEntity.getFinalTenantId()); + long total = wxCUserBasicInfoService.findCount(dto); long userCountWithCar = wxCUserCarService.countUser(dto); Map userWithCar = new HashMap(); userWithCar.put("title", "已绑定车牌"); @@ -2223,9 +2225,10 @@ 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 = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long all = wxCUserBasicInfoService.findCount(dto); List vos = new ArrayList<>(); Calendar c = Calendar.getInstance(); for (EnumAgeInfo a : EnumAgeInfo.values()) { @@ -2234,7 +2237,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(tenantEntity,a, c, dto); + long count = getCountByAge(a, c, dto); vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); } return new ResultData(datamap); @@ -2255,6 +2258,7 @@ 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()) { @@ -2264,7 +2268,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setLevelStartScore(levelList.get(i).getPoints()); } - long all = wxCUserBasicInfoService.findCountByScore(tenantEntity,dto); + long all = wxCUserBasicInfoService.findCountByScore(dto); levelList.get(i).setCount(all); } @@ -2272,7 +2276,8 @@ public class WxChartServiceImpl implements WxChartDataService { //没有等级的会员 other.setLevel("无"); WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); - other.setCount(wxCUserBasicInfoService.findCount(tenantEntity,dto) + dto.updateTenantInfo(tenantEntity); + other.setCount(wxCUserBasicInfoService.findCount(dto) - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); levelList.add(other); return new ResultData(levelList); @@ -2287,11 +2292,12 @@ 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 = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long total = wxCUserBasicInfoService.findCount(dto); List tagList = new ArrayList<>(); EnumTag[] tags = {EnumTag.ID_49, EnumTag.ID_50, @@ -2323,11 +2329,12 @@ 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 = wxCUserBasicInfoService.findCount(tenantEntity,dto); + long total = wxCUserBasicInfoService.findCount(dto); List tagList = new ArrayList<>(); EnumTag[] tags = { EnumTag.ID_112, @@ -2709,7 +2716,7 @@ public class WxChartServiceImpl implements WxChartDataService { } - private long getCountByAge(TenantEntity tenantInfo,EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { + private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { if (a.getStart() != 0 || a.getEnd() != 0) { c.add(Calendar.YEAR, -a.getEnd()); Date startTime = c.getTime(); @@ -2725,7 +2732,7 @@ public class WxChartServiceImpl implements WxChartDataService { dto.setBirthEndTime(null); } - return wxCUserBasicInfoService.findCountByAge(tenantInfo,dto); + return wxCUserBasicInfoService.findCountByAge(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 e35266b6d..208e327aa 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java @@ -77,11 +77,12 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { l.setScale(WxLevelConfig.DEFAULT_SCALE); } WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); + dto.updateTenantInfo(tenantEntity); dto.setLevelStartScore(l.getPoints()); if (i + 1 - select open_id from tt_c_user where msg_count >= 10 + select open_id + from tt_c_user + where msg_count >= 10 and `tenant_id` = #{tenantId} @@ -243,7 +245,8 @@ - update tt_c_user set msg_count = msg_count+2 + update tt_c_user + set msg_count = msg_count+2 where msg_count < 10 and `id` = #{id} @@ -269,7 +272,8 @@ - - where 1 = 1 - - - and wcubi.`id` = #{basicInfo.id} - - - - and wcubi.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') - - - - 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.levelStartScore} - - - - and wcubi.poins < #{basicInfo.levelEndScore} - - - - 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.`active_time` between #{basicInfo.activeStartTime} and #{basicInfo.activeEndTime} - - - - and wcubi.`status` = #{basicInfo.status} - - - - and wcubi.id in (select c_user_id from wx_c_user_car - where 1=1 - - and `tenant_id` = #{tenantInfo.tenantId} - - - and `parent_tenant_id` = #{tenantInfo.parentTenantId} - - and car_number like concat('%', #{basicInfo.carNumber},'%')) - - - - and wcubi.id in - - #{idItem} - - - order by ${basicInfo.sortColumns} - - - - - update wx_c_user_basic_info set poins=#{poins} @@ -286,8 +181,9 @@ - - - - - - - cub.id,cub.phone,cub.birthdate,cub.education,cub.sex,cub.`height`,cub.`weight`,cub.`id_card`,cub.email,cub.address,cub.poins,cub.tag_id, - cub.create_date,cub.update_date,cub.name,cub.level,cub.nick_name,cub.score_date,cub.final_tenant_id + wcubi.id,wcubi.phone,wcubi.birthdate,wcubi.education,wcubi.sex,wcubi.`height`,wcubi.`weight`,wcubi.`id_card`,wcubi.email,wcubi.address,wcubi.poins,wcubi.tag_id, + wcubi.create_date,wcubi.update_date,wcubi.name,wcubi.level,wcubi.nick_name,wcubi.score_date,wcubi.final_tenant_id - - - - - - - - @@ -633,8 +346,8 @@ - - + + @@ -642,78 +355,68 @@ - - - - - cu.`id`,cu.`phone`,cu.`birthdate`,cu.`education`,cu.`sex`,cu.`height`,cu.`weight`,cu.`id_card`,cu.`email`,cu.`address`,cu.`poins`,cu.`tag_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` - - - where 1 = 1 + where wcubi.`final_tenant_id` = #{finalTenantId} - and cu.`id` = #{id} + and wcubi.`id` = #{id} - - and cu.`final_tenant_id` = #{finalTenantId} + + and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') - and cu.`phone` like concat('%', #{phone},'%') + and wcubi.`phone` like concat('%', #{phone},'%') - and cu.`birthdate` = #{birthdate} + and wcubi.`birthdate` = #{birthdate} - and cu.`education` like concat('%', #{education},'%') + and wcubi.`education` like concat('%', #{education},'%') - and cu.`sex` = #{sex} + and wcubi.`sex` = #{sex} - and cu.`email` like concat('%', #{email},'%') + and wcubi.`email` like concat('%', #{email},'%') - and cu.`address` like concat('%', #{address},'%') + and wcubi.`address` like concat('%', #{address},'%') - and cu.`poins` = #{poins} + and wcubi.`poins` = #{poins} - and cu.`tag_id` = #{tagId} + and wcubi.`tag_id` = #{tagId} - and cu.`create_date` = #{createDate} + and wcubi.`create_date` = #{createDate} - and cu.`update_date` = #{updateDate} + and wcubi.`update_date` = #{updateDate} - and cu.`act_record` = #{actRecord} + and wcubi.`act_record` = #{actRecord} - and cu.`name` like concat('%', #{name},'%') + and wcubi.`name` like concat('%', #{name},'%') - and cu.`create_date` between #{startTime} and #{endTime} + and wcubi.`create_date` between #{startTime} and #{endTime} @@ -721,233 +424,97 @@ - and cu.id in + and wcubi.id in #{idItem} - order by cu.`active_time` DESC + order by wcubi.`active_time` DESC - - where 1 = 1 - - - and cu.`id` = #{basicInfo.id} - - - - and cu.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') - - - - 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 wcubi.`active_time` between #{basicInfo.activeStartTime} and #{basicInfo.activeEndTime} - - - - and cu.id in - - #{idItem} - - - order by cu.`active_time` DESC - - - - - - - - - - - - - - - cu.`id`,cu.`phone`,cu.`email` - - where 1=1 - - and cu.`final_tenant_id` = #{finalTenantId} + where wcubi.`final_tenant_id` = #{finalTenantId} + + and wcubi.`tenant_id` like concat('%,', #{tenantId},',%') - - and cu.create_date >= #{startTime} + and wcubi.create_date >= #{startTime} - and cu.create_date <= #{endTime} + and wcubi.create_date <= #{endTime} - and cu.birthdate >= #{birthStartTime} + and wcubi.birthdate >= #{birthStartTime} - and cu.birthdate < #{birthEndTime} + and wcubi.birthdate < #{birthEndTime} - and cu.active_time >= #{loginStartTime} + and wcubi.active_time >= #{loginStartTime} - and cu.active_time <= #{loginEndTime} + and wcubi.active_time <= #{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 >= #{verifiedStartTime} - and co.update_date <= #{verifiedEndTime}) + and 0 < + (select count(*) from wx_coupon_order wco + where wcubi.id = wco.c_user_id + and wco.coupon_order_status = 1 + and wco.update_date >= #{verifiedStartTime} + and wco.update_date <= #{verifiedEndTime}) - and cu.phone in (${phones}) + and wcubi.phone in (${phones}) - and cu.poins >= #{levelStartScore} + and wcubi.poins >= #{levelStartScore} - and cu.poins < #{levelEndScore} + and wcubi.poins < #{levelEndScore} - and (cu.poins is null or - (cu.poins >= #{levelStartScore} + and (wcubi.poins is null or + (wcubi.poins >= #{levelStartScore} - and cu.poins < #{levelEndScore} + and wcubi.poins < #{levelEndScore} )) - and JSON_CONTAINS(JSON_ARRAY(cut.tags),JSON_ARRAY + and JSON_CONTAINS(JSON_ARRAY(wcut.tags),JSON_ARRAY #{idItem} @@ -956,96 +523,20 @@ - - where 1=1 - - and cu.`tenant_id` like concat('%,', #{tenantInfo.tenantId},',%') - - - - 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} - - ) - - - - - @@ -1053,62 +544,23 @@ - - - - - - - + UPDATE wx_c_user_basic_info set act_record = act_record +1 where id = #{id} and final_tenant_id = #{finalTenantId} diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index 52ad8f0fb..0d2dfe372 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -233,7 +233,9 @@ - update wx_c_user set msg_count = msg_count+2 - where msg_count < 10 + update wx_c_user + set msg_count = msg_count+2 + where msg_count < 10 and `id` = #{id} @@ -269,7 +272,8 @@ - SELECT `level` FROM `wx_level_config` where tenant_id = #{tenantId} and points <= #{points} ORDER BY points desc LIMIT 1 + SELECT `level` FROM `wx_level_config` where tenant_id = #{finalTenantId} and points <= #{points} ORDER BY points desc LIMIT 1