Commit 8dbabb9efc6a75af1b1afee47dadb2e06faba05f
1 parent
dc134718
trade:1、重构 order handler 的参数;2、增加砍价商品的价格计算
Showing
35 changed files
with
365 additions
and
423 deletions
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApi.java
| 1 | package cn.iocoder.yudao.module.promotion.api.bargain; | 1 | package cn.iocoder.yudao.module.promotion.api.bargain; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainRecordCreateReqDTO; | 3 | import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainRecordCreateReqDTO; |
| 4 | +import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||
| 4 | 5 | ||
| 5 | import javax.validation.Valid; | 6 | import javax.validation.Valid; |
| 6 | 7 | ||
| @@ -20,4 +21,16 @@ public interface BargainRecordApi { | @@ -20,4 +21,16 @@ public interface BargainRecordApi { | ||
| 20 | */ | 21 | */ |
| 21 | void createBargainRecord(@Valid BargainRecordCreateReqDTO reqDTO); | 22 | void createBargainRecord(@Valid BargainRecordCreateReqDTO reqDTO); |
| 22 | 23 | ||
| 24 | + /** | ||
| 25 | + * 【下单前】校验是否参与砍价活动 | ||
| 26 | + * <p> | ||
| 27 | + * 如果校验失败,则抛出业务异常 | ||
| 28 | + * | ||
| 29 | + * @param userId 用户编号 | ||
| 30 | + * @param bargainRecordId 砍价活动编号 | ||
| 31 | + * @param skuId SKU 编号 | ||
| 32 | + * @return 砍价信息 | ||
| 33 | + */ | ||
| 34 | + BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId); | ||
| 35 | + | ||
| 23 | } | 36 | } |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/dto/BargainRecordCreateReqDTO.java
| @@ -51,6 +51,7 @@ public class BargainRecordCreateReqDTO { | @@ -51,6 +51,7 @@ public class BargainRecordCreateReqDTO { | ||
| 51 | @NotNull(message = "商品原价不能为空") | 51 | @NotNull(message = "商品原价不能为空") |
| 52 | private Integer price; | 52 | private Integer price; |
| 53 | 53 | ||
| 54 | + // TODO @puhui999:创建时,这个参数不应该传递哈; | ||
| 54 | /** | 55 | /** |
| 55 | * 开团状态:进行中 砍价成功 砍价失败 | 56 | * 开团状态:进行中 砍价成功 砍价失败 |
| 56 | */ | 57 | */ |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/dto/BargainValidateJoinRespDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.api.bargain.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * 校验参与砍价 Response DTO | ||
| 7 | + */ | ||
| 8 | +@Data | ||
| 9 | +public class BargainValidateJoinRespDTO { | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 砍价活动编号 | ||
| 13 | + */ | ||
| 14 | + private Long activityId; | ||
| 15 | + /** | ||
| 16 | + * 砍价活动名称 | ||
| 17 | + */ | ||
| 18 | + private String name; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 砍价金额 | ||
| 22 | + */ | ||
| 23 | + private Integer bargainPrice; | ||
| 24 | + | ||
| 25 | +} |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/api/seckill/SeckillActivityApi.java
| @@ -19,13 +19,14 @@ public interface SeckillActivityApi { | @@ -19,13 +19,14 @@ public interface SeckillActivityApi { | ||
| 19 | void updateSeckillStock(Long id, Long skuId, Integer count); | 19 | void updateSeckillStock(Long id, Long skuId, Integer count); |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | - * 校验是否参与秒杀商品 | 22 | + * 【下单前】校验是否参与秒杀活动 |
| 23 | * | 23 | * |
| 24 | * 如果校验失败,则抛出业务异常 | 24 | * 如果校验失败,则抛出业务异常 |
| 25 | * | 25 | * |
| 26 | * @param activityId 活动编号 | 26 | * @param activityId 活动编号 |
| 27 | * @param skuId SKU 编号 | 27 | * @param skuId SKU 编号 |
| 28 | * @param count 数量 | 28 | * @param count 数量 |
| 29 | + * @return 秒杀信息 | ||
| 29 | */ | 30 | */ |
| 30 | SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); | 31 | SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); |
| 31 | 32 |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
| @@ -97,5 +97,8 @@ public interface ErrorCodeConstants { | @@ -97,5 +97,8 @@ public interface ErrorCodeConstants { | ||
| 97 | ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1_013_013_001, "砍价失败,已参与过该砍价"); | 97 | ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1_013_013_001, "砍价失败,已参与过该砍价"); |
| 98 | ErrorCode BARGAIN_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1_013_013_002, "砍价失败,父砍价不存在"); | 98 | ErrorCode BARGAIN_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1_013_013_002, "砍价失败,父砍价不存在"); |
| 99 | ErrorCode BARGAIN_RECORD_USER_FULL = new ErrorCode(1_013_013_003, "砍价失败,砍价人数已满"); | 99 | ErrorCode BARGAIN_RECORD_USER_FULL = new ErrorCode(1_013_013_003, "砍价失败,砍价人数已满"); |
| 100 | + ErrorCode BARGAIN_JOIN_RECORD_NOT_IN_PROGRESS = new ErrorCode(1_013_013_004, "砍价失败,砍价记录不在进行中"); | ||
| 101 | + ErrorCode BARGAIN_JOIN_FAILED_ACTIVITY_TIME_END = new ErrorCode(1_013_013_005, "砍价失败,活动已经结束"); | ||
| 102 | + ErrorCode BARGAIN_JOIN_ACTIVITY_STATUS_CLOSED = new ErrorCode(1_013_013_006, "砍价失败,原因:砍价活动已关闭"); | ||
| 100 | 103 | ||
| 101 | } | 104 | } |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/bargain/BargainRecordStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.enums.bargain; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 砍价记录的状态枚举 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@AllArgsConstructor | ||
| 15 | +@Getter | ||
| 16 | +public enum BargainRecordStatusEnum implements IntArrayValuable { | ||
| 17 | + | ||
| 18 | + IN_PROGRESS(1, "砍价中"), | ||
| 19 | + SUCCESS(2, "砍价成功"), | ||
| 20 | + FAILED(3, "砍价失败"), | ||
| 21 | + ; | ||
| 22 | + | ||
| 23 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BargainRecordStatusEnum::getStatus).toArray(); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 值 | ||
| 27 | + */ | ||
| 28 | + private final Integer status; | ||
| 29 | + /** | ||
| 30 | + * 名字 | ||
| 31 | + */ | ||
| 32 | + private final String name; | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public int[] array() { | ||
| 36 | + return ARRAYS; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | +} |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/common/PromotionTypeEnum.java
| @@ -16,8 +16,8 @@ import java.util.Arrays; | @@ -16,8 +16,8 @@ import java.util.Arrays; | ||
| 16 | public enum PromotionTypeEnum implements IntArrayValuable { | 16 | public enum PromotionTypeEnum implements IntArrayValuable { |
| 17 | 17 | ||
| 18 | SECKILL_ACTIVITY(1, "秒杀活动"), | 18 | SECKILL_ACTIVITY(1, "秒杀活动"), |
| 19 | - BARGAIN_ACTIVITY(2, "拼团活动"), | ||
| 20 | - COMBINATION_ACTIVITY(3, "砍价活动"), | 19 | + BARGAIN_ACTIVITY(2, "砍价活动"), |
| 20 | + COMBINATION_ACTIVITY(3, "拼团活动"), | ||
| 21 | 21 | ||
| 22 | DISCOUNT_ACTIVITY(4, "限时折扣"), | 22 | DISCOUNT_ACTIVITY(4, "限时折扣"), |
| 23 | REWARD_ACTIVITY(5, "满减送"), | 23 | REWARD_ACTIVITY(5, "满减送"), |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/bargain/BargainRecordApiImpl.java
| 1 | package cn.iocoder.yudao.module.promotion.api.bargain; | 1 | package cn.iocoder.yudao.module.promotion.api.bargain; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainRecordCreateReqDTO; | 3 | import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainRecordCreateReqDTO; |
| 4 | +import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||
| 5 | +import cn.iocoder.yudao.module.promotion.service.bargain.BargainRecordService; | ||
| 4 | import org.springframework.stereotype.Service; | 6 | import org.springframework.stereotype.Service; |
| 5 | 7 | ||
| 8 | +import javax.annotation.Resource; | ||
| 9 | + | ||
| 6 | /** | 10 | /** |
| 7 | - * 砍价活动 API 实现类 TODO @puhui999 | 11 | + * 砍价活动 API 实现类 |
| 8 | * | 12 | * |
| 9 | * @author HUIHUI | 13 | * @author HUIHUI |
| 10 | */ | 14 | */ |
| 11 | @Service | 15 | @Service |
| 12 | public class BargainRecordApiImpl implements BargainRecordApi { | 16 | public class BargainRecordApiImpl implements BargainRecordApi { |
| 13 | 17 | ||
| 18 | + @Resource | ||
| 19 | + private BargainRecordService bargainRecordService; | ||
| 20 | + | ||
| 14 | @Override | 21 | @Override |
| 15 | public void createBargainRecord(BargainRecordCreateReqDTO reqDTO) { | 22 | public void createBargainRecord(BargainRecordCreateReqDTO reqDTO) { |
| 23 | + } | ||
| 16 | 24 | ||
| 25 | + @Override | ||
| 26 | + public BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) { | ||
| 27 | + return bargainRecordService.validateJoinBargain(userId, bargainRecordId, skuId); | ||
| 17 | } | 28 | } |
| 18 | 29 | ||
| 19 | } | 30 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainRecordDO.java
| 1 | package cn.iocoder.yudao.module.promotion.dal.dataobject.bargain; | 1 | package cn.iocoder.yudao.module.promotion.dal.dataobject.bargain; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -43,7 +44,6 @@ public class BargainRecordDO extends BaseDO { | @@ -43,7 +44,6 @@ public class BargainRecordDO extends BaseDO { | ||
| 43 | * 商品 SPU 编号 | 44 | * 商品 SPU 编号 |
| 44 | */ | 45 | */ |
| 45 | private Long spuId; | 46 | private Long spuId; |
| 46 | - | ||
| 47 | /** | 47 | /** |
| 48 | * 商品 SKU 编号 | 48 | * 商品 SKU 编号 |
| 49 | */ | 49 | */ |
| @@ -53,19 +53,19 @@ public class BargainRecordDO extends BaseDO { | @@ -53,19 +53,19 @@ public class BargainRecordDO extends BaseDO { | ||
| 53 | * 砍价底价,单位分 | 53 | * 砍价底价,单位分 |
| 54 | */ | 54 | */ |
| 55 | private Integer bargainPrice; | 55 | private Integer bargainPrice; |
| 56 | - | ||
| 57 | /** | 56 | /** |
| 58 | * 商品原价,单位分 | 57 | * 商品原价,单位分 |
| 59 | */ | 58 | */ |
| 60 | private Integer price; | 59 | private Integer price; |
| 61 | - | ||
| 62 | /** | 60 | /** |
| 63 | * 应付金额,单位分 | 61 | * 应付金额,单位分 |
| 64 | */ | 62 | */ |
| 65 | private Integer payPrice; | 63 | private Integer payPrice; |
| 66 | 64 | ||
| 67 | /** | 65 | /** |
| 68 | - * 状态1 - 砍价中;2- 砍价成功;3 - 砍价失败 | 66 | + * 砍价状态 |
| 67 | + * | ||
| 68 | + * 枚举 {@link BargainRecordStatusEnum} | ||
| 69 | */ | 69 | */ |
| 70 | private Integer status; | 70 | private Integer status; |
| 71 | 71 | ||
| @@ -81,7 +81,9 @@ public class BargainRecordDO extends BaseDO { | @@ -81,7 +81,9 @@ public class BargainRecordDO extends BaseDO { | ||
| 81 | 81 | ||
| 82 | /** | 82 | /** |
| 83 | * 过期时间 | 83 | * 过期时间 |
| 84 | + * | ||
| 85 | + * 到达该时间时,其他用户无法帮助砍价,但是还是允许下单 | ||
| 84 | */ | 86 | */ |
| 85 | - private Data expireTime; | 87 | + private LocalDateTime expireTime; |
| 86 | 88 | ||
| 87 | } | 89 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/bargain/BargainRecordMapper.java
| @@ -12,4 +12,9 @@ import org.apache.ibatis.annotations.Mapper; | @@ -12,4 +12,9 @@ import org.apache.ibatis.annotations.Mapper; | ||
| 12 | @Mapper | 12 | @Mapper |
| 13 | public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { | 13 | public interface BargainRecordMapper extends BaseMapperX<BargainRecordDO> { |
| 14 | 14 | ||
| 15 | + default BargainRecordDO selectByIdAndUserId(Long id, Long userId) { | ||
| 16 | + return selectOne(BargainRecordDO::getId, id, | ||
| 17 | + BargainRecordDO::getUserId, userId); | ||
| 18 | + } | ||
| 19 | + | ||
| 15 | } | 20 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordService.java
| 1 | package cn.iocoder.yudao.module.promotion.service.bargain; | 1 | package cn.iocoder.yudao.module.promotion.service.bargain; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||
| 5 | + | ||
| 4 | /** | 6 | /** |
| 5 | * 砍价记录 service 接口 | 7 | * 砍价记录 service 接口 |
| 6 | * | 8 | * |
| @@ -8,6 +10,16 @@ package cn.iocoder.yudao.module.promotion.service.bargain; | @@ -8,6 +10,16 @@ package cn.iocoder.yudao.module.promotion.service.bargain; | ||
| 8 | */ | 10 | */ |
| 9 | public interface BargainRecordService { | 11 | public interface BargainRecordService { |
| 10 | 12 | ||
| 11 | -// TODO | 13 | + /** |
| 14 | + * 【下单前】校验是否参与砍价活动 | ||
| 15 | + * <p> | ||
| 16 | + * 如果校验失败,则抛出业务异常 | ||
| 17 | + * | ||
| 18 | + * @param userId 用户编号 | ||
| 19 | + * @param bargainRecordId 砍价活动编号 | ||
| 20 | + * @param skuId SKU 编号 | ||
| 21 | + * @return 砍价信息 | ||
| 22 | + */ | ||
| 23 | + BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId); | ||
| 12 | 24 | ||
| 13 | } | 25 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainRecordServiceImpl.java
| 1 | package cn.iocoder.yudao.module.promotion.service.bargain; | 1 | package cn.iocoder.yudao.module.promotion.service.bargain; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.lang.Assert; | ||
| 4 | +import cn.hutool.core.util.ObjUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | ||
| 7 | +import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||
| 8 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO; | ||
| 9 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainRecordDO; | ||
| 10 | +import cn.iocoder.yudao.module.promotion.dal.mysql.bargain.BargainRecordMapper; | ||
| 11 | +import cn.iocoder.yudao.module.promotion.enums.bargain.BargainRecordStatusEnum; | ||
| 3 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 4 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
| 5 | 14 | ||
| 15 | +import javax.annotation.Resource; | ||
| 16 | + | ||
| 17 | +import java.util.Objects; | ||
| 18 | + | ||
| 19 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 20 | +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*; | ||
| 21 | + | ||
| 6 | /** | 22 | /** |
| 7 | * 砍价记录 Service 实现类 | 23 | * 砍价记录 Service 实现类 |
| 8 | * | 24 | * |
| @@ -11,4 +27,46 @@ import org.springframework.validation.annotation.Validated; | @@ -11,4 +27,46 @@ import org.springframework.validation.annotation.Validated; | ||
| 11 | @Service | 27 | @Service |
| 12 | @Validated | 28 | @Validated |
| 13 | public class BargainRecordServiceImpl implements BargainRecordService { | 29 | public class BargainRecordServiceImpl implements BargainRecordService { |
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private BargainActivityService bargainActivityService; | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private BargainRecordMapper bargainRecordMapper; | ||
| 36 | + | ||
| 37 | + // TODO puhui999:create 时,需要校验下限购数量; | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId) { | ||
| 41 | + // 1.1 拼团记录不存在 | ||
| 42 | + BargainRecordDO record = bargainRecordMapper.selectByIdAndUserId(bargainRecordId, userId); | ||
| 43 | + if (record == null) { | ||
| 44 | + throw exception(BARGAIN_RECORD_NOT_EXISTS); | ||
| 45 | + } | ||
| 46 | + // 1.2 拼团记录未在进行中 | ||
| 47 | + if (ObjUtil.notEqual(record.getStatus(), BargainRecordStatusEnum.IN_PROGRESS)) { | ||
| 48 | + throw exception(BARGAIN_JOIN_RECORD_NOT_IN_PROGRESS); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + // 2.1 砍价活动不存在 | ||
| 52 | + BargainActivityDO activity = bargainActivityService.getBargainActivity(record.getActivityId()); | ||
| 53 | + if (activity == null) { | ||
| 54 | + throw exception(BARGAIN_ACTIVITY_NOT_EXISTS); | ||
| 55 | + } | ||
| 56 | + if (ObjUtil.notEqual(activity.getStatus(), CommonStatusEnum.ENABLE.getStatus())) { | ||
| 57 | + throw exception(BARGAIN_JOIN_ACTIVITY_STATUS_CLOSED); | ||
| 58 | + } | ||
| 59 | + Assert.isTrue(Objects.equals(skuId, activity.getSkuId()), "砍价商品不匹配"); // 防御性校验 | ||
| 60 | + // 2.2 活动已过期 | ||
| 61 | + if (LocalDateTimeUtils.isBetween(activity.getStartTime(), activity.getEndTime())) { | ||
| 62 | + throw exception(BARGAIN_JOIN_FAILED_ACTIVITY_TIME_END); | ||
| 63 | + } | ||
| 64 | + // 2.3 库存不足 | ||
| 65 | + if (activity.getStock() <= 0) { | ||
| 66 | + throw exception(BARGAIN_ACTIVITY_UPDATE_STOCK_FAIL); | ||
| 67 | + } | ||
| 68 | + return new BargainValidateJoinRespDTO().setActivityId(activity.getId()).setName(activity.getName()) | ||
| 69 | + .setBargainPrice(record.getPayPrice()); | ||
| 70 | + } | ||
| 71 | + | ||
| 14 | } | 72 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityService.java
| @@ -108,15 +108,6 @@ public interface SeckillActivityService { | @@ -108,15 +108,6 @@ public interface SeckillActivityService { | ||
| 108 | PageResult<SeckillActivityDO> getSeckillActivityAppPageByConfigId(AppSeckillActivityPageReqVO pageReqVO); | 108 | PageResult<SeckillActivityDO> getSeckillActivityAppPageByConfigId(AppSeckillActivityPageReqVO pageReqVO); |
| 109 | 109 | ||
| 110 | /** | 110 | /** |
| 111 | - * 获取秒杀活动商品信息 | ||
| 112 | - * | ||
| 113 | - * @param id 活动编号 | ||
| 114 | - * @param skuIds sku 编号 | ||
| 115 | - * @return 秒杀活动商品信息列表 | ||
| 116 | - */ | ||
| 117 | - List<SeckillProductDO> getSeckillActivityProductList(Long id, Collection<Long> skuIds); | ||
| 118 | - | ||
| 119 | - /** | ||
| 120 | * 校验是否参与秒杀商品 | 111 | * 校验是否参与秒杀商品 |
| 121 | * | 112 | * |
| 122 | * 如果校验失败,则抛出业务异常 | 113 | * 如果校验失败,则抛出业务异常 |
| @@ -124,6 +115,7 @@ public interface SeckillActivityService { | @@ -124,6 +115,7 @@ public interface SeckillActivityService { | ||
| 124 | * @param activityId 活动编号 | 115 | * @param activityId 活动编号 |
| 125 | * @param skuId SKU 编号 | 116 | * @param skuId SKU 编号 |
| 126 | * @param count 数量 | 117 | * @param count 数量 |
| 118 | + * @return 秒杀信息 | ||
| 127 | */ | 119 | */ |
| 128 | SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); | 120 | SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); |
| 129 | 121 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java
| @@ -279,18 +279,6 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { | @@ -279,18 +279,6 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { | ||
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | @Override | 281 | @Override |
| 282 | - public List<SeckillProductDO> getSeckillActivityProductList(Long id, Collection<Long> skuIds) { | ||
| 283 | - | ||
| 284 | - // 2、校验活动商品是否存在 | ||
| 285 | - List<SeckillProductDO> productList = filterList(seckillProductMapper.selectListByActivityId(id), | ||
| 286 | - item -> skuIds.contains(item.getSkuId())); | ||
| 287 | - if (CollectionUtil.isEmpty(productList)) { | ||
| 288 | - throw exception(SKU_NOT_EXISTS); | ||
| 289 | - } | ||
| 290 | - return productList; | ||
| 291 | - } | ||
| 292 | - | ||
| 293 | - @Override | ||
| 294 | public SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count) { | 282 | public SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count) { |
| 295 | // 1.1 校验秒杀活动是否存在 | 283 | // 1.1 校验秒杀活动是否存在 |
| 296 | SeckillActivityDO activity = validateSeckillActivityExists(activityId); | 284 | SeckillActivityDO activity = validateSeckillActivityExists(activityId); |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeOrderSettlementReqVO.java
| @@ -60,15 +60,14 @@ public class AppTradeOrderSettlementReqVO { | @@ -60,15 +60,14 @@ public class AppTradeOrderSettlementReqVO { | ||
| 60 | private Long combinationHeadId; | 60 | private Long combinationHeadId; |
| 61 | 61 | ||
| 62 | // ========== 砍价活动相关字段 ========== | 62 | // ========== 砍价活动相关字段 ========== |
| 63 | - // TODO @puhui999:是不是砍价记录的编号哈? | ||
| 64 | - @Schema(description = "砍价活动编号", example = "123") | ||
| 65 | - private Long bargainActivityId; | 63 | + @Schema(description = "砍价记录编号", example = "123") |
| 64 | + private Long bargainRecordId; | ||
| 66 | 65 | ||
| 67 | @AssertTrue(message = "活动商品每次只能购买一种规格") | 66 | @AssertTrue(message = "活动商品每次只能购买一种规格") |
| 68 | @JsonIgnore | 67 | @JsonIgnore |
| 69 | public boolean isValidActivityItems() { | 68 | public boolean isValidActivityItems() { |
| 70 | // 校验是否是活动订单 | 69 | // 校验是否是活动订单 |
| 71 | - if (ObjUtil.isAllEmpty(seckillActivityId, combinationActivityId, combinationHeadId)) { | 70 | + if (ObjUtil.isAllEmpty(seckillActivityId, combinationActivityId, combinationHeadId, bargainRecordId)) { |
| 72 | return true; | 71 | return true; |
| 73 | } | 72 | } |
| 74 | // 校验订单项是否超出 | 73 | // 校验订单项是否超出 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderConvert.java
| @@ -16,7 +16,6 @@ import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDeta | @@ -16,7 +16,6 @@ import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDeta | ||
| 16 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; | 16 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; |
| 17 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; | 17 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 18 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 18 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 19 | -import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO; | ||
| 20 | import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; | 19 | import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO; |
| 21 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; | 20 | import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO; |
| 22 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; | 21 | import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO; |
| @@ -34,8 +33,6 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEn | @@ -34,8 +33,6 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEn | ||
| 34 | import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO; | 33 | import cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto.ExpressTrackRespDTO; |
| 35 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; | 34 | import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties; |
| 36 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; | 35 | import cn.iocoder.yudao.module.trade.service.brokerage.bo.BrokerageAddReqBO; |
| 37 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterOrderCreateReqBO; | ||
| 38 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeBeforeOrderCreateReqBO; | ||
| 39 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO; | 36 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO; |
| 40 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; | 37 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; |
| 41 | import org.mapstruct.Mapper; | 38 | import org.mapstruct.Mapper; |
| @@ -94,19 +91,19 @@ public interface TradeOrderConvert { | @@ -94,19 +91,19 @@ public interface TradeOrderConvert { | ||
| 94 | return new ProductSkuUpdateStockReqDTO(items); | 91 | return new ProductSkuUpdateStockReqDTO(items); |
| 95 | } | 92 | } |
| 96 | 93 | ||
| 97 | - default ProductSkuUpdateStockReqDTO convertNegative(List<AppTradeOrderSettlementReqVO.Item> list) { | 94 | + default ProductSkuUpdateStockReqDTO convertNegative(List<TradeOrderItemDO> list) { |
| 98 | List<ProductSkuUpdateStockReqDTO.Item> items = CollectionUtils.convertList(list, item -> | 95 | List<ProductSkuUpdateStockReqDTO.Item> items = CollectionUtils.convertList(list, item -> |
| 99 | new ProductSkuUpdateStockReqDTO.Item().setId(item.getSkuId()).setIncrCount(-item.getCount())); | 96 | new ProductSkuUpdateStockReqDTO.Item().setId(item.getSkuId()).setIncrCount(-item.getCount())); |
| 100 | return new ProductSkuUpdateStockReqDTO(items); | 97 | return new ProductSkuUpdateStockReqDTO(items); |
| 101 | } | 98 | } |
| 102 | 99 | ||
| 103 | default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, | 100 | default PayOrderCreateReqDTO convert(TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 104 | - TradePriceCalculateRespBO calculateRespBO, TradeOrderProperties orderProperties) { | 101 | + TradeOrderProperties orderProperties) { |
| 105 | PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO() | 102 | PayOrderCreateReqDTO createReqDTO = new PayOrderCreateReqDTO() |
| 106 | .setAppId(orderProperties.getAppId()).setUserIp(order.getUserIp()); | 103 | .setAppId(orderProperties.getAppId()).setUserIp(order.getUserIp()); |
| 107 | // 商户相关字段 | 104 | // 商户相关字段 |
| 108 | createReqDTO.setMerchantOrderId(String.valueOf(order.getId())); | 105 | createReqDTO.setMerchantOrderId(String.valueOf(order.getId())); |
| 109 | - String subject = calculateRespBO.getItems().get(0).getSpuName(); | 106 | + String subject = orderItems.get(0).getSpuName(); |
| 110 | subject = StrUtils.maxLength(subject, PayOrderCreateReqDTO.SUBJECT_MAX_LENGTH); // 避免超过 32 位 | 107 | subject = StrUtils.maxLength(subject, PayOrderCreateReqDTO.SUBJECT_MAX_LENGTH); // 避免超过 32 位 |
| 111 | createReqDTO.setSubject(subject); | 108 | createReqDTO.setSubject(subject); |
| 112 | createReqDTO.setBody(subject); // TODO 芋艿:临时写死 | 109 | createReqDTO.setBody(subject); // TODO 芋艿:临时写死 |
| @@ -263,36 +260,4 @@ public interface TradeOrderConvert { | @@ -263,36 +260,4 @@ public interface TradeOrderConvert { | ||
| 263 | return bo; | 260 | return bo; |
| 264 | } | 261 | } |
| 265 | 262 | ||
| 266 | - @Mappings({ | ||
| 267 | - @Mapping(target = "userId", source = "userId"), | ||
| 268 | - @Mapping(target = "orderType", source = "calculateRespBO.type"), | ||
| 269 | - @Mapping(target = "items", source = "createReqVO.items"), | ||
| 270 | - }) | ||
| 271 | - TradeBeforeOrderCreateReqBO convert(Long userId, AppTradeOrderCreateReqVO createReqVO, TradePriceCalculateRespBO calculateRespBO); | ||
| 272 | - | ||
| 273 | - | ||
| 274 | - List<TradeAfterOrderCreateReqBO.Item> convertList(List<TradeOrderItemDO> orderItems); | ||
| 275 | - | ||
| 276 | - | ||
| 277 | - @Mappings({ | ||
| 278 | - @Mapping(target = "userId", source = "userId"), | ||
| 279 | - @Mapping(target = "orderId", source = "tradeOrderDO.id"), | ||
| 280 | - @Mapping(target = "payPrice", source = "tradeOrderDO.payPrice"), | ||
| 281 | - @Mapping(target = "items", source = "orderItems"), | ||
| 282 | - }) | ||
| 283 | - TradeAfterOrderCreateReqBO convert(Long userId, AppTradeOrderCreateReqVO createReqVO, | ||
| 284 | - TradeOrderDO tradeOrderDO, List<TradeOrderItemDO> orderItems); | ||
| 285 | - | ||
| 286 | - @Mappings({ | ||
| 287 | - @Mapping(target = "activityId", source = "combinationActivityId"), | ||
| 288 | - @Mapping(target = "spuId", expression = "java(reqBO.getItems().get(0).getSpuId())"), | ||
| 289 | - @Mapping(target = "skuId", expression = "java(reqBO.getItems().get(0).getSkuId())"),// TODO 艿艿看看这里 | ||
| 290 | - @Mapping(target = "count", expression = "java(reqBO.getItems().get(0).getCount())"), | ||
| 291 | - @Mapping(target = "orderId", source = "orderId"), | ||
| 292 | - @Mapping(target = "userId", source = "userId"), | ||
| 293 | - @Mapping(target = "headId", source = "combinationHeadId"), | ||
| 294 | - @Mapping(target = "combinationPrice", source = "payPrice") | ||
| 295 | - }) | ||
| 296 | - CombinationRecordCreateReqDTO convert(TradeAfterOrderCreateReqBO reqBO); | ||
| 297 | - | ||
| 298 | } | 263 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/order/TradeOrderLogConvert.java
| 1 | package cn.iocoder.yudao.module.trade.convert.order; | 1 | package cn.iocoder.yudao.module.trade.convert.order; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; | 3 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; |
| 4 | -import cn.iocoder.yudao.module.trade.service.order.bo.logger.TradeOrderLogCreateReqBO; | 4 | +import cn.iocoder.yudao.module.trade.service.order.bo.TradeOrderLogCreateReqBO; |
| 5 | import org.mapstruct.Mapper; | 5 | import org.mapstruct.Mapper; |
| 6 | import org.mapstruct.factory.Mappers; | 6 | import org.mapstruct.factory.Mappers; |
| 7 | 7 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
| @@ -295,4 +295,17 @@ public class TradeOrderDO extends BaseDO { | @@ -295,4 +295,17 @@ public class TradeOrderDO extends BaseDO { | ||
| 295 | */ | 295 | */ |
| 296 | private Long seckillActivityId; | 296 | private Long seckillActivityId; |
| 297 | 297 | ||
| 298 | + /** | ||
| 299 | + * 砍价活动编号 | ||
| 300 | + * | ||
| 301 | + * 关联 BargainActivityDO 的 id 字段 | ||
| 302 | + */ | ||
| 303 | + private Long bargainActivityId; | ||
| 304 | + /** | ||
| 305 | + * 砍价记录编号 | ||
| 306 | + * | ||
| 307 | + * 关联 BargainRecordDO 的 id 字段 | ||
| 308 | + */ | ||
| 309 | + private Long bargainRecordId; | ||
| 310 | + | ||
| 298 | } | 311 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/framework/order/core/aop/TradeOrderLogAspect.java
| @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; | ||
| 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; | 7 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; |
| 8 | import cn.iocoder.yudao.module.trade.framework.order.core.annotations.TradeOrderLog; | 8 | import cn.iocoder.yudao.module.trade.framework.order.core.annotations.TradeOrderLog; |
| 9 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderLogService; | 9 | import cn.iocoder.yudao.module.trade.service.order.TradeOrderLogService; |
| 10 | -import cn.iocoder.yudao.module.trade.service.order.bo.logger.TradeOrderLogCreateReqBO; | 10 | +import cn.iocoder.yudao.module.trade.service.order.bo.TradeOrderLogCreateReqBO; |
| 11 | import lombok.extern.slf4j.Slf4j; | 11 | import lombok.extern.slf4j.Slf4j; |
| 12 | import org.aspectj.lang.JoinPoint; | 12 | import org.aspectj.lang.JoinPoint; |
| 13 | import org.aspectj.lang.annotation.AfterReturning; | 13 | import org.aspectj.lang.annotation.AfterReturning; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderLogService.java
| 1 | package cn.iocoder.yudao.module.trade.service.order; | 1 | package cn.iocoder.yudao.module.trade.service.order; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; | 3 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; |
| 4 | -import cn.iocoder.yudao.module.trade.service.order.bo.logger.TradeOrderLogCreateReqBO; | 4 | +import cn.iocoder.yudao.module.trade.service.order.bo.TradeOrderLogCreateReqBO; |
| 5 | import org.springframework.scheduling.annotation.Async; | 5 | import org.springframework.scheduling.annotation.Async; |
| 6 | 6 | ||
| 7 | import java.util.List; | 7 | import java.util.List; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderLogServiceImpl.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.service.order; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.trade.service.order; | ||
| 3 | import cn.iocoder.yudao.module.trade.convert.order.TradeOrderLogConvert; | 3 | import cn.iocoder.yudao.module.trade.convert.order.TradeOrderLogConvert; |
| 4 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; | 4 | import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderLogDO; |
| 5 | import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderLogMapper; | 5 | import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderLogMapper; |
| 6 | -import cn.iocoder.yudao.module.trade.service.order.bo.logger.TradeOrderLogCreateReqBO; | 6 | +import cn.iocoder.yudao.module.trade.service.order.bo.TradeOrderLogCreateReqBO; |
| 7 | import org.springframework.stereotype.Service; | 7 | import org.springframework.stereotype.Service; |
| 8 | 8 | ||
| 9 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderUpdateServiceImpl.java
| @@ -27,7 +27,6 @@ import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi; | @@ -27,7 +27,6 @@ import cn.iocoder.yudao.module.product.api.comment.ProductCommentApi; | ||
| 27 | import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; | 27 | import cn.iocoder.yudao.module.product.api.comment.dto.ProductCommentCreateReqDTO; |
| 28 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; | 28 | import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; |
| 29 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | 29 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 30 | -import cn.iocoder.yudao.module.promotion.api.bargain.BargainRecordApi; | ||
| 31 | import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; | 30 | import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; |
| 32 | import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi; | 31 | import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi; |
| 33 | import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; | 32 | import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO; |
| @@ -61,7 +60,6 @@ import cn.iocoder.yudao.module.trade.service.cart.CartService; | @@ -61,7 +60,6 @@ import cn.iocoder.yudao.module.trade.service.cart.CartService; | ||
| 61 | import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; | 60 | import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService; |
| 62 | import cn.iocoder.yudao.module.trade.service.message.TradeMessageService; | 61 | import cn.iocoder.yudao.module.trade.service.message.TradeMessageService; |
| 63 | import cn.iocoder.yudao.module.trade.service.message.bo.TradeOrderMessageWhenDeliveryOrderReqBO; | 62 | import cn.iocoder.yudao.module.trade.service.message.bo.TradeOrderMessageWhenDeliveryOrderReqBO; |
| 64 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterPayOrderReqBO; | ||
| 65 | import cn.iocoder.yudao.module.trade.service.order.handler.TradeOrderHandler; | 63 | import cn.iocoder.yudao.module.trade.service.order.handler.TradeOrderHandler; |
| 66 | import cn.iocoder.yudao.module.trade.service.price.TradePriceService; | 64 | import cn.iocoder.yudao.module.trade.service.price.TradePriceService; |
| 67 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO; | 65 | import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO; |
| @@ -128,8 +126,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -128,8 +126,6 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 128 | @Resource | 126 | @Resource |
| 129 | private CombinationRecordApi combinationRecordApi; | 127 | private CombinationRecordApi combinationRecordApi; |
| 130 | @Resource | 128 | @Resource |
| 131 | - private BargainRecordApi bargainRecordApi; | ||
| 132 | - @Resource | ||
| 133 | private MemberUserApi memberUserApi; | 129 | private MemberUserApi memberUserApi; |
| 134 | @Resource | 130 | @Resource |
| 135 | private MemberLevelApi memberLevelApi; | 131 | private MemberLevelApi memberLevelApi; |
| @@ -195,24 +191,27 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -195,24 +191,27 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 195 | @Transactional(rollbackFor = Exception.class) | 191 | @Transactional(rollbackFor = Exception.class) |
| 196 | @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_CREATE) | 192 | @TradeOrderLog(operateType = TradeOrderOperateTypeEnum.MEMBER_CREATE) |
| 197 | public TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) { | 193 | public TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) { |
| 198 | - // 0. 价格计算 | 194 | + // 1.1 价格计算 |
| 199 | TradePriceCalculateRespBO calculateRespBO = calculatePrice(userId, createReqVO); | 195 | TradePriceCalculateRespBO calculateRespBO = calculatePrice(userId, createReqVO); |
| 196 | + // 1.2 构建订单 | ||
| 197 | + TradeOrderDO order = buildTradeOrder(userId, userIp, createReqVO, calculateRespBO); | ||
| 198 | + List<TradeOrderItemDO> orderItems = buildTradeOrderItems(order, calculateRespBO); | ||
| 200 | 199 | ||
| 201 | - // 1. 订单创建前的逻辑 | ||
| 202 | - beforeCreateTradeOrder(userId, createReqVO, calculateRespBO); | 200 | + // 2. 订单创建前的逻辑 |
| 201 | + beforeCreateTradeOrder(order, orderItems); | ||
| 203 | 202 | ||
| 204 | - // 2.1 插入 TradeOrderDO 订单 | ||
| 205 | - TradeOrderDO order = createTradeOrder(userId, userIp, createReqVO, calculateRespBO); | ||
| 206 | - // 2.2 插入 TradeOrderItemDO 订单项 | ||
| 207 | - List<TradeOrderItemDO> orderItems = createTradeOrderItems(order, calculateRespBO); | 203 | + // 3. 保存订单 |
| 204 | + tradeOrderMapper.insert(order); | ||
| 205 | + orderItems.forEach(orderItem -> orderItem.setOrderId(order.getId())); | ||
| 206 | + tradeOrderItemMapper.insertBatch(orderItems); | ||
| 208 | 207 | ||
| 209 | - // 3. 订单创建后的逻辑 | ||
| 210 | - afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO); | 208 | + // 4. 订单创建后的逻辑 |
| 209 | + afterCreateTradeOrder(order, orderItems, createReqVO); | ||
| 211 | return order; | 210 | return order; |
| 212 | } | 211 | } |
| 213 | 212 | ||
| 214 | - private TradeOrderDO createTradeOrder(Long userId, String clientIp, AppTradeOrderCreateReqVO createReqVO, | ||
| 215 | - TradePriceCalculateRespBO calculateRespBO) { | 213 | + private TradeOrderDO buildTradeOrder(Long userId, String clientIp, AppTradeOrderCreateReqVO createReqVO, |
| 214 | + TradePriceCalculateRespBO calculateRespBO) { | ||
| 216 | TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(userId, clientIp, createReqVO, calculateRespBO); | 215 | TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(userId, clientIp, createReqVO, calculateRespBO); |
| 217 | order.setType(calculateRespBO.getType()); | 216 | order.setType(calculateRespBO.getType()); |
| 218 | order.setNo(tradeNoRedisDAO.generate(TradeNoRedisDAO.TRADE_ORDER_NO_PREFIX)); | 217 | order.setNo(tradeNoRedisDAO.generate(TradeNoRedisDAO.TRADE_ORDER_NO_PREFIX)); |
| @@ -235,33 +234,27 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -235,33 +234,27 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 235 | order.setPickUpVerifyCode(RandomUtil.randomNumbers(8)); // 随机一个核销码,长度为 8 位 | 234 | order.setPickUpVerifyCode(RandomUtil.randomNumbers(8)); // 随机一个核销码,长度为 8 位 |
| 236 | } | 235 | } |
| 237 | // TODO @疯狂:是不是可以在这里设置下推广人哈; | 236 | // TODO @疯狂:是不是可以在这里设置下推广人哈; |
| 238 | - tradeOrderMapper.insert(order); | ||
| 239 | return order; | 237 | return order; |
| 240 | } | 238 | } |
| 241 | 239 | ||
| 242 | - private List<TradeOrderItemDO> createTradeOrderItems(TradeOrderDO tradeOrderDO, | ||
| 243 | - TradePriceCalculateRespBO calculateRespBO) { | ||
| 244 | - List<TradeOrderItemDO> orderItems = TradeOrderConvert.INSTANCE.convertList(tradeOrderDO, calculateRespBO); | ||
| 245 | - tradeOrderItemMapper.insertBatch(orderItems); | ||
| 246 | - return orderItems; | 240 | + private List<TradeOrderItemDO> buildTradeOrderItems(TradeOrderDO tradeOrderDO, |
| 241 | + TradePriceCalculateRespBO calculateRespBO) { | ||
| 242 | + return TradeOrderConvert.INSTANCE.convertList(tradeOrderDO, calculateRespBO); | ||
| 247 | } | 243 | } |
| 248 | 244 | ||
| 249 | /** | 245 | /** |
| 250 | * 订单创建前,执行前置逻辑 | 246 | * 订单创建前,执行前置逻辑 |
| 251 | * | 247 | * |
| 252 | - * @param userId 用户编号 | ||
| 253 | - * @param createReqVO 创建订单请求 | ||
| 254 | - * @param calculateRespBO 订单价格计算结果 | 248 | + * @param order 订单 |
| 249 | + * @param orderItems 订单项 | ||
| 255 | */ | 250 | */ |
| 256 | - private void beforeCreateTradeOrder(Long userId, AppTradeOrderCreateReqVO createReqVO, | ||
| 257 | - TradePriceCalculateRespBO calculateRespBO) { | 251 | + private void beforeCreateTradeOrder(TradeOrderDO order, List<TradeOrderItemDO> orderItems) { |
| 258 | // 1. 执行订单创建前置处理器 | 252 | // 1. 执行订单创建前置处理器 |
| 259 | // TODO @puhui999:这里有个纠结点;handler 的定义是只处理指定类型的订单的拓展逻辑;还是通用的 handler,类似可以处理优惠劵等等 | 253 | // TODO @puhui999:这里有个纠结点;handler 的定义是只处理指定类型的订单的拓展逻辑;还是通用的 handler,类似可以处理优惠劵等等 |
| 260 | - tradeOrderHandlers.forEach(handler -> | ||
| 261 | - handler.beforeOrderCreate(TradeOrderConvert.INSTANCE.convert(userId, createReqVO, calculateRespBO))); | 254 | + tradeOrderHandlers.forEach(handler -> handler.beforeOrderCreate(order, orderItems)); |
| 262 | 255 | ||
| 263 | // 2. 下单时扣减商品库存 | 256 | // 2. 下单时扣减商品库存 |
| 264 | - productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convertNegative(createReqVO.getItems())); | 257 | + productSkuApi.updateSkuStock(TradeOrderConvert.INSTANCE.convertNegative(orderItems)); |
| 265 | } | 258 | } |
| 266 | 259 | ||
| 267 | /** | 260 | /** |
| @@ -269,22 +262,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -269,22 +262,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 269 | * <p> | 262 | * <p> |
| 270 | * 例如说:优惠劵的扣减、积分的扣减、支付单的创建等等 | 263 | * 例如说:优惠劵的扣减、积分的扣减、支付单的创建等等 |
| 271 | * | 264 | * |
| 272 | - * @param userId 用户编号 | 265 | + * @param order 订单 |
| 266 | + * @param orderItems 订单项 | ||
| 273 | * @param createReqVO 创建订单请求 | 267 | * @param createReqVO 创建订单请求 |
| 274 | - * @param order 交易订单 | ||
| 275 | - * @param calculateRespBO 订单价格计算结果 | ||
| 276 | */ | 268 | */ |
| 277 | - private void afterCreateTradeOrder(Long userId, AppTradeOrderCreateReqVO createReqVO, | ||
| 278 | - TradeOrderDO order, List<TradeOrderItemDO> orderItems, | ||
| 279 | - TradePriceCalculateRespBO calculateRespBO) { | 269 | + private void afterCreateTradeOrder(TradeOrderDO order, List<TradeOrderItemDO> orderItems, |
| 270 | + AppTradeOrderCreateReqVO createReqVO) { | ||
| 280 | // 1. 执行订单创建后置处理器 | 271 | // 1. 执行订单创建后置处理器 |
| 281 | - tradeOrderHandlers.forEach(handler -> handler.afterOrderCreate( | ||
| 282 | - TradeOrderConvert.INSTANCE.convert(userId, createReqVO, order, orderItems))); | 272 | + tradeOrderHandlers.forEach(handler -> handler.afterOrderCreate(order, orderItems)); |
| 283 | 273 | ||
| 284 | // 2. 有使用优惠券时更新 | 274 | // 2. 有使用优惠券时更新 |
| 285 | // 不在前置扣减的原因,是因为优惠劵要记录使用的订单号 | 275 | // 不在前置扣减的原因,是因为优惠劵要记录使用的订单号 |
| 286 | - if (createReqVO.getCouponId() != null) { | ||
| 287 | - couponApi.useCoupon(new CouponUseReqDTO().setId(createReqVO.getCouponId()).setUserId(userId) | 276 | + if (order.getCouponId() != null) { |
| 277 | + couponApi.useCoupon(new CouponUseReqDTO().setId(order.getCouponId()).setUserId(order.getUserId()) | ||
| 288 | .setOrderId(order.getId())); | 278 | .setOrderId(order.getId())); |
| 289 | } | 279 | } |
| 290 | 280 | ||
| @@ -295,11 +285,11 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -295,11 +285,11 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 295 | // 4. 删除购物车商品 | 285 | // 4. 删除购物车商品 |
| 296 | Set<Long> cartIds = convertSet(createReqVO.getItems(), AppTradeOrderSettlementReqVO.Item::getCartId); | 286 | Set<Long> cartIds = convertSet(createReqVO.getItems(), AppTradeOrderSettlementReqVO.Item::getCartId); |
| 297 | if (CollUtil.isNotEmpty(cartIds)) { | 287 | if (CollUtil.isNotEmpty(cartIds)) { |
| 298 | - cartService.deleteCart(userId, cartIds); | 288 | + cartService.deleteCart(order.getUserId(), cartIds); |
| 299 | } | 289 | } |
| 300 | 290 | ||
| 301 | // 5. 生成预支付 | 291 | // 5. 生成预支付 |
| 302 | - createPayOrder(order, orderItems, calculateRespBO); | 292 | + createPayOrder(order, orderItems); |
| 303 | 293 | ||
| 304 | // 6. 插入订单日志 | 294 | // 6. 插入订单日志 |
| 305 | TradeOrderLogUtils.setOrderInfo(order.getId(), null, order.getStatus()); | 295 | TradeOrderLogUtils.setOrderInfo(order.getId(), null, order.getStatus()); |
| @@ -313,11 +303,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -313,11 +303,10 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 313 | // TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来! | 303 | // TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来! |
| 314 | } | 304 | } |
| 315 | 305 | ||
| 316 | - private void createPayOrder(TradeOrderDO order, List<TradeOrderItemDO> orderItems, | ||
| 317 | - TradePriceCalculateRespBO calculateRespBO) { | 306 | + private void createPayOrder(TradeOrderDO order, List<TradeOrderItemDO> orderItems) { |
| 318 | // 创建支付单,用于后续的支付 | 307 | // 创建支付单,用于后续的支付 |
| 319 | PayOrderCreateReqDTO payOrderCreateReqDTO = TradeOrderConvert.INSTANCE.convert( | 308 | PayOrderCreateReqDTO payOrderCreateReqDTO = TradeOrderConvert.INSTANCE.convert( |
| 320 | - order, orderItems, calculateRespBO, tradeOrderProperties); | 309 | + order, orderItems, tradeOrderProperties); |
| 321 | Long payOrderId = payOrderApi.createOrder(payOrderCreateReqDTO); | 310 | Long payOrderId = payOrderApi.createOrder(payOrderCreateReqDTO); |
| 322 | 311 | ||
| 323 | // 更新到交易单上 | 312 | // 更新到交易单上 |
| @@ -343,8 +332,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | @@ -343,8 +332,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService { | ||
| 343 | } | 332 | } |
| 344 | 333 | ||
| 345 | // 3、订单支付成功后 | 334 | // 3、订单支付成功后 |
| 346 | - tradeOrderHandlers.forEach(tradeOrderHandler -> tradeOrderHandler.afterPayOrder(new TradeAfterPayOrderReqBO() | ||
| 347 | - .setOrderId(order.getId()).setOrderType(order.getType()).setUserId(order.getUserId()).setPayTime(LocalDateTime.now()))); | 335 | + tradeOrderHandlers.forEach(handler -> handler.afterPayOrder(order)); |
| 348 | 336 | ||
| 349 | // 4.1 增加用户积分(赠送) | 337 | // 4.1 增加用户积分(赠送) |
| 350 | addUserPoint(order.getUserId(), order.getGivePoint(), MemberPointBizTypeEnum.ORDER_GIVE, order.getId()); | 338 | addUserPoint(order.getUserId(), order.getGivePoint(), MemberPointBizTypeEnum.ORDER_GIVE, order.getId()); |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/TradeAfterOrderCreateReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.trade.service.order.bo; | ||
| 2 | - | ||
| 3 | -import lombok.Data; | ||
| 4 | - | ||
| 5 | -import javax.validation.Valid; | ||
| 6 | -import javax.validation.constraints.NotNull; | ||
| 7 | -import java.util.List; | ||
| 8 | - | ||
| 9 | -// TODO 芋艿:在想想这些参数的定义 | ||
| 10 | -/** | ||
| 11 | - * 订单创建之后 Request BO | ||
| 12 | - * | ||
| 13 | - * @author HUIHUI | ||
| 14 | - */ | ||
| 15 | -@Data | ||
| 16 | -public class TradeAfterOrderCreateReqBO { | ||
| 17 | - | ||
| 18 | - // ========== 拼团活动相关字段 ========== | ||
| 19 | - | ||
| 20 | - /** | ||
| 21 | - * 拼团活动编号 | ||
| 22 | - */ | ||
| 23 | - private Long combinationActivityId; | ||
| 24 | - | ||
| 25 | - /** | ||
| 26 | - * 拼团团长编号 | ||
| 27 | - */ | ||
| 28 | - private Long combinationHeadId; | ||
| 29 | - | ||
| 30 | - /** | ||
| 31 | - * 订单编号 | ||
| 32 | - */ | ||
| 33 | - @NotNull(message = "订单编号不能为空") | ||
| 34 | - private Long orderId; | ||
| 35 | - | ||
| 36 | - /** | ||
| 37 | - * 用户编号 | ||
| 38 | - */ | ||
| 39 | - @NotNull(message = "用户编号不能为空") | ||
| 40 | - private Long userId; | ||
| 41 | - | ||
| 42 | - /** | ||
| 43 | - * 支付金额 | ||
| 44 | - */ | ||
| 45 | - @NotNull(message = "支付金额不能为空") | ||
| 46 | - private Integer payPrice; | ||
| 47 | - | ||
| 48 | - // ========== 购买商品相关字段 ========== | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * 订单购买的商品信息 | ||
| 52 | - */ | ||
| 53 | - private List<Item> items; | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 订单商品信息 | ||
| 57 | - * 记录购买商品的简要核心信息 | ||
| 58 | - * | ||
| 59 | - * @author HUIHUI | ||
| 60 | - */ | ||
| 61 | - @Data | ||
| 62 | - @Valid | ||
| 63 | - public static class Item { | ||
| 64 | - | ||
| 65 | - /** | ||
| 66 | - * SPU 编号 | ||
| 67 | - */ | ||
| 68 | - @NotNull(message = "SPU 编号不能为空") | ||
| 69 | - private Long spuId; | ||
| 70 | - | ||
| 71 | - /** | ||
| 72 | - * 商品 SKU 编号 | ||
| 73 | - * | ||
| 74 | - * 关联 ProductSkuDO 的 id 编号 | ||
| 75 | - */ | ||
| 76 | - @NotNull(message = "SKU 编号活动商品不能为空") | ||
| 77 | - private Long skuId; | ||
| 78 | - | ||
| 79 | - /** | ||
| 80 | - * 购买的商品数量 | ||
| 81 | - */ | ||
| 82 | - @NotNull(message = "购买数量不能为空") | ||
| 83 | - private Integer count; | ||
| 84 | - | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/TradeAfterPayOrderReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.trade.service.order.bo; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | ||
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | -import lombok.Data; | ||
| 6 | - | ||
| 7 | -import java.time.LocalDateTime; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 订单支付后 Request BO | ||
| 11 | - * | ||
| 12 | - * @author HUIHUI | ||
| 13 | - */ | ||
| 14 | -@Data | ||
| 15 | -public class TradeAfterPayOrderReqBO { | ||
| 16 | - | ||
| 17 | - /** | ||
| 18 | - * 订单编号 | ||
| 19 | - */ | ||
| 20 | - @Schema(description = "订单编号", example = "6") | ||
| 21 | - private Long orderId; | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 订单类型 | ||
| 25 | - * | ||
| 26 | - * 枚举 {@link TradeOrderTypeEnum} | ||
| 27 | - */ | ||
| 28 | - @Schema(description = "订单类型", example = "3") | ||
| 29 | - private Integer orderType; | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 用户编号 | ||
| 33 | - */ | ||
| 34 | - @Schema(description = "用户编号", example = "11") | ||
| 35 | - private Long userId; | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 订单支付时间 | ||
| 39 | - */ | ||
| 40 | - @Schema(description = "订单支付时间", example = "2023-08-15 10:00:00") | ||
| 41 | - private LocalDateTime payTime; | ||
| 42 | - | ||
| 43 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/TradeBeforeOrderCreateReqBO.java deleted
| 1 | -package cn.iocoder.yudao.module.trade.service.order.bo; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | ||
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | -import javax.validation.Valid; | ||
| 7 | -import javax.validation.constraints.NotNull; | ||
| 8 | -import java.util.List; | ||
| 9 | -// TODO 芋艿:在想想这些参数的定义 | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 订单创建之前 Request BO | ||
| 13 | - * | ||
| 14 | - * @author HUIHUI | ||
| 15 | - */ | ||
| 16 | -@Data | ||
| 17 | -public class TradeBeforeOrderCreateReqBO { | ||
| 18 | - | ||
| 19 | - /** | ||
| 20 | - * 订单类型 | ||
| 21 | - * | ||
| 22 | - * 枚举 {@link TradeOrderTypeEnum} | ||
| 23 | - */ | ||
| 24 | - @NotNull(message = "订单类型不能为空") | ||
| 25 | - private Integer orderType; | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 用户编号 | ||
| 29 | - * | ||
| 30 | - * 关联 MemberUserDO 的 id 编号 | ||
| 31 | - */ | ||
| 32 | - @NotNull(message = "用户编号不能为空") | ||
| 33 | - private Long userId; | ||
| 34 | - | ||
| 35 | - // ========== 秒杀活动相关字段 ========== | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | - * 秒杀活动编号 | ||
| 39 | - */ | ||
| 40 | - private Long seckillActivityId; | ||
| 41 | - | ||
| 42 | - // ========== 拼团活动相关字段 ========== | ||
| 43 | - | ||
| 44 | - /** | ||
| 45 | - * 拼团活动编号 | ||
| 46 | - */ | ||
| 47 | - private Long combinationActivityId; | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * 拼团团长编号 | ||
| 51 | - */ | ||
| 52 | - private Long combinationHeadId; | ||
| 53 | - | ||
| 54 | - // ========== 砍价活动相关字段 ========== | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * 砍价活动编号 | ||
| 58 | - */ | ||
| 59 | - private Long bargainActivityId; | ||
| 60 | - | ||
| 61 | - // ========== 购买商品相关字段 ========== | ||
| 62 | - | ||
| 63 | - /** | ||
| 64 | - * 订单购买的商品信息 | ||
| 65 | - */ | ||
| 66 | - private List<Item> items; | ||
| 67 | - | ||
| 68 | - /** | ||
| 69 | - * 订单商品信息 | ||
| 70 | - * 记录购买商品的简要核心信息 | ||
| 71 | - * | ||
| 72 | - * @author HUIHUI | ||
| 73 | - */ | ||
| 74 | - @Data | ||
| 75 | - @Valid | ||
| 76 | - public static class Item { | ||
| 77 | - | ||
| 78 | - /** | ||
| 79 | - * 商品 SKU 编号 | ||
| 80 | - * | ||
| 81 | - * 关联 ProductSkuDO 的 id 编号 | ||
| 82 | - */ | ||
| 83 | - @NotNull(message = "SKU 编号活动商品不能为空") | ||
| 84 | - private Long skuId; | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | - * 购买的商品数量 | ||
| 88 | - */ | ||
| 89 | - @NotNull(message = "购买数量不能为空") | ||
| 90 | - private Integer count; | ||
| 91 | - | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/logger/TradeOrderLogCreateReqBO.java renamed to yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/bo/TradeOrderLogCreateReqBO.java
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeBargainHandler.java
| @@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.trade.service.order.handler; | @@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.trade.service.order.handler; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | import cn.iocoder.yudao.module.promotion.api.bargain.BargainActivityApi; | 4 | import cn.iocoder.yudao.module.promotion.api.bargain.BargainActivityApi; |
| 5 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; | ||
| 6 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | ||
| 5 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | 7 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; |
| 6 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeBeforeOrderCreateReqBO; | ||
| 7 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| 8 | 9 | ||
| 9 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
| 11 | +import java.util.List; | ||
| 10 | 12 | ||
| 11 | /** | 13 | /** |
| 12 | * 砍价订单 handler 实现类 | 14 | * 砍价订单 handler 实现类 |
| @@ -19,21 +21,14 @@ public class TradeBargainHandler implements TradeOrderHandler { | @@ -19,21 +21,14 @@ public class TradeBargainHandler implements TradeOrderHandler { | ||
| 19 | @Resource | 21 | @Resource |
| 20 | private BargainActivityApi bargainActivityApi; | 22 | private BargainActivityApi bargainActivityApi; |
| 21 | 23 | ||
| 22 | - // TODO @puhui999:先临时写在这里;在价格计算时,如果是秒杀商品,需要校验如下条件: | ||
| 23 | - // 1. 商品存在、库存充足、单次限购; | ||
| 24 | - // 2. 活动进行中、时间段符合 | ||
| 25 | - | ||
| 26 | @Override | 24 | @Override |
| 27 | - public void beforeOrderCreate(TradeBeforeOrderCreateReqBO reqBO) { | ||
| 28 | - // 如果是砍价订单 | ||
| 29 | - if (ObjectUtil.notEqual(TradeOrderTypeEnum.BARGAIN.getType(), reqBO.getOrderType())) { | 25 | + public void beforeOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) { |
| 26 | + if (ObjectUtil.notEqual(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) { | ||
| 30 | return; | 27 | return; |
| 31 | } | 28 | } |
| 32 | - | ||
| 33 | - // 获取商品信息 | ||
| 34 | - TradeBeforeOrderCreateReqBO.Item item = reqBO.getItems().get(0); | ||
| 35 | // 扣减砍价活动的库存 | 29 | // 扣减砍价活动的库存 |
| 36 | - bargainActivityApi.updateBargainActivityStock(reqBO.getBargainActivityId(), item.getCount()); | 30 | + bargainActivityApi.updateBargainActivityStock(order.getBargainActivityId(), |
| 31 | + orderItems.get(0).getCount()); | ||
| 37 | } | 32 | } |
| 38 | 33 | ||
| 39 | } | 34 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationHandler.java
| 1 | package cn.iocoder.yudao.module.trade.service.order.handler; | 1 | package cn.iocoder.yudao.module.trade.service.order.handler; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.ObjectUtil; | ||
| 4 | import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; | 3 | import cn.iocoder.yudao.module.promotion.api.combination.CombinationRecordApi; |
| 5 | -import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert; | ||
| 6 | -import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | ||
| 7 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterOrderCreateReqBO; | ||
| 8 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterPayOrderReqBO; | ||
| 9 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeBeforeOrderCreateReqBO; | ||
| 10 | import org.springframework.stereotype.Component; | 4 | import org.springframework.stereotype.Component; |
| 11 | 5 | ||
| 12 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
| @@ -22,38 +16,38 @@ public class TradeCombinationHandler implements TradeOrderHandler { | @@ -22,38 +16,38 @@ public class TradeCombinationHandler implements TradeOrderHandler { | ||
| 22 | @Resource | 16 | @Resource |
| 23 | private CombinationRecordApi combinationRecordApi; | 17 | private CombinationRecordApi combinationRecordApi; |
| 24 | 18 | ||
| 25 | - @Override | ||
| 26 | - public void beforeOrderCreate(TradeBeforeOrderCreateReqBO reqBO) { | ||
| 27 | - // 如果不是拼团订单则结束 | ||
| 28 | - if (ObjectUtil.notEqual(TradeOrderTypeEnum.COMBINATION.getType(), reqBO.getOrderType())) { | ||
| 29 | - return; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - // 获取商品信息 | ||
| 33 | - TradeBeforeOrderCreateReqBO.Item item = reqBO.getItems().get(0); | ||
| 34 | - // 校验是否满足拼团活动相关限制 | ||
| 35 | - combinationRecordApi.validateCombinationRecord(reqBO.getCombinationActivityId(), reqBO.getUserId(), item.getSkuId(), item.getCount()); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - @Override | ||
| 39 | - public void afterOrderCreate(TradeAfterOrderCreateReqBO reqBO) { | ||
| 40 | - if (reqBO.getCombinationActivityId() == null) { | ||
| 41 | - return; | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - // 创建砍价记录 | ||
| 45 | - combinationRecordApi.createCombinationRecord(TradeOrderConvert.INSTANCE.convert(reqBO)); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - @Override | ||
| 49 | - public void afterPayOrder(TradeAfterPayOrderReqBO reqBO) { | ||
| 50 | - // 如果不是拼团订单则结束 | ||
| 51 | - if (ObjectUtil.notEqual(TradeOrderTypeEnum.COMBINATION.getType(), reqBO.getOrderType())) { | ||
| 52 | - return; | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录 | ||
| 56 | - combinationRecordApi.updateRecordStatusToInProgress(reqBO.getUserId(), reqBO.getOrderId(), reqBO.getPayTime()); | ||
| 57 | - } | 19 | +// @Override |
| 20 | +// public void beforeOrderCreate(TradeBeforeOrderCreateReqBO reqBO) { | ||
| 21 | +// // 如果不是拼团订单则结束 | ||
| 22 | +// if (ObjectUtil.notEqual(TradeOrderTypeEnum.COMBINATION.getType(), reqBO.getOrderType())) { | ||
| 23 | +// return; | ||
| 24 | +// } | ||
| 25 | +// | ||
| 26 | +// // 获取商品信息 | ||
| 27 | +// TradeBeforeOrderCreateReqBO.Item item = reqBO.getItems().get(0); | ||
| 28 | +// // 校验是否满足拼团活动相关限制 | ||
| 29 | +// combinationRecordApi.validateCombinationRecord(reqBO.getCombinationActivityId(), reqBO.getUserId(), item.getSkuId(), item.getCount()); | ||
| 30 | +// } | ||
| 31 | + | ||
| 32 | +// @Override | ||
| 33 | +// public void afterOrderCreate(TradeAfterOrderCreateReqBO reqBO) { | ||
| 34 | +// if (reqBO.getCombinationActivityId() == null) { | ||
| 35 | +// return; | ||
| 36 | +// } | ||
| 37 | +// | ||
| 38 | +// // 创建砍价记录 | ||
| 39 | +// combinationRecordApi.createCombinationRecord(TradeOrderConvert.INSTANCE.convert(reqBO)); | ||
| 40 | +// } | ||
| 41 | + | ||
| 42 | +// @Override | ||
| 43 | +// public void afterPayOrder(TradeAfterPayOrderReqBO reqBO) { | ||
| 44 | +// // 如果不是拼团订单则结束 | ||
| 45 | +// if (ObjectUtil.notEqual(TradeOrderTypeEnum.COMBINATION.getType(), reqBO.getOrderType())) { | ||
| 46 | +// return; | ||
| 47 | +// } | ||
| 48 | +// | ||
| 49 | +// // 更新拼团状态 TODO puhui999:订单支付失败或订单支付过期删除这条拼团记录 | ||
| 50 | +// combinationRecordApi.updateRecordStatusToInProgress(reqBO.getUserId(), reqBO.getOrderId(), reqBO.getPayTime()); | ||
| 51 | +// } | ||
| 58 | 52 | ||
| 59 | } | 53 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeOrderHandler.java
| 1 | package cn.iocoder.yudao.module.trade.service.order.handler; | 1 | package cn.iocoder.yudao.module.trade.service.order.handler; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterOrderCreateReqBO; | ||
| 4 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeAfterPayOrderReqBO; | ||
| 5 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeBeforeOrderCreateReqBO; | 3 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; |
| 4 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * 订单活动特殊逻辑处理器 handler 接口 | 9 | * 订单活动特殊逻辑处理器 handler 接口 |
| @@ -15,23 +16,25 @@ public interface TradeOrderHandler { | @@ -15,23 +16,25 @@ public interface TradeOrderHandler { | ||
| 15 | /** | 16 | /** |
| 16 | * 订单创建前 | 17 | * 订单创建前 |
| 17 | * | 18 | * |
| 18 | - * @param reqBO 请求 | 19 | + * @param order 订单 |
| 20 | + * @param orderItems 订单项 | ||
| 19 | */ | 21 | */ |
| 20 | - default void beforeOrderCreate(TradeBeforeOrderCreateReqBO reqBO) {} | 22 | + default void beforeOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) {} |
| 21 | 23 | ||
| 22 | /** | 24 | /** |
| 23 | * 订单创建后 | 25 | * 订单创建后 |
| 24 | * | 26 | * |
| 25 | - * @param reqBO 请求 | 27 | + * @param order 订单 |
| 28 | + * @param orderItems 订单项 | ||
| 26 | */ | 29 | */ |
| 27 | - default void afterOrderCreate(TradeAfterOrderCreateReqBO reqBO) {} | 30 | + default void afterOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) {} |
| 28 | 31 | ||
| 29 | /** | 32 | /** |
| 30 | * 支付订单后 | 33 | * 支付订单后 |
| 31 | * | 34 | * |
| 32 | - * @param reqBO 请求 | 35 | + * @param order 订单 |
| 33 | */ | 36 | */ |
| 34 | - default void afterPayOrder(TradeAfterPayOrderReqBO reqBO) {} | 37 | + default void afterPayOrder(TradeOrderDO order) {} |
| 35 | 38 | ||
| 36 | /** | 39 | /** |
| 37 | * 订单取消 | 40 | * 订单取消 |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeSeckillHandler.java
| @@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.trade.service.order.handler; | @@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.trade.service.order.handler; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | import cn.iocoder.yudao.module.promotion.api.seckill.SeckillActivityApi; | 4 | import cn.iocoder.yudao.module.promotion.api.seckill.SeckillActivityApi; |
| 5 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO; | ||
| 6 | +import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO; | ||
| 5 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; | 7 | import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum; |
| 6 | -import cn.iocoder.yudao.module.trade.service.order.bo.TradeBeforeOrderCreateReqBO; | ||
| 7 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| 8 | 9 | ||
| 9 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
| 11 | +import java.util.List; | ||
| 10 | 12 | ||
| 11 | /** | 13 | /** |
| 12 | * 秒杀订单 handler 实现类 | 14 | * 秒杀订单 handler 实现类 |
| @@ -19,21 +21,14 @@ public class TradeSeckillHandler implements TradeOrderHandler { | @@ -19,21 +21,14 @@ public class TradeSeckillHandler implements TradeOrderHandler { | ||
| 19 | @Resource | 21 | @Resource |
| 20 | private SeckillActivityApi seckillActivityApi; | 22 | private SeckillActivityApi seckillActivityApi; |
| 21 | 23 | ||
| 22 | - // TODO @puhui999:先临时写在这里;在价格计算时,如果是秒杀商品,需要校验如下条件: | ||
| 23 | - // 1. 商品存在、库存充足、单次限购; | ||
| 24 | - // 2. 活动进行中、时间段符合 | ||
| 25 | - | ||
| 26 | @Override | 24 | @Override |
| 27 | - public void beforeOrderCreate(TradeBeforeOrderCreateReqBO reqBO) { | ||
| 28 | - // 如果是秒杀订单:额外扣减秒杀的库存; | ||
| 29 | - if (ObjectUtil.notEqual(TradeOrderTypeEnum.SECKILL.getType(), reqBO.getOrderType())) { | 25 | + public void beforeOrderCreate(TradeOrderDO order, List<TradeOrderItemDO> orderItems) { |
| 26 | + if (ObjectUtil.notEqual(TradeOrderTypeEnum.SECKILL.getType(), order.getType())) { | ||
| 30 | return; | 27 | return; |
| 31 | } | 28 | } |
| 32 | - | ||
| 33 | - // 获取商品信息 | ||
| 34 | - TradeBeforeOrderCreateReqBO.Item item = reqBO.getItems().get(0); | ||
| 35 | // 扣减秒杀活动的库存 | 29 | // 扣减秒杀活动的库存 |
| 36 | - seckillActivityApi.updateSeckillStock(reqBO.getSeckillActivityId(), item.getSkuId(), item.getCount()); | 30 | + seckillActivityApi.updateSeckillStock(order.getSeckillActivityId(), |
| 31 | + orderItems.get(0).getSkuId(), orderItems.get(0).getCount()); | ||
| 37 | } | 32 | } |
| 38 | 33 | ||
| 39 | } | 34 | } |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateReqBO.java
| @@ -81,9 +81,9 @@ public class TradePriceCalculateReqBO { | @@ -81,9 +81,9 @@ public class TradePriceCalculateReqBO { | ||
| 81 | 81 | ||
| 82 | // ========== 砍价活动相关字段 ========== | 82 | // ========== 砍价活动相关字段 ========== |
| 83 | /** | 83 | /** |
| 84 | - * 砍价活动编号 | 84 | + * 砍价记录编号 |
| 85 | */ | 85 | */ |
| 86 | - private Long bargainActivityId; | 86 | + private Long bargainRecordId; |
| 87 | 87 | ||
| 88 | /** | 88 | /** |
| 89 | * 商品 SKU | 89 | * 商品 SKU |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/bo/TradePriceCalculateRespBO.java
| @@ -59,6 +59,11 @@ public class TradePriceCalculateRespBO { | @@ -59,6 +59,11 @@ public class TradePriceCalculateRespBO { | ||
| 59 | private Integer givePoint; | 59 | private Integer givePoint; |
| 60 | 60 | ||
| 61 | /** | 61 | /** |
| 62 | + * 砍价活动编号 | ||
| 63 | + */ | ||
| 64 | + private Long bargainActivityId; | ||
| 65 | + | ||
| 66 | + /** | ||
| 62 | * 订单价格 | 67 | * 订单价格 |
| 63 | */ | 68 | */ |
| 64 | @Data | 69 | @Data |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeBargainActivityPriceCalculator.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.trade.service.price.calculator; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.lang.Assert; | ||
| 4 | +import cn.hutool.core.util.StrUtil; | ||
| 5 | +import cn.iocoder.yudao.module.promotion.api.bargain.BargainRecordApi; | ||
| 6 | +import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||
| 7 | +import cn.iocoder.yudao.module.promotion.enums.common.PromotionTypeEnum; | ||
| 8 | +import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO; | ||
| 9 | +import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; | ||
| 10 | +import org.springframework.core.annotation.Order; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 12 | + | ||
| 13 | +import javax.annotation.Resource; | ||
| 14 | + | ||
| 15 | +// TODO huihui:单测需要补充 | ||
| 16 | +/** | ||
| 17 | + * 砍价活动的 {@link TradePriceCalculator} 实现类 | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 21 | +@Component | ||
| 22 | +@Order(TradePriceCalculator.ORDER_BARGAIN_ACTIVITY) | ||
| 23 | +public class TradeBargainActivityPriceCalculator implements TradePriceCalculator { | ||
| 24 | + | ||
| 25 | + @Resource | ||
| 26 | + private BargainRecordApi bargainRecordApi; | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public void calculate(TradePriceCalculateReqBO param, TradePriceCalculateRespBO result) { | ||
| 30 | + // 1. 判断订单类型和是否具有拼团记录编号 | ||
| 31 | + if (param.getBargainRecordId() != null) { | ||
| 32 | + return; | ||
| 33 | + } | ||
| 34 | + Assert.isTrue(param.getItems().size() == 1, "砍价时,只允许选择一个商品"); | ||
| 35 | + Assert.isTrue(param.getItems().get(0).getCount() == 1, "砍价时,只允许选择一个商品"); | ||
| 36 | + // 2. 校验是否可以参与砍价 | ||
| 37 | + TradePriceCalculateRespBO.OrderItem orderItem = result.getItems().get(0); | ||
| 38 | + BargainValidateJoinRespDTO bargainActivity = bargainRecordApi.validateJoinBargain( | ||
| 39 | + param.getUserId(), param.getBargainRecordId(), orderItem.getSkuId()); | ||
| 40 | + | ||
| 41 | + // 3.1 记录优惠明细 | ||
| 42 | + Integer discountPrice = orderItem.getPayPrice() - bargainActivity.getBargainPrice() * orderItem.getCount(); | ||
| 43 | + TradePriceCalculatorHelper.addPromotion(result, orderItem, | ||
| 44 | + param.getSeckillActivityId(), bargainActivity.getName(), PromotionTypeEnum.BARGAIN_ACTIVITY.getType(), | ||
| 45 | + StrUtil.format("砍价活动:省 {} 元", TradePriceCalculatorHelper.formatPrice(discountPrice)), | ||
| 46 | + discountPrice); | ||
| 47 | + // 3.2 更新 SKU 优惠金额 | ||
| 48 | + orderItem.setDiscountPrice(orderItem.getDiscountPrice() + discountPrice); | ||
| 49 | + TradePriceCalculatorHelper.recountPayPrice(orderItem); | ||
| 50 | + TradePriceCalculatorHelper.recountAllPrice(result); | ||
| 51 | + // 4. 特殊:设置对应的砍价活动编号 | ||
| 52 | + result.setBargainActivityId(bargainActivity.getActivityId()); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradePriceCalculator.java
| @@ -14,6 +14,10 @@ import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; | @@ -14,6 +14,10 @@ import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO; | ||
| 14 | public interface TradePriceCalculator { | 14 | public interface TradePriceCalculator { |
| 15 | 15 | ||
| 16 | int ORDER_MEMBER_LEVEL = 5; | 16 | int ORDER_MEMBER_LEVEL = 5; |
| 17 | + | ||
| 18 | + int ORDER_SECKILL_ACTIVITY = 8; | ||
| 19 | + int ORDER_BARGAIN_ACTIVITY = 8; | ||
| 20 | + | ||
| 17 | int ORDER_DISCOUNT_ACTIVITY = 10; | 21 | int ORDER_DISCOUNT_ACTIVITY = 10; |
| 18 | int ORDER_REWARD_ACTIVITY = 20; | 22 | int ORDER_REWARD_ACTIVITY = 20; |
| 19 | int ORDER_COUPON = 30; | 23 | int ORDER_COUPON = 30; |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeSeckillActivityPriceCalculator.java
| @@ -23,7 +23,7 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PRICE_CALCU | @@ -23,7 +23,7 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PRICE_CALCU | ||
| 23 | * @author HUIHUI | 23 | * @author HUIHUI |
| 24 | */ | 24 | */ |
| 25 | @Component | 25 | @Component |
| 26 | -@Order(TradePriceCalculator.ORDER_DISCOUNT_ACTIVITY) | 26 | +@Order(TradePriceCalculator.ORDER_SECKILL_ACTIVITY) |
| 27 | public class TradeSeckillActivityPriceCalculator implements TradePriceCalculator { | 27 | public class TradeSeckillActivityPriceCalculator implements TradePriceCalculator { |
| 28 | 28 | ||
| 29 | @Resource | 29 | @Resource |