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 9ad94f356..9778c5564 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -44,17 +44,17 @@ public class WxCUserBasicInfo implements Serializable { /**微信用户绑定的手机号**/ - @Excel(name="手机",width = 20,orderNum = "2") + @Excel(name="手机号",width = 20,orderNum = "3") @io.swagger.annotations.ApiModelProperty(value="微信用户绑定的手机号",name="phone") @NotNull private String phone; /**出生日期**/ - @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "3") + @Excel(name="生日",width = 20,format="yyyy-MM-dd",orderNum = "6") @NotNull @io.swagger.annotations.ApiModelProperty(value="出生日期",name="birthdate") private Date birthdate; /**学历**/ - @Excel(name="学历",width = 20,orderNum = "4") + @Excel(name="学历",width = 20,orderNum = "5") @NotNull @io.swagger.annotations.ApiModelProperty(value="学历",name="education") private String education; @@ -67,6 +67,7 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="邮箱",name="email") private String email; /**地址**/ + @Excel(name="地址",width = 20,orderNum = "7") @io.swagger.annotations.ApiModelProperty(value="地址",name="address") private String address; /**积分**/ @@ -76,9 +77,11 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="用户标签",name="tagId") private Long tagId; /**创建时间**/ + @Excel(name="注册时间",width = 20,format="yyyy-MM-dd", orderNum = "9") @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") private Date createDate; /**更新时间**/ + @Excel(name="上次活跃时间",width = 20,format="yyyy-MM-dd", orderNum = "8") @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; /**租户id**/ @@ -86,7 +89,7 @@ public class WxCUserBasicInfo implements Serializable { private String tenantId; /**用户姓名**/ - @Excel(name="姓名",width = 20) + @Excel(name="姓名",width = 20,orderNum = "1") @NotNull @io.swagger.annotations.ApiModelProperty(value="用户姓名",name="name") private String name; @@ -95,6 +98,7 @@ public class WxCUserBasicInfo implements Serializable { @io.swagger.annotations.ApiModelProperty(value="会员等级",name="level") private String level; /**用户昵称**/ + @Excel(name="微信昵称",width = 20,orderNum = "4") @io.swagger.annotations.ApiModelProperty(value="用户昵称",name="nickName") private String nickName; 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 fa9b7a669..6b556183b 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; @@ -117,40 +118,62 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } String filename = UUID.randomUUID() + ".xlsx"; filepath = filepath + filename; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { File file = new File(filepath); workbook = new XSSFWorkbook(); XSSFSheet sheetTwo = workbook.createSheet("会员信息"); Row rowtwo = sheetTwo.createRow(0); Cell nameCellTwo = rowtwo.createCell(0); - Cell phoneCellTwo = rowtwo.createCell(1); - Cell sexCellTwo = rowtwo.createCell(2); - Cell birthdateCellTwo = rowtwo.createCell(3); + Cell sexCellTwo = rowtwo.createCell(1); + Cell phoneCellTwo = rowtwo.createCell(2); + Cell nickNameCellTwo = rowtwo.createCell(3); Cell educationCellTwo = rowtwo.createCell(4); - + Cell birthdateCellTwo = rowtwo.createCell(5); + Cell addrCellTwo = rowtwo.createCell(6); + Cell updateDateCellTwo = rowtwo.createCell(7); + Cell createDateCellTwo = rowtwo.createCell(8); nameCellTwo.setCellValue("姓名"); - phoneCellTwo.setCellValue("手机"); sexCellTwo.setCellValue("性别"); - birthdateCellTwo.setCellValue("生日"); + phoneCellTwo.setCellValue("手机号"); + nickNameCellTwo.setCellValue("微信昵称"); educationCellTwo.setCellValue("学历"); - + birthdateCellTwo.setCellValue("生日"); + addrCellTwo.setCellValue("地址"); + updateDateCellTwo.setCellValue("上次活跃时间"); + createDateCellTwo.setCellValue("注册时间"); for (int i = 0; i < memberlist.size(); i++) { rowtwo = sheetTwo.createRow(i + 1); nameCellTwo = rowtwo.createCell(0); - phoneCellTwo = rowtwo.createCell(1); - sexCellTwo = rowtwo.createCell(2); - birthdateCellTwo = rowtwo.createCell(3); + sexCellTwo = rowtwo.createCell(1); + phoneCellTwo = rowtwo.createCell(2); + nickNameCellTwo = rowtwo.createCell(3); educationCellTwo = rowtwo.createCell(4); + birthdateCellTwo = rowtwo.createCell(5); + addrCellTwo = rowtwo.createCell(6); + updateDateCellTwo = rowtwo.createCell(7); + createDateCellTwo = rowtwo.createCell(8); WxCUserBasicInfo entity = memberlist.get(i); + String sexStr = "保密"; + if (entity.getSex() == 1) + sexStr = "男"; + else if (entity.getSex() == 2) + sexStr = "女"; nameCellTwo.setCellValue(entity.getName()); + sexCellTwo.setCellValue(sexStr); phoneCellTwo.setCellValue(entity.getPhone()); - sexCellTwo.setCellValue(entity.getSex()); - birthdateCellTwo.setCellValue(entity.getBirthdate()); + nickNameCellTwo.setCellValue(entity.getNickName()); educationCellTwo.setCellValue(entity.getEducation()); + birthdateCellTwo.setCellValue(entity.getBirthdate()); + addrCellTwo.setCellValue(entity.getAddress()); + updateDateCellTwo.setCellValue(sdf.format(entity.getUpdateDate())); + createDateCellTwo.setCellValue(sdf.format(entity.getCreateDate())); } @@ -212,17 +235,26 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { XSSFSheet sheetTwo = workbook.createSheet("会员信息"); Row rowtwo = sheetTwo.createRow(0); + Cell nameCellTwo = rowtwo.createCell(0); - Cell phoneCellTwo = rowtwo.createCell(1); - Cell sexCellTwo = rowtwo.createCell(2); - Cell birthdateCellTwo = rowtwo.createCell(3); + Cell sexCellTwo = rowtwo.createCell(1); + Cell phoneCellTwo = rowtwo.createCell(2); + Cell nickNameCellTwo = rowtwo.createCell(3); Cell educationCellTwo = rowtwo.createCell(4); + Cell birthdateCellTwo = rowtwo.createCell(5); + Cell addrCellTwo = rowtwo.createCell(6); + Cell updateDateCellTwo = rowtwo.createCell(7); + Cell createDateCellTwo = rowtwo.createCell(8); nameCellTwo.setCellValue("姓名"); - phoneCellTwo.setCellValue("手机"); sexCellTwo.setCellValue("性别"); - birthdateCellTwo.setCellValue("生日"); + phoneCellTwo.setCellValue("手机号"); + nickNameCellTwo.setCellValue("微信昵称"); educationCellTwo.setCellValue("学历"); + birthdateCellTwo.setCellValue("生日"); + addrCellTwo.setCellValue("地址"); + updateDateCellTwo.setCellValue("上次活跃时间"); + createDateCellTwo.setCellValue("注册时间"); FileOutputStream fileOut = new FileOutputStream(file); workbook.write(fileOut); @@ -260,16 +292,17 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { if (oldUserBase != null) { oldUserBase.setTenantId(tenantId); + oldUserBase.setName(userBase.getName()); oldUserBase.setSex(userBase.getSex()); + oldUserBase.setNickName(userBase.getNickName()); oldUserBase.setEducation(userBase.getEducation()); oldUserBase.setBirthdate(userBase.getBirthdate()); - oldUserBase.setName(userBase.getName()); - oldUserBase.setUpdateDate(curDate); + oldUserBase.setAddress(userBase.getAddress()); + oldUserBase.setUpdateDate(userBase.getUpdateDate()); + oldUserBase.setCreateDate(userBase.getCreateDate()); } else { userBase.setId(idWorker.nextId()); userBase.setTenantId(tenantId); - userBase.setCreateDate(curDate); - userBase.setUpdateDate(curDate); } // update 昵称