全量导出接口

master
382696293@qq.com 2 years ago
parent fcadefc972
commit b3ba3fc9fb

@ -0,0 +1,230 @@
package com.flossom.common.core.domain.export;
import com.flossom.common.core.annotation.Excel;
import java.util.Date;
import java.util.List;
public class WxUserMemberExport {
/**
* id
*/
@Excel(name = "用户编号")
private Long id;
/**
*
*/
@Excel(name = "会员昵称")
private String nickname;
/**
*
*/
@Excel(name = "积分")
private Integer credit;
/**
*
*/
@Excel(name = "即将过期积分")
private Integer expireCredit;
/**
* unionid
*/
@Excel(name = "unionid")
private String unionid;
/**
*
*/
@Excel(name = "手机号")
private String mobile;
/**
*
*/
@Excel(name = "省")
private String province;
/**
*
*/
@Excel(name = "市")
private String city;
/**
*
*/
@Excel(name = "区")
private String area;
/**
*
*/
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/**
*
*/
@Excel(name = "仪器数量")
private Integer devicesNum;
// @Excel(name = "仪器名称")
private List<String> devicesName;
/**
*
*/
@Excel(name = "用户注册时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Excel(name = "企微标签")
String wecomTags;
@Excel(name = "小程序标签")
String miniProgramTags;
public WxUserMemberExport() {
}
public WxUserMemberExport(Long id, String nickname, Integer credit, Integer expireCredit, String unionid, String mobile, String province, String city, String area, Date birthday, Integer devicesNum, Date createTime) {
this.id = id;
this.nickname = nickname;
this.credit = credit;
this.expireCredit = expireCredit;
this.unionid = unionid;
this.mobile = mobile;
this.province = province;
this.city = city;
this.area = area;
this.birthday = birthday;
this.devicesNum = devicesNum;
this.createTime = createTime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public Integer getCredit() {
return credit;
}
public void setCredit(Integer credit) {
this.credit = credit;
}
public Integer getExpireCredit() {
return expireCredit;
}
public void setExpireCredit(Integer expireCredit) {
this.expireCredit = expireCredit;
}
public String getUnionid() {
return unionid;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public Integer getDevicesNum() {
return devicesNum;
}
public void setDevicesNum(Integer devicesNum) {
this.devicesNum = devicesNum;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getWecomTags() {
return wecomTags;
}
public void setWecomTags(String wecomTags) {
this.wecomTags = wecomTags;
}
public String getMiniProgramTags() {
return miniProgramTags;
}
public void setMiniProgramTags(String miniProgramTags) {
this.miniProgramTags = miniProgramTags;
}
public List<String> getDevicesName() {
return devicesName;
}
public void setDevicesName(List<String> devicesName) {
this.devicesName = devicesName;
}
}

@ -2,6 +2,7 @@ package com.flossom.common.core.domain.req;
import com.flossom.common.core.web.domain.BaseEntity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -106,6 +107,11 @@ public class WxUserMemberVm extends BaseEntity {
*/
List<Integer> miniProgramTags;
/**
*
*/
List<String> exportFields = new ArrayList<>();
public WxUserMemberVm() {
}
@ -259,4 +265,12 @@ public class WxUserMemberVm extends BaseEntity {
public void setMiniProgramTags(List<Integer> miniProgramTags) {
this.miniProgramTags = miniProgramTags;
}
public List<String> getExportFields() {
return exportFields;
}
public void setExportFields(List<String> exportFields) {
this.exportFields = exportFields;
}
}

@ -115,10 +115,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cityId != null and cityId != ''"> and member.city_id = #{cityId}</if>
<if test="areaId != null and areaId != ''"> and member.area_id = #{areaId}</if>
<if test="birthday != null "> and member.birthday = #{birthday}</if>
<if test="params.beginTime != null and params.beginTime != ''">
<if test="params != null and params.beginTime != null">
and member.create_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''">
<if test="params != null and params.endTime != null">
and member.create_time &lt;= #{params.endTime}
</if>
<if test="deviceNumStart != null and deviceNumEnd != null"> and member.devices_num &gt;= #{deviceNumStart} and member.devices_num &lt;= #{deviceNumEnd}</if>

@ -4,6 +4,8 @@ import javax.servlet.http.HttpServletResponse;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.domain.entity.WxUserMember;
import com.flossom.common.core.domain.entity.WxUserTag;
import com.flossom.common.core.domain.export.WxUserMemberExport;
import com.flossom.common.core.domain.req.AllChangIntegralOperateReq;
import com.flossom.common.core.domain.req.WxUserIntegralVm;
import com.flossom.common.core.domain.req.WxUserMemberReq;
@ -20,10 +22,14 @@ import com.flossom.common.log.annotation.Log;
import com.flossom.common.log.enums.BusinessType;
import com.flossom.common.security.annotation.RequiresPermissions;
import com.flossom.system.service.IWxUserMemberService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Array;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -61,15 +67,30 @@ public class WxUserMemberController extends BaseController {
}
/**
*
*
*/
@RequiresPermissions("system:member:export")
@Log(title = "用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxUserMember wxUserMember) {
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMember);
ExcelUtil<WxUserMember> util = new ExcelUtil<WxUserMember>(WxUserMember.class);
util.exportExcel(response, list, "用户数据");
@PostMapping("/allExport")
public void export(HttpServletResponse response, @RequestBody WxUserMemberVm wxUserMemberVm) {
List<WxUserMemberRet> list = wxUserMemberService.selectWxUserMemberRetList(wxUserMemberVm);
List<WxUserMemberExport> exportList = new ArrayList<>();
WxUserMemberExport export;
for (WxUserMemberRet wxUserMemberRet : list) {
export = new WxUserMemberExport();
BeanUtils.copyProperties(wxUserMemberRet, export);
List<WxUserTag> miniProgramTags = wxUserMemberRet.getMiniProgramTags();
if (miniProgramTags != null && miniProgramTags.size() > 0) {
export.setMiniProgramTags(miniProgramTags.stream().map(WxUserTag::getTagName).collect(Collectors.joining(",")));
}
List<WxUserTag> wecomTags = wxUserMemberRet.getWecomTags();
if (wecomTags != null && wecomTags.size() > 0) {
export.setWecomTags(wecomTags.stream().map(WxUserTag::getTagName).collect(Collectors.joining(",")));
}
exportList.add(export);
}
ExcelUtil<WxUserMemberExport> util = new ExcelUtil(WxUserMemberExport.class);
util.exportExcel(response, exportList, "用户数据", wxUserMemberVm.getExportFields() == null ? null : wxUserMemberVm.getExportFields());
}
/**

Loading…
Cancel
Save