commit
01fca4e9c7
|
@ -48,4 +48,9 @@ public class AppProductSpuRespVO {
|
||||||
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private Integer salesCount;
|
private Integer salesCount;
|
||||||
|
|
||||||
|
// ========== 物流相关字段 =========
|
||||||
|
|
||||||
|
@Schema(description = "配送方式数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private List<Integer> deliveryTypes;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class CouponServiceImpl implements CouponService {
|
||||||
findAndThen(userCouponIdsMap, userId, couponIds::addAll);
|
findAndThen(userCouponIdsMap, userId, couponIds::addAll);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[takeCouponsByAdmin][coupon({}) 优惠券发放失败]", entry, e);
|
log.error("[takeCouponsByAdmin][coupon({}) 优惠券发放失败 userId({})]", entry, userId, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return couponIds;
|
return couponIds;
|
||||||
|
|
|
@ -2,7 +2,10 @@ package cn.iocoder.yudao.module.trade.service.brokerage;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.util.*;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import cn.hutool.core.util.BooleanUtil;
|
||||||
|
import cn.hutool.core.util.ObjUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||||
|
@ -26,12 +29,12 @@ import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO;
|
||||||
import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO;
|
import cn.iocoder.yudao.module.trade.service.brokerage.bo.UserBrokerageSummaryRespBO;
|
||||||
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
import cn.iocoder.yudao.module.trade.service.config.TradeConfigService;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -79,7 +82,7 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService {
|
||||||
TradeConfigDO memberConfig = tradeConfigService.getTradeConfig();
|
TradeConfigDO memberConfig = tradeConfigService.getTradeConfig();
|
||||||
// 0 未启用分销功能
|
// 0 未启用分销功能
|
||||||
if (memberConfig == null || !BooleanUtil.isTrue(memberConfig.getBrokerageEnabled())) {
|
if (memberConfig == null || !BooleanUtil.isTrue(memberConfig.getBrokerageEnabled())) {
|
||||||
log.warn("[addBrokerage][增加佣金失败:brokerageEnabled 未配置,userId({})", userId);
|
log.error("[addBrokerage][增加佣金失败:brokerageEnabled 未配置,userId({}) bizType({}) list({})", userId, bizType, list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +183,10 @@ public class BrokerageRecordServiceImpl implements BrokerageRecordService {
|
||||||
} else if (Objects.equals(sourceUserLevel, 2)) {
|
} else if (Objects.equals(sourceUserLevel, 2)) {
|
||||||
fixedPrice = item.getSecondFixedPrice();
|
fixedPrice = item.getSecondFixedPrice();
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(StrUtil.format("用户等级({}) 不合法", sourceUserLevel));
|
log.error("[addBrokerage][user({}) list({}) brokerageFrozenDays({}) brokeragePercent({}) " +
|
||||||
|
"bizType({}) 用户等级sourceUserLevel({}) 不合法]", user, list, brokerageFrozenDays,
|
||||||
|
brokeragePercent, bizType, sourceUserLevel);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
int brokeragePrice = calculatePrice(item.getBasePrice(), brokeragePercent, fixedPrice);
|
int brokeragePrice = calculatePrice(item.getBasePrice(), brokeragePercent, fixedPrice);
|
||||||
if (brokeragePrice <= 0) {
|
if (brokeragePrice <= 0) {
|
||||||
|
|
|
@ -329,7 +329,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
/**
|
/**
|
||||||
* 校验支付订单的合法性
|
* 校验支付订单的合法性
|
||||||
*
|
*
|
||||||
* @param order 交易订单
|
* @param order 交易订单
|
||||||
* @param payOrderId 支付订单编号
|
* @param payOrderId 支付订单编号
|
||||||
* @return 支付订单
|
* @return 支付订单
|
||||||
*/
|
*/
|
||||||
|
@ -747,7 +747,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
}
|
}
|
||||||
DeliveryPickUpStoreDO deliveryPickUpStore = pickUpStoreService.getDeliveryPickUpStore(order.getPickUpStoreId());
|
DeliveryPickUpStoreDO deliveryPickUpStore = pickUpStoreService.getDeliveryPickUpStore(order.getPickUpStoreId());
|
||||||
if (deliveryPickUpStore == null
|
if (deliveryPickUpStore == null
|
||||||
|| !CollUtil.contains(deliveryPickUpStore.getVerifyUserIds(), userId)) {
|
|| !CollUtil.contains(deliveryPickUpStore.getVerifyUserIds(), userId)) {
|
||||||
throw exception(ORDER_PICK_UP_FAIL_NOT_VERIFY_USER);
|
throw exception(ORDER_PICK_UP_FAIL_NOT_VERIFY_USER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,7 +920,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
// 1. 检验订单存在
|
// 1. 检验订单存在
|
||||||
TradeOrderDO order = tradeOrderMapper.selectOrderByIdAndUserId(orderId, userId);
|
TradeOrderDO order = tradeOrderMapper.selectOrderByIdAndUserId(orderId, userId);
|
||||||
if (order == null) {
|
if (order == null) {
|
||||||
throw exception(ORDER_NOT_FOUND);
|
log.error("[updateOrderGiveCouponIds][userId({}) orderId({}) giveCouponIds({}) {}]", userId, orderId,
|
||||||
|
giveCouponIds, ORDER_NOT_FOUND);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 更新订单赠送的优惠券编号列表
|
// 2. 更新订单赠送的优惠券编号列表
|
||||||
|
|
|
@ -4,12 +4,11 @@ import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
import cn.iocoder.yudao.module.member.convert.level.MemberLevelConvert;
|
||||||
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT;
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE_BIZ_NOT_SUPPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,6 +16,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.EXPERIENCE
|
||||||
*
|
*
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class MemberLevelApiImpl implements MemberLevelApi {
|
public class MemberLevelApiImpl implements MemberLevelApi {
|
||||||
|
@ -33,7 +33,9 @@ public class MemberLevelApiImpl implements MemberLevelApi {
|
||||||
public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
public void addExperience(Long userId, Integer experience, Integer bizType, String bizId) {
|
||||||
MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType);
|
MemberExperienceBizTypeEnum bizTypeEnum = MemberExperienceBizTypeEnum.getByType(bizType);
|
||||||
if (bizTypeEnum == null) {
|
if (bizTypeEnum == null) {
|
||||||
throw exception(EXPERIENCE_BIZ_NOT_SUPPORT);
|
log.error("[addExperience][userId({}) experience({}) bizType({}) bizId({}) {}]", userId, experience, bizType,
|
||||||
|
bizId, EXPERIENCE_BIZ_NOT_SUPPORT);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId);
|
memberLevelService.addExperience(userId, experience, bizTypeEnum, bizId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ package cn.iocoder.yudao.module.member.api.point;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT;
|
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECORD_BIZ_NOT_SUPPORT;
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.POINT_RECO
|
||||||
*
|
*
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class MemberPointApiImpl implements MemberPointApi {
|
public class MemberPointApiImpl implements MemberPointApi {
|
||||||
|
@ -28,7 +29,9 @@ public class MemberPointApiImpl implements MemberPointApi {
|
||||||
Assert.isTrue(point > 0);
|
Assert.isTrue(point > 0);
|
||||||
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||||
if (bizTypeEnum == null) {
|
if (bizTypeEnum == null) {
|
||||||
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
|
log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
|
||||||
|
POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId);
|
memberPointRecordService.createPointRecord(userId, point, bizTypeEnum, bizId);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +41,9 @@ public class MemberPointApiImpl implements MemberPointApi {
|
||||||
Assert.isTrue(point > 0);
|
Assert.isTrue(point > 0);
|
||||||
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
MemberPointBizTypeEnum bizTypeEnum = MemberPointBizTypeEnum.getByType(bizType);
|
||||||
if (bizTypeEnum == null) {
|
if (bizTypeEnum == null) {
|
||||||
throw exception(POINT_RECORD_BIZ_NOT_SUPPORT);
|
log.error("[addPoint][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
|
||||||
|
POINT_RECORD_BIZ_NOT_SUPPORT);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId);
|
memberPointRecordService.createPointRecord(userId, -point, bizTypeEnum, bizId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.member.service.point;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
|
||||||
|
@ -11,6 +10,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper;
|
||||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -75,13 +74,17 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
||||||
Integer userPoint = ObjectUtil.defaultIfNull(user.getPoint(), 0);
|
Integer userPoint = ObjectUtil.defaultIfNull(user.getPoint(), 0);
|
||||||
int totalPoint = userPoint + point; // 用户变动后的积分
|
int totalPoint = userPoint + point; // 用户变动后的积分
|
||||||
if (totalPoint < 0) {
|
if (totalPoint < 0) {
|
||||||
throw exception(USER_POINT_NOT_ENOUGH);
|
log.error("[createPointRecord][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
|
||||||
|
USER_POINT_NOT_ENOUGH);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 更新用户积分
|
// 2. 更新用户积分
|
||||||
boolean success = memberUserService.updateUserPoint(userId, point);
|
boolean success = memberUserService.updateUserPoint(userId, point);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw exception(USER_POINT_NOT_ENOUGH);
|
log.error("[createPointRecord][userId({}) point({}) bizType({}) bizId({}) {}]", userId, point, bizType, bizId,
|
||||||
|
USER_POINT_NOT_ENOUGH);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 增加积分记录
|
// 3. 增加积分记录
|
||||||
|
|
Loading…
Reference in New Issue