Commit 34b9b49a by 徐康
parents a1eb7345 cc3079ce
......@@ -7,6 +7,7 @@ import com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCod
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import com.freemud.sdk.api.assortment.order.request.order.BaseQueryOrderRequest;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrderByIdResponse;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -28,7 +29,7 @@ public class OrderManager {
queryOrderByIdResponse.setErrcode(Integer.parseInt(orderInfo.getCode()));
queryOrderByIdResponse.setErrmsg(orderInfo.getMessage());
}
if(orderInfo != null && orderInfo.getResult() != null){
if(orderInfo != null && orderInfo.getResult() != null && StringUtils.isNotEmpty(orderInfo.getResult().getOrderCode())){
OrderBeanV1 orderBeanV1 = orderCenterSdkAdapter.convent2NEWOrderInfo(orderInfo.getResult());
queryOrderByIdResponse.setData(orderBeanV1);
}
......
......@@ -365,6 +365,11 @@ public class ActivityCalculationDiscountResponseDto {
//活动覆盖商品数量,比如第二件实际优惠一件,但是两件商品都算活动叠加数量
private Integer addOnQuantity = 0;
/**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMembershipLevel;
}
/**
......
......@@ -316,6 +316,11 @@ public class CartGoods {
private String taxId;
/**
* 当前用户的会员等级(目前只有会员价活动使用)
*/
private String currentMemberLevel;
/**
* 套餐固定商品
*/
private List<ComboxGoods> productComboList;
......
......@@ -78,12 +78,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
if (calculationDiscountResult == null || CollectionUtils.isEmpty(calculationDiscountResult.getDiscounts())) {
return;
}
Map<String, Long> result = new HashMap<>();
Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount> result = new HashMap<>();
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods goods : calculationDiscountResult.getGoods()) {
if (!CollectionUtils.isEmpty(goods.getDiscounts())) {
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : goods.getDiscounts()) {
if (ActivityTypeEnum.TYPE_27.getCode().equals(goodsDiscount.getType())) {
result.putIfAbsent(goods.getCartGoodsUid(), goodsDiscount.getDiscount());
result.putIfAbsent(goods.getCartGoodsUid(), goodsDiscount);
}
}
}
......@@ -95,11 +95,12 @@ public class MemberDiscountServiceImpl implements IPromotionService {
for (CartGoods cartGoods : cartGoodsList) {
//优惠总价
Long discountPrice = result.get(cartGoods.getCartGoodsUid());
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = result.get(cartGoods.getCartGoodsUid());
//老促销计算价格接口套餐价购物车内部计算价格,已在套餐实现类计算好价格,这里无需再扣减
if (discountPrice != null && discountPrice > 0 && CollectionUtils.isEmpty(cartGoods.getProductComboList())
if (goodsDiscount != null && goodsDiscount.getDiscount() > 0 && CollectionUtils.isEmpty(cartGoods.getProductComboList())
&& CollectionUtils.isEmpty(cartGoods.getProductGroupList())) {
cartGoods.setAmount(cartGoods.getAmount() - discountPrice);
cartGoods.setAmount(cartGoods.getAmount() - goodsDiscount.getDiscount());
cartGoods.setCurrentMemberLevel(goodsDiscount.getCurrentMembershipLevel());
}
}
}
......
......@@ -134,10 +134,17 @@ public class CalculationCommonService {
cartGoods.setCurrentCouponDiscount(0);
cartGoods.setFinalPrice(find.getNowPrice());
if (CollectionUtils.isNotEmpty(find.getDiscounts())){
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream()
.filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null);
if (goodsDiscount != null){
cartGoods.setCurrentCouponDiscount(goodsDiscount.getDiscount() == null ? 0 : goodsDiscount.getDiscount().intValue());
// ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount = find.getDiscounts().stream()
// .filter(p -> p.getActivityCode().equals(couponCode)).findFirst().orElse(null);
// if (goodsDiscount != null){
// }
for (ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount goodsDiscount : find.getDiscounts()){
if(goodsDiscount.getActivityCode().equals(couponCode)){
cartGoods.setCurrentCouponDiscount(goodsDiscount.getDiscount() == null ? 0 : goodsDiscount.getDiscount().intValue());
}
if(StringUtils.isNotEmpty(goodsDiscount.getCurrentMembershipLevel())){
cartGoods.setCurrentMemberLevel(goodsDiscount.getCurrentMembershipLevel());
}
}
}
//cartGoods.setOriginalAmount(find.getOriginalPrice());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment