|
|
@@ -15,6 +15,8 @@ import com.sqx.modules.coupon.service.TbCouponUserService;
|
|
|
import com.sqx.modules.goods.entity.GoodsShop;
|
|
|
import com.sqx.modules.goods.service.GoodsShopService;
|
|
|
import com.sqx.modules.member.dto.VipPromoRecordDTO;
|
|
|
+import com.sqx.modules.member.entity.VipPromoCode;
|
|
|
+import com.sqx.modules.member.service.VipPromoCodeService;
|
|
|
import com.sqx.modules.member.service.VipPromoRecordService;
|
|
|
import com.sqx.modules.member.service.VipService;
|
|
|
import com.sqx.modules.member.vo.VipReduceVO;
|
|
|
@@ -46,17 +48,17 @@ public class VipServiceImpl implements VipService {
|
|
|
private final UserService userService;
|
|
|
private final CommonInfoService commonInfoService;
|
|
|
private final TbCouponUserService tbCouponUserService;
|
|
|
+ private final VipPromoCodeService vipPromoCodeService;
|
|
|
private final VipPromoRecordService vipPromoRecordService;
|
|
|
private final UserMoneyService userMoneyService;
|
|
|
private final GoodsShopService goodsShopService;
|
|
|
private final AppOrderService appOrderService;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public PayTransactionsVO getPayParam(Long userId, String promoCode) {
|
|
|
UserEntity user = userService.getById(userId);
|
|
|
- if(ObjectUtil.isNotNull(user.getIsVip()) && user.getIsVip() == 1 && VipExpirationUtil.isVipValid(user.getVipExpirationTime())) {
|
|
|
- new SqxException("已经是会员,不能重复购买!");
|
|
|
- }
|
|
|
+ beforePay(user, promoCode);
|
|
|
|
|
|
// 查询会员价格
|
|
|
CommonInfo one = commonInfoService.findOne(313);
|
|
|
@@ -82,8 +84,6 @@ public class VipServiceImpl implements VipService {
|
|
|
public void paySuccess(PayDetails payDetails) {
|
|
|
Long userId = payDetails.getUserId();
|
|
|
UserEntity user = userService.getById(userId);
|
|
|
- // 202511141701426541989257421909929985
|
|
|
- // 新增会员充值记录
|
|
|
VipPromoRecordDTO recordDTO = VipPromoRecordDTO.builder()
|
|
|
.userId(userId)
|
|
|
.userName(user.getNickName())
|
|
|
@@ -103,9 +103,7 @@ public class VipServiceImpl implements VipService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void balancePay(Long userId, String promoCode) {
|
|
|
UserEntity user = userService.getById(userId);
|
|
|
- if(ObjectUtil.isNotNull(user.getIsVip()) && user.getIsVip() == 1 && VipExpirationUtil.isVipValid(user.getVipExpirationTime())) {
|
|
|
- new SqxException("已经是会员,不能重复购买!");
|
|
|
- }
|
|
|
+ beforePay(user, promoCode);
|
|
|
|
|
|
// 会员价格
|
|
|
CommonInfo vipPrice = commonInfoService.findOne(313);
|
|
|
@@ -136,6 +134,17 @@ public class VipServiceImpl implements VipService {
|
|
|
afterPaySuccess(userId);
|
|
|
}
|
|
|
|
|
|
+ private void beforePay(UserEntity user, String promoCode) {
|
|
|
+ if(ObjectUtil.isNotNull(user.getIsVip()) && user.getIsVip() == 1 && VipExpirationUtil.isVipValid(user.getVipExpirationTime())) {
|
|
|
+ new SqxException("已经是会员,不能重复购买!");
|
|
|
+ }
|
|
|
+
|
|
|
+ VipPromoCode vipPromoCode = vipPromoCodeService.getByCode(promoCode);
|
|
|
+ if (ObjectUtil.isNull(vipPromoCode)) {
|
|
|
+ new SqxException("无效的推广码!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public VipReduceVO getVipReduceInfo(Long userId, Long shopId) {
|
|
|
GoodsShop goodsShop = goodsShopService.getById(shopId);
|