From 0c5dc72d47e680fd63cd09ae0b5fa409e5fd12b4 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 13 Sep 2018 15:41:21 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E4=BF=A1=E6=81=AF][?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D]:=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E9=A2=98=E5=8F=8A=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98,=E4=BB=A5=E5=8F=8A=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BB=A5=E5=8F=8A=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxCUserBasicInfoController.java | 46 +++++------ .../simple/domain/po/WxCUserBasicInfo.java | 39 +++++---- .../simple/mapper/WxCUserBasicInfoMapper.java | 6 -- .../service/WxCUserBasicInfoService.java | 7 +- .../impl/WxCUserBasicInfoServiceImpl.java | 79 +------------------ .../mapper/WxCUserBasicInfoMapper.xml | 59 -------------- 6 files changed, 49 insertions(+), 187 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java index 41c8e1ef5..a10e4a5f4 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java @@ -130,29 +130,31 @@ public class WxCUserBasicInfoController extends BaseController { @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id); - if (info != null && info.getTagId() != null) { - WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId()); - if (StringUtils.isNotBlank(uTag.getTags())) { - List ids = JSONObject.parseArray(uTag.getTags(), Long.class); - WxTags wxTags = new WxTags(); - wxTags.setIds(ids); - PageInfo page = wxTagsService.listAsPage(wxTags, 1, 5000); - String tagNames = ""; - String tagIds = ""; - List 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 ids = JSONObject.parseArray(uTag.getTags(), Long.class); + WxTags wxTags = new WxTags(); + wxTags.setIds(ids); + PageInfo page = wxTagsService.listAsPage(wxTags, 1, 5000); + String tagNames = ""; + String tagIds = ""; + List 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 { info = new WxCUserBasicInfo(); diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index 0debb147e..9ad94f356 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -42,63 +42,62 @@ public class WxCUserBasicInfo implements Serializable { this.ids = ids; } - - - /*微信用户绑定的手机号**/ + + /**微信用户绑定的手机号**/ @Excel(name="手机",width = 20,orderNum = "2") @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") @NotNull private String phone; - /*出生日期**/ + /**出生日期**/ @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") @NotNull @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") private Date birthdate; - /*学历**/ + /**学历**/ @Excel(name="学历",width = 20,orderNum = "4") @NotNull @io.swagger.annotations.ApiModelProperty(value="学历",name="education") private String education; - /*性别:0:保密 1.男 2女**/ + /**性别:0:保密 1.男 2女**/ @Excel(name="性别",width = 20,replace = { "保密_0", "男_1","女_2"},orderNum = "2") @NotNull @io.swagger.annotations.ApiModelProperty(value="性别:0:保密 1.男 2女",name="sex") private Integer sex; - /*邮箱**/ + /**邮箱**/ @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") private String email; - /*地址**/ + /**地址**/ @io.swagger.annotations.ApiModelProperty(value="地址",name="address") private String address; - /*积分**/ + /**积分**/ @io.swagger.annotations.ApiModelProperty(value="积分",name="poins") private Integer poins; - /*标签**/ - @io.swagger.annotations.ApiModelProperty(value="标签",name="tagId") + /**用户标签**/ + @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") private Long tagId; - /*创建时间**/ + /**创建时间**/ @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; - /*更新时间**/ + /**更新时间**/ @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; - /*租户id**/ + /**租户id**/ @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") private String tenantId; - /*用户姓名**/ + /**用户姓名**/ @Excel(name="姓名",width = 20) @NotNull @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") private String name; - - /*会员等级**/ + + /**会员等级**/ @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") private String level; - /*用户昵称**/ + /**用户昵称**/ @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") private String nickName; - + @Transient private String tagIds; @Transient @@ -138,7 +137,7 @@ public class WxCUserBasicInfo implements Serializable { this.tagNames = tagNames; } - + public String getTagIds() { return tagIds; } diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java index 9253f7268..4705fc127 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java @@ -11,10 +11,6 @@ import java.util.Map; public interface WxCUserBasicInfoMapper extends CommonMapper { List findList(WxCUserBasicInfo wxCUserBasicInfo); - - - - List list(WxCUserBasicInfoDto record); void updateScore(WxCUserBasicInfo record); @@ -24,6 +20,4 @@ public interface WxCUserBasicInfoMapper extends CommonMapper> findListMap(WxCUserBasicInfoDto record); - } diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java index 443a8333a..2a680a346 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java @@ -17,8 +17,8 @@ public interface WxCUserBasicInfoService { * 根据实体查询分页列表 * * @param record - * @param offset - * @param limit + * @param pageIndex + * @param pageSize * @return */ PageInfo listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize); @@ -77,9 +77,6 @@ public interface WxCUserBasicInfoService { */ long findCountByAge(WxCUserBasicInfoDto dto); - - PageInfo> queryListMap(WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize); - void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); void exportTemplate(HttpServletRequest request, HttpServletResponse response, String tenantId); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index 0d8e05d27..fa9b7a669 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -103,23 +103,11 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { return wxCUserBasicInfoMapper.findCountByAge(dto); } - @Override - public PageInfo> queryListMap(WxCUserBasicInfoDto record, Integer pageNum, Integer pageSize) { - return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.findListMap(record)); - } - @Override public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { - - - WxCUser wxCUser = new WxCUser(); - wxCUser.setTenantId(tenantId); - List userlist = wxCUserMapper.findList(wxCUser); - - WxCUserBasicInfoDto basicInfoDto = new WxCUserBasicInfoDto(); - basicInfoDto.setTenantId(tenantId); - List memberlist = wxCUserBasicInfoMapper.list(basicInfoDto); - + WxCUserBasicInfo basicInfoQ = new WxCUserBasicInfo(); + basicInfoQ.setTenantId(tenantId); + List memberlist = wxCUserBasicInfoMapper.findList(basicInfoQ); XSSFWorkbook workbook; String filepath = "./uploads/"; @@ -132,60 +120,6 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { try { File file = new File(filepath); 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("会员信息"); Row rowtwo = sheetTwo.createRow(0); Cell nameCellTwo = rowtwo.createCell(0); @@ -214,12 +148,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { nameCellTwo.setCellValue(entity.getName()); 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()); educationCellTwo.setCellValue(entity.getEducation()); } diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index d1694f2e3..779cf9770 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -99,34 +99,6 @@ cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name - - update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} and id=#{cUserId} @@ -164,36 +136,5 @@ and birthdate <= #{birthEndTime} - - -