Merge branch 'master' into feature/mall_product
commit
eadd9f2daa
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearRes
|
|||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.ShoppingMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
|
||||
|
@ -72,6 +73,15 @@ public class MemberController {
|
|||
pageRespVO.setPromoterId(SecurityFrameworkUtils.getLoginUserId());
|
||||
return CommonResult.success(rechargeOrderService.promoterOrderInfo(pageRespVO));
|
||||
}
|
||||
@Operation(summary = "获取当前登录商城数量统计")
|
||||
@RequestMapping(value = "/shoppingOrderCount", method = RequestMethod.GET)
|
||||
@PreAuthenticated
|
||||
@TenantIgnore
|
||||
@Parameter(name = "type", description = "时间类型1、当日2、上周3、上月4、累计", required = true)
|
||||
public CommonResult<ShoppingMemberOrderVO> shoppingOrderCount(@RequestParam Integer type) {
|
||||
return CommonResult.success(rechargeOrderService.shoppingOrderCount(type,SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取当前登录发展会员数量统计")
|
||||
@RequestMapping(value = "/promoterOrderCount", method = RequestMethod.GET)
|
||||
@PreAuthenticated
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package cn.iocoder.yudao.module.shop.controller.app.member.vo;
|
||||
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "商城发展数量统计")
|
||||
public class ShoppingMemberOrderVO {
|
||||
@Schema(description = "总金额")
|
||||
private Long memberCount;
|
||||
@Schema(description = "总金额")
|
||||
private BigDecimal totalAmount;
|
||||
@Schema(description = "会员提成")
|
||||
private Integer goodsCommission;
|
||||
}
|
|
@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -71,4 +72,6 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
|
|||
* @param spreadId 推广人uid
|
||||
*/
|
||||
OrderBrokerageData getBrokerageData(@Param("uid") Long uid, @Param("spreadId") Integer spreadId);
|
||||
|
||||
BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate")LocalDateTime endDate,@Param("promoterId") Long promoterId);
|
||||
}
|
||||
|
|
|
@ -1393,8 +1393,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
|
|||
if (StringUtils.equals("SUCCESS", result.getTradeState())) {
|
||||
String outTradeNo = result.getOutTradeNo();
|
||||
// 用户支付金额
|
||||
Integer payerTotal1 = result.getAmount().getPayerTotal();
|
||||
BigDecimal payerTotal = new BigDecimal(result.getAmount().getPayerTotal()).multiply(new BigDecimal("100"));
|
||||
BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2);
|
||||
// 处理相关逻辑
|
||||
if (outTradeNo.contains("MEMBER_")) {
|
||||
log.info("WXPAY====会员===>");
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.*;
|
|||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.ShoppingMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
|
||||
|
@ -86,4 +87,6 @@ public interface RechargeOrderService {
|
|||
List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone);
|
||||
|
||||
Boolean memberChangeTie(MemberChangeTieRequest changeTieRequest);
|
||||
|
||||
ShoppingMemberOrderVO shoppingOrderCount(Integer type, Long loginUserId);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|||
import cn.iocoder.yudao.module.member.api.user.dto.AppUserInfoReqDTO;
|
||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.PromoterMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.controller.app.member.vo.ShoppingMemberOrderVO;
|
||||
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.order.StoreOrderMapper;
|
||||
import cn.iocoder.yudao.module.shop.dal.mysql.recharge.RechargeOrderInfoMapper;
|
||||
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
|
||||
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
|
||||
|
@ -68,6 +70,9 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
private MemberUserApi memberUserApi;
|
||||
@Resource
|
||||
private TenantApi tenantApi;
|
||||
@Resource
|
||||
private StoreOrderMapper storeOrderMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
|
||||
|
@ -144,7 +149,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
if (promoterDrawVO.getMemberCommission() == null) {
|
||||
promoterDrawVO.setMemberCommission(0);
|
||||
}
|
||||
promoterDrawVO.setDrawAmount(NumberUtil.mul(promoterDrawNew.getDealAmount(),NumberUtil.div(promoterDrawVO.getMemberCommission().toString(),"100",2)));
|
||||
promoterDrawVO.setDrawAmount(NumberUtil.mul(promoterDrawNew.getDealAmount(), NumberUtil.div(promoterDrawVO.getMemberCommission().toString(), "100"), 2));
|
||||
} else {
|
||||
promoterDrawVO.setDealAmount(new BigDecimal(0));
|
||||
promoterDrawVO.setTotalAmount(new BigDecimal(0));
|
||||
|
@ -156,6 +161,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
}
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO) {
|
||||
return rechargeOrderMapper.selectList(exportReqVO);
|
||||
|
@ -323,4 +329,33 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
|
|||
return memberUserApi.updateById(user) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShoppingMemberOrderVO shoppingOrderCount(Integer type, Long promoterId) {
|
||||
ShoppingMemberOrderVO shoppingMemberOrderVO = new ShoppingMemberOrderVO();
|
||||
AppUserInfoReqDTO appUserInfoReqDTO = new AppUserInfoReqDTO();
|
||||
appUserInfoReqDTO.setPromoterId(promoterId);
|
||||
if (type == 1) {
|
||||
appUserInfoReqDTO.setStartTime(LocalDateTimeUtil.beginOfDay(LocalDateTime.now()));
|
||||
appUserInfoReqDTO.setEndTime(LocalDateTimeUtil.endOfDay(LocalDateTime.now()));
|
||||
} else if (type == 2) {
|
||||
LocalDateTime todayOfLastWeek = LocalDateTime.now().minusDays(7);
|
||||
LocalDateTime monday = todayOfLastWeek.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).plusDays(1);
|
||||
LocalDateTime sunday = todayOfLastWeek.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).minusDays(1);
|
||||
appUserInfoReqDTO.setStartTime(LocalDateTimeUtil.beginOfDay(monday));
|
||||
appUserInfoReqDTO.setEndTime(LocalDateTimeUtil.endOfDay(sunday));
|
||||
} else if (type == 3) {
|
||||
LocalDateTime lastMonth = LocalDateTime.now().minusMonths(1); // 当前月份减1
|
||||
LocalDateTime firstDay = lastMonth.with(TemporalAdjusters.firstDayOfMonth()); // 获取当前月的第一天
|
||||
LocalDateTime lastDay = lastMonth.with(TemporalAdjusters.lastDayOfMonth()); // 获取当前月的最后一天
|
||||
appUserInfoReqDTO.setStartTime(LocalDateTimeUtil.beginOfDay(firstDay));
|
||||
appUserInfoReqDTO.setEndTime(LocalDateTimeUtil.endOfDay(lastDay));
|
||||
}
|
||||
BigDecimal totalAmount = storeOrderMapper.shoppingOrderCount(appUserInfoReqDTO.getStartTime(), appUserInfoReqDTO.getEndTime(), promoterId);
|
||||
shoppingMemberOrderVO.setTotalAmount(totalAmount);
|
||||
shoppingMemberOrderVO.setMemberCount(memberUserApi.promoterOrderCount(appUserInfoReqDTO));
|
||||
TenantDTO tenantDTO = tenantApi.getTenant(TenantContextHolder.getTenantId());
|
||||
shoppingMemberOrderVO.setGoodsCommission(tenantDTO.getGoodsCommission());
|
||||
return shoppingMemberOrderVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,4 +51,17 @@
|
|||
right join eb_user_brokerage_record as br on br.link_id = o.order_id and br.status = 3 and br.uid = #{spreadId}
|
||||
where o.uid = #{uid} and o.status > 1;
|
||||
</select>
|
||||
|
||||
<select id="shoppingOrderCount" resultType="java.math.BigDecimal">
|
||||
select sum(pay_price) from eb_store_order
|
||||
<where>
|
||||
paid=1 and promoter_id=#{promoterId}
|
||||
<if test="startDate!=null">
|
||||
and pay_time>=#{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null">
|
||||
and pay_time<=#{endDate}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue