|
@@ -2870,7 +2870,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
*/
|
|
|
Date now = new Date();
|
|
|
|
|
|
- int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(),"2021-03-09 00:00:00");
|
|
|
+// int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(),"2021-03-09 00:00:00");
|
|
|
|
|
|
LocalDate courseStartDay = LocalDate.now();
|
|
|
LocalDate tempCourseLocalDate = LocalDate.parse("2020-03-01", DateUtil.dateFormatter);
|
|
@@ -3096,13 +3096,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if(teacherDefaultSalary == null){
|
|
|
throw new BizException("请设置教师课酬");
|
|
|
}
|
|
|
- BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
+// BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
|
|
|
- BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
- BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
- BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
+// BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
+// 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) {
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
+ 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());
|
|
@@ -3122,8 +3127,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseScheduleStudentPayment.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(oneMonthPrice);
|
|
|
- courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
+ if(i == 0){
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(firstAmount);
|
|
|
+ }else {
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(divide);
|
|
|
+ }
|
|
|
+// courseScheduleStudentPayment.setExpectPrice(oneMonthPrice);
|
|
|
+// courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
courseScheduleStudentPayment.setOriginalPrice(oneMonthPrice);
|
|
|
courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
@@ -3169,12 +3181,12 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
throw new BizException("用户账户找不到");
|
|
|
}
|
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
- if (userCashAccount.getBalance().subtract(studentPaymentOrder.getExpectAmount().subtract(studentPaymentOrder.getCouponRemitFee())).doubleValue() >= 0) {
|
|
|
+ if (userCashAccount.getBalance().subtract(studentPaymentOrder.getExpectAmount()).doubleValue() >= 0) {
|
|
|
studentPaymentRouteOrderService.addRouteOrder(orderNo, practiceGroupBuyParams.getOrganId(), amount);
|
|
|
|
|
|
// 更新订单信息
|
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
|
- studentPaymentOrder.setBalancePaymentAmount(studentPaymentOrder.getExpectAmount().subtract(studentPaymentOrder.getCouponRemitFee()));
|
|
|
+ studentPaymentOrder.setBalancePaymentAmount(studentPaymentOrder.getExpectAmount());
|
|
|
studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
|
studentPaymentOrder.setUpdateTime(now);
|
|
|
studentPaymentOrder.setOrganId(practiceGroupBuyParams.getOrganId());
|
|
@@ -3193,7 +3205,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if (userCashAccount.getBalance().doubleValue() > 0) {
|
|
|
balance = userCashAccount.getBalance();
|
|
|
sysUserCashAccountService.updateBalance(practiceGroupBuyParams.getStudentId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "网管课购买");
|
|
|
- amount = studentPaymentOrder.getExpectAmount().subtract(userCashAccount.getBalance()).subtract(studentPaymentOrder.getCouponRemitFee());
|
|
|
+ amount = studentPaymentOrder.getExpectAmount().subtract(userCashAccount.getBalance());
|
|
|
studentPaymentOrder.setActualAmount(amount);
|
|
|
studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
|
|
|
} else {
|