|
@@ -74,6 +74,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
|
|
|
@Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentOrderDao studentPaymentOrderDaop;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
|
|
@@ -102,7 +104,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
throw new BizException("未获取到排课信息");
|
|
|
}
|
|
|
|
|
|
- int giveClassTimes=0;
|
|
|
+ int giveClassTimes=0;
|
|
|
if(vipGroupApplyBaseInfoDto.getStatus().equals(VipGroupStatusEnum.APPLYING)
|
|
|
&&Objects.nonNull(vipGroupActivity)
|
|
|
&&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
|
|
@@ -110,6 +112,12 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
giveClassTimes=Integer.parseInt(vipGroupActivity.getAttribute2());
|
|
|
}
|
|
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDaop.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+ BigDecimal couponFee = new BigDecimal(0);
|
|
|
+ if(Objects.nonNull(studentPaymentOrder)){
|
|
|
+ couponFee = studentPaymentOrder.getCouponRemitFee().divide(new BigDecimal(vipGroupCourseSchedules.size()-giveClassTimes), CommonConstants.DECIMAL_PLACE);
|
|
|
+ }
|
|
|
+
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
|
|
|
Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipGroupCourseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
|
|
|
for(TeachModeEnum teachModeEnum:courseScheduleGroupByTeachMode.keySet()){
|
|
@@ -129,13 +137,14 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
//学生线上单节课应缴费计算
|
|
|
switch (vipGroupActivity.getType()) {
|
|
|
case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
break;
|
|
|
case DISCOUNT:
|
|
|
courseScheduleStudentPayment.setExpectPrice(
|
|
|
vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(
|
|
|
new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee)
|
|
|
);
|
|
|
break;
|
|
|
case GIVE_CLASS:
|
|
@@ -143,7 +152,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
&& i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
} else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -153,13 +162,14 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
//学生线下单节课应缴费计算
|
|
|
switch (vipGroupActivity.getType()) {
|
|
|
case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
break;
|
|
|
case DISCOUNT:
|
|
|
courseScheduleStudentPayment.setExpectPrice(
|
|
|
vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().multiply(
|
|
|
new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
.divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee)
|
|
|
);
|
|
|
break;
|
|
|
case GIVE_CLASS:
|
|
@@ -167,7 +177,7 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
&& i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
} else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
}
|
|
|
break;
|
|
|
default:
|