| @@ -3,16 +3,11 @@ package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.po.WxCUser; | |||||
| import com.iformall.domain.po.WxLevelConfig; | |||||
| import com.iformall.domain.po.WxUserChannel; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.vo.UserStructureVo; | import com.iformall.domain.vo.UserStructureVo; | ||||
| import com.iformall.enums.EnumAgeInfo; | import com.iformall.enums.EnumAgeInfo; | ||||
| import com.iformall.enums.EnumCUserBaseInfoSex; | import com.iformall.enums.EnumCUserBaseInfoSex; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxCUserService; | |||||
| import com.iformall.service.WxLevelConfigService; | |||||
| import com.iformall.service.WxUserChannelService; | |||||
| import com.iformall.service.*; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -45,6 +40,9 @@ public class WxUserStructureController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxLevelConfigService wxLevelConfigService; | private WxLevelConfigService wxLevelConfigService; | ||||
| @Autowired | |||||
| private WxCUserCarService wxCUserCarService; | |||||
| @Autowired | @Autowired | ||||
| private WxUserChannelService wxUserChannelService; | private WxUserChannelService wxUserChannelService; | ||||
| @@ -132,6 +130,48 @@ public class WxUserStructureController extends BaseController { | |||||
| return new ResultData(levelList); | return new ResultData(levelList); | ||||
| } | } | ||||
| @ApiOperation("查询会员绑车牌结构") | |||||
| @GetMapping("/findUserCarStructure") | |||||
| public ResultData findCarLevelStructure(Date startTime, Date endTime) { | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||||
| dto.setTenantId(getTenantId()); | |||||
| dto.setStartTime(startTime); | |||||
| dto.setEndTime(endTime); | |||||
| List<Long> idList = wxCUserBasicInfoService.findIdList(dto); | |||||
| WxCUserCar wxCUserCar = new WxCUserCar(); | |||||
| wxCUserCar.setTenantId(getTenantId()); | |||||
| wxCUserCar.setIds(idList); //注:countUser接口通过ids传递user_id list. | |||||
| long userCountWithCar = wxCUserCarService.countUser(wxCUserCar); | |||||
| Map userWithCar = new HashMap(); | |||||
| userWithCar.put("title","已绑定车牌"); | |||||
| userWithCar.put("count",userCountWithCar); | |||||
| long userCountWithoutCar = idList.size()-userCountWithCar; | |||||
| Map userWithoutCar = new HashMap(); | |||||
| userWithoutCar.put("title","未绑定车牌"); | |||||
| userWithoutCar.put("count",userCountWithoutCar); | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||||
| nf.setMinimumFractionDigits(2); | |||||
| if(userCountWithoutCar + userCountWithCar>0) { | |||||
| userWithCar.put("percentage",nf.format(userCountWithCar/new Double(userCountWithoutCar + userCountWithCar).doubleValue())); | |||||
| userWithoutCar.put("percentage",nf.format(userCountWithoutCar/new Double(userCountWithoutCar + userCountWithCar).doubleValue())); | |||||
| } else { | |||||
| userWithCar.put("percentage","--"); | |||||
| userWithoutCar.put("percentage","--"); | |||||
| } | |||||
| List<Map> list = new ArrayList<>(); | |||||
| list.add(userWithCar); | |||||
| list.add(userWithoutCar); | |||||
| return new ResultData(list); | |||||
| } | |||||
| /********************************会员数据**************************************/ | /********************************会员数据**************************************/ | ||||
| @@ -23,4 +23,6 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| long findCount(WxCUserBasicInfoDto dto); | long findCount(WxCUserBasicInfoDto dto); | ||||
| List<Long> findIdList(WxCUserBasicInfoDto dto); | |||||
| } | } | ||||
| @@ -8,10 +8,5 @@ public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | |||||
| List<WxCUserCar> findList(WxCUserCar wxCUserCar); | List<WxCUserCar> findList(WxCUserCar wxCUserCar); | ||||
| Integer countList(WxCUserCar wxCUserCar); | Integer countList(WxCUserCar wxCUserCar); | ||||
| Integer countUser(WxCUserCar wxCUserCar); | |||||
| } | } | ||||
| @@ -98,6 +98,13 @@ public interface WxCUserBasicInfoService { | |||||
| */ | */ | ||||
| long findCountByScore(WxCUserBasicInfoDto dto); | long findCountByScore(WxCUserBasicInfoDto dto); | ||||
| /** | |||||
| * 查找id列表 | |||||
| * | |||||
| * @param dto | |||||
| * @return | |||||
| */ | |||||
| List<Long> findIdList(WxCUserBasicInfoDto dto); | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | ||||
| @@ -33,6 +33,13 @@ public interface WxCUserCarService { | |||||
| */ | */ | ||||
| Integer countUserCar(WxCUserCar record); | Integer countUserCar(WxCUserCar record); | ||||
| /** | |||||
| * 根据实体查询count | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| Integer countUser(WxCUserCar record); | |||||
| /** | /** | ||||
| * 根据实体查询 | * 根据实体查询 | ||||
| * | * | ||||
| @@ -128,13 +128,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| wxCUserBasicInfoMapper.deleteByPrimaryKey(id); | wxCUserBasicInfoMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public long findCountBySex(WxCUserBasicInfoDto dto) { | public long findCountBySex(WxCUserBasicInfoDto dto) { | ||||
| return wxCUserBasicInfoMapper.findCountBySex(dto); | return wxCUserBasicInfoMapper.findCountBySex(dto); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public long findCountByAge(WxCUserBasicInfoDto dto) { | public long findCountByAge(WxCUserBasicInfoDto dto) { | ||||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | return wxCUserBasicInfoMapper.findCountByAge(dto); | ||||
| @@ -145,6 +143,13 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| return wxCUserBasicInfoMapper.findCountByScore(dto); | return wxCUserBasicInfoMapper.findCountByScore(dto); | ||||
| } | } | ||||
| @Override | |||||
| public List<Long> findIdList(WxCUserBasicInfoDto dto) | |||||
| { | |||||
| return wxCUserBasicInfoMapper.findIdList(dto); | |||||
| } | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | ||||
| @@ -35,6 +35,11 @@ public class WxCUserCarServiceImpl implements WxCUserCarService { | |||||
| return wxCUserCarMapper.countList(record); | return wxCUserCarMapper.countList(record); | ||||
| } | } | ||||
| @Override | |||||
| public Integer countUser(WxCUserCar record) { | |||||
| return wxCUserCarMapper.countUser(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCUserCar getOne(WxCUserCar record) { | public WxCUserCar getOne(WxCUserCar record) { | ||||
| List<WxCUserCar> userCarList = wxCUserCarMapper.findList(record); | List<WxCUserCar> userCarList = wxCUserCarMapper.findList(record); | ||||
| @@ -193,5 +193,17 @@ | |||||
| and tenant_id =#{tenantId} | and tenant_id =#{tenantId} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findIdList" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||||
| select id from wx_c_user_basic_info where 1=1 | |||||
| <if test=" null != startTime "> | |||||
| and create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and create_date < #{endTime} | |||||
| </if> | |||||
| <if test="null != tenantId"> | |||||
| and tenant_id =#{tenantId} | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -76,5 +76,18 @@ | |||||
| select count(*) from wx_c_user_car | select count(*) from wx_c_user_car | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="countUser" parameterType="com.iformall.domain.po.WxCUserCar" resultType="java.lang.Integer"> | |||||
| select count(DISTINCT c_user_id) from wx_c_user_car | |||||
| where 1=1 | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and c_user_id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||