|
@@ -726,7 +726,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
//校验购买的课程组每节课时间是否和自己的课时冲突
|
|
//校验购买的课程组每节课时间是否和自己的课时冲突
|
|
batchCheckStudentCourseTime(studentId, courseList, CourseSchedule::getStartTime, CourseSchedule::getEndTime);
|
|
batchCheckStudentCourseTime(studentId, courseList, CourseSchedule::getStartTime, CourseSchedule::getEndTime);
|
|
//写入学生购买课程记录
|
|
//写入学生购买课程记录
|
|
- buyLiveCourseAfter(orderReqInfo.getOrderNo(), studentId, courseList, courseGroup);
|
|
|
|
|
|
+ buyLiveCourseAfter(orderReqInfo.getOrderNo(), studentId, courseList, courseGroup,orderReqInfo.getActualPrice());
|
|
|
|
|
|
OrderCreateRes orderCreateRes = new OrderCreateRes();
|
|
OrderCreateRes orderCreateRes = new OrderCreateRes();
|
|
orderCreateRes.setRes(true);
|
|
orderCreateRes.setRes(true);
|
|
@@ -745,16 +745,17 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
|
|
|
/**
|
|
/**
|
|
* 待订单创建完毕后继续后续操作
|
|
* 待订单创建完毕后继续后续操作
|
|
- *
|
|
|
|
- * @param orderNo 订单号
|
|
|
|
- * @param courseList 课程列表
|
|
|
|
|
|
+ * @param orderNo 订单号
|
|
* @param studentId 学员id
|
|
* @param studentId 学员id
|
|
|
|
+ * @param courseList 课程列表
|
|
* @param courseGroup 直播课程组信息
|
|
* @param courseGroup 直播课程组信息
|
|
|
|
+ * @param actualPrice
|
|
*/
|
|
*/
|
|
- private void buyLiveCourseAfter(String orderNo, Long studentId, List<CourseSchedule> courseList, CourseGroup courseGroup) {
|
|
|
|
|
|
+ private void buyLiveCourseAfter(String orderNo, Long studentId, List<CourseSchedule> courseList, CourseGroup courseGroup, BigDecimal actualPrice) {
|
|
log.info("buyLiveCourse buyLiveCourseAfter -> order {} studentId {} courseList {} courseGroup {}", orderNo, studentId, JSON.toJSONString(courseList), JSON.toJSONString(courseGroup));
|
|
log.info("buyLiveCourse buyLiveCourseAfter -> order {} studentId {} courseList {} courseGroup {}", orderNo, studentId, JSON.toJSONString(courseList), JSON.toJSONString(courseGroup));
|
|
//获取每节课购买的价格
|
|
//获取每节课购买的价格
|
|
Map<Integer, BigDecimal> courseAveragePrice = WrapperUtil.getAveragePrice(courseGroup.getCourseNum(), courseGroup.getCoursePrice());
|
|
Map<Integer, BigDecimal> courseAveragePrice = WrapperUtil.getAveragePrice(courseGroup.getCourseNum(), courseGroup.getCoursePrice());
|
|
|
|
+ Map<Integer, BigDecimal> courseAverageActualPrice = WrapperUtil.getAveragePrice(courseGroup.getCourseNum(),actualPrice);
|
|
//写course_schedule_student_payment表 作为记录锁定时间用,防止重复购买,如果支付失败则删除该数据
|
|
//写course_schedule_student_payment表 作为记录锁定时间用,防止重复购买,如果支付失败则删除该数据
|
|
List<CourseScheduleStudentPayment> studentPaymentList = new ArrayList<>();
|
|
List<CourseScheduleStudentPayment> studentPaymentList = new ArrayList<>();
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
@@ -766,9 +767,10 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
studentPayment.setCourseId(course.getId());
|
|
studentPayment.setCourseId(course.getId());
|
|
studentPayment.setOrderNo(orderNo);
|
|
studentPayment.setOrderNo(orderNo);
|
|
BigDecimal amount = courseAveragePrice.get(i.getAndIncrement());
|
|
BigDecimal amount = courseAveragePrice.get(i.getAndIncrement());
|
|
|
|
+ BigDecimal actualAmount = courseAverageActualPrice.get(i.getAndIncrement());
|
|
studentPayment.setOriginalPrice(amount);
|
|
studentPayment.setOriginalPrice(amount);
|
|
studentPayment.setExpectPrice(amount);
|
|
studentPayment.setExpectPrice(amount);
|
|
- studentPayment.setActualPrice(amount);
|
|
|
|
|
|
+ studentPayment.setActualPrice(actualAmount);
|
|
studentPayment.setCreatedTime(now);
|
|
studentPayment.setCreatedTime(now);
|
|
studentPayment.setUpdatedTime(now);
|
|
studentPayment.setUpdatedTime(now);
|
|
studentPayment.setCourseType(courseGroup.getType());
|
|
studentPayment.setCourseType(courseGroup.getType());
|