|
|
|
@@ -217,17 +217,19 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
long girl=getCount(dto); |
|
|
|
Long all =secrecy+boy+girl; |
|
|
|
List<UserStructureVo> vos = new ArrayList<>(); |
|
|
|
vos.add(getVo(boy, all, "男")); |
|
|
|
vos.add(getVo(girl, all, "女")); |
|
|
|
vos.add(getVo(secrecy, all, "保密")); |
|
|
|
vos.add(getVo(boy, all, "男",1)); |
|
|
|
vos.add(getVo(girl, all, "女",2)); |
|
|
|
vos.add(getVo(secrecy, all, "保密",3)); |
|
|
|
return new ResultData(vos); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("查询会员年龄结构") |
|
|
|
@GetMapping("/findUserAgeStructure") |
|
|
|
public ResultData findUserAgeStructure() { |
|
|
|
|
|
|
|
long all =wxCUserBasicInfoService.findCountByAge(new WxCuerBasicInfoDto()); |
|
|
|
public ResultData findUserAgeStructure( Date startTime,Date endTime) { |
|
|
|
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); |
|
|
|
dto.setStartTime(startTime); |
|
|
|
dto.setEndTime(endTime); |
|
|
|
long all =wxCUserBasicInfoService.findCountByAge(dto); |
|
|
|
List<UserStructureVo> vos = new ArrayList<>(); |
|
|
|
Calendar c = Calendar.getInstance(); |
|
|
|
for(EnumAgeInfo a:EnumAgeInfo.values()) { |
|
|
|
@@ -236,25 +238,22 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
c.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
c.set(Calendar.MINUTE,0); |
|
|
|
c.set(Calendar.SECOND,0); |
|
|
|
long count = getCountByAge(a, c); |
|
|
|
vos.add(getVo(count, all, a.getDesc())); |
|
|
|
long count = getCountByAge(a, c,dto); |
|
|
|
vos.add(getVo(count, all, a.getDesc(),a.getSortNum())); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
return new ResultData(vos); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private long getCountByAge(EnumAgeInfo a,Calendar c) { |
|
|
|
WxCuerBasicInfoDto dto =new WxCuerBasicInfoDto(); |
|
|
|
private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) { |
|
|
|
c.add(Calendar.YEAR, -a.getEnd()); |
|
|
|
Date startTime = c.getTime(); |
|
|
|
c.clear(); |
|
|
|
c.setTime(startTime); |
|
|
|
c.add(Calendar.YEAR,a.getEnd()-a.getStart()); |
|
|
|
Date endTime = c.getTime(); |
|
|
|
dto.setStartTime(startTime); |
|
|
|
dto.setEndTime(endTime); |
|
|
|
dto.setBirthStartTime(startTime); |
|
|
|
dto.setBirthEndTime(endTime); |
|
|
|
return wxCUserBasicInfoService.findCountByAge(dto); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -266,8 +265,9 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
wxCUserService.findCountBySex(dto); |
|
|
|
} |
|
|
|
|
|
|
|
private UserStructureVo getVo(long count,long all,String name) { |
|
|
|
private UserStructureVo getVo(long count,long all,String name,Integer num) { |
|
|
|
UserStructureVo vo = new UserStructureVo(); |
|
|
|
vo.setSortNum(num); |
|
|
|
vo.setName(name); |
|
|
|
vo.setCount(count+""); |
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
|