From df3e6f3b5c429328e38140bf71533a15bad9c391 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 20 Jan 2022 11:35:56 +0800 Subject: [PATCH] =?UTF-8?q?/=E3=80=81=E9=9B=86=E5=9B=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=A7=AF=E5=88=86=E6=88=90=E9=95=BF=E5=80=BC?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/base/BaseController.java | 18 +- .../datatower/WxChartDataController.java | 5 + .../datatower/WxUserStatisticsController.java | 155 ++++++++--------- .../datatower/WxUserStructureController.java | 132 ++++++++------- .../market/FengNiaoMapController.java | 2 +- .../market/WxCampaignController.java | 3 +- .../controller/market/WxCouponController.java | 3 - .../mem/UserBasicInfoAddressController.java | 10 +- .../mem/WxCUserBasicInfoController.java | 32 ++-- .../controller/mem/WxCUserDataController.java | 17 +- .../mem/WxLevelConfigController.java | 13 +- .../mem/WxScoreRulesController.java | 2 +- .../com/iformall/mapper/TtCUserMapper.java | 6 +- .../com/iformall/mapper/WxCUserMapper.java | 6 +- .../com/iformall/service/TtCUserService.java | 11 +- .../service/WxCUserBasicInfoService.java | 7 - .../com/iformall/service/WxCUserService.java | 9 +- .../service/cuser/CUserServiceApapter.java | 4 +- .../cuser/tt/TtBUserServiceAdapter.java | 4 +- .../cuser/tt/TtCUserServiceAdapter.java | 14 +- .../cuser/wx/WxBUserServiceAdapter.java | 4 +- .../cuser/wx/WxCUserServiceAdapter.java | 14 +- .../service/impl/TtCUserServiceImpl.java | 22 +-- .../impl/WxCUserBasicInfoServiceImpl.java | 67 -------- .../service/impl/WxCUserServiceImpl.java | 22 +-- .../service/impl/WxChartServiceImpl.java | 79 +++++---- .../impl/WxLevelConfigServiceImpl.java | 5 +- .../main/resources/mapper/TtCUserMapper.xml | 151 +++++++---------- .../mapper/WxCUserBasicInfoMapper.xml | 18 -- .../main/resources/mapper/WxCUserMapper.xml | 160 ++++++++---------- .../resources/mapper/WxLevelConfigMapper.xml | 16 +- 31 files changed, 442 insertions(+), 569 deletions(-) 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 7d52eb6a6..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,30 +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()){ - logger.info("修改前"+(i-1)+"=="+wxCountList.get(i-1).getTotalCount()); - logger.info("修改前"+i+"=="+wxCountList.get(i).getTotalCount()); - wxCountList.get(i).setTotalCount(wxCountList.get(i-1).getTotalCount()); - logger.info("修改后"+(i-1)+"=="+wxCountList.get(i-1).getTotalCount()); - logger.info("修改后"+i+"=="+wxCountList.get(i).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 = "查询会员趋势") @@ -237,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); @@ -254,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; @@ -304,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 4043d2df1..e3f4e8347 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -93,7 +93,7 @@ public class WxCUserBasicInfoController extends BaseController { private WxCreditHistoryService wxCreditHistoryService; 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()); @@ -115,7 +115,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()); @@ -191,9 +191,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()) { @@ -362,9 +362,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); @@ -385,9 +386,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") @@ -620,14 +622,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/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/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 00eb691a2..123eac584 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -767,49 +767,21 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc return wxCUserBasicInfoMapper.findCountBySex(dto); } - @Override - public long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { - dto.setTenantId(tenantInfo.getTenantId()); - 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) { - dto.setTenantId(tenantInfo.getTenantId()); - 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) { - dto.setTenantId(tenantInfo.getTenantId()); - 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) { - basicInfo.setTenantId(tenantInfo.getTenantId()); - basicInfo.undateFinalTenantId(tenantInfo); - return wxCUserBasicInfoMapper.countVoList(basicInfo); - } - @Override public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) { // List list = wxCUserBasicInfoMapper.findVoList(basicInfo); @@ -823,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(); @@ -1183,25 +1130,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc return wxCUserBasicInfoMapper.findCount(dto); } - @Override - public long findCount(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { - dto.setTenantId(tenantInfo.getTenantId()); - 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) { - dto.setTenantId(tenantInfo.getTenantId()); - dto.setFinalTenantId(tenantInfo.getFinalTenantId()); - return wxCUserBasicInfoMapper.findCountHistory(dto); - } - @Override public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { List list = wxCarPayRecordMapper.findCarPayList(record); 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 201e77985..cfb61a2aa 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -1383,11 +1383,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); @@ -1398,7 +1398,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); @@ -1475,7 +1475,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); @@ -1492,7 +1492,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++); @@ -1792,12 +1792,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); @@ -1805,7 +1805,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); @@ -1819,7 +1819,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); @@ -1827,7 +1828,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); @@ -1839,7 +1840,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(); @@ -1858,7 +1859,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++; @@ -1872,7 +1873,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) { @@ -1942,6 +1943,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); @@ -1957,7 +1959,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++; @@ -1971,7 +1973,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) { @@ -1993,7 +1995,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(); @@ -2014,7 +2016,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); } } @@ -2028,7 +2030,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(); @@ -2047,7 +2049,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++; @@ -2083,7 +2085,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++; @@ -2101,7 +2103,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(); @@ -2118,7 +2120,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); } } @@ -2138,9 +2140,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()) { @@ -2149,7 +2152,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); @@ -2163,13 +2166,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", "已绑定车牌"); @@ -2203,9 +2205,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()) { @@ -2214,7 +2217,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); @@ -2235,6 +2238,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()) { @@ -2244,7 +2248,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); } @@ -2252,7 +2256,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); @@ -2267,11 +2272,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, @@ -2303,11 +2309,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, @@ -2689,7 +2696,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(); @@ -2705,7 +2712,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 @@ - select open_id from wx_c_user where msg_count >= 10 + select open_id + from wx_c_user + where msg_count >= 10 and `tenant_id` = #{tenantId} @@ -243,8 +245,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