Просмотр исходного кода

/、集团用户会员积分成长值标签

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
df3e6f3b5c
31 измененных файлов: 442 добавлений и 569 удалений
  1. +17
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java
  2. +5
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java
  3. +78
    -77
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java
  4. +70
    -62
      mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java
  5. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java
  6. +2
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java
  7. +0
    -3
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  8. +5
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java
  9. +19
    -13
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java
  10. +11
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java
  11. +4
    -9
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java
  12. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java
  13. +3
    -3
      mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java
  14. +3
    -3
      mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java
  15. +4
    -7
      mallinkService/src/main/java/com/iformall/service/TtCUserService.java
  16. +0
    -7
      mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java
  17. +4
    -5
      mallinkService/src/main/java/com/iformall/service/WxCUserService.java
  18. +2
    -2
      mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java
  19. +2
    -2
      mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java
  20. +4
    -10
      mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java
  21. +2
    -2
      mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java
  22. +4
    -10
      mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java
  23. +8
    -14
      mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java
  24. +0
    -67
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java
  25. +8
    -14
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java
  26. +43
    -36
      mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java
  27. +3
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java
  28. +64
    -87
      mallinkService/src/main/resources/mapper/TtCUserMapper.xml
  29. +0
    -18
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  30. +69
    -91
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml
  31. +6
    -10
      mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml

+ 17
- 1
mallinkAdmin/src/main/java/com/iformall/controller/base/BaseController.java Просмотреть файл

@@ -76,7 +76,23 @@ public class BaseController {
}

/**
* 处理集团新增修改所需租户信息(广场独立修改,集团修改全部)
* 处理集团新增修改所需租户信息(只能取集团数据,积分/成长值/等级)
* 处理集团版 tenantId为空,parentTenantId为集团tenantId
* ifParentUpdateTenantInfo
*/
public TenantEntity getFinalTenantInfo() {
TenantEntity info = this.getTenantInfo();
String tenantId = info.getTenantId();
if(StringUtils.isNotBlank(info.getParentTenantId())){
tenantId = info.getParentTenantId();
}
TenantEntity tenantEntity = new TenantEntity();
tenantEntity.setTenantId(tenantId);
return tenantEntity;
}

/**
* 处理集团新增修改所需租户信息(广场独立修改,集团能修改各广场、自己信息)
* 处理集团版 tenantId为空,parentTenantId为集团tenantId
* ifParentUpdateTenantInfo
*/


+ 5
- 0
mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxChartDataController.java Просмотреть файл

@@ -9,6 +9,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -71,6 +72,10 @@ public class WxChartDataController extends BaseController {
String chart = params.get("chart");
logger.info("[" + getIpAddr() + "] WxChartDataController::queryData chart: " + chart);
TenantEntity tenantEntity = getTenantInfo();
if(StringUtils.isBlank(tenantEntity.getTenantId())){
//todo 集团版查询数据待重构
return new ResultData("集团版查询数据待重构");
}
params.put("tenantId",tenantEntity.getTenantId());
params.put("parentTenantId", tenantEntity.getParentTenantId());
ResultData data = wxChartDataService.queryData(params);


+ 78
- 77
mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStatisticsController.java Просмотреть файл

@@ -11,6 +11,7 @@ import com.iformall.service.*;
import com.iformall.service.cuser.CUserServiceFactory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -44,16 +45,19 @@ public class WxUserStatisticsController extends BaseController {
if(plat == null){
plat = EnumAppPlat.WX.getCode();
}

TenantEntity tenantEntity = getTenantInfo();
List<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,30 +171,65 @@ public class WxUserStatisticsController extends BaseController {

}while (curTime.before(endTime) || curTime.equals(endTime));


if (wxCountList.size() > 0
&& wxCountList.get(0).getTotalCount() != null
&& wxCountList.get(0).getTotalCount() == 0) {
WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto();
pdto.updateTenantInfo(tenantEntity);
pdto.setEndTime(startTime);
wxCountList.get(0).setTotalCount(cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(pdto, tenantEntitys));
}
for (int i = 1; i < wxCountList.size(); i++){
if (wxCountList.get(i).getTotalCount() != null &&
wxCountList.get(i-1).getTotalCount() != null &&
wxCountList.get(i).getTotalCount() < wxCountList.get(i-1).getTotalCount()){
logger.info("修改前"+(i-1)+"=="+wxCountList.get(i-1).getTotalCount());
logger.info("修改前"+i+"=="+wxCountList.get(i).getTotalCount());
wxCountList.get(i).setTotalCount(wxCountList.get(i-1).getTotalCount());
logger.info("修改后"+(i-1)+"=="+wxCountList.get(i-1).getTotalCount());
logger.info("修改后"+i+"=="+wxCountList.get(i).getTotalCount());
for (UserCountVo ucv:wxCountList) {
if(ucv.getIncCount() == null){
ucv.setTotalCount(0l);
}
startTotal += ucv.getIncCount();
ucv.setTotalCount(startTotal);
}

return new ResultData(wxCountList);
}

@ApiOperation("查询会员数量")
@GetMapping("/findBasicUserCount")
@SystemControllerLog(description = "查询会员数量")
public ResultData findBasicUserCount() {
logger.debug("[" + getIpAddr() + "] WxUserStatisticsController::findBasicUserCount");

TenantEntity tenantEntity = getTenantInfo();
// List<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 = "查询会员趋势")
@@ -237,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);
@@ -254,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;
@@ -304,8 +304,9 @@ public class WxUserStatisticsController extends BaseController {
&& memCountList.get(0).getTotalCount() != null
&& memCountList.get(0).getTotalCount() == 0) {
WxCUserBasicInfoDto pdto = new WxCUserBasicInfoDto();
pdto.updateTenantInfo(tenantEntity);
pdto.setEndTime(startTime);
memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(ifParentUpdateTenantInfo(),pdto));
memCountList.get(0).setTotalCount(wxCUserBasicInfoService.findCount(pdto));
}
for (int i = 1; i < memCountList.size(); i++){
if ( memCountList.get(i).getTotalCount() != null &&


+ 70
- 62
mallinkAdmin/src/main/java/com/iformall/controller/datatower/WxUserStructureController.java Просмотреть файл

@@ -65,16 +65,18 @@ public class WxUserStructureController extends BaseController {
@SystemControllerLog(description = "会员管理-查询会员性别结构")
public ResultData findUserSexStructure(Date startTime, Date endTime) {
logger.debug("[" + getIpAddr() + "] WxUserStructureController::findUserSexStructure");
TenantEntity tenantInfo = getTenantInfo();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantInfo);
dto.setStartTime(startTime);
dto.setEndTime(endTime);
//保密
dto.setSex(EnumCUserBaseInfoSex.UNKNOWN.getCode());
long secrecy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto);
long secrecy = wxCUserBasicInfoService.findCountBySex(dto);
dto.setSex(EnumCUserBaseInfoSex.MALE.getCode());
long boy = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto);
long boy = wxCUserBasicInfoService.findCountBySex(dto);
dto.setSex(EnumCUserBaseInfoSex.FEMALE.getCode());
long girl = wxCUserBasicInfoService.findCountBySex(getTenantInfo(),dto);
long girl = wxCUserBasicInfoService.findCountBySex(dto);
Long all = secrecy + boy + girl;
List<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) {


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/FengNiaoMapController.java Просмотреть файл

@@ -29,7 +29,7 @@ public class FengNiaoMapController extends BaseController {
@ApiOperation("查询地图配置")
@GetMapping("/getConfig")
public ResultData getConfig() {
String tenantId = ifParentUpdateTenantInfo().getTenantId();
String tenantId = getTenantInfo().getTenantId();
if (!StringUtils.isBlank(tenantId)) {
try {
FengNiaoMapConfig config = fengNiaoMapService.getConfigByTenantId(tenantId);


+ 2
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCampaignController.java Просмотреть файл

@@ -57,7 +57,7 @@ public class WxCampaignController extends BaseController {
if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) {
wxCampaign.setStatus(null);
}
wxCampaign.updateTenantInfo(ifParentUpdateTenantInfo());
wxCampaign.updateTenantInfo(getTenantInfo());
wxCampaign.setSortColumns(BaseEntity.SortField.CreateTime_DESC,BaseEntity.SortField.Id_DESC);
final PageInfo<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());


+ 0
- 3
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java Просмотреть файл

@@ -57,9 +57,6 @@ public class WxCouponController extends BaseController {
private WxMallService wxMallService;
@Autowired
RedisLock redisLock;
@Autowired
private WxPayAccountService wxPayAccountService;

@ApiOperation("分页列表接口")
@GetMapping("list")


+ 5
- 5
mallinkAdmin/src/main/java/com/iformall/controller/mem/UserBasicInfoAddressController.java Просмотреть файл

@@ -41,7 +41,7 @@ public class UserBasicInfoAddressController extends BaseController {
if(userBasicInfoAddress.getUserId() == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "用户ID为空");
}
userBasicInfoAddress.undateFinalTenantId(ifParentUpdateTenantInfo());
userBasicInfoAddress.undateFinalTenantId(getTenantInfo());
PageInfo<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);
}


+ 19
- 13
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java Просмотреть файл

@@ -93,7 +93,7 @@ public class WxCUserBasicInfoController extends BaseController {
private WxCreditHistoryService wxCreditHistoryService;

private void updateLevelParam(WxCUserBasicInfo info) {
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo());
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(getFinalTenantInfo());
levelList = levelList.stream()
.sorted(Comparator.comparing(WxLevelConfig::getPoints))
.collect(Collectors.toList());
@@ -115,7 +115,7 @@ public class WxCUserBasicInfoController extends BaseController {
info.setLevel(WxLevelConfigService.DEFAULT_LEVEL);
} else {
info.setLevel(WxLevelConfigService.DEFAULT_LEVEL);
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo());
List<WxLevelConfig> levelList = wxLevelConfigService.getByTenantInfo(getFinalTenantInfo());
for (WxLevelConfig levelConfig : levelList) {
if (info.getPoins() >= levelConfig.getPoints()) {
info.setLevel(levelConfig.getLevel());
@@ -191,9 +191,9 @@ public class WxCUserBasicInfoController extends BaseController {
updateLevelParam(wxCUserBasicInfo);
}
}
wxCUserBasicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
wxCUserBasicInfo.undateFinalTenantId(getTenantInfo());
wxCUserBasicInfo.setSortColumns(BaseEntity.SortField.wcubiActiveTime_DESC);
PageInfo<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()) {
@@ -362,9 +362,10 @@ public class WxCUserBasicInfoController extends BaseController {
basicInfo.setName(null);
}
}

basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
int exportDataCount = wxCUserBasicInfoService.exportDataCount(ifParentUpdateTenantInfo(),basicInfo);
TenantEntity tenantInfo = getTenantInfo();
basicInfo.setTenantId(tenantInfo.getTenantId());
basicInfo.setFinalTenantId(tenantInfo.getFinalTenantId());
int exportDataCount = wxCUserBasicInfoService.exportDataCount(basicInfo);
return new ResultData(exportDataCount);


@@ -385,9 +386,10 @@ public class WxCUserBasicInfoController extends BaseController {
basicInfo.setName(null);
}
}

basicInfo.undateFinalTenantId(ifParentUpdateTenantInfo());
wxCUserBasicInfoService.exportData(getTenantInfo(),basicInfo, request, response);
TenantEntity tenantInfo = getTenantInfo();
basicInfo.setTenantId(tenantInfo.getTenantId());
basicInfo.setFinalTenantId(tenantInfo.getFinalTenantId());
wxCUserBasicInfoService.exportData(basicInfo, request, response);
}

@RequestMapping("/exportTemplate")
@@ -620,14 +622,18 @@ public class WxCUserBasicInfoController extends BaseController {
@SystemControllerLog(description = "会员管理-迁移数据")
public ResultData cuserOldToNew(@RequestBody Map<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,"同一个用户");


+ 11
- 6
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserDataController.java Просмотреть файл

@@ -61,10 +61,14 @@ public class WxCUserDataController extends BaseController {
plat = EnumAppPlat.WX.getCode();
}
TenantEntity tenantEntity = getTenantInfo();
List<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);
}



+ 4
- 9
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxLevelConfigController.java Просмотреть файл

@@ -47,14 +47,9 @@ public class WxLevelConfigController extends BaseController {
public ResultData list(@ModelAttribute WxLevelConfig wxLevelConfig, Integer pageNum, Integer pageSize) {
logger.debug("[" + getIpAddr() + "] WxLevelConfigController::list");
if (null == wxLevelConfig) wxLevelConfig = new WxLevelConfig();
TenantEntity tenantEntity = ifParentUpdateTenantInfo();
if(StringUtils.isNotBlank(tenantEntity.getParentTenantId())){
wxLevelConfig.setTenantId(tenantEntity.getParentTenantId());
}else{
wxLevelConfig.setTenantId(tenantEntity.getTenantId());
}
wxLevelConfig.updateTenantInfo(getFinalTenantInfo());
wxLevelConfig.setSortColumns(BaseEntity.SortField.Points_ASC);
final PageInfo<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);


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/mem/WxScoreRulesController.java Просмотреть файл

@@ -37,7 +37,7 @@ public class WxScoreRulesController extends BaseController {
@SystemControllerLog(description = "成长值-配置")
public ResultData list() {
logger.debug("[" + getIpAddr() + "] WxScoreRulesController::list");
WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(ifParentUpdateTenantInfo());
WxScoreRules scoreRules = wxScoreRulesService.getScoreRules(getFinalTenantInfo());
if (scoreRules.getCreditLocked() == null) {
scoreRules.setCreditLocked(EnumCreditLockedStatus.OPEN.getCode());
}


+ 3
- 3
mallinkService/src/main/java/com/iformall/mapper/TtCUserMapper.java Просмотреть файл

@@ -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();



+ 3
- 3
mallinkService/src/main/java/com/iformall/mapper/WxCUserMapper.java Просмотреть файл

@@ -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();



+ 4
- 7
mallinkService/src/main/java/com/iformall/service/TtCUserService.java Просмотреть файл

@@ -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);



+ 0
- 7
mallinkService/src/main/java/com/iformall/service/WxCUserBasicInfoService.java Просмотреть файл

@@ -105,7 +105,6 @@ public interface WxCUserBasicInfoService {
* @return
*/
long findCountBySex(WxCUserBasicInfoDto dto);
long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto);

/**
* 根据年龄查询数量
@@ -115,7 +114,6 @@ public interface WxCUserBasicInfoService {
*/

long findCountByAge(WxCUserBasicInfoDto dto);
long findCountByAge(TenantEntity tenantInfo, WxCUserBasicInfoDto dto);

/**
* 根据年龄积分查寻数量
@@ -124,13 +122,10 @@ public interface WxCUserBasicInfoService {
* @return
*/
long findCountByScore(WxCUserBasicInfoDto dto);
long findCountByScore(TenantEntity tenantInfo,WxCUserBasicInfoDto dto);

int exportDataCount(WxCUserBasicInfo basicInfo);
int exportDataCount(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo);

void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response);
void exportData(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response);


void exportTemplate(HttpServletRequest request, HttpServletResponse response);
@@ -138,10 +133,8 @@ public interface WxCUserBasicInfoService {
void importOneMem(String importKey, List<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


+ 4
- 5
mallinkService/src/main/java/com/iformall/service/WxCUserService.java Просмотреть файл

@@ -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);

/**
* 登录后发消息


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/cuser/CUserServiceApapter.java Просмотреть файл

@@ -42,9 +42,9 @@ public interface CUserServiceApapter {

void updateMsgCount(CUser user);

long findCount(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys);
long findCount(WxCUserBasicInfoDto dto);

List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto, List<TenantEntity> tenantEntitys);
List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto);

void actionAfterLogin(CUser user);



+ 2
- 2
mallinkService/src/main/java/com/iformall/service/cuser/tt/TtBUserServiceAdapter.java Просмотреть файл

@@ -245,12 +245,12 @@ public class TtBUserServiceAdapter extends BasicCUserService implements CUserSer
}

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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;
}



+ 4
- 10
mallinkService/src/main/java/com/iformall/service/cuser/tt/TtCUserServiceAdapter.java Просмотреть файл

@@ -300,19 +300,13 @@ public class TtCUserServiceAdapter extends BasicCUserService implements CUserSer
}

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/cuser/wx/WxBUserServiceAdapter.java Просмотреть файл

@@ -245,12 +245,12 @@ public class WxBUserServiceAdapter extends BasicCUserService implements CUserSer
}

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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;
}



+ 4
- 10
mallinkService/src/main/java/com/iformall/service/cuser/wx/WxCUserServiceAdapter.java Просмотреть файл

@@ -308,19 +308,13 @@ public class WxCUserServiceAdapter extends BasicCUserService implements CUserSer
}

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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


+ 8
- 14
mallinkService/src/main/java/com/iformall/service/impl/TtCUserServiceImpl.java Просмотреть файл

@@ -162,29 +162,23 @@ public class TtCUserServiceImpl implements TtCUserService {
// }

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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


+ 0
- 67
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -767,49 +767,21 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
return wxCUserBasicInfoMapper.findCountBySex(dto);
}

@Override
public long findCountBySex(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) {
dto.setTenantId(tenantInfo.getTenantId());
dto.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCUserBasicInfoMapper.findCountBySex(dto);
}

@Override
public long findCountByAge(WxCUserBasicInfoDto dto) {
return wxCUserBasicInfoMapper.findCountByAge(dto);
}

@Override
public long findCountByAge(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) {
dto.setTenantId(tenantInfo.getTenantId());
dto.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCUserBasicInfoMapper.findCountByAge(dto);
}

@Override
public long findCountByScore(WxCUserBasicInfoDto dto) {
return wxCUserBasicInfoMapper.findCountByScore(dto);
}

@Override
public long findCountByScore(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) {
dto.setTenantId(tenantInfo.getTenantId());
dto.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCUserBasicInfoMapper.findCountByScore(dto);
}

@Override
public int exportDataCount(WxCUserBasicInfo basicInfo) {
return wxCUserBasicInfoMapper.countVoList(basicInfo);
}

@Override
public int exportDataCount(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo) {
basicInfo.setTenantId(tenantInfo.getTenantId());
basicInfo.undateFinalTenantId(tenantInfo);
return wxCUserBasicInfoMapper.countVoList(basicInfo);
}

@Override
public void exportData(WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) {
// List<WxCUserBasicInfoVo> list = wxCUserBasicInfoMapper.findVoList(basicInfo);
@@ -823,31 +795,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
excelService.exportBigExcel(this,basicInfo, null, "会员信息", WxCUserBasicInfoVo.class, "会员信息数据.xlsx", response, false);
}

@Override
public void exportData(TenantEntity tenantInfo, WxCUserBasicInfo basicInfo, HttpServletRequest request, HttpServletResponse response) {
// List<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();
@@ -1183,25 +1130,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc
return wxCUserBasicInfoMapper.findCount(dto);
}

@Override
public long findCount(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) {
dto.setTenantId(tenantInfo.getTenantId());
dto.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCUserBasicInfoMapper.findCount(dto);
}

@Override
public List<UserCountVo> findCountHistory(WxCUserBasicInfoDto dto) {
return wxCUserBasicInfoMapper.findCountHistory(dto);
}

@Override
public List<UserCountVo> findCountHistory(TenantEntity tenantInfo, WxCUserBasicInfoDto dto) {
dto.setTenantId(tenantInfo.getTenantId());
dto.setFinalTenantId(tenantInfo.getFinalTenantId());
return wxCUserBasicInfoMapper.findCountHistory(dto);
}

@Override
public void exportCarPayData(WxCarPayRecord record, HttpServletRequest request, HttpServletResponse response) {
List<WxCarPayRecord> list = wxCarPayRecordMapper.findCarPayList(record);


+ 8
- 14
mallinkService/src/main/java/com/iformall/service/impl/WxCUserServiceImpl.java Просмотреть файл

@@ -224,29 +224,23 @@ public class WxCUserServiceImpl implements WxCUserService {
// }

@Override
public long findCount(WxCUserBasicInfoDto dto, List<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


+ 43
- 36
mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java Просмотреть файл

@@ -1383,11 +1383,11 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getNewUserCount(TenantEntity tenantEntity) {
List<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);
@@ -1398,7 +1398,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long todayCount = wxCUserService.findCount(dto,tenantEntitys);
long todayCount = wxCUserService.findCount(dto);
datamap.put("allCount", allCount);//会员总数
datamap.put("todayCount", todayCount);//今日新增会员数
return new ResultData(datamap);
@@ -1475,7 +1475,7 @@ public class WxChartServiceImpl implements WxChartDataService {
}

private ResultData getNewMemberCount(TenantEntity tenantEntity, int days, String returnName) {
List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
// List<TenantEntity> tenantEntitys = wxMallMapper.getTenantEntitys(tenantEntity);
HashMap<String, Object> datamap = new HashMap<>();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
@@ -1492,7 +1492,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserService.findCount(dto,tenantEntitys);
long count = wxCUserService.findCount(dto);
UserStructureVo vo = new UserStructureVo();
vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime()));
vo.setSortNum(sortNum++);
@@ -1792,12 +1792,12 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemeberWechatTotal(TenantEntity tenantEntity) {
List<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);
@@ -1805,7 +1805,7 @@ public class WxChartServiceImpl implements WxChartDataService {
Date today = c.getTime();
dto.setStartTime(today);
dto.setEndTime(null);
long wxtodayCount = wxCUserService.findCount(dto,tenantEntitys);//今天新增
long wxtodayCount = wxCUserService.findCount(dto);//今天新增
datamap.put("wxallCount", wxallCount);//累计会员总数
datamap.put("wxtodayCount", wxtodayCount);//今日新增会员数
return new ResultData(datamap);
@@ -1819,7 +1819,8 @@ public class WxChartServiceImpl implements WxChartDataService {
private ResultData getMemberTotalCount(TenantEntity tenantEntity) {
HashMap<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);
@@ -1827,7 +1828,7 @@ public class WxChartServiceImpl implements WxChartDataService {
Date today = c.getTime();
dto.setStartTime(today);
dto.setEndTime(null);
long todayCount = wxCUserBasicInfoService.findCount(tenantEntity,dto);//今天新增
long todayCount = wxCUserBasicInfoService.findCount(dto);//今天新增
datamap.put("allCount", allCount);//累计会员总数
datamap.put("todayCount", todayCount);//今日新增会员数
return new ResultData(datamap);
@@ -1839,7 +1840,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemberWechatJoinTrade(TenantEntity tenantEntity) {
List<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();
@@ -1858,7 +1859,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserService.findCount(dto,tenantEntitys);
long count = wxCUserService.findCount(dto);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -1872,7 +1873,7 @@ public class WxChartServiceImpl implements WxChartDataService {
c.add(Calendar.DAY_OF_YEAR, -daysBefore);
dto.setEndTime(c.getTime());
dto.setStartTime(null);
long firstDay = wxCUserService.findCount(dto,tenantEntitys);//统计的第一天总数
long firstDay = wxCUserService.findCount(dto);//统计的第一天总数
int i = 0;
long sumCount = 0;
for (UserStructureVo v : wxnewCountVos) {
@@ -1942,6 +1943,7 @@ public class WxChartServiceImpl implements WxChartDataService {
private ResultData getMemberJoinTrade(TenantEntity tenantEntity) {
HashMap<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);
@@ -1957,7 +1959,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserBasicInfoService.findCount(tenantEntity,dto);
long count = wxCUserBasicInfoService.findCount(dto);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -1971,7 +1973,7 @@ public class WxChartServiceImpl implements WxChartDataService {
c.add(Calendar.DAY_OF_YEAR, -daysBefore);
dto.setEndTime(c.getTime());
dto.setStartTime(null);
long firstDay = wxCUserBasicInfoService.findCount(tenantEntity,dto);//统计的第一天总数
long firstDay = wxCUserBasicInfoService.findCount(dto);//统计的第一天总数
int i = 0;
long sumCount = 0;
for (UserStructureVo v : newCountVos) {
@@ -1993,7 +1995,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getFromChannelAnalysis(TenantEntity tenantEntity) {
List<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();
@@ -2014,7 +2016,7 @@ public class WxChartServiceImpl implements WxChartDataService {
wxCUser.setSceneList(sceneList);
WxUserChannel channelStructure = new WxUserChannel();
channelStructure.setChannelName(w.getChannelName());
channelStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys,wxCUser));
channelStructure.setCount(wxCUserMapper.countByChannel(wxCUser));
channelStructureList.add(channelStructure);
}
}
@@ -2028,7 +2030,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getWechatMemberTrade(TenantEntity tenantEntity) {
List<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();
@@ -2047,7 +2049,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserService.findCount(dto,tenantEntitys);
long count = wxCUserService.findCount(dto);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -2083,7 +2085,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setStartTime(c.getTime());
c.add(Calendar.DAY_OF_YEAR, 1);
dto.setEndTime(c.getTime());
long count = wxCUserBasicInfoService.findCount(tenantEntity,dto);
long count = wxCUserBasicInfoService.findCount(dto);
UserStructureVo vo = new UserStructureVo();
vo.setSortNum(j);
j++;
@@ -2101,7 +2103,7 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getSceneAnalysis(TenantEntity tenantEntity) {
List<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();
@@ -2118,7 +2120,7 @@ public class WxChartServiceImpl implements WxChartDataService {
wxCUser.setSceneList(scene);
WxUserChannel senceStructure = new WxUserChannel();
senceStructure.setDescription(uc.getDescription());
senceStructure.setCount(wxCUserMapper.countByChannel(tenantEntitys, wxCUser));
senceStructure.setCount(wxCUserMapper.countByChannel(wxCUser));
senceStructureList.add(senceStructure);
}
}
@@ -2138,9 +2140,10 @@ public class WxChartServiceImpl implements WxChartDataService {
private ResultData getMemberSexRate(TenantEntity tenantEntity, String startdate, String enddate) {
HashMap<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()) {
@@ -2149,7 +2152,7 @@ public class WxChartServiceImpl implements WxChartDataService {
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
long count = getCountByAge(tenantEntity,a, c, dto);
long count = getCountByAge(a, c, dto);
vos.add(getVo(count, all, a.getDesc(), a.getSortNum()));
}
return new ResultData(datamap);
@@ -2163,13 +2166,12 @@ public class WxChartServiceImpl implements WxChartDataService {
* @return
*/
private ResultData getMemberBindCar(TenantEntity tenantEntity, String startdate, String enddate) {
List<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", "已绑定车牌");
@@ -2203,9 +2205,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()) {
@@ -2214,7 +2217,7 @@ public class WxChartServiceImpl implements WxChartDataService {
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
long count = getCountByAge(tenantEntity,a, c, dto);
long count = getCountByAge(a, c, dto);
vos.add(getVo(count, all, a.getDesc(), a.getSortNum()));
}
return new ResultData(datamap);
@@ -2235,6 +2238,7 @@ public class WxChartServiceImpl implements WxChartDataService {

for (int i = 0; i < levelList.size(); i++) {
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
dto.setStartTime(DateUtils.stringToDate(startdate));
dto.setEndTime(DateUtils.stringToDate(enddate));
if (i + 1 < levelList.size()) {
@@ -2244,7 +2248,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setLevelStartScore(levelList.get(i).getPoints());
}

long all = wxCUserBasicInfoService.findCountByScore(tenantEntity,dto);
long all = wxCUserBasicInfoService.findCountByScore(dto);

levelList.get(i).setCount(all);
}
@@ -2252,7 +2256,8 @@ public class WxChartServiceImpl implements WxChartDataService {
//没有等级的会员
other.setLevel("无");
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
other.setCount(wxCUserBasicInfoService.findCount(tenantEntity,dto)
dto.updateTenantInfo(tenantEntity);
other.setCount(wxCUserBasicInfoService.findCount(dto)
- levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L));
levelList.add(other);
return new ResultData(levelList);
@@ -2267,11 +2272,12 @@ public class WxChartServiceImpl implements WxChartDataService {
*/
private ResultData getMobileBrandAnalysis(TenantEntity tenantEntity, String startdate, String enddate) {
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
Date startTime = DateUtils.stringToDate(startdate);
Date endTime = DateUtils.stringToDate(enddate);
dto.setStartTime(startTime);
dto.setEndTime(endTime);
long total = wxCUserBasicInfoService.findCount(tenantEntity,dto);
long total = wxCUserBasicInfoService.findCount(dto);
List<WxTags> tagList = new ArrayList<>();
EnumTag[] tags = {EnumTag.ID_49,
EnumTag.ID_50,
@@ -2303,11 +2309,12 @@ public class WxChartServiceImpl implements WxChartDataService {
*/
private ResultData getMemActivity(TenantEntity tenantEntity, String startdate, String enddate) {
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
Date startTime = DateUtils.stringToDate(startdate);
Date endTime = DateUtils.stringToDate(enddate);
dto.setStartTime(startTime);
dto.setEndTime(endTime);
long total = wxCUserBasicInfoService.findCount(tenantEntity,dto);
long total = wxCUserBasicInfoService.findCount(dto);
List<WxTags> tagList = new ArrayList<>();
EnumTag[] tags = {
EnumTag.ID_112,
@@ -2689,7 +2696,7 @@ public class WxChartServiceImpl implements WxChartDataService {
}


private long getCountByAge(TenantEntity tenantInfo,EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) {
private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) {
if (a.getStart() != 0 || a.getEnd() != 0) {
c.add(Calendar.YEAR, -a.getEnd());
Date startTime = c.getTime();
@@ -2705,7 +2712,7 @@ public class WxChartServiceImpl implements WxChartDataService {
dto.setBirthEndTime(null);
}

return wxCUserBasicInfoService.findCountByAge(tenantInfo,dto);
return wxCUserBasicInfoService.findCountByAge(dto);
}

private UserStructureVo getVo(long count, long all, String name, Integer num) {


+ 3
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxLevelConfigServiceImpl.java Просмотреть файл

@@ -77,11 +77,12 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService {
l.setScale(WxLevelConfig.DEFAULT_SCALE);
}
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.updateTenantInfo(tenantEntity);
dto.setLevelStartScore(l.getPoints());
if (i + 1<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


+ 64
- 87
mallinkService/src/main/resources/mapper/TtCUserMapper.xml Просмотреть файл

@@ -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 &gt;= 10
select open_id
from tt_c_user
where msg_count &gt;= 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 &lt; 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 &lt; #{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') &lt;= reportTime
</if>
<if test="2 == basicDto.reportType ">
date_format(create_date, '%Y-%m') &lt;= reportTime
</if>
<if test="3 == basicDto.reportType ">
date_format(create_date, '%Y') &lt;= 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 &gt;= #{basicDto.startTime}
</if>
<if test=" null != basicDto.endTime">
and create_date &lt; #{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 &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{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 &gt;= #{ttCUser.startDate}
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
</if>
<if test=" null != ttCUser.endDate">
and create_date &lt; #{ttCUser.endDate}
<if test=" null != endDate">
and create_date &lt; #{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 &gt;= #{ttCUser.startDate}
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
</if>
<if test=" null != ttCUser.endDate">
and create_date &lt; #{ttCUser.endDate}
<if test=" null != endDate">
and create_date &lt; #{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">


+ 0
- 18
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -315,24 +315,6 @@
<if test="3 == reportType ">
date_format(wcubi.create_date, '%Y') as reportTime,
</if>

<if test="1 == reportType or 2 == reportType or 3 == reportType">
(select count(wcubi.id) from wx_c_user_basic_info wcubi
where wcubi.`final_tenant_id` = #{finalTenantId}
<if test=" null != tenantId and '' != tenantId">
and wcubi.`tenant_id` like concat('%,', #{tenantId},',%')
</if>
<if test="1 == reportType ">
and date_format(wcubi.create_date, '%Y-%m-%d') &lt;= reportTime
</if>
<if test="2 == reportType ">
and date_format(wcubi.create_date, '%Y-%m') &lt;= reportTime
</if>
<if test="3 == reportType ">
and date_format(wcubi.create_date, '%Y') &lt;= reportTime
</if>
) as totalCount
</if>
from wx_c_user_basic_info wcubi
where wcubi.`final_tenant_id` = #{finalTenantId}
<if test=" null != tenantId and '' != tenantId">


+ 69
- 91
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -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 &gt;= 10
select open_id
from wx_c_user
where msg_count &gt;= 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 &lt; 10
update wx_c_user
set msg_count = msg_count+2
where msg_count &lt; 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 &lt; #{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') &lt;= reportTime
</if>
<if test="2 == basicDto.reportType ">
date_format(create_date, '%Y-%m') &lt;= reportTime
</if>
<if test="3 == basicDto.reportType ">
date_format(create_date, '%Y') &lt;= 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 &gt;= #{basicDto.startTime}
</if>
<if test=" null != basicDto.endTime">
and create_date &lt; #{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 &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt; #{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 &gt;= #{wxCUser.startDate}
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
</if>
<if test=" null != wxCUser.endDate">
and create_date &lt; #{wxCUser.endDate}
<if test=" null != endDate">
and create_date &lt; #{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 &gt;= #{wxCUser.startDate}
<if test=" null != startDate ">
and create_date &gt;= #{startDate}
</if>
<if test=" null != wxCUser.endDate">
and create_date &lt; #{wxCUser.endDate}
<if test=" null != endDate">
and create_date &lt; #{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">


+ 6
- 10
mallinkService/src/main/resources/mapper/WxLevelConfigMapper.xml Просмотреть файл

@@ -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 &lt;= #{points} ORDER BY points desc LIMIT 1
SELECT `level` FROM `wx_level_config` where tenant_id = #{finalTenantId} and points &lt;= #{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} &gt;=points and tenant_id = #{tenantId} order by points desc limit 1 ;
select `scale` from wx_level_config where tenant_id = #{finalTenantId} and #{points} &gt;=points order by points desc limit 1 ;
</select>

</mapper>

Загрузка…
Отмена
Сохранить