|
@@ -638,8 +638,10 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//查询直播课服务费
|
|
|
String liveServiceRateStr = sysConfigService.findConfigValue(SysConfigConstant.LIVE_SERVICE_RATE);
|
|
|
BigDecimal liveServiceRate = new BigDecimal(liveServiceRateStr).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
|
|
|
+ //总课酬 1 - (1 * 手续费率)
|
|
|
+ BigDecimal totalRatePrice = expectPrice.subtract(expectPrice.multiply(liveServiceRate)).setScale(2, RoundingMode.HALF_UP);
|
|
|
//获取每节课的课酬 key 课堂数 value 课酬
|
|
|
- Map<Integer, BigDecimal> singerCourseSalary = getSingerCourseSalary(expectPrice, courseGroup.getCourseNum(), liveServiceRate);
|
|
|
+ Map<Integer, BigDecimal> singerCourseSalary = getCourseAveragePrice(courseGroup.getCourseNum(), totalRatePrice);
|
|
|
//写入课酬表计算-根据课程组总金额计算分配到每节课的金额
|
|
|
Date now = new Date();
|
|
|
List<CourseScheduleTeacherSalary> teacherSalaryList = new ArrayList<>();
|
|
@@ -660,23 +662,6 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
courseScheduleTeacherSalaryService.getDao().insertBatch(teacherSalaryList);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 学生购买直播课程,计算每节课课酬
|
|
|
- *
|
|
|
- * @param totalPrice 课酬总金额
|
|
|
- * @param totalCourseNum 课程总数
|
|
|
- * @param rate 课酬费率
|
|
|
- * @return key 课堂数 value 课酬
|
|
|
- */
|
|
|
- private Map<Integer, BigDecimal> getSingerCourseSalary(BigDecimal totalPrice, Integer totalCourseNum, BigDecimal rate) {
|
|
|
- //1 - (1 * 手续费率)
|
|
|
- BiFunction<BigDecimal, BigDecimal, BigDecimal> getPrice = (p, r) -> p.subtract(p.multiply(r)).setScale(2, RoundingMode.HALF_UP);
|
|
|
- //总课酬
|
|
|
- BigDecimal totalRatePrice = getPrice.apply(totalPrice, rate);
|
|
|
- return getCourseAveragePrice(totalCourseNum, totalRatePrice);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 计算课堂每节课价格
|
|
|
*
|