拼团记录:完善拼团记录创建前的条件校验规则

This commit is contained in:
puhui999
2023-10-07 14:30:25 +08:00
parent c7b5df930e
commit f40bd23f6a
10 changed files with 117 additions and 71 deletions

View File

@ -18,12 +18,13 @@ public interface CombinationRecordApi {
/**
* 校验是否满足拼团条件
*
* @param activityId 活动编号
* @param userId 用户编号
* @param activityId 活动编号
* @param headId 团长编号
* @param skuId sku 编号
* @param count 数量
*/
void validateCombinationRecord(Long activityId, Long userId, Long skuId, Integer count);
void validateCombinationRecord(Long userId, Long activityId, Long headId, Long skuId, Integer count);
/**
* 创建开团记录
@ -71,13 +72,13 @@ public interface CombinationRecordApi {
*
* 如果校验失败,则抛出业务异常
*
* @param activityId 活动编号
* @param userId 用户编号
* @param activityId 活动编号
* @param headId 团长编号
* @param skuId sku 编号
* @param count 数量
* @return 拼团信息
*/
// TODO @puhuiuserId 放最前面;然后应该还有个 headId 参数;
CombinationValidateJoinRespDTO validateJoinCombination(Long activityId, Long userId, Long skuId, Integer count);
CombinationValidateJoinRespDTO validateJoinCombination(Long userId, Long activityId, Long headId, Long skuId, Integer count);
}

View File

@ -80,7 +80,7 @@ public interface ErrorCodeConstants {
ErrorCode COMBINATION_RECORD_EXISTS = new ErrorCode(1_013_011_001, "拼团失败,已参与过该拼团");
ErrorCode COMBINATION_RECORD_HEAD_NOT_EXISTS = new ErrorCode(1_013_011_002, "拼团失败,父拼团不存在");
ErrorCode COMBINATION_RECORD_USER_FULL = new ErrorCode(1_013_011_003, "拼团失败,拼团人数已满");
ErrorCode COMBINATION_RECORD_FAILED_HAVE_JOINED = new ErrorCode(1_013_011_004, "拼团失败,已参与其它拼团");
ErrorCode COMBINATION_RECORD_FAILED_HAVE_JOINED = new ErrorCode(1_013_011_004, "拼团失败,原因:存在该活动正在进行的拼团记录");
ErrorCode COMBINATION_RECORD_FAILED_TIME_NOT_START = new ErrorCode(1_013_011_005, "拼团失败,活动未开始");
ErrorCode COMBINATION_RECORD_FAILED_TIME_END = new ErrorCode(1_013_011_006, "拼团失败,活动已经结束");
ErrorCode COMBINATION_RECORD_FAILED_SINGLE_LIMIT_COUNT_EXCEED = new ErrorCode(1_013_011_007, "拼团失败,原因:单次限购超出");

View File

@ -40,4 +40,8 @@ public enum CombinationRecordStatusEnum implements IntArrayValuable {
return ObjectUtil.equal(status, SUCCESS.getStatus());
}
public static boolean isInProgress(Integer status) {
return ObjectUtil.equal(status, IN_PROGRESS.getStatus());
}
}