From 41b9950b03bafeb5fa90770794faf9baeacade6b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 11 十一月 2024 16:15:43 +0800
Subject: [PATCH] 代码提交
---
xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java | 143 ++++++++++++++++++++++++++++-------------------
1 files changed, 86 insertions(+), 57 deletions(-)
diff --git a/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java b/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
index 1a32c50..a9c22a3 100644
--- a/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
+++ b/xinquan-modules/xinquan-order/src/main/java/com/xinquan/order/controller/client/ClientOrderController.java
@@ -179,11 +179,13 @@
if (order.getAppUserId().equals(userId) && order.getGiveUserId() == null){
OrderCourseVO orderCourseVO = new OrderCourseVO();
BeanUtils.copyProperties(order, orderCourseVO);
+ orderCourseVO.setBusinessId(order.getBusinessId());
res.add(orderCourseVO);
}
if (order.getGiveUserId()!=null&&order.getGiveUserId().equals(userId)){
OrderCourseVO orderCourseVO = new OrderCourseVO();
BeanUtils.copyProperties(order, orderCourseVO);
+ orderCourseVO.setBusinessId(order.getBusinessId());
res.add(orderCourseVO);
}
}
@@ -203,6 +205,7 @@
break;
case 2:
OrderCourseVO data = remoteCourseService.getCourseByIdAny(orderCourseVO).getData();
+ Course data4 = remoteCourseService.getCourseById(data.getBusinessId()).getData();
if (data==null)continue;
BeanUtils.copyProperties(data, orderCourseVO);
List<CourseChapter> data2 = remoteCourseService.getChapterByCourseId(orderCourseVO.getBusinessId() + "").getData();
@@ -212,6 +215,11 @@
}
Integer data3 = remoteCourseService.getCountByCourseId(orderCourseVO.getBusinessId() + "").getData();
orderCourseVO.setCount(data3+temp);
+ if (data4!=null){
+ orderCourseVO.setCourseTitle(data4.getCourseTitle());
+ orderCourseVO.setCoverUrl(data4.getCoverUrl());
+ orderCourseVO.setBusinessId(data4.getId());
+ }
break;
}
}
@@ -726,6 +734,9 @@
.eq(OrderPaymentRecord::getPayOrderNo, string).ne(OrderPaymentRecord::getPaymentStatus, 2).one();
if (two!=null){
Order one = orderService.getById(two.getOrderId());
+ if (one.getPaymentStatus()==2){
+ return;
+ }
one.setPaymentStatus(2);
one.setPaymentTime(LocalDateTime.now());
OrderPaymentRecord one2 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId())
@@ -737,33 +748,45 @@
// 实际支付金额
BigDecimal realPayAmount = one.getRealPayAmount();
// 判断订单所属用户是否有上级 是否需要做分佣处理
- AppUser data3 = remoteAppUserService.getAppUserById(one.getAppUserId() + "").getData();
- if (data3.getInviteUserId()!=null){
- // 分佣给上级 先远程查询分佣比例
- CommissionRule data1 = sysUserClient.getCommission().getData();
- if (data1!=null){
- if (data1.getProportion()!=null){
- BigDecimal bigDecimal = realPayAmount.multiply(data1.getProportion())
- .setScale(2, BigDecimal.ROUND_HALF_DOWN);
- // 上级获取的分佣金额
- AppUser appUserById = remoteAppUserService.getAppUserById(data3.getInviteUserId() + "").getData();
- // 更新用户余额
- remoteAppUserService.updateAppUser(
- AppUserDTO.builder().balance(
- appUserById.getBalance().add(bigDecimal))
- .build(), SecurityConstants.INNER);
- // 新增分佣流水明细
- AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
- appUserWalletRecord.setAppUserId(data3.getInviteUserId());
- appUserWalletRecord.setChangeType(1);
- appUserWalletRecord.setReason("分佣收益");
- appUserWalletRecord.setAmount(bigDecimal);
- appUserWalletRecord.setChildAppUserId(one.getAppUserId());
- appUserWalletRecord.setOrderId(one.getId());
- remoteAppUserService.addBalanceRecord(appUserWalletRecord);
- one.setCommissionAmount(bigDecimal);
- one.setCommissionId(data3.getInviteUserId());
- orderService.updateById(one);
+ AppUser data9 = remoteAppUserService.getAppUserById(one.getAppUserId() + "").getData();
+ if (one.getGiveUserId()!=null){
+ remoteAppUserService.addNotice(one.getGiveUserId() + "", one.getBusinessId() + "",
+ one.getAppUserId() + "", one.getTotalAmount() + "");
+ }
+
+ if (data9.getInviteUserId()!=null) {
+
+ if (one.getOrderFrom() == 1 || one.getOrderFrom() == 2 || one.getOrderFrom() == 3) {
+ // 查询实际支付价格 不包含余额抵扣价格
+ OrderPaymentRecord one1 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId())
+ .ne(OrderPaymentRecord::getPaymentType, 4).one();
+ // 分佣给上级 先远程查询分佣比例
+ CommissionRule data1 = sysUserClient.getCommission().getData();
+ if (data1 != null) {
+ if (data1.getProportion() != null) {
+
+ BigDecimal bigDecimal = one1.getPayAmount().multiply(data1.getProportion()).divide(new BigDecimal("100"))
+ .setScale(2, BigDecimal.ROUND_HALF_DOWN);
+ // 上级获取的分佣金额
+ AppUser appUserById = remoteAppUserService.getAppUserById(data9.getInviteUserId() + "").getData();
+ // 更新用户余额
+// remoteAppUserService.updateAppUser(
+// AppUserDTO.builder().balance(
+// appUserById.getBalance().add(bigDecimal))
+// .build(), SecurityConstants.INNER);
+ // 新增分佣流水明细
+ AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
+ appUserWalletRecord.setAppUserId(data9.getInviteUserId());
+ appUserWalletRecord.setChangeType(1);
+ appUserWalletRecord.setReason("分佣收益");
+ appUserWalletRecord.setAmount(bigDecimal);
+ appUserWalletRecord.setChildAppUserId(one.getAppUserId());
+ appUserWalletRecord.setOrderId(one.getId());
+ remoteAppUserService.addBalanceRecord(appUserWalletRecord);
+ one.setCommissionAmount(bigDecimal);
+ one.setCommissionId(data9.getInviteUserId());
+ orderService.updateById(one);
+ }
}
}
}
@@ -772,7 +795,7 @@
OrderPaymentRecord one1 = orderPaymentRecordService.lambdaQuery().eq(OrderPaymentRecord::getOrderId, one.getId())
.eq(OrderPaymentRecord::getPaymentType, 4).one();
AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
- appUserWalletRecord.setAppUserId(data3.getInviteUserId());
+ appUserWalletRecord.setAppUserId(data9.getInviteUserId());
String reason=null;
switch (one.getOrderFrom()){
case 1:
@@ -797,35 +820,6 @@
// 会员
reason = "购买【"+one.getBuyContent()+"】";
appUserWalletRecord.setChangeType(2);
- if (data3.getInviteUserId()!=null){
- // 分佣给上级 先远程查询分佣比例
- CommissionRule data4 = sysUserClient.getCommission().getData();
- if (data4!=null){
- if (data4.getProportion()!=null){
- BigDecimal bigDecimal = realPayAmount.multiply(data4.getProportion())
- .divide(new BigDecimal(100),2, BigDecimal.ROUND_DOWN);
- // 上级获取的分佣金额
- AppUser appUserById = remoteAppUserService.getAppUserById(data3.getInviteUserId() + "").getData();
- // 更新用户余额
- remoteAppUserService.updateAppUser(
- AppUserDTO.builder().balance(
- appUserById.getBalance().add(bigDecimal))
- .build(), SecurityConstants.INNER);
- // 新增分佣流水明细
- AppUserWalletRecord appUserWalletRecord1 = new AppUserWalletRecord();
- appUserWalletRecord1.setAppUserId(data3.getInviteUserId());
- appUserWalletRecord1.setChangeType(1);
- appUserWalletRecord1.setReason("分佣收益");
- appUserWalletRecord1.setAmount(bigDecimal);
- appUserWalletRecord1.setChildAppUserId(one.getAppUserId());
- appUserWalletRecord1.setOrderId(one.getId());
- remoteAppUserService.addBalanceRecord(appUserWalletRecord1);
- one.setCommissionAmount(bigDecimal);
- one.setCommissionId(data3.getInviteUserId());
- orderService.updateById(one);
- }
- }
- }
break;
case 4:
// 充值
@@ -838,6 +832,41 @@
appUserWalletRecord.setChildAppUserId(one.getAppUserId());
appUserWalletRecord.setOrderId(one.getId());
remoteAppUserService.addBalanceRecord(appUserWalletRecord);
+ }else{
+ switch (one.getOrderFrom()){
+ case 2:
+ Course data2 = remoteCourseService.getCourseById(one.getBusinessId()).getData();
+ // 增加用户与课程的关系表
+ if (one.getGiveUserId()!=null){
+ remoteAppUserService.addAppUserCourse(one.getBusinessId(),one.getGiveUserId(),one.getId(),1);
+ }else{
+ // 自己购买
+ remoteAppUserService.addAppUserCourse(one.getBusinessId(),one.getAppUserId(),one.getId(),2);
+ }
+ break;
+ case 3:
+ // 会员
+ if (one.getBuyContent().contains("月")){
+
+ remoteAppUserService.addVipExpireTime(one.getAppUserId(),1);
+ }else if (one.getBuyContent().contains("季")){
+ remoteAppUserService.addVipExpireTime(one.getAppUserId(),2);
+ }else if (one.getBuyContent().contains("年")){
+ remoteAppUserService.addVipExpireTime(one.getAppUserId(),3);
+ }
+ break;
+ case 4:
+ remoteAppUserService.addBalance(one.getAppUserId(),one.getRealPayAmount());
+ AppUserWalletRecord appUserWalletRecord = new AppUserWalletRecord();
+ appUserWalletRecord.setAppUserId(one.getAppUserId());
+ appUserWalletRecord.setChangeType(1);
+ appUserWalletRecord.setReason("充值");
+ appUserWalletRecord.setAmount(one.getRealPayAmount());
+ appUserWalletRecord.setChildAppUserId(one.getAppUserId());
+ appUserWalletRecord.setOrderId(one.getId());
+ remoteAppUserService.addBalanceRecord(appUserWalletRecord);
+ break;
+ }
}
PrintWriter out = response.getWriter();
out.write("succeeded");
--
Gitblit v1.7.1