Commit c79a080c by wuwenlong

团购券支持多套餐配置

parent b533c833
......@@ -257,11 +257,18 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
}
private Boolean checkPack(SConsumerCoupon item, CouponRequest couponRequest, List<SPack> sPacks){
// if(Objects.nonNull(item.getPackageId())&&item.getPackageId().compareTo(couponRequest.getPackageId())!=0){
// SPack pack = sPacks.stream().filter(obj -> obj.getId().compareTo(item.getPackageId())==0).findFirst().orElse(null);
// item.setIsAvailable(AvailableEnum.UNAVAILABLE.getCode());
// item.setReason("优惠卷当前套餐不可用,【"+pack.getName()+"】套餐可用");
// }
if(couponRequest.getOrderMode().compareTo(BuyTypeEnum.PACK.getCode())==0
&&StringUtils.isNotBlank(item.getPackIds())&&Objects.nonNull(couponRequest.getPackageId())){
List<Long> confPackIds = Arrays.stream(item.getPackIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
if(!confPackIds.contains(couponRequest.getPackageId())){
List<SPack> packs = sPacks.stream().filter(obj -> confPackIds.contains(obj.getId())).collect(Collectors.toList());
if(!CollectionUtils.isEmpty(packs)){
List<String> packNames = packs.stream().map(SPack::getName).distinct().collect(Collectors.toList());
item.setIsAvailable(AvailableEnum.UNAVAILABLE.getCode());
item.setReason("优惠卷当前套餐不可用,【"+packNames.toString()+"】套餐可用");
}
}
}
return item.getIsAvailable()==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