|
@@ -103,28 +103,44 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|
List<OmsOrderItem> orderItemList = new ArrayList<>();
|
|
List<OmsOrderItem> orderItemList = new ArrayList<>();
|
|
//获取购物车及优惠信息
|
|
//获取购物车及优惠信息
|
|
Long userId = SessionContextHolder.getId();
|
|
Long userId = SessionContextHolder.getId();
|
|
- List<OmsCartItemDTO> cartPromotionItemList = omsCartItemService.listPromotion(orderParam.getCartIds());
|
|
|
|
- for (OmsCartItemDTO cartPromotionItem : cartPromotionItemList) {
|
|
|
|
|
|
+ List<OmsCartItemDTO> cartPromotionItemList = new ArrayList<>();
|
|
|
|
+ if (CollectionUtils.isEmpty(orderParam.getCartIds())){
|
|
//生成下单商品信息
|
|
//生成下单商品信息
|
|
OmsOrderItem orderItem = new OmsOrderItem();
|
|
OmsOrderItem orderItem = new OmsOrderItem();
|
|
- orderItem.setGoodsId(cartPromotionItem.getGoodsId());
|
|
|
|
- orderItem.setGoodsName(cartPromotionItem.getGoodsName());
|
|
|
|
- orderItem.setGoodsPic(cartPromotionItem.getGoodsPic());
|
|
|
|
- orderItem.setGoodsAttr(cartPromotionItem.getGoodsAttr());
|
|
|
|
- orderItem.setGoodsBrand(cartPromotionItem.getGoodsBrand());
|
|
|
|
- orderItem.setGoodsSn(cartPromotionItem.getGoodsSn());
|
|
|
|
- orderItem.setGoodsPrice(cartPromotionItem.getPrice());
|
|
|
|
- orderItem.setGoodsQuantity(cartPromotionItem.getQuantity());
|
|
|
|
- orderItem.setGoodsSkuId(cartPromotionItem.getGoodsSkuId());
|
|
|
|
- orderItem.setGoodsSkuCode(cartPromotionItem.getGoodsSkuCode());
|
|
|
|
- orderItem.setGoodsCategoryId(cartPromotionItem.getGoodsCategoryId());
|
|
|
|
|
|
+ orderItem.setGoodsId(orderParam.getGoodsInfo().getGoodsId());
|
|
|
|
+ orderItem.setGoodsName(orderParam.getGoodsInfo().getGoodsName());
|
|
|
|
+ orderItem.setGoodsPic(orderParam.getGoodsInfo().getGoodsPic());
|
|
|
|
+ orderItem.setGoodsPrice(orderParam.getGoodsInfo().getPrice());
|
|
|
|
+ orderItem.setGoodsQuantity(orderParam.getGoodsInfo().getQuantity());
|
|
|
|
+ orderItem.setGoodsCategoryId(orderParam.getGoodsInfo().getGoodsCategoryId());
|
|
// orderItem.setPromotionAmount(cartPromotionItem.getReduceAmount());
|
|
// orderItem.setPromotionAmount(cartPromotionItem.getReduceAmount());
|
|
// orderItem.setPromotionName(cartPromotionItem.getPromotionMessage());
|
|
// orderItem.setPromotionName(cartPromotionItem.getPromotionMessage());
|
|
orderItem.setGiftIntegration(0L);
|
|
orderItem.setGiftIntegration(0L);
|
|
orderItem.setGiftGrowth(0);
|
|
orderItem.setGiftGrowth(0);
|
|
orderItemList.add(orderItem);
|
|
orderItemList.add(orderItem);
|
|
|
|
+ }else{
|
|
|
|
+ cartPromotionItemList = omsCartItemService.listPromotion(orderParam.getCartIds());
|
|
|
|
+ for (OmsCartItemDTO cartPromotionItem : cartPromotionItemList) {
|
|
|
|
+ //生成下单商品信息
|
|
|
|
+ OmsOrderItem orderItem = new OmsOrderItem();
|
|
|
|
+ orderItem.setGoodsId(cartPromotionItem.getGoodsId());
|
|
|
|
+ orderItem.setGoodsName(cartPromotionItem.getGoodsName());
|
|
|
|
+ orderItem.setGoodsPic(cartPromotionItem.getGoodsPic());
|
|
|
|
+ orderItem.setGoodsAttr(cartPromotionItem.getGoodsAttr());
|
|
|
|
+ orderItem.setGoodsBrand(cartPromotionItem.getGoodsBrand());
|
|
|
|
+ orderItem.setGoodsSn(cartPromotionItem.getGoodsSn());
|
|
|
|
+ orderItem.setGoodsPrice(cartPromotionItem.getPrice());
|
|
|
|
+ orderItem.setGoodsQuantity(cartPromotionItem.getQuantity());
|
|
|
|
+ orderItem.setGoodsSkuId(cartPromotionItem.getGoodsSkuId());
|
|
|
|
+ orderItem.setGoodsSkuCode(cartPromotionItem.getGoodsSkuCode());
|
|
|
|
+ orderItem.setGoodsCategoryId(cartPromotionItem.getGoodsCategoryId());
|
|
|
|
+// orderItem.setPromotionAmount(cartPromotionItem.getReduceAmount());
|
|
|
|
+// orderItem.setPromotionName(cartPromotionItem.getPromotionMessage());
|
|
|
|
+ orderItem.setGiftIntegration(0L);
|
|
|
|
+ orderItem.setGiftGrowth(0);
|
|
|
|
+ orderItemList.add(orderItem);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
//判断购物车中商品是否都有库存
|
|
//判断购物车中商品是否都有库存
|
|
// if (!hasStock(cartPromotionItemList)) {
|
|
// if (!hasStock(cartPromotionItemList)) {
|
|
// Asserts.fail("库存不足,无法下单");
|
|
// Asserts.fail("库存不足,无法下单");
|
|
@@ -137,13 +153,13 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//使用优惠券
|
|
//使用优惠券
|
|
- UserCouponDTO userCouponDTO = getUseCoupon(cartPromotionItemList, orderParam.getCouponId());
|
|
|
|
- if (userCouponDTO == null) {
|
|
|
|
- Asserts.check(true, "该优惠券不可用");
|
|
|
|
- }
|
|
|
|
- //对下单商品的优惠券进行处理
|
|
|
|
- assert userCouponDTO != null;
|
|
|
|
- handleCouponAmount(orderItemList, userCouponDTO);
|
|
|
|
|
|
+// UserCouponDTO userCouponDTO = getUseCoupon(cartPromotionItemList, orderParam.getCouponId());
|
|
|
|
+// if (userCouponDTO == null) {
|
|
|
|
+// Asserts.check(true, "该优惠券不可用");
|
|
|
|
+// }
|
|
|
|
+// //对下单商品的优惠券进行处理
|
|
|
|
+// assert userCouponDTO != null;
|
|
|
|
+// handleCouponAmount(orderItemList, userCouponDTO);
|
|
}
|
|
}
|
|
//判断是否使用积分
|
|
//判断是否使用积分
|
|
if (orderParam.getUseIntegration() == null || orderParam.getUseIntegration().equals(0)) {
|
|
if (orderParam.getUseIntegration() == null || orderParam.getUseIntegration().equals(0)) {
|