|
|
@@ -68,12 +68,17 @@ public class WxCUserDataController extends BaseController { |
|
|
// List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); |
|
|
// List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); |
|
|
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); |
|
|
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); |
|
|
dto.updateTenantInfo(tenantEntity); |
|
|
dto.updateTenantInfo(tenantEntity); |
|
|
long allCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -29); |
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
Date today = c.getTime(); |
|
|
|
|
|
|
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
List<UserStructureVo> list = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCountData(dto); |
|
|
|
|
|
Map<String,Long> countDate = new HashMap<>(); |
|
|
|
|
|
for (UserStructureVo vo:list) { |
|
|
|
|
|
countDate.put(vo.getName(),vo.getCount()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
long todayCount = 0; |
|
|
long todayCount = 0; |
|
|
long yesterdayCount = 0; |
|
|
long yesterdayCount = 0; |
|
|
@@ -83,17 +88,12 @@ public class WxCUserDataController extends BaseController { |
|
|
|
|
|
|
|
|
for (int i = 29, sortNum = 0; i >= 0; i--) { |
|
|
for (int i = 29, sortNum = 0; i >= 0; i--) { |
|
|
c.clear(); |
|
|
c.clear(); |
|
|
c.setTime(today); |
|
|
|
|
|
|
|
|
c.setTime(new Date()); |
|
|
c.add(Calendar.DAY_OF_YEAR, -i); |
|
|
c.add(Calendar.DAY_OF_YEAR, -i); |
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, 1); |
|
|
|
|
|
dto.setEndTime(c.getTime()); |
|
|
|
|
|
long count = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); |
|
|
|
|
|
UserStructureVo vo = new UserStructureVo(); |
|
|
UserStructureVo vo = new UserStructureVo(); |
|
|
|
|
|
|
|
|
vo.setName(new SimpleDateFormat("MM/dd").format(dto.getStartTime())); |
|
|
|
|
|
|
|
|
vo.setName(new SimpleDateFormat("MM/dd").format(c.getTime())); |
|
|
vo.setSortNum(sortNum++); |
|
|
vo.setSortNum(sortNum++); |
|
|
vo.setCount(count); |
|
|
|
|
|
|
|
|
vo.setCount(countDate.get(vo.getName())==null?0:countDate.get(vo.getName())); |
|
|
if (i <= 7) { |
|
|
if (i <= 7) { |
|
|
UserStructureVo vow = new UserStructureVo(); |
|
|
UserStructureVo vow = new UserStructureVo(); |
|
|
vow.setSortNum(vo.getSortNum()); |
|
|
vow.setSortNum(vo.getSortNum()); |
|
|
@@ -128,33 +128,76 @@ public class WxCUserDataController extends BaseController { |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
} |
|
|
} |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
map.put("allCount", allCount);//会员总数 |
|
|
|
|
|
map.put("todayCount", todayCount);//今日新增会员数 |
|
|
|
|
|
map.put("weekVos", weekVos);//月用户增加数列表 |
|
|
|
|
|
|
|
|
map.put("weekVos", weekVos);//周用户增加数列表 |
|
|
map.put("monthVos", monthVos);//月用户增加数列表 |
|
|
map.put("monthVos", monthVos);//月用户增加数列表 |
|
|
map.put("dayPercentage", dayPercentage);//日环比 |
|
|
map.put("dayPercentage", dayPercentage);//日环比 |
|
|
map.put("weekPercentage", weekPercentage); //周同比 |
|
|
|
|
|
|
|
|
map.put("weekPercentage", weekPercentage);//周同比 |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(map); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("findUserAddCount") |
|
|
|
|
|
@ApiOperation("查询用户增长 总数,今日,近一周") |
|
|
|
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询用户增长") |
|
|
|
|
|
public ResultData findUserAddCount(Integer plat) { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAddCount"); |
|
|
|
|
|
if(plat == null){ |
|
|
|
|
|
plat = EnumAppPlat.WX.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
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); |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
c.set(Calendar.MINUTE, 0); |
|
|
|
|
|
c.set(Calendar.SECOND, 0); |
|
|
|
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
long todayCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -7); |
|
|
|
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
long weekCount = cuserFactory.getCUserService(EnumAppPlat.getByCode(plat)).findCount(dto); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
map.put("allCount", allCount);// 用户总数 |
|
|
|
|
|
map.put("todayCount", todayCount);// 今日新增用户 |
|
|
|
|
|
map.put("weekCount", weekCount);// 近一周新增用户 |
|
|
|
|
|
return new ResultData(map); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
long weekVosCount = 0l; |
|
|
|
|
|
for (UserStructureVo us:weekVos) { |
|
|
|
|
|
weekVosCount += us.getCount(); |
|
|
|
|
|
|
|
|
@GetMapping("findBasicUserAddCount") |
|
|
|
|
|
@ApiOperation("查询会员增长 总数,今日,近一周") |
|
|
|
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询会员增长") |
|
|
|
|
|
public ResultData findBasicUserAddCount() { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findBasicUserAddCount"); |
|
|
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
if(StringUtils.isBlank(tenantEntity.getTenantId())){ |
|
|
|
|
|
//todo 集团版查询数据待重构 |
|
|
|
|
|
return new ResultData("集团版查询数据待重构"); |
|
|
} |
|
|
} |
|
|
map.put("weekVosCount", weekVosCount); //周新增会员 |
|
|
|
|
|
|
|
|
|
|
|
//自然增长 |
|
|
|
|
|
//String startdate = DateUtils.getTimeBefore(30, new Date()); |
|
|
|
|
|
//String systemTime = DateUtils.getSystemTime("yyyy-MM-dd"); |
|
|
|
|
|
//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(tenantEntity)); |
|
|
|
|
|
//全部导入的 |
|
|
|
|
|
map.put("importCount", wxCUserBasicInfoService.findImportUserCount(tenantEntity)); |
|
|
|
|
|
//全部 |
|
|
|
|
|
map.put("allHistoryUserCount", wxCUserBasicInfoService.findCount(wxCUserBasicInfoDto)); |
|
|
|
|
|
|
|
|
// List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); |
|
|
|
|
|
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); |
|
|
|
|
|
dto.updateTenantInfo(tenantEntity); |
|
|
|
|
|
long allCount = wxCUserBasicInfoService.findCount(dto); |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
c.set(Calendar.MINUTE, 0); |
|
|
|
|
|
c.set(Calendar.SECOND, 0); |
|
|
|
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
long todayCount = wxCUserBasicInfoService.findCount(dto); |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -7); |
|
|
|
|
|
dto.setStartTime(c.getTime()); |
|
|
|
|
|
long weekCount = wxCUserBasicInfoService.findCount(dto);; |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
map.put("allCount", allCount);// 会员总数 |
|
|
|
|
|
map.put("todayCount", todayCount);// 今日新增会员 |
|
|
|
|
|
map.put("weekCount", weekCount);// 近一周新增会员 |
|
|
return new ResultData(map); |
|
|
return new ResultData(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -171,7 +214,7 @@ public class WxCUserDataController extends BaseController { |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
Date endTime = c.getTime(); |
|
|
Date endTime = c.getTime(); |
|
|
c.add(Calendar.DAY_OF_YEAR, -30); |
|
|
|
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -28); |
|
|
Date startTime = c.getTime(); |
|
|
Date startTime = c.getTime(); |
|
|
params.put("startTime", startTime); |
|
|
params.put("startTime", startTime); |
|
|
params.put("endTime", endTime); |
|
|
params.put("endTime", endTime); |
|
|
@@ -191,15 +234,8 @@ public class WxCUserDataController extends BaseController { |
|
|
List<UserStructureVo> weekVos = new ArrayList<>();//每周uv |
|
|
List<UserStructureVo> weekVos = new ArrayList<>();//每周uv |
|
|
List<UserStructureVo> monthVos = new ArrayList<>();//每月uv |
|
|
List<UserStructureVo> monthVos = new ArrayList<>();//每月uv |
|
|
|
|
|
|
|
|
//今日活跃数 |
|
|
|
|
|
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
|
|
|
|
|
params.put("startTime",today+" 00:00:00"); |
|
|
|
|
|
params.put("endTime",today+" 23:59:59"); |
|
|
|
|
|
long todayVisitCount = wxUserVisitService.queryVisitUv(params); |
|
|
|
|
|
|
|
|
|
|
|
long yesterdayCount = 0;//昨天活跃数 |
|
|
long yesterdayCount = 0;//昨天活跃数 |
|
|
long beforeYesterdayCount = 0;//前天活跃数 |
|
|
long beforeYesterdayCount = 0;//前天活跃数 |
|
|
long thisMonthCount = 0;//月总数 |
|
|
|
|
|
long dayOfWeekCount = 0;//上周周x数 |
|
|
long dayOfWeekCount = 0;//上周周x数 |
|
|
for (int i = 29, sortNum = 0; i >= 0; i--) { |
|
|
for (int i = 29, sortNum = 0; i >= 0; i--) { |
|
|
c.clear(); |
|
|
c.clear(); |
|
|
@@ -237,7 +273,6 @@ public class WxCUserDataController extends BaseController { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
monthVos.add(vo); |
|
|
monthVos.add(vo); |
|
|
thisMonthCount += vo.getCount(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
@@ -253,49 +288,68 @@ public class WxCUserDataController extends BaseController { |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
} |
|
|
} |
|
|
Map<String, Object> mapVo = new HashMap<>(); |
|
|
Map<String, Object> mapVo = new HashMap<>(); |
|
|
mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 |
|
|
|
|
|
mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 |
|
|
|
|
|
|
|
|
// mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 |
|
|
|
|
|
// mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 |
|
|
mapVo.put("weekVos", weekVos);//周活跃数列表 |
|
|
mapVo.put("weekVos", weekVos);//周活跃数列表 |
|
|
mapVo.put("monthVos", monthVos);//月活跃数列表 |
|
|
mapVo.put("monthVos", monthVos);//月活跃数列表 |
|
|
mapVo.put("dayPercentage", dayPercentage);//日环比 |
|
|
mapVo.put("dayPercentage", dayPercentage);//日环比 |
|
|
mapVo.put("weekPercentage", weekPercentage); //周同比 |
|
|
mapVo.put("weekPercentage", weekPercentage); //周同比 |
|
|
|
|
|
return new ResultData(mapVo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
mapVo.put("todayVisitCount", todayVisitCount); //今日活跃数 |
|
|
|
|
|
long weekVosCount = 0l; |
|
|
|
|
|
for (UserStructureVo us:weekVos) { |
|
|
|
|
|
weekVosCount += us.getCount(); |
|
|
|
|
|
|
|
|
@ApiOperation("查询微信用户活跃数量 昨日活跃,近一周活跃,近一月活跃") |
|
|
|
|
|
@GetMapping("findUserVisitCount") |
|
|
|
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询微信用户活跃数量") |
|
|
|
|
|
public ResultData findUserVisitCount() { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserVisitCount"); |
|
|
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
HashMap<String, Object> params = new HashMap<>(); |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -1); |
|
|
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
c.set(Calendar.MINUTE, 0); |
|
|
|
|
|
c.set(Calendar.SECOND, 0); |
|
|
|
|
|
params.put("startTime", c.getTime()); |
|
|
|
|
|
params.put("tenantId", tenantEntity.getTenantId()); |
|
|
|
|
|
if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { |
|
|
|
|
|
params.put("parentTenantId", tenantEntity.getParentTenantId()); |
|
|
} |
|
|
} |
|
|
mapVo.put("weekVosCount", weekVosCount);//周活跃数总数 |
|
|
|
|
|
|
|
|
//昨日活跃数 |
|
|
|
|
|
long yesterdayCount = wxUserVisitService.queryVisitUv(params); |
|
|
|
|
|
//近一周活跃 |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -6); |
|
|
|
|
|
params.put("startTime", c.getTime()); |
|
|
|
|
|
long weekCount = wxUserVisitService.queryVisitUv(params); |
|
|
|
|
|
//近一月活跃 |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -22); |
|
|
|
|
|
params.put("startTime", c.getTime()); |
|
|
|
|
|
long monthCount = wxUserVisitService.queryVisitUv(params); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> mapVo = new HashMap<>(); |
|
|
|
|
|
mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 |
|
|
|
|
|
mapVo.put("weekCount", weekCount);//周活跃数总数 |
|
|
|
|
|
mapVo.put("monthCount", monthCount);//近一个月活跃数 |
|
|
return new ResultData(mapVo); |
|
|
return new ResultData(mapVo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ApiOperation("查询用户消费金额") |
|
|
@ApiOperation("查询用户消费金额") |
|
|
@GetMapping("findUserAmountData") |
|
|
@GetMapping("findUserAmountData") |
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询用户消费金额") |
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询用户消费金额") |
|
|
public ResultData findUserAmountData(Integer plat) { |
|
|
|
|
|
|
|
|
public ResultData findUserAmountData() { |
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); |
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserAmountData"); |
|
|
if(plat == null){ |
|
|
|
|
|
plat = EnumAppPlat.WX.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
if(StringUtils.isBlank(tenantEntity.getTenantId())){ |
|
|
|
|
|
//todo 集团版查询数据待重构 |
|
|
|
|
|
return new ResultData("集团版查询数据待重构"); |
|
|
|
|
|
} |
|
|
Calendar c = Calendar.getInstance(); |
|
|
Calendar c = Calendar.getInstance(); |
|
|
Date today = c.getTime(); |
|
|
Date today = c.getTime(); |
|
|
c.add(Calendar.DAY_OF_YEAR, 1); |
|
|
c.add(Calendar.DAY_OF_YEAR, 1); |
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.MINUTE, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
c.set(Calendar.SECOND, 0); |
|
|
Date endTime = c.getTime();//明天0点 |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 |
|
|
|
|
|
Date startTime = c.getTime(); |
|
|
|
|
|
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); |
|
|
|
|
|
WxCouponOrder wxCouponOrder = new WxCouponOrder(); |
|
|
|
|
|
wxCouponOrder.updateTenantInfo(tenantEntity); |
|
|
|
|
|
wxCouponOrder.setStartTime(startTime); |
|
|
|
|
|
wxCouponOrder.setEndTime(endTime); |
|
|
|
|
|
int thisMonthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys);//月消费金额 |
|
|
|
|
|
c.clear(); |
|
|
|
|
|
c.setTime(endTime); |
|
|
|
|
|
Date eTime = c.getTime(); |
|
|
|
|
|
|
|
|
Date eTime = c.getTime();//明天0点 |
|
|
|
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -30); |
|
|
c.add(Calendar.DAY_OF_YEAR, -30); |
|
|
Date sTime = c.getTime(); |
|
|
Date sTime = c.getTime(); |
|
|
List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantEntity, sTime, eTime); |
|
|
List<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantEntity, sTime, eTime); |
|
|
@@ -356,10 +410,6 @@ public class WxCUserDataController extends BaseController { |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
weekPercentage = nf.format(count.doubleValue() / new Double(dayOfWeekCount).doubleValue()); |
|
|
} |
|
|
} |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
DecimalFormat df = new DecimalFormat("0.00"); |
|
|
|
|
|
map.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 |
|
|
|
|
|
String thisMonthCountStr = df.format((float) thisMonthCount / 100); |
|
|
|
|
|
map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 |
|
|
|
|
|
map.put("dayPercentage", dayPercentage);//日环比 |
|
|
map.put("dayPercentage", dayPercentage);//日环比 |
|
|
map.put("weekPercentage", weekPercentage); //周同比 |
|
|
map.put("weekPercentage", weekPercentage); //周同比 |
|
|
map.put("weekVos", weekVos);//一周金额列表 |
|
|
map.put("weekVos", weekVos);//一周金额列表 |
|
|
@@ -367,6 +417,43 @@ public class WxCUserDataController extends BaseController { |
|
|
return new ResultData(map); |
|
|
return new ResultData(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("查询用户消费金额 今日,周,月") |
|
|
|
|
|
@GetMapping("findUserConsumeAmount") |
|
|
|
|
|
@SystemControllerLog(description = "会员首页-报表数据-查询用户消费金额") |
|
|
|
|
|
public ResultData findUserConsumeAmount() { |
|
|
|
|
|
logger.debug("[" + getIpAddr() + "] WxCUserDataController::findUserConsumeAmount"); |
|
|
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
|
|
if(StringUtils.isBlank(tenantEntity.getTenantId())){ |
|
|
|
|
|
//todo 集团版查询数据待重构 |
|
|
|
|
|
return new ResultData("集团版查询数据待重构"); |
|
|
|
|
|
} |
|
|
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
|
|
c.set(Calendar.MINUTE, 0); |
|
|
|
|
|
c.set(Calendar.SECOND, 0); |
|
|
|
|
|
List<TenantEntity> tenantEntitys = wxMallService.getTenantEntitys(tenantEntity); |
|
|
|
|
|
WxCouponOrder wxCouponOrder = new WxCouponOrder(); |
|
|
|
|
|
wxCouponOrder.updateTenantInfo(tenantEntity); |
|
|
|
|
|
wxCouponOrder.setStartTime(c.getTime()); |
|
|
|
|
|
//今日消费金额 |
|
|
|
|
|
int todayCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys); |
|
|
|
|
|
//周交易金额 |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -7); |
|
|
|
|
|
wxCouponOrder.setStartTime(c.getTime()); |
|
|
|
|
|
int weekCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys); |
|
|
|
|
|
//月交易金额 |
|
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -22); |
|
|
|
|
|
wxCouponOrder.setStartTime(c.getTime()); |
|
|
|
|
|
int monthCount = wxCouponOrderService.queryPriceTotal(wxCouponOrder,tenantEntitys); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00"); |
|
|
|
|
|
map.put("todayCount", df.format((float) todayCount / 100));//今日消费金额 |
|
|
|
|
|
map.put("weekCount", df.format((float) weekCount / 100));//近一周消费金额 |
|
|
|
|
|
map.put("monthCount", df.format((float) monthCount / 100));//近一个月消费金额数 |
|
|
|
|
|
return new ResultData(map); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|