| @@ -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 | |||
| */ | |||
| @@ -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); | |||
| @@ -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<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||
| //todo 集团版查询数据待重构 | |||
| return new ResultData("集团版查询数据待重构"); | |||
| } | |||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> 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<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> 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<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||
| //todo 集团版查询数据待重构 | |||
| return new ResultData("集团版查询数据待重构"); | |||
| } | |||
| // List<TenantEntity> 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<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> wxCounts = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCountHistory(dto,tenantEntitys);//每日新增会员数 | |||
| List<UserCountVo> wxCountList = new ArrayList<>(); | |||
| List<UserCountVo> 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<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> 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<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| @@ -250,7 +254,7 @@ public class WxUserStatisticsController extends BaseController { | |||
| dto.setReportType(reportType); | |||
| List<UserCountVo> memCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 | |||
| List<UserCountVo> 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 && | |||
| @@ -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<UserStructureVo> 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<UserStructureVo> 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<WxLevelConfig> 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<TenantEntity> 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<WxTags> 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<WxTags> tagList = new ArrayList<>(); | |||
| @@ -299,16 +307,21 @@ public class WxUserStructureController extends BaseController { | |||
| logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserCount"); | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||
| //todo 集团版查询数据待重构 | |||
| return new ResultData("集团版查询数据待重构"); | |||
| } | |||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| //昨日同比 | |||
| Map<String, Object> 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<UserCountVo> wxCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto,tenantEntitys);//每日新增会员数 | |||
| List<UserCountVo> wxCountList = new ArrayList<>(); | |||
| List<UserCountVo> wxCounts = wxCUserService.findCountHistory(dto);//获取每日/每月/每年新增微信用户数 | |||
| List<UserCountVo> memCountList = new ArrayList<>();//每日新增会员数 | |||
| List<UserCountVo> memCounts = wxCUserBasicInfoService.findCountHistory(ifParentUpdateTenantInfo(),dto);//每日新增会员数 | |||
| List<UserCountVo> 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<String> sceneList = null; | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||
| //todo 集团版查询数据待重构 | |||
| return new ResultData("集团版查询数据待重构"); | |||
| } | |||
| // List<TenantEntity> 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<WxCUser> page = wxCUserService.listByChannel(wxCUser,tenantEntitys, pageNum, pageSize); | |||
| PageInfo<WxCUser> 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<WxUserChannel> channelStructureList = new ArrayList<>(); | |||
| List<WxUserChannel> senceStructureList = new ArrayList<>(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(getTenantInfo()); | |||
| TenantEntity tenantInfo = getTenantInfo(); | |||
| wxCUser.updateTenantInfo(wxCUser); | |||
| // List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(getTenantInfo()); | |||
| List<WxUserChannel> 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) { | |||
| @@ -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); | |||
| @@ -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<WxCampaign> 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()); | |||
| @@ -57,9 +57,6 @@ public class WxCouponController extends BaseController { | |||
| private WxMallService wxMallService; | |||
| @Autowired | |||
| RedisLock redisLock; | |||
| @Autowired | |||
| private WxPayAccountService wxPayAccountService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -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<UserBasicInfoAddress> 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); | |||
| } | |||
| @@ -97,7 +97,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| WxCouponMerchantMapper wxCouponMerchantMapper; | |||
| private void updateLevelParam(WxCUserBasicInfo info) { | |||
| List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo()); | |||
| List<WxLevelConfig> 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<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo()); | |||
| List<WxLevelConfig> 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<WxCUserBasicInfo> page = wxCUserBasicInfoService.listAsPage(ifParentUpdateTenantInfo(),wxCUserBasicInfo, pageNum, pageSize); | |||
| PageInfo<WxCUserBasicInfo> 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<String,String> 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,"同一个用户"); | |||
| @@ -61,10 +61,14 @@ public class WxCUserDataController extends BaseController { | |||
| plat = EnumAppPlat.WX.getCode(); | |||
| } | |||
| TenantEntity tenantEntity = getTenantInfo(); | |||
| List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); | |||
| if(StringUtils.isBlank(tenantEntity.getTenantId())){ | |||
| //todo 集团版查询数据待重构 | |||
| return new ResultData("集团版查询数据待重构"); | |||
| } | |||
| // List<TenantEntity> 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); | |||
| } | |||
| @@ -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<WxLevelConfig> page = wxLevelConfigService.listAsPage(tenantEntity,wxLevelConfig, pageNum, pageSize); | |||
| final PageInfo<WxLevelConfig> 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); | |||
| @@ -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()); | |||
| } | |||
| @@ -150,6 +150,7 @@ public class WxCouponChannelController extends BaseController { | |||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||
| List<Integer> 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()); | |||
| @@ -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<WxCUserBasicInfoFilterDto> filterList; | |||
| public void undateFinalTenantId(TenantEntity tenantEntity){ | |||
| setFinalTenantId(tenantEntity.getTenantId()); | |||
| if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){ | |||
| setFinalTenantId(tenantEntity.getParentTenantId()); | |||
| } | |||
| } | |||
| } | |||
| @@ -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() { | |||
| @@ -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) { | |||
| @@ -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(); | |||
| } | |||
| } | |||
| @@ -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(); | |||
| } | |||
| } | |||
| @@ -23,11 +23,11 @@ public interface TtCUserMapper extends CommonMapper<TtCUser, Long> { | |||
| long findCount(WxCUserBasicInfoDto basicDto); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto basicDto); | |||
| List<TtCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("ttCUser")TtCUser ttCUser); | |||
| List<TtCUser> listByChannel(TtCUser ttCUser); | |||
| long countByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("ttCUser")TtCUser ttCUser); | |||
| long countByChannel(TtCUser ttCUser); | |||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||
| @@ -14,13 +14,10 @@ import java.util.List; | |||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | |||
| long findCountByFilter(WxCUserBasicInfoDto dto); | |||
| long findCountByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findListByFilter(WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByFilter1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfoDto wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfo> findListPhoneAndNameByIds(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<Long> findIdList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| @@ -35,43 +32,24 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||
| void updateNewId(CUserBaseVo record); | |||
| long findCountBySex(WxCUserBasicInfoDto dto); | |||
| long findCountBySex1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| long findCountByAge(WxCUserBasicInfoDto dto); | |||
| long findCountByAge1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| long findCountByScore(WxCUserBasicInfoDto dto); | |||
| long findCountByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByScore(WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findListByScore1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfo> findBirthdayList(@Param("finalTenantId")String finalTenantId, @Param("begin")String begin, @Param("end")String end); | |||
| List<WxCUserBasicInfo> findBirthdayList1(@Param("finalTenantId")String finalTenantId,@Param("tenantId")String tenantId,@Param("parentTenantId")String parentTenantId, @Param("begin")String begin, @Param("end")String end); | |||
| List<WxCUserBasicInfo> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory1(@Param("tenantInfo")TenantEntity tenantInfo,@Param("basicInfo")WxCUserBasicInfoDto dto); | |||
| List<WxCUserBasicInfoVo> findVoList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<Long> findVoIdsList(WxCUserBasicInfo wxCUserBasicInfo); | |||
| List<WxCUserBasicInfoVo> findVoList1(@Param("tenantInfo")TenantEntity tenantInfo, @Param("basicInfo")WxCUserBasicInfo basicInfo); | |||
| List<Long> 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); | |||
| @@ -23,11 +23,11 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||
| long findCount(WxCUserBasicInfoDto basicDto); | |||
| List<UserCountVo> findCountHistory(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("basicDto")WxCUserBasicInfoDto basicDto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto basicDto); | |||
| List<WxCUser> listByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCUser")WxCUser wxCUser); | |||
| List<WxCUser> listByChannel(WxCUser wxCUser); | |||
| long countByChannel(@Param("tenantEntitys")List<TenantEntity> tenantEntitys, @Param("wxCUser")WxCUser wxCUser); | |||
| long countByChannel(WxCUser wxCUser); | |||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||
| @@ -88,32 +88,29 @@ public interface TtCUserService { | |||
| * @param tenantEntitys | |||
| * @return | |||
| */ | |||
| long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 统计数量 | |||
| * @param dto | |||
| * @param tenantEntitys | |||
| * @return | |||
| */ | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 通过渠道获取会员信息 | |||
| * @param user | |||
| * @param tenantEntitys | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<TtCUser> listByChannel(TtCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize); | |||
| PageInfo<TtCUser> listByChannel(TtCUser user, Integer pageIndex, Integer pageSize); | |||
| long countByChannel(List<TenantEntity> tenantEntitys, TtCUser user); | |||
| long countByChannel(TtCUser user); | |||
| /** | |||
| * 登录后发消息 | |||
| * @param user | |||
| */ | |||
| void actionMsgAfterLogin(WxCUserFrom wxCUserFrom); | |||
| @@ -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<WxTags> tagList, CUserBaseInfoT uBase,MallUserInfo mallUserInfo); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| long findCount(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(TenantEntity tenantInfo,WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 停车会员记录导出 | |||
| * @param record | |||
| @@ -99,15 +99,14 @@ public interface WxCUserService { | |||
| * @param tenantEntitys | |||
| * @return | |||
| */ | |||
| long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| /** | |||
| * 统计数量 | |||
| * @param dto | |||
| * @param tenantEntitys | |||
| * @return | |||
| */ | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| /** | |||
| @@ -118,9 +117,9 @@ public interface WxCUserService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCUser> listByChannel(WxCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize); | |||
| long countByChannel(List<TenantEntity> tenantEntitys, WxCUser user); | |||
| long countByChannel(WxCUser user); | |||
| /** | |||
| * 登录后发消息 | |||
| @@ -42,9 +42,9 @@ public interface CUserServiceApapter { | |||
| void updateMsgCount(CUser user); | |||
| long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| long findCount(WxCUserBasicInfoDto dto); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys); | |||
| List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto); | |||
| void actionAfterLogin(CUser user); | |||
| @@ -245,12 +245,12 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| public long findCount(WxCUserBasicInfoDto dto) { | |||
| return 0l; | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return null; | |||
| } | |||
| @@ -300,19 +300,13 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return ttCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return ttCUserMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| @@ -245,12 +245,12 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| public long findCount(WxCUserBasicInfoDto dto) { | |||
| return 0l; | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return null; | |||
| } | |||
| @@ -308,19 +308,13 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer | |||
| } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return wxCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return wxCUserMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| @@ -162,29 +162,23 @@ public class TtCUserServiceImpl implements TtCUserService { | |||
| // } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return ttCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return ttCUserMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| public PageInfo<TtCUser> listByChannel(TtCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCUserMapper.listByChannel(tenantEntitys,user)); | |||
| public PageInfo<TtCUser> listByChannel(TtCUser user, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> ttCUserMapper.listByChannel(user)); | |||
| } | |||
| @Override | |||
| public long countByChannel(List<TenantEntity> tenantEntitys, TtCUser user) { | |||
| return ttCUserMapper.countByChannel(tenantEntitys, user); | |||
| public long countByChannel(TtCUser user) { | |||
| return ttCUserMapper.countByChannel(user); | |||
| } | |||
| @Override | |||
| @@ -518,29 +518,19 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||
| @Override | |||
| public long countByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> 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<WxCUserBasicInfo> listByFilter(TenantEntity tenantEntity, List<WxCUserBasicInfoFilterDto> 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<WxCUserBasicInfo> listAsPage(TenantEntity tenantInfo, WxCUserBasicInfo wxCUserBasicInfo, Integer pageIndex, Integer pageSize) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList1(tenantInfo,wxCUserBasicInfo)); | |||
| }else{ | |||
| //直接查询本表 | |||
| wxCUserBasicInfo.undateFinalTenantId(tenantInfo); | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findList(wxCUserBasicInfo)); | |||
| } | |||
| 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<WxCUserBasicInfoVo> 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<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| // if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| // //关联微信表查询 | |||
| // list = wxCUserBasicInfoMapper.findVoList1(tenantInfo,basicInfo); | |||
| // }else{ | |||
| // //直接查询本表 | |||
| // basicInfo.undateFinalTenantId(tenantInfo); | |||
| // list = wxCUserBasicInfoMapper.findVoList(basicInfo); | |||
| // } | |||
| // List<WxTags> tagList = wxTagsMapper.findListAll(); | |||
| // Map<Long, String> tagMap = tagList.stream().collect(Collectors.toMap(WxTags::getId, WxTags::getName)); | |||
| // list.stream().filter(u->u.getTags()!=null).forEach(u->{ | |||
| // List<Long> ids = JSONObject.parseArray(u.getTags(), Long.class); | |||
| // String tagNames = StringUtils.join(ids.stream().map(id->tagMap.get(id)).collect(Collectors.toList()),"/"); | |||
| // u.setTagNames(tagNames); | |||
| // }); | |||
| // excelService.exportExcel(list, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false); | |||
| 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<WxCUserBasicInfoVo> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return wxCUserBasicInfoMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| public List<UserCountVo> findCountHistory(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) { | |||
| if(StringUtils.isNotBlank(tenantInfo.getParentTenantId())){ | |||
| //关联微信表查询 | |||
| return wxCUserBasicInfoMapper.findCountHistory1(tenantInfo,dto); | |||
| }else{ | |||
| //直接查询本表 | |||
| dto.setTenantId(tenantInfo.getFinalTenantId()); | |||
| dto.setFinalTenantId(tenantInfo.getFinalTenantId()); | |||
| return wxCUserBasicInfoMapper.findCountHistory(dto); | |||
| } | |||
| } | |||
| @Override | |||
| public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) { | |||
| List<WxCarPayRecord> 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<WxCUserBasicInfo> 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<WxCUserBasicInfo> 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<WxCUserBasicInfoVo> list = new ArrayList<WxCUserBasicInfoVo>(); | |||
| 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; | |||
| } | |||
| @@ -224,29 +224,23 @@ public class WxCUserServiceImpl implements WxCUserService { | |||
| // } | |||
| @Override | |||
| public long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> 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<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys) { | |||
| return wxCUserMapper.findCountHistory(tenantEntitys,dto); | |||
| public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) { | |||
| return wxCUserMapper.findCountHistory(dto); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCUser> listByChannel(WxCUser user, List<TenantEntity> tenantEntitys, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(tenantEntitys,user)); | |||
| public PageInfo<WxCUser> listByChannel(WxCUser user, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(user)); | |||
| } | |||
| @Override | |||
| public long countByChannel(List<TenantEntity> tenantEntitys, WxCUser user) { | |||
| return wxCUserMapper.countByChannel(tenantEntitys, user); | |||
| public long countByChannel(WxCUser user) { | |||
| return wxCUserMapper.countByChannel(user); | |||
| } | |||
| @Override | |||
| @@ -1403,11 +1403,11 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| * @return | |||
| */ | |||
| private ResultData getNewUserCount(TenantEntity tenantEntity) { | |||
| List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> 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<String, Object> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> 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<String, Object> datamap = new HashMap<>(); | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.updateTenantInfo(tenantEntity); | |||
| final int daysBefore = 29; | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| @@ -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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<WxUserChannel> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| HashMap<String, Object> datamap = new HashMap<>(); | |||
| List<WxUserChannel> 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<String, Object> 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<UserStructureVo> 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<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity); | |||
| // List<TenantEntity> 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<String, Object> 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<UserStructureVo> 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<WxTags> 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<WxTags> 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) { | |||
| @@ -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<page.getList().size()) | |||
| dto.setLevelEndScore(page.getList().get(i+1).getPoints()); | |||
| l.setUserCount(wxCUserBasicInfoService.findCountByScore(tenantEntity,dto)); | |||
| l.setUserCount(wxCUserBasicInfoService.findCountByScore(dto)); | |||
| } | |||
| return page; | |||
| @@ -190,7 +191,7 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||
| levelConfigs.add(levelConfig); | |||
| } | |||
| wxLevelConfigMapper.insertBatch(levelConfigs); | |||
| this.deleteRedis(tenantEntity.getTenantId()); | |||
| this.deleteRedis(tenantEntity.getFinalTenantId()); | |||
| } | |||
| @Override | |||
| @@ -233,7 +233,9 @@ | |||
| <select id="listOpenId" parameterType="com.iformall.domain.po.tt.TtCUser" resultType="String"> | |||
| select open_id from tt_c_user where msg_count >= 10 | |||
| select open_id | |||
| from tt_c_user | |||
| where msg_count >= 10 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -243,7 +245,8 @@ | |||
| </select> | |||
| <update id="updateMsgCount" parameterType="com.iformall.domain.po.tt.TtCUser"> | |||
| update tt_c_user set msg_count = msg_count+2 | |||
| update tt_c_user | |||
| set msg_count = msg_count+2 | |||
| where msg_count < 10 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| @@ -269,7 +272,8 @@ | |||
| <!-- </update>--> | |||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.tt.TtCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| select <include refid="allColumns"/> | |||
| from tt_c_user | |||
| where `open_id` = #{openId} | |||
| <if test=" null != appId and '' != appId"> | |||
| and `app_id` = #{appId} | |||
| @@ -278,21 +282,31 @@ | |||
| </select> | |||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.tt.TtCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| select <include refid="allColumns"/> | |||
| from tt_c_user | |||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | |||
| </select> | |||
| <select id="findByToken" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user | |||
| select <include refid="allColumns"/> | |||
| from tt_c_user | |||
| where `token` = #{token} and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from tt_c_user where id = #{id} and `tenant_id` = #{tenantId} | |||
| select <include refid="allColumns"/> | |||
| from tt_c_user | |||
| where id = #{id} | |||
| and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from tt_c_user where 1=1 | |||
| select count(id) | |||
| from tt_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| </if> | |||
| @@ -302,114 +316,76 @@ | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCountHistory" resultType="com.iformall.domain.vo.UserCountVo"> | |||
| select count(id) as incCount, | |||
| <if test="1 == basicDto.reportType "> | |||
| <if test="1 == reportType "> | |||
| date_format(create_date, '%Y-%m-%d') as reportTime, | |||
| </if> | |||
| <if test="2 == basicDto.reportType "> | |||
| <if test="2 == reportType "> | |||
| date_format(create_date, '%Y-%m') as reportTime, | |||
| </if> | |||
| <if test="3 == basicDto.reportType "> | |||
| <if test="3 == reportType "> | |||
| date_format(create_date, '%Y') as reportTime, | |||
| </if> | |||
| <if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType"> | |||
| (select count(id) from | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where | |||
| <if test="1 == basicDto.reportType "> | |||
| date_format(create_date, '%Y-%m-%d') <= reportTime | |||
| </if> | |||
| <if test="2 == basicDto.reportType "> | |||
| date_format(create_date, '%Y-%m') <= reportTime | |||
| </if> | |||
| <if test="3 == basicDto.reportType "> | |||
| date_format(create_date, '%Y') <= reportTime | |||
| </if> | |||
| <if test=" null != basicDto.tenantId and '' != basicDto.tenantId"> | |||
| and `tenant_id` = #{basicDto.tenantId} | |||
| </if> | |||
| <if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId"> | |||
| and `parent_tenant_id` = #{basicDto.parentTenantId} | |||
| </if> | |||
| ) as totalCount | |||
| </if> | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where 1=1 | |||
| <if test=" null != basicDto.tenantId and '' != basicDto.tenantId"> | |||
| and `tenant_id` = #{basicDto.tenantId} | |||
| </if> | |||
| <if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId"> | |||
| and `parent_tenant_id` = #{basicDto.parentTenantId} | |||
| </if> | |||
| <if test=" null != basicDto.startTime "> | |||
| and create_date >= #{basicDto.startTime} | |||
| </if> | |||
| <if test=" null != basicDto.endTime"> | |||
| and create_date < #{basicDto.endTime} | |||
| </if> | |||
| <if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType"> | |||
| from tt_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test="1 == reportType or 2 == reportType or 3 == reportType"> | |||
| group by reportTime | |||
| </if> | |||
| </select> | |||
| <select id="listByChannel" resultMap="BaseResultMap" > | |||
| select id,user_id,nick_name,phone,create_date,scene_address from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where 1=1 | |||
| <if test=" null != ttCUser.tenantId and '' != ttCUser.tenantId"> | |||
| and `tenant_id` = #{ttCUser.tenantId} | |||
| </if> | |||
| <if test=" null != ttCUser.parentTenantId and '' != ttCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{ttCUser.parentTenantId} | |||
| select id,user_id,nick_name,phone,create_date,scene_address | |||
| from tt_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != ttCUser.startDate "> | |||
| and create_date >= #{ttCUser.startDate} | |||
| <if test=" null != startDate "> | |||
| and create_date >= #{startDate} | |||
| </if> | |||
| <if test=" null != ttCUser.endDate"> | |||
| and create_date < #{ttCUser.endDate} | |||
| <if test=" null != endDate"> | |||
| and create_date < #{endDate} | |||
| </if> | |||
| <if test=" ttCUser.sceneList!= null "> | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="ttCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != ttCUser.sortColumns"> order by ${ttCUser.sortColumns} </if> | |||
| <if test=" null == ttCUser.sortColumns"> order by create_date desc </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by create_date desc </if> | |||
| </select> | |||
| <select id="countByChannel" resultType="java.lang.Long" > | |||
| select count(id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from tt_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) tt_c_user where 1=1 | |||
| <if test=" null != ttCUser.tenantId and '' != ttCUser.tenantId"> | |||
| and `tenant_id` = #{ttCUser.tenantId} | |||
| </if> | |||
| <if test=" null != ttCUser.parentTenantId and '' != ttCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{ttCUser.parentTenantId} | |||
| select count(id) | |||
| from tt_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != ttCUser.startDate "> | |||
| and create_date >= #{ttCUser.startDate} | |||
| <if test=" null != startDate "> | |||
| and create_date >= #{startDate} | |||
| </if> | |||
| <if test=" null != ttCUser.endDate"> | |||
| and create_date < #{ttCUser.endDate} | |||
| <if test=" null != endDate"> | |||
| and create_date < #{endDate} | |||
| </if> | |||
| <if test=" ttCUser.sceneList!= null "> | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="ttCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| @@ -421,8 +397,9 @@ | |||
| <update id="updateUserId" parameterType="com.iformall.domain.po.tt.TtCUser"> | |||
| update tt_c_user set user_id=#{userId} | |||
| where id = #{id} | |||
| update tt_c_user | |||
| set user_id=#{userId} | |||
| where id = #{id} | |||
| </update> | |||
| <update id="delForUserIdOnly"> | |||
| @@ -233,7 +233,9 @@ | |||
| <select id="listOpenId" parameterType="com.iformall.domain.po.WxCUser" resultType="String"> | |||
| select open_id from wx_c_user where msg_count >= 10 | |||
| select open_id | |||
| from wx_c_user | |||
| where msg_count >= 10 | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| @@ -243,8 +245,9 @@ | |||
| </select> | |||
| <update id="updateMsgCount" parameterType="com.iformall.domain.po.WxCUser"> | |||
| 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 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| @@ -269,7 +272,8 @@ | |||
| <!-- </update>--> | |||
| <select id="findByOpenId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| select <include refid="allColumns"/> | |||
| from wx_c_user | |||
| where `open_id` = #{openId} | |||
| <if test=" null != appId and '' != appId"> | |||
| and `app_id` = #{appId} | |||
| @@ -278,21 +282,33 @@ | |||
| </select> | |||
| <select id="findByUnionId" parameterType="com.iformall.domain.po.WxCUser" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| where `open_app_id` = #{openAppId} and `union_id` = #{unionId} | |||
| select <include refid="allColumns"/> | |||
| from wx_c_user | |||
| where `open_app_id` = #{openAppId} | |||
| and `union_id` = #{unionId} | |||
| </select> | |||
| <select id="findByToken" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user | |||
| where `token` = #{token} and `tenant_id` = #{tenantId} | |||
| select <include refid="allColumns"/> | |||
| from wx_c_user | |||
| where `token` = #{token} | |||
| and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> from wx_c_user where id = #{id} and `tenant_id` = #{tenantId} | |||
| select <include refid="allColumns"/> | |||
| from wx_c_user | |||
| where id = #{id} | |||
| and `tenant_id` = #{tenantId} | |||
| </select> | |||
| <select id="findCount" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||
| select count(id) from wx_c_user where 1=1 | |||
| select count(id) | |||
| from wx_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != sex "> | |||
| and gender =#{sex} | |||
| </if> | |||
| @@ -302,114 +318,75 @@ | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| </select> | |||
| <select id="findCountHistory" resultType="com.iformall.domain.vo.UserCountVo"> | |||
| select count(id) as incCount, | |||
| <if test="1 == basicDto.reportType "> | |||
| <if test="1 == reportType "> | |||
| date_format(create_date, '%Y-%m-%d') as reportTime, | |||
| </if> | |||
| <if test="2 == basicDto.reportType "> | |||
| <if test="2 == reportType "> | |||
| date_format(create_date, '%Y-%m') as reportTime, | |||
| </if> | |||
| <if test="3 == basicDto.reportType "> | |||
| <if test="3 == reportType "> | |||
| date_format(create_date, '%Y') as reportTime, | |||
| </if> | |||
| <if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType"> | |||
| (select count(id) from | |||
| (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_c_user where | |||
| <if test="1 == basicDto.reportType "> | |||
| date_format(create_date, '%Y-%m-%d') <= reportTime | |||
| </if> | |||
| <if test="2 == basicDto.reportType "> | |||
| date_format(create_date, '%Y-%m') <= reportTime | |||
| </if> | |||
| <if test="3 == basicDto.reportType "> | |||
| date_format(create_date, '%Y') <= reportTime | |||
| </if> | |||
| <if test=" null != basicDto.tenantId and '' != basicDto.tenantId"> | |||
| and `tenant_id` = #{basicDto.tenantId} | |||
| </if> | |||
| <if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId"> | |||
| and `parent_tenant_id` = #{basicDto.parentTenantId} | |||
| </if> | |||
| ) as totalCount | |||
| </if> | |||
| from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_c_user where 1=1 | |||
| <if test=" null != basicDto.tenantId and '' != basicDto.tenantId"> | |||
| and `tenant_id` = #{basicDto.tenantId} | |||
| </if> | |||
| <if test=" null != basicDto.parentTenantId and '' != basicDto.parentTenantId"> | |||
| and `parent_tenant_id` = #{basicDto.parentTenantId} | |||
| </if> | |||
| <if test=" null != basicDto.startTime "> | |||
| and create_date >= #{basicDto.startTime} | |||
| </if> | |||
| <if test=" null != basicDto.endTime"> | |||
| and create_date < #{basicDto.endTime} | |||
| </if> | |||
| <if test="1 == basicDto.reportType or 2 == basicDto.reportType or 3 == basicDto.reportType"> | |||
| from wx_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != startTime "> | |||
| and create_date >= #{startTime} | |||
| </if> | |||
| <if test=" null != endTime"> | |||
| and create_date < #{endTime} | |||
| </if> | |||
| <if test="1 == reportType or 2 == reportType or 3 == reportType"> | |||
| group by reportTime | |||
| </if> | |||
| </select> | |||
| <select id="listByChannel" resultMap="BaseResultMap" > | |||
| select id,user_id,nick_name,phone,create_date,scene_address from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_c_user where 1=1 | |||
| <if test=" null != wxCUser.tenantId and '' != wxCUser.tenantId"> | |||
| and `tenant_id` = #{wxCUser.tenantId} | |||
| </if> | |||
| <if test=" null != wxCUser.parentTenantId and '' != wxCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{wxCUser.parentTenantId} | |||
| select id,user_id,nick_name,phone,create_date,scene_address | |||
| from wx_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != wxCUser.startDate "> | |||
| and create_date >= #{wxCUser.startDate} | |||
| <if test=" null != startDate "> | |||
| and create_date >= #{startDate} | |||
| </if> | |||
| <if test=" null != wxCUser.endDate"> | |||
| and create_date < #{wxCUser.endDate} | |||
| <if test=" null != endDate"> | |||
| and create_date < #{endDate} | |||
| </if> | |||
| <if test=" wxCUser.sceneList!= null "> | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="wxCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != wxCUser.sortColumns"> order by ${wxCUser.sortColumns} </if> | |||
| <if test=" null == wxCUser.sortColumns"> order by create_date desc </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| <if test=" null == sortColumns"> order by create_date desc </if> | |||
| </select> | |||
| <select id="countByChannel" resultType="java.lang.Long" > | |||
| select count(id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all"> | |||
| SELECT * from wx_c_user${tenantEntity.shardTableSuffix} | |||
| </foreach>) wx_c_user where 1=1 | |||
| <if test=" null != wxCUser.tenantId and '' != wxCUser.tenantId"> | |||
| and `tenant_id` = #{wxCUser.tenantId} | |||
| </if> | |||
| <if test=" null != wxCUser.parentTenantId and '' != wxCUser.parentTenantId"> | |||
| and `parent_tenant_id` = #{wxCUser.parentTenantId} | |||
| select count(id) | |||
| from wx_c_user | |||
| where `tenant_id` = #{tenantId} | |||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||
| and `parent_tenant_id` = #{parentTenantId} | |||
| </if> | |||
| <if test=" null != wxCUser.startDate "> | |||
| and create_date >= #{wxCUser.startDate} | |||
| <if test=" null != startDate "> | |||
| and create_date >= #{startDate} | |||
| </if> | |||
| <if test=" null != wxCUser.endDate"> | |||
| and create_date < #{wxCUser.endDate} | |||
| <if test=" null != endDate"> | |||
| and create_date < #{endDate} | |||
| </if> | |||
| <if test=" wxCUser.sceneList!= null "> | |||
| <if test=" sceneList!= null "> | |||
| and scene_address in | |||
| <foreach collection="wxCUser.sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||
| #{scene} | |||
| </foreach> | |||
| </if> | |||
| @@ -421,8 +398,9 @@ | |||
| <update id="updateUserId" parameterType="com.iformall.domain.po.WxCUser"> | |||
| update wx_c_user set user_id=#{userId} | |||
| where id = #{id} | |||
| update wx_c_user | |||
| set user_id=#{userId} | |||
| where id = #{id} | |||
| </update> | |||
| <update id="delForUserIdOnly"> | |||
| @@ -19,16 +19,12 @@ | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| where wlc.`tenant_id` = #{finalTenantId} | |||
| <if test=" null != id "> | |||
| and wlc.`id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId and '' != tenantId"> | |||
| and wlc.`tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != points "> | |||
| and wlc.`points` = #{points} | |||
| </if> | |||
| @@ -75,7 +71,7 @@ | |||
| discount_enable, capability,scale) values | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| (#{item.id,jdbcType=BIGINT}, | |||
| #{item.tenantId,jdbcType=VARCHAR}, | |||
| #{item.finalTenantId,jdbcType=VARCHAR}, | |||
| #{item.points,jdbcType=INTEGER}, | |||
| #{item.level,jdbcType=VARCHAR}, | |||
| #{item.description,jdbcType=VARCHAR}, | |||
| @@ -92,7 +88,7 @@ | |||
| <!-- <foreach collection="list" item="item" index="index" open="" close="" separator=";">--> | |||
| update wx_level_config | |||
| <set> | |||
| <if test=" null != tenantId ">`tenant_id` = #{tenantId},</if> | |||
| <if test=" null != tenantId ">`tenant_id` = #{finalTenantId},</if> | |||
| <if test=" null != points ">`points` = #{points},</if> | |||
| <if test=" null != level ">`level` = #{level},</if> | |||
| <if test=" null != description ">`description` = #{description},</if> | |||
| @@ -106,14 +102,14 @@ | |||
| </update> | |||
| <delete id="deleteAll" parameterType="com.iformall.domain.po.WxLevelConfig"> | |||
| delete from wx_level_config where `tenant_id` = #{tenantId}; | |||
| delete from wx_level_config where `tenant_id` = #{finalTenantId}; | |||
| </delete> | |||
| <select id="getLevel" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="String"> | |||
| 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 | |||
| </select> | |||
| <select id="getScale" parameterType="com.iformall.domain.po.WxLevelConfig" resultType="java.lang.Integer"> | |||
| select `scale` from wx_level_config where #{points} >=points and tenant_id = #{tenantId} order by points desc limit 1 ; | |||
| select `scale` from wx_level_config where tenant_id = #{finalTenantId} and #{points} >=points order by points desc limit 1 ; | |||
| </select> | |||
| </mapper> | |||