nickchange
2023-11-01 bbee9271b06ede8c00f795be690835e28a142d4a
cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.account.entity.TAppUser;
import com.dsh.account.entity.VipPayment;
import com.dsh.account.feignclient.activity.UserConponClient;
import com.dsh.account.mapper.VipPaymentMapper;
import com.dsh.account.model.IncomeQuery;
import com.dsh.account.service.IVipPaymentService;
@@ -32,10 +33,6 @@
    @Autowired
    private PayMoneyUtil payMoneyUtil;
    @Autowired
    private VipPaymentMapper vipPaymentMapper;
    /**
     * 购买年度会员
@@ -114,7 +111,6 @@
                                    vipPayment1.setPayTime(new Date());
                                    vipPayment1.setOrderNumber(transaction_id);
                                    VipPaymentServiceImpl.this.updateById(vipPayment1);
                                    TAppUser appUser = appUserService.getById(vipPayment1.getAppUserId());
                                    Date vipEndTime = appUser.getVipEndTime();
                                    if(null == vipEndTime){
@@ -123,6 +119,7 @@
                                    Calendar calendar = Calendar.getInstance();
                                    calendar.setTime(vipEndTime);
                                    calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1);
                                    appUser.setIsVip(1);
                                    appUser.setVipEndTime(calendar.getTime());
                                    appUserService.updateById(appUser);
                                    return;
@@ -234,6 +231,8 @@
    @Autowired
    private UserConponClient userConponClient;
    /**
     * 购买年度会员支付回调处理
     * @param code
@@ -241,7 +240,7 @@
     * @throws Exception
     */
    @Override
    public ResultUtil addVipPaymentCallback(String code, String orderNumber) throws Exception {
    public synchronized ResultUtil addVipPaymentCallback(String code, String orderNumber) throws Exception {
        VipPayment vipPayment1 = VipPaymentServiceImpl.this.getOne(new QueryWrapper<VipPayment>().eq("code", code));
        if(vipPayment1.getPayStatus() != 1){
            return ResultUtil.success();
@@ -261,6 +260,8 @@
        calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1);
        appUser.setVipEndTime(calendar.getTime());
        appUserService.updateById(appUser);
        // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限
        userConponClient.queryCouponByUser(appUser.getId());
        return ResultUtil.success();
    }