Commit 99933a70 by chongfu.liang

fix

parent 61e555bf
......@@ -56,6 +56,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
@Autowired
private ProductManager productManager;
@Autowired
private CouponManager couponManager;
......@@ -453,7 +454,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
List<CartGoods> giftGoods = null;
AdditionBO additionBO = null;
ScoreReduceBO scoreReduceBO = null;
if (distributeBO.getCalculationDiscountBO() == null || CollectionUtils.isEmpty(distributeBO.getCartGoods())){
if (distributeBO.getCalculationDiscountBO() != null || CollectionUtils.isEmpty(distributeBO.getCartGoods())){
/**
* 用促销价格初始化购物车行记录成交价
*/
......@@ -466,13 +467,15 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
*/
additionBO = this.additionResponse(distributeBO.getCalculationDiscountBO().getResult(), baseRequestDTO);
/**
* 积分抵扣
*/
scoreReduceBO = this.scoreReduce(distributeBO.getCalculationDiscountBO().getResult(), baseRequestDTO, shoppingGoodsAmountBO, additionBO);
}
/**
* 积分抵扣
*/
scoreReduceBO = this.scoreReduce(distributeBO.getCalculationDiscountBO(), baseRequestDTO, shoppingGoodsAmountBO, additionBO);
/**
* 配送费
*/
DeliveryBO delivery = null;
......@@ -661,7 +664,7 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
}
public ScoreReduceBO scoreReduce(CalculationDiscountBO.CalculationDiscountResult discountResult
public ScoreReduceBO scoreReduce(CalculationDiscountBO calculationDiscountBO
, ListCartGoodsBO baseRequestDTO, ShoppingGoodsAmountBO shoppingGoodsAmountBO, AdditionBO additionBO) {
ScoreReduceBO scoreReduce = new ScoreReduceBO();
if (baseRequestDTO == null || baseRequestDTO.getUseCustomerScore() == null
......@@ -698,28 +701,34 @@ public class AbstractListCartGoodsService implements ListCartGoodsService {
if (getValue(userScoreUseDetail.getOverlayOffers()) == 0) {
scoreReduce.setScoreReduceState(getValue(userScoreUseDetail.getScoreState()));
} else {
if (StringUtils.isNotBlank(baseRequestDTO.getCouponCode()) || (discountResult != null && discountResult.getTotalDiscountAmount().intValue() > 0)
|| (discountResult != null && !CollectionUtils.isEmpty(discountResult.getDiscounts()))) {
//是否有换购
int type81 = 0;
for (CalculationDiscountBO.CalculationDiscountResult.Discount discount : discountResult.getDiscounts()) {
if (ActivityTypeEnum.TYPE_81.getCode().equals(discount.getType())) {
type81 = 1;
break;
CalculationDiscountBO.CalculationDiscountResult discountResult = null;
if (calculationDiscountBO != null){
discountResult = calculationDiscountBO.getResult();
}
if (discountResult != null){
if (StringUtils.isNotBlank(baseRequestDTO.getCouponCode()) || (discountResult.getTotalDiscountAmount().intValue() > 0)
|| (!CollectionUtils.isEmpty(discountResult.getDiscounts()))) {
//是否有换购
int type81 = 0;
for (CalculationDiscountBO.CalculationDiscountResult.Discount discount : discountResult.getDiscounts()) {
if (ActivityTypeEnum.TYPE_81.getCode().equals(discount.getType())) {
type81 = 1;
break;
}
}
//集点
long discountCount = discountResult.getDiscounts().stream().filter(discount -> !ActivityTypeEnum.TYPE_221.getCode().equals(discount.getType())).count();
//积分抵扣开关禁用 有换购活动 且选中了换购商品
// - 有换购且选中了换购商品
// - 有换购且没有选中换购商品 且除集点以外还有其他促销
if ((type81 == 0 && discountCount >= 1)
|| (type81 == 1 && !CollectionUtils.isEmpty(baseRequestDTO.getSendGoods()))
|| (type81 == 1 && discountCount > 1)) {
scoreReduce.setScoreReduceState(5);
userScoreUseDetail.setScoreState(5);
scoreReduce.setReduceAmount(0);
}
}
//集点
long discountCount = discountResult.getDiscounts().stream().filter(discount -> !ActivityTypeEnum.TYPE_221.getCode().equals(discount.getType())).count();
//积分抵扣开关禁用 有换购活动 且选中了换购商品
// - 有换购且选中了换购商品
// - 有换购且没有选中换购商品 且除集点以外还有其他促销
if ((type81 == 0 && discountCount >= 1)
|| (type81 == 1 && !CollectionUtils.isEmpty(baseRequestDTO.getSendGoods()))
|| (type81 == 1 && discountCount > 1)) {
scoreReduce.setScoreReduceState(5);
userScoreUseDetail.setScoreState(5);
scoreReduce.setReduceAmount(0);
}
}
}
......
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