mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【代码优化】商城: 满减送活动校验提示优化
This commit is contained in:
parent
a808157a62
commit
ea6e365097
@ -44,7 +44,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode REWARD_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_002, "满减送活动已关闭,不能修改");
|
ErrorCode REWARD_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_002, "满减送活动已关闭,不能修改");
|
||||||
ErrorCode REWARD_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1_013_006_003, "满减送活动未关闭,不能删除");
|
ErrorCode REWARD_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1_013_006_003, "满减送活动未关闭,不能删除");
|
||||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_004, "满减送活动已关闭,不能重复关闭");
|
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_006_004, "满减送活动已关闭,不能重复关闭");
|
||||||
ErrorCode REWARD_ACTIVITY_SCOPE_EXISTS = new ErrorCode(1_013_006_005, "与该时间段已存在的满减送活动商品范围冲突");
|
ErrorCode REWARD_ACTIVITY_SCOPE_EXISTS = new ErrorCode(1_013_006_005, "与该时间段满减送活动【{}】商品范围冲突,原因:{}");
|
||||||
|
|
||||||
// ========== TODO 空着 1-013-007-000 ============
|
// ========== TODO 空着 1-013-007-000 ============
|
||||||
|
|
||||||
|
@ -135,16 +135,16 @@ public class RewardActivityServiceImpl implements RewardActivityService {
|
|||||||
// 例如说,rewardActivity 是全部活动,结果有个 db 里的 activity 是某个分类,它也是冲突的。也就是说,当前时间段内,有且仅有只能有一个活动!
|
// 例如说,rewardActivity 是全部活动,结果有个 db 里的 activity 是某个分类,它也是冲突的。也就是说,当前时间段内,有且仅有只能有一个活动!
|
||||||
if (PromotionProductScopeEnum.isAll(item.getProductScope()) ||
|
if (PromotionProductScopeEnum.isAll(item.getProductScope()) ||
|
||||||
PromotionProductScopeEnum.isAll(rewardActivity.getProductScope())) {
|
PromotionProductScopeEnum.isAll(rewardActivity.getProductScope())) {
|
||||||
// TODO puhui999:需要提示出来与满减送活动“xxx 活动”存在商品范围冲突;这里可能要分情况,下面需要把 activityName 传入
|
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS, item.getName(),
|
||||||
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS);
|
PromotionProductScopeEnum.isAll(item.getProductScope()) ? "该活动商品范围为全部已覆盖包含本活动范围" :
|
||||||
|
"本活动商品范围为全部已覆盖包含了该活动商品范围");
|
||||||
}
|
}
|
||||||
// 情况二:如果与该时间段内商品范围为类别的活动冲突
|
// 情况二:如果与该时间段内商品范围为类别的活动冲突
|
||||||
if (PromotionProductScopeEnum.isCategory(item.getProductScope())) {
|
if (PromotionProductScopeEnum.isCategory(item.getProductScope())) {
|
||||||
// TODO puhui999:前端我们有限制,只允许子分类么?可能要限制下,不然基于分类查询不到对应的商品。因为商品目前必须在子分类下
|
|
||||||
// 校验分类是否冲突
|
// 校验分类是否冲突
|
||||||
if (PromotionProductScopeEnum.isCategory(rewardActivity.getProductScope())) {
|
if (PromotionProductScopeEnum.isCategory(rewardActivity.getProductScope())) {
|
||||||
if (!intersectionDistinct(item.getProductScopeValues(), rewardActivity.getProductScopeValues()).isEmpty()) {
|
if (!intersectionDistinct(item.getProductScopeValues(), rewardActivity.getProductScopeValues()).isEmpty()) {
|
||||||
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS);
|
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS, item.getName(), "商品分类范围重叠");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校验商品分类是否冲突
|
// 校验商品分类是否冲突
|
||||||
@ -152,7 +152,7 @@ public class RewardActivityServiceImpl implements RewardActivityService {
|
|||||||
List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(rewardActivity.getProductScopeValues());
|
List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(rewardActivity.getProductScopeValues());
|
||||||
if (!intersectionDistinct(item.getProductScopeValues(),
|
if (!intersectionDistinct(item.getProductScopeValues(),
|
||||||
convertSet(spuList, ProductSpuRespDTO::getCategoryId)).isEmpty()) {
|
convertSet(spuList, ProductSpuRespDTO::getCategoryId)).isEmpty()) {
|
||||||
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS);
|
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS, item.getName(), "该活动商品分类范围已包含本活动所选商品");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class RewardActivityServiceImpl implements RewardActivityService {
|
|||||||
// 校验商品是否冲突
|
// 校验商品是否冲突
|
||||||
if (PromotionProductScopeEnum.isSpu(rewardActivity.getProductScope())) {
|
if (PromotionProductScopeEnum.isSpu(rewardActivity.getProductScope())) {
|
||||||
if (!intersectionDistinct(item.getProductScopeValues(), rewardActivity.getProductScopeValues()).isEmpty()) {
|
if (!intersectionDistinct(item.getProductScopeValues(), rewardActivity.getProductScopeValues()).isEmpty()) {
|
||||||
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS);
|
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS, item.getName(), "活动商品范围所选商品重叠");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 校验商品分类是否冲突
|
// 校验商品分类是否冲突
|
||||||
@ -169,7 +169,7 @@ public class RewardActivityServiceImpl implements RewardActivityService {
|
|||||||
List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(item.getProductScopeValues());
|
List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(item.getProductScopeValues());
|
||||||
if (!intersectionDistinct(rewardActivity.getProductScopeValues(),
|
if (!intersectionDistinct(rewardActivity.getProductScopeValues(),
|
||||||
convertSet(spuList, ProductSpuRespDTO::getCategoryId)).isEmpty()) {
|
convertSet(spuList, ProductSpuRespDTO::getCategoryId)).isEmpty()) {
|
||||||
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS);
|
throw exception(REWARD_ACTIVITY_SCOPE_EXISTS, item.getName(), "本活动商品分类范围包含了该活动所选商品");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user