Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product
commit
1351a9a075
|
@ -110,6 +110,18 @@ public class RechargeOrderController {
|
|||
return success(pageResult);
|
||||
}
|
||||
|
||||
@PostMapping("/findPromoterDrawPage")
|
||||
@Operation(summary = "获得推广员抽佣统计")
|
||||
@PreAuthorize("@ss.hasPermission('shop:recharge-order:query')")
|
||||
@TenantIgnore
|
||||
public CommonResult<PageResult<PromoterDrawVO>> getRechargeOrderPage(@RequestBody PromoterDrawReqVO pageVO) {
|
||||
if(!TenantContextHolder.ID_SYSTEM.equals(SecurityFrameworkUtils.getLoginUser().getTenantId())){
|
||||
pageVO.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId());
|
||||
}
|
||||
PageResult<PromoterDrawVO> pageResult = rechargeOrderService.findPromoterDrawPage(pageVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出订单 Excel")
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Data
|
||||
public class PromoterDrawReqVO extends PageParam {
|
||||
|
||||
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "组织名称")
|
||||
private String deptName;
|
||||
@Schema(description = "组织结构名称")
|
||||
private String parentOrganizationName;
|
||||
@Schema(description = "推广员名称")
|
||||
private String nickname;
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
@Schema(description = "成为推广员时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PromoterDrawVO {
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
@Schema(description = "组织id")
|
||||
private Long deptId;
|
||||
@Schema(description = "商户id")
|
||||
private Long tenantId;
|
||||
@Schema(description = "组织名称")
|
||||
private String deptName;
|
||||
@Schema(description = "组织结构名称")
|
||||
private String parentOrganizationName;
|
||||
@Schema(description = "推广员名称")
|
||||
private String nickname;
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
@Schema(description = "成为推广员时间")
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "会员提成")
|
||||
private Integer memberCommission;
|
||||
@Schema(description = "商品提成")
|
||||
private Integer goodsCommission;
|
||||
|
||||
@Schema(description = "成交定单数")
|
||||
private BigDecimal orderCount;
|
||||
@Schema(description = "可提现金额")
|
||||
private BigDecimal drawAmount;
|
||||
@Schema(description = "成交金额")
|
||||
private BigDecimal dealAmount;
|
||||
@Schema(description = "累计金额")
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
}
|
|
@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -31,5 +34,6 @@ public class RechargeOrderRespVO extends RechargeOrderBaseVO {
|
|||
private String parentOrganizationName;
|
||||
@Schema(description = "推广员名称")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "提成金额", required = true, example = "3114")
|
||||
private BigDecimal commissionPrice;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ public interface RechargeOrderMapper extends BaseMapperX<RechargeOrderDO> {
|
|||
.orderByDesc(RechargeOrderDO::getId));
|
||||
}
|
||||
IPage<RechargeOrderRespVO> findListPage(IPage<RechargeOrderRespVO> page, @Param("data") RechargeOrderPageReqVO data);
|
||||
|
||||
IPage<PromoterDrawVO> findPromoterDrawPage(IPage<PromoterDrawVO> page, @Param("data") PromoterDrawReqVO data);
|
||||
|
||||
List<PromoterDrawVO> findPromoterDrawCount(@Param("promoterIds") List<Long> promoterIds);
|
||||
BigDecimal promoterOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate")LocalDateTime endDate,@Param("promoterId") Long promoterId);
|
||||
|
||||
List<RechargeOrderExcelVO> findListExcel(@Param("data") RechargeOrderExportReqVO data);
|
||||
|
|
|
@ -1457,8 +1457,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
orderDO.setUserPhone(StringUtils.isEmpty(request.getUserPhone()) ? user.getMobile() : request.getUserPhone());
|
||||
orderDO.setConfirmPhone(StringUtils.isEmpty(request.getConfirmPhone()) ? user.getMobile() : request.getConfirmPhone());
|
||||
orderDO.setTotalNum(orderInfos.size());
|
||||
// BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
||||
BigDecimal sum = new BigDecimal("0.01");
|
||||
BigDecimal sum = new BigDecimal(orderInfos.stream().mapToDouble(OrderContentRequest.OrderInfo::getGearAmount).sum());
|
||||
// BigDecimal sum = new BigDecimal("0.01");
|
||||
orderDO.setTotalPrice(sum);
|
||||
orderDO.setPayPrice(sum);
|
||||
orderDO.setPayTime(LocalDateTime.now());
|
||||
|
|
|
@ -64,7 +64,7 @@ public interface RechargeOrderService {
|
|||
* @return 订单分页
|
||||
*/
|
||||
PageResult<RechargeOrderRespVO> getRechargeOrderPage(RechargeOrderPageReqVO pageReqVO);
|
||||
|
||||
PageResult<PromoterDrawVO> findPromoterDrawPage(PromoterDrawReqVO pageReqVO);
|
||||
/**
|
||||
* 获得订单列表, 用于 Excel 导出
|
||||
*
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.shop.service.recharge;
|
||||
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
|
@ -44,6 +45,7 @@ import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderMapper;
|
|||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.shop.enums.ErrorCodeConstants.*;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
|
||||
/**
|
||||
* 订单 Service 实现类
|
||||
|
@ -124,7 +126,36 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
rechargeOrderMapper.findListPage(page, pageReqVO);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PromoterDrawVO> findPromoterDrawPage(PromoterDrawReqVO pageReqVO) {
|
||||
Page<PromoterDrawVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
rechargeOrderMapper.findPromoterDrawPage(page, pageReqVO);
|
||||
List<PromoterDrawVO> list = page.getRecords();
|
||||
if(list!=null && list.size() > 0){
|
||||
List<Long> collect1 = list.stream().map(PromoterDrawVO::getUserId).collect(Collectors.toList());
|
||||
List<PromoterDrawVO> promoterDrawVOList = rechargeOrderMapper.findPromoterDrawCount(collect1);
|
||||
Map<Long,PromoterDrawVO> nameList = promoterDrawVOList.stream().collect(toMap(PromoterDrawVO::getUserId, value -> value,(value1,value2)->value1));
|
||||
list.forEach(promoterDrawVO -> {
|
||||
PromoterDrawVO promoterDrawNew = nameList.get(promoterDrawVO.getUserId());
|
||||
if(promoterDrawNew!=null){
|
||||
promoterDrawVO.setDealAmount(promoterDrawNew.getDealAmount());
|
||||
promoterDrawVO.setTotalAmount(promoterDrawNew.getTotalAmount());
|
||||
promoterDrawVO.setOrderCount(promoterDrawNew.getOrderCount());
|
||||
if(promoterDrawVO.getMemberCommission()==null){
|
||||
promoterDrawVO.setMemberCommission(0);
|
||||
}
|
||||
promoterDrawVO.setDrawAmount(NumberUtil.mul(promoterDrawNew.getDealAmount(),NumberUtil.div(promoterDrawVO.getMemberCommission().toString(),"100"),2));
|
||||
}else {
|
||||
promoterDrawVO.setDealAmount(new BigDecimal(0));
|
||||
promoterDrawVO.setTotalAmount(new BigDecimal(0));
|
||||
promoterDrawVO.setOrderCount(new BigDecimal(0));
|
||||
promoterDrawVO.setMemberCommission(0);
|
||||
promoterDrawVO.setDrawAmount(new BigDecimal(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
@Override
|
||||
public List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO) {
|
||||
return rechargeOrderMapper.selectList(exportReqVO);
|
||||
|
|
|
@ -10,6 +10,61 @@
|
|||
-->
|
||||
|
||||
|
||||
<select id="findPromoterDrawPage" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.PromoterDrawVO">
|
||||
SELECT
|
||||
a.user_id,
|
||||
a.dept_id,
|
||||
a.tenant_id,
|
||||
c.`name`as dept_name,
|
||||
c.parent_organization_name,
|
||||
d.nickname,
|
||||
d.mobile,
|
||||
a.create_time,
|
||||
b.member_commission,
|
||||
b.goods_commission
|
||||
FROM
|
||||
member_promoter a
|
||||
LEFT JOIN system_dept c on c.id= a.dept_id
|
||||
LEFT JOIN member_user d on d.id=a.user_id
|
||||
LEFT JOIN system_tenant b on b.id=a.tenant_id
|
||||
<where>
|
||||
<if test="data.tenantId!=null">
|
||||
and a.tenant_id=#{data.tenantId}
|
||||
</if>
|
||||
<if test="data.tenantId!=null">
|
||||
and c.parent_Organization_name=#{data.parentOrganizationName}
|
||||
</if>
|
||||
<if test="data.mobile!=null and data.mobile!=''">
|
||||
and d.mobile=#{data.mobile}
|
||||
</if>
|
||||
<if test="data.nickname!=null and data.nickname!=''">
|
||||
and d.nickname=#{data.nickname}
|
||||
</if>
|
||||
<if test="data.createTime !=null ">
|
||||
and a.create_time >=#{data.createTime[0]}
|
||||
</if>
|
||||
<if test="data.createTime !=null ">
|
||||
and a.create_time <=#{data.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="findPromoterDrawCount" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.PromoterDrawVO">
|
||||
select b.promoter_id as user_id,count(case b.paid=1 when 1 then 0 end) as order_count,
|
||||
sum(case b.paid =1 when 1 then 0 end) as deal_amount,
|
||||
sum(case b.paid in (1,2) when 1 then 0 end) as total_amount
|
||||
from cy_recharge_order b
|
||||
<where>
|
||||
<if test="promoterIds!=null and promoterIds.size()>0">
|
||||
and b.promoter_id in
|
||||
<foreach collection="promoterIds" separator="," open="(" close=")" item="id">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY b.promoter_id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findListPage" resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO">
|
||||
select
|
||||
a.id,
|
||||
|
@ -50,6 +105,8 @@
|
|||
a.pay_type,
|
||||
a.total_price,
|
||||
a.pay_price,
|
||||
a.pay_price,
|
||||
CONVERT(a.pay_price*e.member_commission/100, DECIMAL(15,2)) as commissionPrice,
|
||||
a.paid,
|
||||
d.parent_organization_name
|
||||
from cy_recharge_order a
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<view class="box">
|
||||
<u-navbar autoBack title="发展会员业绩" bgColor="rgba(255,255,255,0)" :placeholder="true" leftIconSize="40"
|
||||
<u-navbar autoBack :title="performance[active].name" bgColor="rgba(255,255,255,0)" :placeholder="true" leftIconSize="40"
|
||||
leftIconColor="#fff" titleStyle="font-size:35rpx;color:#fff">
|
||||
<!-- <view slot="right">
|
||||
<u-icon name="more-dot-fill" color="#fff"></u-icon>
|
||||
<!-- <view slot="right">
|
||||
<u-icon name="more-dot-fill" color="#fff" @click="show = true"></u-icon>
|
||||
</view> -->
|
||||
</u-navbar>
|
||||
<u-sticky bgColor="#fff">
|
||||
|
@ -48,7 +48,7 @@
|
|||
</view>
|
||||
<view class="sale_turnover">
|
||||
<view class="turnover_title">
|
||||
流水明细
|
||||
{{performance[active].fund}}
|
||||
</view>
|
||||
<view class="turnover_list">
|
||||
<u-list
|
||||
|
@ -71,6 +71,7 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-action-sheet :actions="performance" @close="show = false" :closeOnClickOverlay="true" :closeOnClickAction="true" @select="selectClick" :title="title" :show="show"></u-action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -96,6 +97,23 @@
|
|||
fontWeight: '400',
|
||||
color: '#fff'
|
||||
},
|
||||
show:false,
|
||||
title:'业绩',
|
||||
active:0,
|
||||
performance: [
|
||||
{
|
||||
fund:'流水明细',
|
||||
name:'发展会员业绩',
|
||||
fontSize:'30',
|
||||
id:0
|
||||
},
|
||||
{
|
||||
fund:'订单流水',
|
||||
name: '商品订单业绩',
|
||||
fontSize:'30',
|
||||
id:1
|
||||
},
|
||||
],
|
||||
list: [{
|
||||
name: '今日',
|
||||
}, {
|
||||
|
@ -127,6 +145,10 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
selectClick(value){
|
||||
console.log(value)
|
||||
this.active = value.id
|
||||
},
|
||||
async scrolltolower() {
|
||||
if(this.total>this.orderData.length){
|
||||
this.pageData.pageNo++
|
||||
|
|
Loading…
Reference in New Issue