Merge branch 'feature/mall_product' of http://117.33.142.185:3000/zenghuapei/cyywl_server into feature/mall_product

pull/6/head
TianYu 2023-05-31 11:06:39 +08:00
commit 035dd77dd4
7 changed files with 94 additions and 13 deletions

View File

@ -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.RechargeOrderPageReqVO;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeOrderRespVO; 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.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.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest; import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
@ -72,6 +73,15 @@ public class MemberController {
pageRespVO.setPromoterId(SecurityFrameworkUtils.getLoginUserId()); pageRespVO.setPromoterId(SecurityFrameworkUtils.getLoginUserId());
return CommonResult.success(rechargeOrderService.promoterOrderInfo(pageRespVO)); 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 = "获取当前登录发展会员数量统计") @Operation(summary = "获取当前登录发展会员数量统计")
@RequestMapping(value = "/promoterOrderCount", method = RequestMethod.GET) @RequestMapping(value = "/promoterOrderCount", method = RequestMethod.GET)
@PreAuthenticated @PreAuthenticated

View File

@ -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;
}

View File

@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
/** /**
@ -71,4 +72,6 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
* @param spreadId 广uid * @param spreadId 广uid
*/ */
OrderBrokerageData getBrokerageData(@Param("uid") Long uid, @Param("spreadId") Integer spreadId); OrderBrokerageData getBrokerageData(@Param("uid") Long uid, @Param("spreadId") Integer spreadId);
BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate")LocalDateTime endDate,@Param("promoterId") Long promoterId);
} }

View File

@ -1393,8 +1393,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
if (StringUtils.equals("SUCCESS", result.getTradeState())) { if (StringUtils.equals("SUCCESS", result.getTradeState())) {
String outTradeNo = result.getOutTradeNo(); String outTradeNo = result.getOutTradeNo();
// 用户支付金额 // 用户支付金额
Integer payerTotal1 = result.getAmount().getPayerTotal(); BigDecimal payerTotal = NumberUtil.div(result.getAmount().getPayerTotal() + "", "100", 2);
BigDecimal payerTotal = new BigDecimal(result.getAmount().getPayerTotal()).multiply(new BigDecimal("100"));
// 处理相关逻辑 // 处理相关逻辑
if (outTradeNo.contains("MEMBER_")) { if (outTradeNo.contains("MEMBER_")) {
log.info("WXPAY====会员===>"); log.info("WXPAY====会员===>");

View File

@ -4,6 +4,7 @@ import java.util.*;
import javax.validation.*; import javax.validation.*;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; 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.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.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest; import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
@ -86,4 +87,6 @@ public interface RechargeOrderService {
List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone); List<RechargeOrderRespVO> memberOrderInfoByPhone(String phone);
Boolean memberChangeTie(MemberChangeTieRequest changeTieRequest); Boolean memberChangeTie(MemberChangeTieRequest changeTieRequest);
ShoppingMemberOrderVO shoppingOrderCount(Integer type, Long loginUserId);
} }

View File

@ -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.AppUserInfoReqDTO;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; 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.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.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.dal.mysql.recharge.RechargeOrderInfoMapper;
import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest; import cn.iocoder.yudao.module.shop.request.member.MemberChangeTieRequest;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest; import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
@ -68,6 +70,9 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
private MemberUserApi memberUserApi; private MemberUserApi memberUserApi;
@Resource @Resource
private TenantApi tenantApi; private TenantApi tenantApi;
@Resource
private StoreOrderMapper storeOrderMapper;
@Override @Override
public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) { public Long createRechargeOrder(RechargeOrderCreateReqVO createReqVO) {
@ -144,7 +149,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
if (promoterDrawVO.getMemberCommission() == null) { if (promoterDrawVO.getMemberCommission() == null) {
promoterDrawVO.setMemberCommission(0); 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 { } else {
promoterDrawVO.setDealAmount(new BigDecimal(0)); promoterDrawVO.setDealAmount(new BigDecimal(0));
promoterDrawVO.setTotalAmount(new BigDecimal(0)); promoterDrawVO.setTotalAmount(new BigDecimal(0));
@ -156,6 +161,7 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
} }
return new PageResult<>(list, page.getTotal()); return new PageResult<>(list, page.getTotal());
} }
@Override @Override
public List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO) { public List<RechargeOrderDO> getRechargeOrderList(RechargeOrderExportReqVO exportReqVO) {
return rechargeOrderMapper.selectList(exportReqVO); return rechargeOrderMapper.selectList(exportReqVO);
@ -323,4 +329,33 @@ public class RechargeOrderServiceImpl implements RechargeOrderService {
return memberUserApi.updateById(user) > 0; 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;
}
} }

View File

@ -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} 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; where o.uid = #{uid} and o.status > 1;
</select> </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&gt;=#{startDate}
</if>
<if test="endDate!=null">
and pay_time&lt;=#{endDate}
</if>
</where>
</select>
</mapper> </mapper>