mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
分佣: 推广人列表
This commit is contained in:
parent
ee15b802b2
commit
ad0513c87c
@ -33,7 +33,6 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
|
|
||||||
@Tag(name = "用户 APP - 分销用户")
|
@Tag(name = "用户 APP - 分销用户")
|
||||||
@RestController
|
@RestController
|
||||||
@ -113,21 +112,14 @@ public class AppBrokerageUserController {
|
|||||||
return success(BrokerageRecordConvert.INSTANCE.convertPage03(pageResult, userMap));
|
return success(BrokerageRecordConvert.INSTANCE.convertPage03(pageResult, userMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:临时 mock =>
|
|
||||||
@GetMapping("/child-summary-page")
|
@GetMapping("/child-summary-page")
|
||||||
@Operation(summary = "获得下级分销统计分页")
|
@Operation(summary = "获得下级分销统计分页")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<PageResult<AppBrokerageUserChildSummaryRespVO>> getBrokerageUserChildSummaryPage(
|
public CommonResult<PageResult<AppBrokerageUserChildSummaryRespVO>> getBrokerageUserChildSummaryPage(
|
||||||
AppBrokerageUserChildSummaryPageReqVO pageReqVO) {
|
AppBrokerageUserChildSummaryPageReqVO pageReqVO) {
|
||||||
AppBrokerageUserChildSummaryRespVO vo1 = new AppBrokerageUserChildSummaryRespVO()
|
// 分页查询
|
||||||
.setId(1L).setNickname("芋1**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg")
|
PageResult<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserService.getBrokerageUserChildSummaryPage(pageReqVO, getLoginUserId());
|
||||||
.setBrokeragePrice(10).setBrokeragePrice(20).setBrokerageOrderCount(30)
|
return success(pageResult);
|
||||||
.setBrokerageTime(LocalDateTime.now());
|
|
||||||
AppBrokerageUserChildSummaryRespVO vo2 = new AppBrokerageUserChildSummaryRespVO()
|
|
||||||
.setId(1L).setNickname("芋2**艿").setAvatar("http://www.iocoder.cn/images/common/wechat_mp_2017_07_31_bak.jpg")
|
|
||||||
.setBrokeragePrice(20).setBrokeragePrice(30).setBrokerageOrderCount(40)
|
|
||||||
.setBrokerageTime(LocalDateTime.now());
|
|
||||||
return success(new PageResult<>(asList(vo1, vo2), 10L));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-rank-by-price")
|
@GetMapping("/get-rank-by-price")
|
||||||
|
@ -27,7 +27,7 @@ public class AppBrokerageUserChildSummaryRespVO {
|
|||||||
@Schema(description = "分销用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "30")
|
@Schema(description = "分销用户数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "30")
|
||||||
private Integer brokerageUserCount;
|
private Integer brokerageUserCount;
|
||||||
|
|
||||||
@Schema(description = "成为分销员时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "绑定推广员的时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime brokerageTime;
|
private LocalDateTime brokerageTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@ -138,4 +140,8 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> {
|
|||||||
IPage<AppBrokerageUserRankByUserCountRespVO> selectCountPageGroupByBindUserId(Page<?> page,
|
IPage<AppBrokerageUserRankByUserCountRespVO> selectCountPageGroupByBindUserId(Page<?> page,
|
||||||
@Param("beginTime") LocalDateTime beginTime,
|
@Param("beginTime") LocalDateTime beginTime,
|
||||||
@Param("endTime") LocalDateTime endTime);
|
@Param("endTime") LocalDateTime endTime);
|
||||||
|
|
||||||
|
IPage<AppBrokerageUserChildSummaryRespVO> selectSummaryPageByUserId(Page<?> page,
|
||||||
|
@Param("param") AppBrokerageUserChildSummaryPageReqVO param,
|
||||||
|
@Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.trade.service.brokerage;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
@ -140,4 +142,13 @@ public interface BrokerageUserService {
|
|||||||
* @return 推广人排行
|
* @return 推广人排行
|
||||||
*/
|
*/
|
||||||
PageResult<AppBrokerageUserRankByUserCountRespVO> getBrokerageUserRankPageByUserCount(AppBrokerageUserRankPageReqVO pageReqVO);
|
PageResult<AppBrokerageUserRankByUserCountRespVO> getBrokerageUserRankPageByUserCount(AppBrokerageUserRankPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得下级分销统计分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @param userId 用户编号
|
||||||
|
* @return 下级分销统计分页
|
||||||
|
*/
|
||||||
|
PageResult<AppBrokerageUserChildSummaryRespVO> getBrokerageUserChildSummaryPage(AppBrokerageUserChildSummaryPageReqVO pageReqVO, Long userId);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.brokerage.vo.user.BrokerageUserPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankByUserCountRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankPageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserRankPageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
|
||||||
@ -220,6 +222,12 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
|
|||||||
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<AppBrokerageUserChildSummaryRespVO> getBrokerageUserChildSummaryPage(AppBrokerageUserChildSummaryPageReqVO pageReqVO, Long userId) {
|
||||||
|
IPage<AppBrokerageUserChildSummaryRespVO> pageResult = brokerageUserMapper.selectSummaryPageByUserId(MyBatisUtils.buildPage(pageReqVO), pageReqVO, userId);
|
||||||
|
return new PageResult<>(pageResult.getRecords(), pageResult.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isUserCanBind(BrokerageUserDO user, Boolean isNewUser) {
|
private boolean isUserCanBind(BrokerageUserDO user, Boolean isNewUser) {
|
||||||
// 校验分销功能是否启用
|
// 校验分销功能是否启用
|
||||||
TradeConfigDO tradeConfig = tradeConfigService.getTradeConfig();
|
TradeConfigDO tradeConfig = tradeConfigService.getTradeConfig();
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageUserMapper">
|
||||||
|
|
||||||
|
<select id="selectSummaryPageByUserId"
|
||||||
|
resultType="cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.user.AppBrokerageUserChildSummaryRespVO">
|
||||||
|
SELECT bu.id, bu.bind_user_time AS brokerageTime,
|
||||||
|
u.nickname, u.avatar,
|
||||||
|
(SELECT SUM(price) FROM trade_brokerage_record r
|
||||||
|
WHERE r.user_id = u.id AND biz_type = 1 AND r.status = 1 AND r.deleted = FALSE) AS brokeragePrice,
|
||||||
|
(SELECT COUNT(1) FROM trade_brokerage_record r
|
||||||
|
WHERE r.user_id = u.id AND biz_type = 1 AND r.status = 1 AND r.deleted = FALSE) AS brokerageOrderCount,
|
||||||
|
(SELECT COUNT(1) FROM trade_brokerage_user c
|
||||||
|
WHERE c.bind_user_id = u.id AND c.deleted = FALSE) AS brokerageUserCount
|
||||||
|
FROM member_user AS u
|
||||||
|
JOIN trade_brokerage_user AS bu ON bu.id = u.id
|
||||||
|
<where>
|
||||||
|
<if test="param.nickname != null and param.nickname != ''">
|
||||||
|
AND u.nickname LIKE concat('', #{param.nickname}, '')
|
||||||
|
</if>
|
||||||
|
<if test="param.level == 1">
|
||||||
|
AND bu.bind_user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.level == 2">
|
||||||
|
AND bu.bind_user_id = (SELECT id FROM trade_brokerage_user c WHERE c.bind_user_id =
|
||||||
|
#{userId})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
<choose>
|
||||||
|
<when test="param.sortingField.field == 'userCount'">
|
||||||
|
ORDER BY brokerageUserCount ${param.sortingField.order}
|
||||||
|
</when>
|
||||||
|
<when test="param.sortingField.field == 'orderCount'">
|
||||||
|
ORDER BY brokerageOrderCount ${param.sortingField.order}
|
||||||
|
</when>
|
||||||
|
<when test="param.sortingField.field == 'price'">
|
||||||
|
ORDER BY brokeragePrice ${param.sortingField.order}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
ORDER BY bu.bind_user_time DESC
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user