Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
1 files added
6 files modified
| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | return JsonResult.success(distribService.distribDataList(distribDataListDto)); |
| | | } |
| | | |
| | | @ApiOperation(value = "团长数据--列表导出") |
| | | @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.distribDataExport(distribDataListDto); |
| | | List<DistribDataListVo> distribDataListVos = (List<DistribDataListVo>) stringObjectMap.get("data"); |
| | | if (CollUtil.isNotEmpty(distribDataListVos)) { |
| | | for(DistribDataListVo m : distribDataListVos){ |
| | | List<String> list = new ArrayList<>(); |
| | | 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); |
| | | } |
| | | } |
| | | //导出 |
| | | export(rows,response); |
| | | |
| | | OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request)) |
| | | .methodName(Constants.USER_MODUL_NAME).operateAction("用户导出-团长数据").build(); |
| | | mqUtil.sendApp(build); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
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 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); |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "累计收益") |
| | | private String amount; |
| | | |
| | | @ApiModelProperty(value = "累计积分收益") |
| | | private String score; |
| | | |
| | | @ApiModelProperty(value = "累计交易订单") |
| | | private String orderCnt; |
| | | |
| | |
| | | @ApiModelProperty(value="绑定时间") |
| | | private String createTime; |
| | | |
| | | @ApiModelProperty(value="累计金额") |
| | | @ApiModelProperty(value="累计金额收益") |
| | | private BigDecimal amount; |
| | | |
| | | @ApiModelProperty(value="累计积分") |
| | | @ApiModelProperty(value="累计积分收益") |
| | | private BigDecimal score; |
| | | |
| | | @ApiModelProperty(value="累计积分") |
| | | private BigDecimal orderScore; |
| | | |
| | | @ApiModelProperty(value="累计单数") |
| | | private Integer orderCnt; |
| | | |
| | |
| | | a.CREATED_TIME createTime, |
| | | (select IFNULL(count(1), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) orderCnt, |
| | | (select IFNULL(sum(amount), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) amount, |
| | | (select IFNULL(sum(score), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) score |
| | | (select IFNULL(sum(score), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) score, |
| | | (SELECT |
| | | IFNULL(SUM(score),0) as kg |
| | | FROM |
| | | xzx_jhy_order_items WHERE order_id in ( SELECT |
| | | id |
| | | FROM |
| | | xzx_jhy_order WHERE order_no in ( SELECT |
| | | order_no |
| | | FROM |
| | | xzx_user_head_details WHERE |
| | | user_id = a.user_id and head_user_id = #{id} ) )) orderScore |
| | | FROM |
| | | xzx_user_head_relate 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.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} |
| | |
| | | |
| | | <select id="selectOrderByHeadUserId" resultType="java.lang.String"> |
| | | SELECT |
| | | IFNULL(SUM(weight),0) as kg |
| | | IFNULL(SUM(a.weight),0) as kg |
| | | FROM |
| | | xzx_jhy_order_items |
| | | xzx_jhy_order_items a |
| | | left join xzx_sys_environmental_info b on a.item_type = b.id |
| | | WHERE |
| | | order_id in ( |
| | | b.item_unit = 'kg' and a.order_id in ( |
| | | SELECT |
| | | id |
| | | FROM |
| | |
| | | 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 |
| | |
| | | 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> |