迁移 cart 的 web api

解决 promotion-service 模块的启动
This commit is contained in:
YunaiV
2020-08-07 19:12:00 +08:00
parent 5714ddcbe8
commit 84cc2728bd
22 changed files with 348 additions and 130 deletions

View File

@@ -16,14 +16,7 @@ public class UsersCartController {
// @Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
// private CouponService couponService;
//
// @PostMapping("add")
// public CommonResult<Integer> add(@RequestParam("skuId") Integer skuId,
// @RequestParam("quantity") Integer quantity) {
// // 添加到购物车
// cartService.add(UserSecurityContextHolder.getContext().getUserId(), skuId, quantity);
// // 获得目前购物车商品总数量
// return success(cartService.count(UserSecurityContextHolder.getContext().getUserId()));
// }
//
// @PostMapping("update_quantity")
// public CommonResult<UsersCartDetailVO> updateQuantity(@RequestParam("skuId") Integer skuId, // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整
@@ -43,11 +36,7 @@ public class UsersCartController {
// // 获得目前购物车明细
// return getCartDetail();
// }
//
// @GetMapping("count")
// public CommonResult<Integer> count() {
// return success(cartService.count(UserSecurityContextHolder.getContext().getUserId()));
// }
//
// @GetMapping("/list")
// public CommonResult<UsersCartDetailVO> list() { // TODO 芋艿,先暂用这个 VO 。等促销活动出来后,做调整

View File

@@ -239,7 +239,7 @@ public class CartServiceImpl implements CartService {
// 判断是否符合条件
int originalTotal = items.stream().mapToInt(CalcOrderPriceBO.Item::getPresentTotal).sum(); // 此处,指的是以优惠劵视角的原价
if (originalTotal == 0 || originalTotal < couponCard.getPriceAvailable()) {
throw ServiceExceptionUtil.exception(PromotionErrorCodeEnum.COUPON_CARD_NOT_MATCH.getCode()); // TODO 芋艿,这种情况,会出现错误码的提示,无法格式化出来。另外,这块的最佳实践,找人讨论下。
throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_NOT_MATCH.getCode()); // TODO 芋艿,这种情况,会出现错误码的提示,无法格式化出来。另外,这块的最佳实践,找人讨论下。
}
// 计算价格
// 获得到优惠信息,进行价格计算