|
|
@@ -72,6 +72,7 @@ import com.cyksj.service.user.UserBenefitsService;
|
|
|
import com.cyksj.service.user.UserBindRelationService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.param.Operator;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -1316,12 +1317,21 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
|
|
|
|
|
|
//GPT独立会员退款 或代充退款 退还平台发券
|
|
|
if ((orderDon.getGoodsId() == Constant.GPT_PLUS_GID && sku.getNum() == 1) || orderDon.getGoodsId() == Constant.GPT_RECHARGE_GOODS_ID) {
|
|
|
- List<CouponUser> couponUsers = couponUserMapper.selectList(Wrappers.lambdaQuery(CouponUser.class)
|
|
|
- .eq(CouponUser::getUserId, orderDon.getUserId())
|
|
|
- .eq(CouponUser::getChannel, CouponUser.Channel.ptfq)
|
|
|
- .eq(CouponUser::getStatus, CouponUser.Status.unused));
|
|
|
- if (CollUtil.isNotEmpty(couponUsers)) {
|
|
|
- couponUserMapper.deleteBatchIds(couponUsers.stream().map(CouponUser::getId).collect(Collectors.toList()));
|
|
|
+ //若不存在对应的车票 则清除优惠券
|
|
|
+ List<Long> skuIds =goodsDonSkuMapper.selectIdpGptAndRechargeSkuIds(Constant.GPT_PLUS_GID, Constant.GPT_RECHARGE_GOODS_ID);
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(orderDon.getUserId(), null);
|
|
|
+ Number number = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)
|
|
|
+ .field(GroupsRelationView::getSkuId, skuIds).op(Operator.InList)
|
|
|
+ .field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name())
|
|
|
+ .build());
|
|
|
+ if (number.intValue() == 0) {
|
|
|
+ List<CouponUser> couponUsers = couponUserMapper.selectList(Wrappers.lambdaQuery(CouponUser.class)
|
|
|
+ .eq(CouponUser::getUserId, orderDon.getUserId())
|
|
|
+ .eq(CouponUser::getChannel, CouponUser.Channel.ptfq)
|
|
|
+ .eq(CouponUser::getStatus, CouponUser.Status.unused));
|
|
|
+ if (CollUtil.isNotEmpty(couponUsers)) {
|
|
|
+ couponUserMapper.deleteBatchIds(couponUsers.stream().map(CouponUser::getId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|