| @@ -130,29 +130,31 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); | ||||
| if (info != null && info.getTagId() != null) { | |||||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||||
| WxTags wxTags = new WxTags(); | |||||
| wxTags.setIds(ids); | |||||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||||
| String tagNames = ""; | |||||
| String tagIds = ""; | |||||
| List<Long> tagIdList = new ArrayList<>(); | |||||
| for (WxTags wt : page.getList()) { | |||||
| tagNames += wt.getName() + "/"; | |||||
| tagIds += wt.getId() + ","; | |||||
| tagIdList.add(wt.getId()); | |||||
| if (info != null) { | |||||
| if (info.getTagId() != null) { | |||||
| WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); | |||||
| if (StringUtils.isNotBlank(uTag.getTags())) { | |||||
| List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class); | |||||
| WxTags wxTags = new WxTags(); | |||||
| wxTags.setIds(ids); | |||||
| PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000); | |||||
| String tagNames = ""; | |||||
| String tagIds = ""; | |||||
| List<Long> tagIdList = new ArrayList<>(); | |||||
| for (WxTags wt : page.getList()) { | |||||
| tagNames += wt.getName() + "/"; | |||||
| tagIds += wt.getId() + ","; | |||||
| tagIdList.add(wt.getId()); | |||||
| } | |||||
| if (StringUtils.isNotBlank(tagNames)) { | |||||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||||
| } | |||||
| if (StringUtils.isNoneBlank(tagIds)) { | |||||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||||
| } | |||||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||||
| info.setCount(count); | |||||
| } | } | ||||
| if (StringUtils.isNotBlank(tagNames)) { | |||||
| info.setTagNames(tagNames.substring(0, tagNames.length() - 1)); | |||||
| } | |||||
| if (StringUtils.isNoneBlank(tagIds)) { | |||||
| info.setTagIds(tagIds.substring(0, tagIds.length() - 1)); | |||||
| } | |||||
| long count = wxCUserTagsService.findCountByTag(tagIdList); | |||||
| info.setCount(count); | |||||
| } | } | ||||
| } else { | } else { | ||||
| info = new WxCUserBasicInfo(); | info = new WxCUserBasicInfo(); | ||||
| @@ -42,63 +42,62 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| /*微信用户绑定的手机号**/ | |||||
| /**微信用户绑定的手机号**/ | |||||
| @Excel(name="手机",width = 20,orderNum = "2") | @Excel(name="手机",width = 20,orderNum = "2") | ||||
| @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") | ||||
| @NotNull | @NotNull | ||||
| private String phone; | private String phone; | ||||
| /*出生日期**/ | |||||
| /**出生日期**/ | |||||
| @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") | @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") | ||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") | ||||
| private Date birthdate; | private Date birthdate; | ||||
| /*学历**/ | |||||
| /**学历**/ | |||||
| @Excel(name="学历",width = 20,orderNum = "4") | @Excel(name="学历",width = 20,orderNum = "4") | ||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | @io.swagger.annotations.ApiModelProperty(value="学历",name="education") | ||||
| private String education; | private String education; | ||||
| /*性别:0:保密 1.男 2女**/ | |||||
| /**性别:0:保密 1.男 2女**/ | |||||
| @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") | ||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") | ||||
| private Integer sex; | private Integer sex; | ||||
| /*邮箱**/ | |||||
| /**邮箱**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") | @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") | ||||
| private String email; | private String email; | ||||
| /*地址**/ | |||||
| /**地址**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | @io.swagger.annotations.ApiModelProperty(value="地址",name="address") | ||||
| private String address; | private String address; | ||||
| /*积分**/ | |||||
| /**积分**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="poins") | @io.swagger.annotations.ApiModelProperty(value="积分",name="poins") | ||||
| private Integer poins; | private Integer poins; | ||||
| /*标签**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="标签",name="tagId") | |||||
| /**用户标签**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") | |||||
| private Long tagId; | private Long tagId; | ||||
| /*创建时间**/ | |||||
| /**创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| /*更新时间**/ | |||||
| /**更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*租户id**/ | |||||
| /**租户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | ||||
| private String tenantId; | private String tenantId; | ||||
| /*用户姓名**/ | |||||
| /**用户姓名**/ | |||||
| @Excel(name="姓名",width = 20) | @Excel(name="姓名",width = 20) | ||||
| @NotNull | @NotNull | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") | ||||
| private String name; | private String name; | ||||
| /*会员等级**/ | |||||
| /**会员等级**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") | @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") | ||||
| private String level; | private String level; | ||||
| /*用户昵称**/ | |||||
| /**用户昵称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") | ||||
| private String nickName; | private String nickName; | ||||
| @Transient | @Transient | ||||
| private String tagIds; | private String tagIds; | ||||
| @Transient | @Transient | ||||
| @@ -138,7 +137,7 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| this.tagNames = tagNames; | this.tagNames = tagNames; | ||||
| } | } | ||||
| public String getTagIds() { | public String getTagIds() { | ||||
| return tagIds; | return tagIds; | ||||
| } | } | ||||
| @@ -11,10 +11,6 @@ import java.util.Map; | |||||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | ||||
| List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| List<WxCUserBasicInfo> list(WxCUserBasicInfoDto record); | |||||
| void updateScore(WxCUserBasicInfo record); | void updateScore(WxCUserBasicInfo record); | ||||
| @@ -24,6 +20,4 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S | |||||
| long findCountByAge(WxCUserBasicInfoDto dto); | long findCountByAge(WxCUserBasicInfoDto dto); | ||||
| List<Map<String,Object>> findListMap(WxCUserBasicInfoDto record); | |||||
| } | } | ||||
| @@ -17,8 +17,8 @@ public interface WxCUserBasicInfoService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); | ||||
| @@ -77,9 +77,6 @@ public interface WxCUserBasicInfoService { | |||||
| */ | */ | ||||
| long findCountByAge(WxCUserBasicInfoDto dto); | long findCountByAge(WxCUserBasicInfoDto dto); | ||||
| PageInfo<Map<String, Object>> queryListMap(WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize); | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | ||||
| void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); | void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); | ||||
| @@ -103,23 +103,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| return wxCUserBasicInfoMapper.findCountByAge(dto); | return wxCUserBasicInfoMapper.findCountByAge(dto); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<Map<String, Object>> queryListMap(WxCUserBasicInfoDto record, Integer pageNum, Integer pageSize) { | |||||
| return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findListMap(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| WxCUser wxCUser = new WxCUser(); | |||||
| wxCUser.setTenantId(tenantId); | |||||
| List<WxCUser> userlist = wxCUserMapper.findList(wxCUser); | |||||
| WxCUserBasicInfoDto basicInfoDto = new WxCUserBasicInfoDto(); | |||||
| basicInfoDto.setTenantId(tenantId); | |||||
| List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.list(basicInfoDto); | |||||
| WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); | |||||
| basicInfoQ.setTenantId(tenantId); | |||||
| List<WxCUserBasicInfo> memberlist = wxCUserBasicInfoMapper.findList(basicInfoQ); | |||||
| XSSFWorkbook workbook; | XSSFWorkbook workbook; | ||||
| String filepath = "./uploads/"; | String filepath = "./uploads/"; | ||||
| @@ -132,60 +120,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| try { | try { | ||||
| File file = new File(filepath); | File file = new File(filepath); | ||||
| workbook = new XSSFWorkbook(); | workbook = new XSSFWorkbook(); | ||||
| XSSFSheet sheetOne = workbook.createSheet("微信关注用户"); | |||||
| Row row = sheetOne.createRow(0); | |||||
| Cell openIdCell = row.createCell(0); | |||||
| Cell nickNameCell = row.createCell(1); | |||||
| Cell phoneCell = row.createCell(2); | |||||
| Cell genderCell = row.createCell(3); | |||||
| Cell cityCell = row.createCell(4); | |||||
| Cell provinceCell = row.createCell(5); | |||||
| Cell languageCell = row.createCell(6); | |||||
| Cell countryCodeCell = row.createCell(7); | |||||
| Cell registerIpCell = row.createCell(8); | |||||
| Cell sceneadressCell = row.createCell(9); | |||||
| openIdCell.setCellValue("openId"); | |||||
| nickNameCell.setCellValue("昵称"); | |||||
| phoneCell.setCellValue("手机"); | |||||
| genderCell.setCellValue("性别"); | |||||
| cityCell.setCellValue("城市"); | |||||
| provinceCell.setCellValue("省份"); | |||||
| languageCell.setCellValue("语言"); | |||||
| countryCodeCell.setCellValue("国家代码"); | |||||
| registerIpCell.setCellValue("注册IP"); | |||||
| sceneadressCell.setCellValue("场景值"); | |||||
| for (int i = 0; i < userlist.size(); i++) { | |||||
| row = sheetOne.createRow(i + 1); | |||||
| openIdCell = row.createCell(0); | |||||
| nickNameCell = row.createCell(1); | |||||
| phoneCell = row.createCell(2); | |||||
| genderCell = row.createCell(3); | |||||
| cityCell = row.createCell(4); | |||||
| provinceCell = row.createCell(5); | |||||
| languageCell = row.createCell(6); | |||||
| countryCodeCell = row.createCell(7); | |||||
| registerIpCell = row.createCell(8); | |||||
| sceneadressCell = row.createCell(9); | |||||
| WxCUser entity = userlist.get(i); | |||||
| openIdCell.setCellValue(entity.getOpenId()); | |||||
| nickNameCell.setCellValue(entity.getNickName()); | |||||
| phoneCell.setCellValue(entity.getPhone()); | |||||
| genderCell.setCellValue(entity.getGender()); | |||||
| cityCell.setCellValue(entity.getCity()); | |||||
| provinceCell.setCellValue(entity.getProvince()); | |||||
| languageCell.setCellValue(entity.getLanguage()); | |||||
| countryCodeCell.setCellValue(entity.getCountryCode()); | |||||
| registerIpCell.setCellValue(entity.getRegisterIp()); | |||||
| sceneadressCell.setCellValue(entity.getSceneAddress()); | |||||
| } | |||||
| XSSFSheet sheetTwo = workbook.createSheet("会员信息"); | XSSFSheet sheetTwo = workbook.createSheet("会员信息"); | ||||
| Row rowtwo = sheetTwo.createRow(0); | Row rowtwo = sheetTwo.createRow(0); | ||||
| Cell nameCellTwo = rowtwo.createCell(0); | Cell nameCellTwo = rowtwo.createCell(0); | ||||
| @@ -214,12 +148,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| nameCellTwo.setCellValue(entity.getName()); | nameCellTwo.setCellValue(entity.getName()); | ||||
| phoneCellTwo.setCellValue(entity.getPhone()); | phoneCellTwo.setCellValue(entity.getPhone()); | ||||
| String sexStr = "保密"; | |||||
| if (entity.getSex() == 1) | |||||
| sexStr = "男"; | |||||
| else if (entity.getSex() == 2) | |||||
| sexStr = "女"; | |||||
| sexCellTwo.setCellValue(sexStr); | |||||
| sexCellTwo.setCellValue(entity.getSex()); | |||||
| birthdateCellTwo.setCellValue(entity.getBirthdate()); | birthdateCellTwo.setCellValue(entity.getBirthdate()); | ||||
| educationCellTwo.setCellValue(entity.getEducation()); | educationCellTwo.setCellValue(entity.getEducation()); | ||||
| } | } | ||||
| @@ -99,34 +99,6 @@ | |||||
| cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name | cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name | ||||
| </sql> | </sql> | ||||
| <select id="list" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allUserColumns"/> | |||||
| from wx_c_user c | |||||
| left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id | |||||
| where 1=1 | |||||
| <if test=" null != tenantId "> | |||||
| and c.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != phone and phone !='' "> | |||||
| and c.`phone` = #{phone} | |||||
| </if> | |||||
| <if test=" null == phone or phone =='' "> | |||||
| and c.`phone` is not null | |||||
| </if> | |||||
| <if test=" null != startTime "> | |||||
| and cb.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and cb.update_date <= #{endTime} | |||||
| </if> | |||||
| <if test=" null != name and name != '' "> | |||||
| and cb.`name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| </select> | |||||
| <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | <update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo"> | ||||
| update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} | update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} | ||||
| and id=#{cUserId} | and id=#{cUserId} | ||||
| @@ -164,36 +136,5 @@ | |||||
| and birthdate <= #{birthEndTime} | and birthdate <= #{birthEndTime} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findListMap" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="hashmap"> | |||||
| select cu.id,cu.tenant_id tenantId,cu.open_id openId,cu.union_id unionId, | |||||
| cu.nick_name nickName,cu.gender,cu.avatar_url avatarUrl,cubi.phone, | |||||
| cu.pure_phone purePhone,cu.city,cu.province,cu.`language`,cu.country_code countryCode, | |||||
| cu.register_ip registerIp,cu.verify_code_phone verifyCodePhone,cu.qrcode_source qrcodeSource, | |||||
| cu.scene,cu.scene_address sceneAddress,cu.score,cu.update_date updateDate, | |||||
| cu.create_date createDate,cu.app_id appId,cu.session_key sessionKey,cu.token, | |||||
| cu.expire_time expireTime,cu.latitude,cu.longitude,cubi.birthdate,cubi.education, | |||||
| cubi.sex,cubi.email,cubi.address,cubi.poins,cubi.`name`,cubi.`level`,cubi.id cubiid | |||||
| from wx_c_user cu right join wx_c_user_basic_info cubi | |||||
| on cu.phone=cubi.phone and cu.tenant_id=cubi.tenant_id | |||||
| where 1=1 | |||||
| <if test=" null != tenantId "> | |||||
| and cubi.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != phone and phone !='' "> | |||||
| and cubi.`phone` = #{phone} | |||||
| </if> | |||||
| <if test=" null != startTime "> | |||||
| and cubi.create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and cubi.update_date <= #{endTime} | |||||
| </if> | |||||
| <if test=" null != name and name != '' "> | |||||
| and cubi.`name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||