|
|
|
@@ -1,6 +1,8 @@ |
|
|
|
package com.simple.controller; |
|
|
|
|
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
@@ -25,6 +27,7 @@ import com.simple.domain.po.WxCUserTags; |
|
|
|
import com.simple.domain.po.WxCoupon; |
|
|
|
import com.simple.domain.po.WxCouponOrder; |
|
|
|
import com.simple.domain.po.WxTags; |
|
|
|
import com.simple.domain.vo.UserStructureVo; |
|
|
|
import com.simple.service.WxCUserBasicInfoService; |
|
|
|
import com.simple.service.WxCUserService; |
|
|
|
import com.simple.service.WxCUserTagsService; |
|
|
|
@@ -194,4 +197,51 @@ public class WxCUserBasicInfoController extends BaseController |
|
|
|
} |
|
|
|
return new ResultData(Result.SUCCESS,"查询成功",page); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("查询会员性别结构") |
|
|
|
@GetMapping("/findUserSexStructure") |
|
|
|
public ResultData findUserSexStructure( |
|
|
|
Date startTime,Date endTime |
|
|
|
) { |
|
|
|
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); |
|
|
|
dto.setStartTime(startTime); |
|
|
|
dto.setEndTime(endTime); |
|
|
|
dto.setSex(0); |
|
|
|
//保密 |
|
|
|
long secrecy = wxCUserBasicInfoService.findCountBySex(dto); |
|
|
|
dto.setSex(1); |
|
|
|
long boy = wxCUserBasicInfoService.findCountBySex(dto); |
|
|
|
dto.setSex(2); |
|
|
|
long girl=wxCUserBasicInfoService.findCountBySex(dto); |
|
|
|
Long all =secrecy+boy+girl; |
|
|
|
List<UserStructureVo> vos = new ArrayList<>(); |
|
|
|
vos.add(getVo(secrecy, all, "保密")); |
|
|
|
vos.add(getVo(boy, all, "男")); |
|
|
|
vos.add(getVo(girl, all, "女")); |
|
|
|
return new ResultData(vos); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("查询会员年龄结构") |
|
|
|
@GetMapping("/findUserSexStructure") |
|
|
|
public ResultData findUserAgeStructure() { |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private UserStructureVo getVo(long count,long all,String name) { |
|
|
|
UserStructureVo vo = new UserStructureVo(); |
|
|
|
vo.setName(name); |
|
|
|
vo.setCount(count+""); |
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance(); |
|
|
|
nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 |
|
|
|
if(all>0) { |
|
|
|
vo.setPercentage(nf.format(new Long(count).doubleValue()/new Long(all).doubleValue())); |
|
|
|
}else { |
|
|
|
vo.setPercentage("0.00%"); |
|
|
|
} |
|
|
|
return vo; |
|
|
|
} |
|
|
|
|
|
|
|
} |