mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	trade:1、重构 order handler 的参数;2、增加砍价商品的价格计算
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package cn.iocoder.yudao.module.promotion.api.bargain; | ||||
|  | ||||
| import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainRecordCreateReqDTO; | ||||
| import cn.iocoder.yudao.module.promotion.api.bargain.dto.BargainValidateJoinRespDTO; | ||||
|  | ||||
| import javax.validation.Valid; | ||||
|  | ||||
| @@ -20,4 +21,16 @@ public interface BargainRecordApi { | ||||
|      */ | ||||
|     void createBargainRecord(@Valid BargainRecordCreateReqDTO reqDTO); | ||||
|  | ||||
|     /** | ||||
|      * 【下单前】校验是否参与砍价活动 | ||||
|      * <p> | ||||
|      * 如果校验失败,则抛出业务异常 | ||||
|      * | ||||
|      * @param userId          用户编号 | ||||
|      * @param bargainRecordId 砍价活动编号 | ||||
|      * @param skuId           SKU 编号 | ||||
|      * @return 砍价信息 | ||||
|      */ | ||||
|     BargainValidateJoinRespDTO validateJoinBargain(Long userId, Long bargainRecordId, Long skuId); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -51,6 +51,7 @@ public class BargainRecordCreateReqDTO { | ||||
|     @NotNull(message = "商品原价不能为空") | ||||
|     private Integer price; | ||||
|  | ||||
|     // TODO @puhui999:创建时,这个参数不应该传递哈; | ||||
|     /** | ||||
|      * 开团状态:进行中 砍价成功 砍价失败 | ||||
|      */ | ||||
|   | ||||
| @@ -0,0 +1,25 @@ | ||||
| package cn.iocoder.yudao.module.promotion.api.bargain.dto; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * 校验参与砍价 Response DTO | ||||
|  */ | ||||
| @Data | ||||
| public class BargainValidateJoinRespDTO { | ||||
|  | ||||
|     /** | ||||
|      * 砍价活动编号 | ||||
|      */ | ||||
|     private Long activityId; | ||||
|     /** | ||||
|      * 砍价活动名称 | ||||
|      */ | ||||
|     private String name; | ||||
|  | ||||
|     /** | ||||
|      * 砍价金额 | ||||
|      */ | ||||
|     private Integer bargainPrice; | ||||
|  | ||||
| } | ||||
| @@ -19,13 +19,14 @@ public interface SeckillActivityApi { | ||||
|     void updateSeckillStock(Long id, Long skuId, Integer count); | ||||
|  | ||||
|     /** | ||||
|      * 校验是否参与秒杀商品 | ||||
|      * 【下单前】校验是否参与秒杀活动 | ||||
|      * | ||||
|      * 如果校验失败,则抛出业务异常 | ||||
|      * | ||||
|      * @param activityId 活动编号 | ||||
|      * @param skuId SKU 编号 | ||||
|      * @param count 数量 | ||||
|      * @return 秒杀信息 | ||||
|      */ | ||||
|     SeckillValidateJoinRespDTO validateJoinSeckill(Long activityId, Long skuId, Integer count); | ||||
|  | ||||
|   | ||||
| @@ -97,5 +97,8 @@ public interface ErrorCodeConstants { | ||||
|     ErrorCode BARGAIN_RECORD_EXISTS = new ErrorCode(1_013_013_001, "砍价失败,已参与过该砍价"); | ||||
|     ErrorCode BARGAIN_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1_013_013_002, "砍价失败,父砍价不存在"); | ||||
|     ErrorCode BARGAIN_RECORD_USER_FULL = new ErrorCode(1_013_013_003, "砍价失败,砍价人数已满"); | ||||
|     ErrorCode BARGAIN_JOIN_RECORD_NOT_IN_PROGRESS = new ErrorCode(1_013_013_004, "砍价失败,砍价记录不在进行中"); | ||||
|     ErrorCode BARGAIN_JOIN_FAILED_ACTIVITY_TIME_END = new ErrorCode(1_013_013_005, "砍价失败,活动已经结束"); | ||||
|     ErrorCode BARGAIN_JOIN_ACTIVITY_STATUS_CLOSED = new ErrorCode(1_013_013_006, "砍价失败,原因:砍价活动已关闭"); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,39 @@ | ||||
| package cn.iocoder.yudao.module.promotion.enums.bargain; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||||
| import lombok.AllArgsConstructor; | ||||
| import lombok.Getter; | ||||
|  | ||||
| import java.util.Arrays; | ||||
|  | ||||
| /** | ||||
|  * 砍价记录的状态枚举 | ||||
|  * | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @AllArgsConstructor | ||||
| @Getter | ||||
| public enum BargainRecordStatusEnum implements IntArrayValuable { | ||||
|  | ||||
|     IN_PROGRESS(1, "砍价中"), | ||||
|     SUCCESS(2, "砍价成功"), | ||||
|     FAILED(3, "砍价失败"), | ||||
|     ; | ||||
|  | ||||
|     public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BargainRecordStatusEnum::getStatus).toArray(); | ||||
|  | ||||
|     /** | ||||
|      * 值 | ||||
|      */ | ||||
|     private final Integer status; | ||||
|     /** | ||||
|      * 名字 | ||||
|      */ | ||||
|     private final String name; | ||||
|  | ||||
|     @Override | ||||
|     public int[] array() { | ||||
|         return ARRAYS; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -16,8 +16,8 @@ import java.util.Arrays; | ||||
| public enum PromotionTypeEnum implements IntArrayValuable { | ||||
|  | ||||
|     SECKILL_ACTIVITY(1, "秒杀活动"), | ||||
|     BARGAIN_ACTIVITY(2, "拼团活动"), | ||||
|     COMBINATION_ACTIVITY(3, "砍价活动"), | ||||
|     BARGAIN_ACTIVITY(2, "砍价活动"), | ||||
|     COMBINATION_ACTIVITY(3, "拼团活动"), | ||||
|  | ||||
|     DISCOUNT_ACTIVITY(4, "限时折扣"), | ||||
|     REWARD_ACTIVITY(5, "满减送"), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV