|
|
|
@@ -101,13 +101,17 @@ public class WxUserStructureController extends BaseController { |
|
|
|
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
|
|
|
|
dto.setTenantId(getTenantId());
|
|
|
|
dto.setStartTime(startTime);
|
|
|
|
dto.setEndTime(endTime);
|
|
|
|
if (endTime != null) {
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
c.setTime(endTime);
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
endTime = c.getTime();
|
|
|
|
}
|
|
|
|
long allCount = wxCUserService.findCount(dto);//总量
|
|
|
|
//微信用户数据
|
|
|
|
long wxallCount = wxCUserService.findCount(dto);//总量
|
|
|
|
//会员数据
|
|
|
|
Map<String,Object> member=getMemberData(dto);
|
|
|
|
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
@@ -116,8 +120,8 @@ public class WxUserStructureController extends BaseController { |
|
|
|
Date today = c.getTime();
|
|
|
|
dto.setStartTime(today);
|
|
|
|
dto.setEndTime(null);
|
|
|
|
long todayCount = wxCUserService.findCount(dto);//今天新增
|
|
|
|
List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数
|
|
|
|
long wxtodayCount = wxCUserService.findCount(dto);//今天新增
|
|
|
|
List<UserStructureVo> wxnewCountVos = new ArrayList<>();//每日新增会员数
|
|
|
|
int j = 1;
|
|
|
|
for (int i = 29; i >= 0; i--) {
|
|
|
|
c.clear();
|
|
|
|
@@ -132,6 +136,64 @@ public class WxUserStructureController extends BaseController { |
|
|
|
j++;
|
|
|
|
vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime()));
|
|
|
|
vo.setCount(count);
|
|
|
|
wxnewCountVos.add(vo);
|
|
|
|
}
|
|
|
|
List<UserStructureVo> wxallCountVos = new ArrayList<>();//累计会员数
|
|
|
|
c.clear();
|
|
|
|
c.setTime(today);
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -30);
|
|
|
|
dto.setEndTime(c.getTime());
|
|
|
|
dto.setStartTime(null);
|
|
|
|
long firstDay = wxCUserService.findCount(dto);//统计的第一天总数
|
|
|
|
int i = 0;
|
|
|
|
long sumCount = 0;
|
|
|
|
for (UserStructureVo v : wxnewCountVos) {
|
|
|
|
UserStructureVo vo = new UserStructureVo();
|
|
|
|
sumCount += v.getCount();
|
|
|
|
vo.setCount(firstDay + sumCount);
|
|
|
|
vo.setName(v.getName());
|
|
|
|
vo.setSortNum(i + 1);
|
|
|
|
wxallCountVos.add(vo);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("wxallCount", wxallCount);//累计会员总数
|
|
|
|
map.put("wxtodayCount", wxtodayCount);//今日新增会员数
|
|
|
|
map.put("wxallCountVos", wxallCountVos);//累计会员列表( 日期和数量list)
|
|
|
|
map.put("wxnewCountVos", wxnewCountVos);//新增会员列表(日期和数量list)
|
|
|
|
map.putAll(member);
|
|
|
|
return new ResultData(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
private Map<String,Object> getMemberData(WxCUserBasicInfoDto dto) {
|
|
|
|
|
|
|
|
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);
|
|
|
|
Date today = c.getTime();
|
|
|
|
dto.setStartTime(today);
|
|
|
|
dto.setEndTime(null);
|
|
|
|
long todayCount = wxCUserBasicInfoService.findCount(dto);//今天新增
|
|
|
|
List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数
|
|
|
|
int j = 1;
|
|
|
|
for (int i = 29; i >= 0; i--) {
|
|
|
|
c.clear();
|
|
|
|
c.setTime(today);
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, -i);
|
|
|
|
dto.setStartTime(c.getTime());
|
|
|
|
c.add(Calendar.DAY_OF_YEAR, 1);
|
|
|
|
dto.setEndTime(c.getTime());
|
|
|
|
long count = wxCUserBasicInfoService.findCount(dto);
|
|
|
|
UserStructureVo vo = new UserStructureVo();
|
|
|
|
vo.setSortNum(j);
|
|
|
|
j++;
|
|
|
|
vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime()));
|
|
|
|
vo.setCount(count);
|
|
|
|
newCountVos.add(vo);
|
|
|
|
}
|
|
|
|
List<UserStructureVo> allCountVos = new ArrayList<>();//累计会员数
|
|
|
|
@@ -140,7 +202,7 @@ public class WxUserStructureController extends BaseController { |
|
|
|
c.add(Calendar.DAY_OF_YEAR, -30);
|
|
|
|
dto.setEndTime(c.getTime());
|
|
|
|
dto.setStartTime(null);
|
|
|
|
long firstDay = wxCUserService.findCount(dto);//统计的第一天总数
|
|
|
|
long firstDay = wxCUserBasicInfoService.findCount(dto);//统计的第一天总数
|
|
|
|
int i = 0;
|
|
|
|
long sumCount = 0;
|
|
|
|
for (UserStructureVo v : newCountVos) {
|
|
|
|
@@ -152,12 +214,15 @@ public class WxUserStructureController extends BaseController { |
|
|
|
allCountVos.add(vo);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
map.put("allCount", allCount);//累计会员总数
|
|
|
|
map.put("todayCount", todayCount);//今日新增会员数
|
|
|
|
map.put("allCountVos", allCountVos);//累计会员列表( 日期和数量list)
|
|
|
|
map.put("newCountVos", newCountVos);//新增会员列表(日期和数量list)
|
|
|
|
return new ResultData(map);
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("拓客分析")
|
|
|
|
|