From 70fe5c913f04360b226a8e7b9c282be66e1a1182 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 16 Jul 2021 11:27:27 +0800 Subject: [PATCH] 202107016 --- gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java | 8 ++++ gc-user/src/main/resources/mapper/user/AccountMapper.xml | 10 ++--- gc-user/src/main/java/com/xzx/gc/user/vo/DistribDataInfoVo.java | 3 + gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java | 47 +++++++++++++++++++++++ 4 files changed, 62 insertions(+), 6 deletions(-) diff --git a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java index 23bd701..9823cce 100644 --- a/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java +++ b/gc-user/src/main/java/com/xzx/gc/user/controller/AdminDistribController.java @@ -1,5 +1,6 @@ package com.xzx.gc.user.controller; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import com.xzx.gc.common.constant.CommonEnum; import com.xzx.gc.common.constant.Constants; @@ -9,23 +10,31 @@ import com.xzx.gc.entity.RedPaperRule; import com.xzx.gc.entity.UserHeadRelate; import com.xzx.gc.model.JsonResult; +import com.xzx.gc.model.admin.ExportParamModel; +import com.xzx.gc.model.admin.PromoterModel; +import com.xzx.gc.model.admin.UserModel; import com.xzx.gc.user.dto.*; import com.xzx.gc.user.mapper.AccountMapper; import com.xzx.gc.user.mapper.RedPaperRuleMapper; import com.xzx.gc.user.mapper.UserHeadRelateMapper; import com.xzx.gc.user.service.DistribService; import com.xzx.gc.user.vo.*; +import com.xzx.gc.util.DoubleUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; import java.util.Map; @RestController @@ -205,6 +214,44 @@ return JsonResult.success(distribService.distribDataList(distribDataListDto)); } + @ApiOperation(value = "团长数据--列表导出") + @PostMapping(value = Constants.ADMIN_VIEW_PREFIX + "/distrib/export.json") + public void fileExport(@RequestBody DistribDataListDto 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){ + 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()); + rows.add(list); + } + } + //导出 + export(rows,response); + + OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) + .methodName(Constants.USER_MODUL_NAME).operateAction("用户导出-团长数据").build(); + mqUtil.sendApp(build); + + } + } diff --git a/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java b/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java index d446fb7..36a4b62 100644 --- a/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java +++ b/gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java @@ -332,11 +332,19 @@ public Map<String, Object> distribDataList(DistribDataListDto distribDataListDto) { + if(StrUtil.isNotEmpty(distribDataListDto.getQueryCol())){ + String decode = StringUtils.encode(distribDataListDto.getQueryCol()); + distribDataListDto.setName(decode); + distribDataListDto.setPhone(distribDataListDto.getQueryCol()); + } PageHelper.startPage(distribDataListDto.getPage(), distribDataListDto.getLimit()); List<DistribDataListVo> distribDataListVos = accountMapper.distribDataList(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); diff --git a/gc-user/src/main/java/com/xzx/gc/user/vo/DistribDataInfoVo.java b/gc-user/src/main/java/com/xzx/gc/user/vo/DistribDataInfoVo.java index 51813a9..c31e69d 100644 --- a/gc-user/src/main/java/com/xzx/gc/user/vo/DistribDataInfoVo.java +++ b/gc-user/src/main/java/com/xzx/gc/user/vo/DistribDataInfoVo.java @@ -14,6 +14,9 @@ @ApiModelProperty(value = "累计收益") private String amount; + @ApiModelProperty(value = "累计积分收益") + private String score; + @ApiModelProperty(value = "累计交易订单") private String orderCnt; diff --git a/gc-user/src/main/resources/mapper/user/AccountMapper.xml b/gc-user/src/main/resources/mapper/user/AccountMapper.xml index eb04b45..2984e4b 100644 --- a/gc-user/src/main/resources/mapper/user/AccountMapper.xml +++ b/gc-user/src/main/resources/mapper/user/AccountMapper.xml @@ -289,11 +289,8 @@ <where> 1=1 and a.is_head = 1 - <if test="record.name != null and record.name != ''"> - and b.nick_name like concat('%',#{record.name},'%') - </if> - <if test="record.phone != null and record.phone != ''"> - and b.mobile_phone like concat('%',#{record.phone},'%') + <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} @@ -372,7 +369,8 @@ SELECT IFNULL(count(1), 0) cnt, SUM((select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) ) orderCnt, - SUM((select IFNULL(sum(amount), 0) from xzx_user_head_details where head_user_id = a.user_id) ) amount + SUM((select IFNULL(sum(amount), 0) from xzx_user_head_details where head_user_id = a.user_id) ) amount, + SUM((select IFNULL(sum(score), 0) from xzx_user_head_details where head_user_id = a.user_id) ) score FROM xzx_account_info a where -- Gitblit v1.9.1