|
@@ -3544,7 +3544,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
|
|
|
- for (CourseSchedule courseSchedule : practiceCourses) {
|
|
|
+ //使用优惠券
|
|
|
+ StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
+ BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
|
|
|
+ BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), ROUND_DOWN);
|
|
|
+ BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(practiceCourses.size()))).add(divide);
|
|
|
+ for (int i = 0; i < practiceCourses.size(); i++) {
|
|
|
+ CourseSchedule courseSchedule = practiceCourses.get(i);
|
|
|
//课程与老师薪水表
|
|
|
CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
@@ -3563,9 +3570,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseScheduleStudentPayment.setGroupType(GroupType.PRACTICE);
|
|
|
courseScheduleStudentPayment.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
- courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(studentSingleCourseCost);
|
|
|
- courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
+ courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());if(i == 0){
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(firstAmount);
|
|
|
+ }else {
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(divide);
|
|
|
+ }
|
|
|
courseScheduleStudentPayment.setOriginalPrice(studentSingleCourseOriginalCost);
|
|
|
courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
@@ -3602,9 +3613,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
return BaseController.failed(HttpStatus.FOUND, errMessage);
|
|
|
}
|
|
|
-
|
|
|
- //使用优惠券
|
|
|
- StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
+
|
|
|
amount = studentPaymentOrder.getActualAmount();
|
|
|
studentPaymentOrder.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
studentPaymentOrder.setGroupType(GroupType.PRACTICE);
|