优惠卷

复读
This commit is contained in:
wuchunlei
2024-10-25 10:43:11 +08:00
parent 54901e7133
commit cce2106e04
17 changed files with 602 additions and 100 deletions

View File

@@ -12,6 +12,8 @@ import com.peanut.common.utils.OrderUtils;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.book.service.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.CouponService;
import com.peanut.modules.master.service.UserCourseBuyService;
import com.peanut.modules.pay.alipay.config.AliPayConfig;
import com.peanut.modules.pay.alipay.config.AliPayUtil;
import com.peanut.modules.pay.alipay.dto.AlipayDTO;
@@ -62,6 +64,8 @@ public class AliPayServiceImpl implements AliPayService {
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Autowired
private UserCourseBuyService userCourseBuyService;
@Autowired
private JfTransactionDetailsDao jfTransactionDetailsDao;
@Autowired
private MyUserDao myUserDao;
@@ -69,6 +73,8 @@ public class AliPayServiceImpl implements AliPayService {
private VipBuyConfigDao vipBuyConfigDao;
@Autowired
private UserVipDao userVipDao;
@Autowired
private CouponService couponService;
@Override
public String pay(AlipayDTO payDto) {
@@ -95,9 +101,6 @@ public class AliPayServiceImpl implements AliPayService {
aliNotifyDto.setCustomerid(payDto.getCustomerId());
aliNotifyDto.setRelevanceoid(payDto.getRelevanceoid());
payZfbOrderService.save(aliNotifyDto);
BuyOrder order = this.buyOrderService.getOne(new QueryWrapper<BuyOrder>().eq("order_sn",payDto.getRelevanceoid()).eq("del_flag","0"));
order.setPaymentDate(new Date());
this.buyOrderService.updateById(order);
orderInfo = resJson;
}
@@ -155,33 +158,33 @@ public class AliPayServiceImpl implements AliPayService {
String body = oldPayZfbOrderEntity.getBody();
String customerid = oldPayZfbOrderEntity.getCustomerid();
if("relearn".equals(subject)){
BuyOrder orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
.eq("order_sn", oldPayZfbOrderEntity.getRelevanceoid()));
//更新 订单 记录
buyOrderService.updateOrderStatus(Integer.valueOf(customerid),oldPayZfbOrderEntity.getRelevanceoid(),"2");
//插入复读记录
userCourseBuyService.addUserCourseBuyRelearn(orderEntity,"支付宝购买:"+orderEntity.getOrderSn());
}
if ("vip".equals(subject)) {
BuyOrder orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>().eq("order_sn", oldPayZfbOrderEntity.getRelevanceoid()));
//更新 订单 记录
buyOrderService.updateOrderStatus(Integer.valueOf(customerid),oldPayZfbOrderEntity.getRelevanceoid(),"2");
//处理抵扣积分
if(orderEntity.getJfDeduction().compareTo(BigDecimal.ZERO)>0){
userCoinJf(orderEntity);
}
//开通vip
openVipForUser(orderEntity);
//获取会员开通 日期
// BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(Integer.valueOf(body));
// String month = bookBuyConfigEntity.getMonth();
// userService.openMember(Integer.valueOf(customerid),Integer.valueOf(month));
//
// // 插入 开通记录
//
// buyOrderService.updateOrderStatus(Integer.valueOf(customerid),oldPayZfbOrderEntity.getRelevanceoid(),"2");
}
if("point".equals(subject)){
// 插入花生币 变动记录
BookBuyConfigEntity bookBuyConfigEntity = bookBuyConfigService.getById(Integer.valueOf(body));
@@ -284,8 +287,10 @@ public class AliPayServiceImpl implements AliPayService {
}
//开通courseend
List<Integer> collect = buyOrderProductDao.selectList(new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, orderEntity.getOrderId())).stream().map(BuyOrderProduct::getProductId).collect(Collectors.toList());
//发放优惠卷
couponService.insertCouponHistoryByProductId(collect);
//手摸脚模购买后会开启用户的脉穴的功能
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)||collect.contains(136)||collect.contains(137)){
MyUserEntity userInfo = userService.getById(orderEntity.getUserId());
userInfo.setPointPower(1);

View File

@@ -10,6 +10,8 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.peanut.modules.common.dao.*;
import com.peanut.modules.book.service.*;
import com.peanut.modules.common.entity.*;
import com.peanut.modules.common.service.CouponService;
import com.peanut.modules.master.service.UserCourseBuyService;
import com.peanut.modules.pay.refund.entity.PayRefundOrder;
import com.peanut.modules.pay.refund.service.PayRefundOrderService;
import com.peanut.modules.pay.weChatPay.config.WechatPayConfig;
@@ -70,6 +72,8 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
@Autowired
private UserCourseBuyDao userCourseBuyDao;
@Autowired
private UserCourseBuyService userCourseBuyService;
@Autowired
private JfTransactionDetailsDao jfTransactionDetailsDao;
@Autowired
private MyUserDao myUserDao;
@@ -77,6 +81,8 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
private VipBuyConfigDao vipBuyConfigDao;
@Autowired
private UserVipDao userVipDao;
@Autowired
private CouponService couponService;
@Override
public void prepay(WechatPaymentInfo paymentInfo){
@@ -139,18 +145,23 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
// 根据订单号,做幂等处理,并且在对业务数据进行状态检查和处理之前,要采用数据锁进行并发控制,以避免函数重入造成的数据混乱
BuyOrder order = this.buyOrderService.getOne(new QueryWrapper<BuyOrder>().eq("order_sn", orderNo));
if("vip".equals(order.getOrderType())){
if("relearn".equals(order.getOrderType())){
BuyOrder orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>()
.eq("order_sn", orderNo));
//更新 订单 记录
buyOrderService.updateOrderStatus(orderEntity.getUserId(),orderNo,"2");
//插入复读记录
userCourseBuyService.addUserCourseBuyRelearn(orderEntity,"微信购买:"+orderEntity.getOrderSn());
}
if("vip".equals(order.getOrderType())){
BuyOrder orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>().eq("order_sn", orderNo));
//更新 订单 记录
buyOrderService.updateOrderStatus(orderEntity.getUserId(),orderNo,"2");
//处理抵扣积分
if(orderEntity.getJfDeduction().compareTo(BigDecimal.ZERO)>0){
userCoinJf(orderEntity);
}
//开通vip
openVipForUser(orderEntity);
}
@@ -160,13 +171,10 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
BuyOrder orderEntity = buyOrderService.getBaseMapper().selectOne(new QueryWrapper<BuyOrder>().eq("order_sn", orderNo));
BigDecimal realMoney = orderEntity.getRealMoney();
if(orderEntity.getJfDeduction().compareTo(BigDecimal.ZERO)>0){
userCoinJf(orderEntity);
}
//开通bookstart
// 查询订单的所有 book_id
List<Integer> orderBookIdList = shopProductBookService.getOrderBookId(order.getOrderSn());
@@ -226,8 +234,10 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
}
//开通courseend
//手摸脚模购买后会开启用户的脉穴的功能
List<Integer> collect = buyOrderProductDao.selectList(new LambdaQueryWrapper<BuyOrderProduct>().eq(BuyOrderProduct::getOrderId, order.getOrderId())).stream().map(BuyOrderProduct::getProductId).collect(Collectors.toList());
//发放优惠卷
couponService.insertCouponHistoryByProductId(collect);
//手摸脚模购买后会开启用户的脉穴的功能
if(collect.contains(128)||collect.contains(129)||collect.contains(130)||collect.contains(131)||collect.contains(136)||collect.contains(137)){
MyUserEntity userInfo = userService.getById(order.getUserId());
userInfo.setPointPower(1);