|
@@ -27,6 +27,8 @@ import com.yonge.cooleshow.biz.dal.mapper.PaymentDivMemberRecordMapper;
|
|
|
import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
import com.yonge.cooleshow.biz.dal.support.WrapperUtil;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentPaymentVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.PianoRoomSettingsVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.PaymentDivMemberRecordWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantAlbumWrapper;
|
|
@@ -34,13 +36,16 @@ import com.yonge.cooleshow.biz.dal.wrapper.UserPaymentOrderWrapper;
|
|
|
import com.yonge.cooleshow.biz.dal.wrapper.course.CourseRelationWrapper;
|
|
|
import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
+import com.yonge.cooleshow.common.enums.CacheNameEnum;
|
|
|
import com.yonge.cooleshow.common.enums.EStatus;
|
|
|
import com.yonge.cooleshow.common.enums.PostStatusEnum;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.payment.util.DistributedLock;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.joda.time.DateTime;
|
|
|
+import org.redisson.api.RedissonClient;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -150,6 +155,21 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
@Autowired
|
|
|
private DiscountCardRecordService discountCardRecordService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PianoRoomSettingsService pianoRoomSettingsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PianoRoomBuyRecordService pianoRoomBuyRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PianoRoomChangeRecordService pianoRoomChangeRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedissonClient redissonClient;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PianoRoomTimeService pianoRoomTimeService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询详情
|
|
|
*
|
|
@@ -423,7 +443,7 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
Date now = new Date();
|
|
|
List<CourseScheduleTeacherSalary> teacherSalaryList = new ArrayList<>();
|
|
|
for (CourseScheduleStudentPaymentVo payment : paymentList) {
|
|
|
- BigDecimal expectPrice = payment.getExpectPrice();//预计价格
|
|
|
+ BigDecimal expectPrice = payment.getActualPrice();//预计价格
|
|
|
|
|
|
CourseScheduleTeacherSalary teacherSalary = new CourseScheduleTeacherSalary();
|
|
|
teacherSalary.setTeacherId(payment.getTeacherId());
|
|
@@ -471,7 +491,9 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
serviceFeeAmount = tenantdivMap.get(-1L);
|
|
|
} else {
|
|
|
// 分润给老师
|
|
|
- bizMap.merge(userPaymentOrder.getBizId(), teacherAmount, BigDecimal::add);
|
|
|
+ teacherSalaryList.forEach(teacherSalary -> {
|
|
|
+ bizMap.put(teacherSalary.getCourseScheduleId(), teacherSalary.getActualSalary());
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
saveData(userPaymentOrder, tenantdivMap, teacherMap, bizMap, serviceFeeAmount);
|
|
@@ -546,7 +568,7 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
List<CourseSchedule> courseList = courseScheduleService.list(Wrappers.<CourseSchedule>lambdaQuery()
|
|
|
.eq(CourseSchedule::getCourseGroupId, studentPayment.getCourseGroupId()));
|
|
|
//课程总金额
|
|
|
- BigDecimal totalExpectPrice = WrapperUtil.sumList(studentPaymentList, CourseScheduleStudentPayment::getExpectPrice);
|
|
|
+ BigDecimal totalExpectPrice = WrapperUtil.sumList(studentPaymentList, CourseScheduleStudentPayment::getActualPrice);
|
|
|
//查询直播课服务费
|
|
|
String liveServiceRateStr = sysConfigService.findConfigValue(SysConfigConstant.LIVE_SERVICE_RATE);
|
|
|
BigDecimal liveServiceRate = new BigDecimal(liveServiceRateStr).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
|
|
@@ -605,7 +627,9 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
serviceFeeAmount = tenantdivMap.get(-1L);
|
|
|
} else {
|
|
|
// 分润给老师
|
|
|
- bizMap.merge(userPaymentOrder.getBizId(), teacherAmount, BigDecimal::add);
|
|
|
+ teacherSalaryList.forEach(teacherSalary -> {
|
|
|
+ bizMap.put(teacherSalary.getCourseScheduleId(), teacherSalary.getActualSalary());
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -830,6 +854,29 @@ public class PaymentDivMemberRecordServiceImpl extends ServiceImpl<PaymentDivMem
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 琴房课
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void pianoRoom(UserOrderDetailVo orderDetailVo) {
|
|
|
+ pianoRoomBuyRecordService.orderSuccess(orderDetailVo);
|
|
|
+// 分账
|
|
|
+ Map<Long, BigDecimal> tenantdivMap = new HashMap<>();
|
|
|
+ tenantdivMap.merge(-1L, orderDetailVo.getActualPrice(), BigDecimal::add);
|
|
|
+ // 分润
|
|
|
+ Map<Long, BigDecimal> teacherMap = new HashMap<>();
|
|
|
+ // 老师收入
|
|
|
+ Map<Long, BigDecimal> bizMap = new HashMap<>();
|
|
|
+
|
|
|
+ //服务费 原价的平台服务费 ,减去优惠券金额
|
|
|
+ BigDecimal serviceFeeAmount = orderDetailVo.getActualPrice();
|
|
|
+
|
|
|
+ saveData(orderDetailVo, tenantdivMap, teacherMap, bizMap, serviceFeeAmount);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 写入数据库
|
|
|
private void saveData(UserOrderDetailVo userPaymentOrder, Map<Long, BigDecimal> tenantdivMap, Map<Long, BigDecimal> teacherMap, Map<Long, BigDecimal> bizMap, BigDecimal serviceFeeAmount) {
|
|
|
|