只有指定vip才现金优惠券转积分
This commit is contained in:
@@ -389,7 +389,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
|
|||||||
List<Map<String,Object>> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper);
|
List<Map<String,Object>> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper);
|
||||||
for (Map<String,Object> map : buyOrderProducts) {
|
for (Map<String,Object> map : buyOrderProducts) {
|
||||||
ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString());
|
ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString());
|
||||||
//预售书+赠送现金券:VIP用户将券额转为积分;配置user_vip_ids时按限定VIP匹配,不匹配不送券
|
//预售书+赠送现金券:VIP用户将券额转为积分;配置user_vip_ids时匹配VIP且现金券换积分,不匹配只送券
|
||||||
if ("03".equals(shopProduct.getGoodsType())){
|
if ("03".equals(shopProduct.getGoodsType())){
|
||||||
MyUserEntity userEntity = userDao.selectById(order.getUserId());
|
MyUserEntity userEntity = userDao.selectById(order.getUserId());
|
||||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||||
@@ -398,21 +398,15 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
|
|||||||
int productId = Integer.parseInt(map.get("product_id").toString());
|
int productId = Integer.parseInt(map.get("product_id").toString());
|
||||||
int couponId = Integer.parseInt(map.get("coupon_id").toString());
|
int couponId = Integer.parseInt(map.get("coupon_id").toString());
|
||||||
CouponEntity couponEntity = couponDao.selectById(couponId);
|
CouponEntity couponEntity = couponDao.selectById(couponId);
|
||||||
boolean shouldGrantCoupon = true;
|
|
||||||
boolean couponToJf = false;
|
boolean couponToJf = false;
|
||||||
if (StringUtils.isNotEmpty(couponEntity.getUserVipIds())) {
|
if (StringUtils.isNotEmpty(couponEntity.getUserVipIds())) {
|
||||||
if (!matchUserVipIds(couponEntity.getUserVipIds(), userVipList)) {
|
if (matchUserVipIds(couponEntity.getUserVipIds(), userVipList)) {
|
||||||
shouldGrantCoupon = false;
|
|
||||||
} else {
|
|
||||||
couponToJf = couponEntity.getCouponType() == 0;
|
couponToJf = couponEntity.getCouponType() == 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType()));
|
boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType()));
|
||||||
couponToJf = couponEntity.getCouponType() == 0 && (productId == 2023 ? isFyszVip : userVipList.size() > 0);
|
couponToJf = couponEntity.getCouponType() == 0 && (productId == 2023 ? isFyszVip : userVipList.size() > 0);
|
||||||
}
|
}
|
||||||
if (!shouldGrantCoupon) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (couponToJf){
|
if (couponToJf){
|
||||||
BigDecimal jf = BigDecimal.ZERO;
|
BigDecimal jf = BigDecimal.ZERO;
|
||||||
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){
|
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user