| | |
| | | package com.dsh.account.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.dsh.account.service.IVipPaymentService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.util.PayMoneyUtil; |
| | | import com.dsh.account.util.RedisUtil; |
| | | import com.dsh.account.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Resource |
| | | private UserConponClient userConponClient; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | |
| | | /** |
| | | * 购买年度会员 |
| | |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | VipPayment vipPayment1 = VipPaymentServiceImpl.this.getOne(new QueryWrapper<VipPayment>().eq("code", code)); |
| | | if(vipPayment1.getPayStatus() != 1){ |
| | | if(vipPayment1.getPayStatus() == 2){ |
| | | return; |
| | | } |
| | | /** |
| | |
| | | appUser.setVipEndTime(calendar.getTime()); |
| | | appUserService.updateById(appUser); |
| | | // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限 |
| | | userConponClient.queryCouponByUser(appUser.getId()); |
| | | List<Long> longs = userConponClient.queryCouponByUser(appUser.getId()); |
| | | redisUtil.setStrValue("VIP_P_" + vipPayment1.getAppUserId(), JSON.toJSONString(longs), 3600); |
| | | return; |
| | | } |
| | | if("USERPAYING".equals(trade_state) || "ACCEPT".equals(trade_state)){ |
| | |
| | | appUser.setVipEndTime(calendar.getTime()); |
| | | appUserService.updateById(appUser); |
| | | // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限 |
| | | userConponClient.queryCouponByUser(appUser.getId()); |
| | | List<Long> longs = userConponClient.queryCouponByUser(appUser.getId()); |
| | | redisUtil.setStrValue("VIP_P_" + vipPayment1.getAppUserId(), JSON.toJSONString(longs), 3600); |
| | | return; |
| | | } |
| | | if("WAIT_BUYER_PAY".equals(tradeStatus)){ |
| | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private UserConponClient userConponClient; |
| | | |
| | | /** |
| | | * 购买年度会员支付回调处理 |
| | | * @param code |
| | |
| | | @Override |
| | | 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){ |
| | | if(vipPayment1.getPayStatus() == 2){ |
| | | return ResultUtil.success(); |
| | | } |
| | | vipPayment1.setPayStatus(2); |
| | |
| | | VipPaymentServiceImpl.this.updateById(vipPayment1); |
| | | |
| | | TAppUser appUser = appUserService.getById(vipPayment1.getAppUserId()); |
| | | Date vipEndTime = appUser.getVipEndTime(); |
| | | if(null == vipEndTime){ |
| | | vipEndTime = new Date(); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1); |
| | | appUser.setVipEndTime(calendar.getTime()); |
| | | appUserService.updateById(appUser); |
| | | |
| | | // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限 |
| | | List<Long> longs = userConponClient.queryCouponByUser(appUser.getId()); |
| | | redisUtil.setStrValue("VIP_P_" + vipPayment1.getAppUserId(), JSON.toJSONString(longs), 3600); |
| | | return ResultUtil.success(); |
| | | } |
| | | |