1 files added
4 files modified
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "团长数据--列表导出") |
| | | @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/distrib/export.json") |
| | | public void fileExport(@RequestBody DistribDataListDto distribDataListDto, HttpServletRequest request, HttpServletResponse response) { |
| | | @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/distrib/distribDataExport.json") |
| | | public void distribDataExport(@RequestBody ExportDistribDataListDto distribDataListDto, HttpServletRequest request, HttpServletResponse response) { |
| | | List<List<String>> rows = new ArrayList<>(); |
| | | List<String> header=new ArrayList<>(); |
| | | //标题 |
| | | header=CollUtil.newArrayList( "团长名称", "手机号", "身份", "团员数量", "交易单数", "累计收益积分", "累计收益(元)", "累计订单重量(kg)","累计数量(家电)"); |
| | | rows.add(header); |
| | | Map<String, Object> stringObjectMap = distribService.distribDataList(distribDataListDto); |
| | | List<Map<String,Object>> storageModels=(List<Map<String,Object>>) stringObjectMap.get("data"); |
| | | if (CollUtil.isNotEmpty(storageModels)) { |
| | | for(Map<String,Object> m : storageModels){ |
| | | Map<String, Object> stringObjectMap = distribService.distribDataExport(distribDataListDto); |
| | | List<DistribDataListVo> distribDataListVos = (List<DistribDataListVo>) stringObjectMap.get("data"); |
| | | if (CollUtil.isNotEmpty(distribDataListVos)) { |
| | | for(DistribDataListVo m : distribDataListVos){ |
| | | List<String> list = new ArrayList<>(); |
| | | if(null!=m.get("delFlag")){ |
| | | if(m.get("delFlag").toString().equals("1")){ |
| | | m.put("name",m.get("name").toString()+"(已删除)"); |
| | | } |
| | | } |
| | | list.add(m.get("name").toString()); |
| | | list.add(m.get("storageuserphone").toString()); |
| | | list.add(m.get("storageName").toString()); |
| | | list.add(m.get("orderNum").toString()); |
| | | list.add(m.get("storageweight").toString()); |
| | | list.add(m.get("storagemoney").toString()); |
| | | list.add(m.get("recycleweight").toString()); |
| | | list.add(m.get("recyclemoney").toString()); |
| | | list.add(m.getNickname()); |
| | | list.add(m.getPhone()); |
| | | list.add("团长"); |
| | | list.add(m.getCnt().toString()); |
| | | list.add(m.getOrderCnt()); |
| | | list.add(m.getScore()); |
| | | list.add(m.getAmount()); |
| | | list.add(m.getKg()); |
| | | list.add(m.getJdsl()); |
| | | rows.add(list); |
| | | } |
| | | } |
New file |
| | |
| | | package com.xzx.gc.user.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | @Data |
| | | @ApiModel(value = "ExportDistribDataListDto", description = "参数接收类") |
| | | public class ExportDistribDataListDto { |
| | | |
| | | @ApiModelProperty(value = "查询字段") |
| | | private String queryCol; |
| | | |
| | | @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @ApiModelProperty(value="开始时间") |
| | | private Date reserveTimeStart; |
| | | |
| | | @JsonFormat(shape=JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | @ApiModelProperty(value="结束时间") |
| | | private Date reserveTimeEnd; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String name; |
| | | @ApiModelProperty(hidden = true) |
| | | private String Phone; |
| | | } |
| | |
| | | import com.xzx.gc.user.dto.DistribDataListDto; |
| | | import com.xzx.gc.user.dto.DistribInfoListDto; |
| | | import com.xzx.gc.user.dto.DistribListDto; |
| | | import com.xzx.gc.user.dto.ExportDistribDataListDto; |
| | | import com.xzx.gc.user.vo.*; |
| | | import com.xzx.gc.util.GcMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | String selectJDSLByHeadUserId(@Param("accountId")String id); |
| | | |
| | | DistribDataInfoVo selectDistribDataInfoVo(); |
| | | |
| | | List<DistribDataListVo> distribDataExport(@Param("record")ExportDistribDataListDto distribDataListDto); |
| | | } |
| | | |
| | |
| | | public DistribDataInfoVo distribDataInfo(DistribDataInfoDto distribDataInfoDto) { |
| | | return accountMapper.selectDistribDataInfoVo(); |
| | | } |
| | | |
| | | public Map<String, Object> distribDataExport(ExportDistribDataListDto distribDataListDto) { |
| | | if(StrUtil.isNotEmpty(distribDataListDto.getQueryCol())){ |
| | | String decode = StringUtils.encode(distribDataListDto.getQueryCol()); |
| | | distribDataListDto.setName(decode); |
| | | distribDataListDto.setPhone(distribDataListDto.getQueryCol()); |
| | | } |
| | | List<DistribDataListVo> distribDataListVos = accountMapper.distribDataExport(distribDataListDto); |
| | | if(CollUtil.isNotEmpty(distribDataListVos)){ |
| | | for(DistribDataListVo distribDataListVo : distribDataListVos){ |
| | | if(ObjectUtil.isNotEmpty(distribDataListVo)){ |
| | | String nickname = distribDataListVo.getNickname(); |
| | | String decode = StringUtils.decode(nickname); |
| | | distribDataListVo.setNickname(decode); |
| | | String id = distribDataListVo.getId(); |
| | | String kg = accountMapper.selectOrderByHeadUserId(id); |
| | | distribDataListVo.setKg(kg); |
| | | String jdsl = accountMapper.selectJDSLByHeadUserId(id); |
| | | distribDataListVo.setJdsl(jdsl); |
| | | } |
| | | } |
| | | } |
| | | PageInfo<DistribDataListVo> pageInfo = new PageInfo<>(distribDataListVos); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | int count = Convert.toInt(pageInfo.getTotal()); |
| | | data.put("data", distribDataListVos); |
| | | data.put("count", count); |
| | | data.put("code", 0); |
| | | return data; |
| | | } |
| | | |
| | | } |
| | |
| | | and a.is_head = 1 |
| | | </select> |
| | | |
| | | <select id="distribDataExport" resultType="com.xzx.gc.user.vo.DistribDataListVo"> |
| | | SELECT |
| | | a.account_id id, |
| | | b.nick_name nickname, |
| | | b.mobile_phone phone, |
| | | b.regist_time registTime, |
| | | a.is_head isHead, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_relate where head_user_id = a.user_id) cnt, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) orderCnt, |
| | | (select IFNULL(sum(amount), 0) from xzx_user_head_relate where head_user_id = a.user_id) amount, |
| | | (select IFNULL(sum(score), 0) from xzx_user_head_relate where head_user_id = a.user_id ) score, |
| | | a.is_prohibit isProhibit |
| | | FROM |
| | | xzx_account_info a |
| | | LEFT JOIN xzx_user_info b on a.user_id = b.user_id |
| | | <where> |
| | | 1=1 |
| | | and a.is_head = 1 |
| | | <if test="record.queryCol != null and record.queryCol != ''"> |
| | | and (b.nick_name like concat('%',#{record.name},'%') or b.mobile_phone like concat('%',#{record.phone},'%')) |
| | | </if> |
| | | <if test="record.reserveTimeStart != null"> |
| | | and b.regist_time >= #{record.reserveTimeStart} |
| | | </if> |
| | | |
| | | <if test="record.reserveTimeEnd != null"> |
| | | and b.regist_time <= #{record.reserveTimeEnd} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | </select> |
| | | |
| | | </mapper> |