|
|
@@ -105,12 +105,12 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
|
|
|
int giveClassTimes=0;
|
|
|
- if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
|
|
|
- &&Objects.nonNull(vipGroupActivity)
|
|
|
- &&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
|
|
|
- &&vipGroupCourseSchedules.size() >= Integer.parseInt(vipGroupActivity.getAttribute1())){
|
|
|
- giveClassTimes = Integer.parseInt(vipGroupActivity.getAttribute2());
|
|
|
- }
|
|
|
+// if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
|
|
|
+// &&Objects.nonNull(vipGroupActivity)
|
|
|
+// &&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
|
|
|
+// &&vipGroupCourseSchedules.size() >= Integer.parseInt(vipGroupActivity.getAttribute1())){
|
|
|
+// giveClassTimes = Integer.parseInt(vipGroupActivity.getAttribute2());
|
|
|
+// }
|
|
|
|
|
|
StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDaop.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode());
|
|
|
BigDecimal couponFee = new BigDecimal(0);
|
|
|
@@ -135,54 +135,16 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
|
|
|
if (teachModeEnum == TeachModeEnum.ONLINE) {
|
|
|
//学生线上单节课应缴费计算
|
|
|
- switch (vipGroupActivity.getType()) {
|
|
|
- case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
- break;
|
|
|
- case DISCOUNT:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(
|
|
|
- vipGroup.getOnlineClassesUnitPrice().multiply(
|
|
|
- new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
- .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
- .subtract(couponFee)
|
|
|
- );
|
|
|
- break;
|
|
|
- case GIVE_CLASS:
|
|
|
- if (vipGroup.getGiveTeachMode() == teachModeEnum
|
|
|
- && i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
- } else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("活动类型错误!");
|
|
|
- }
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(
|
|
|
+ vipGroup.getOnlineClassesUnitPrice().multiply(vipGroupActivity.getDiscount())
|
|
|
+ .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee));
|
|
|
}else{
|
|
|
//学生线下单节课应缴费计算
|
|
|
- switch (vipGroupActivity.getType()) {
|
|
|
- case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
- break;
|
|
|
- case DISCOUNT:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(
|
|
|
- vipGroup.getOfflineClassesUnitPrice().multiply(
|
|
|
- new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
- .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
- .subtract(couponFee)
|
|
|
- );
|
|
|
- break;
|
|
|
- case GIVE_CLASS:
|
|
|
- if (vipGroup.getGiveTeachMode() == teachModeEnum
|
|
|
- && i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
- } else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("活动类型错误!");
|
|
|
- }
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(
|
|
|
+ vipGroup.getOfflineClassesUnitPrice().multiply(vipGroupActivity.getDiscount())
|
|
|
+ .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee));
|
|
|
}
|
|
|
courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(teachModeEnum)?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
|
courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|
|
|
@@ -215,12 +177,12 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
}
|
|
|
|
|
|
int giveClassTimes=0;
|
|
|
- if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
|
|
|
- &&Objects.nonNull(vipGroupActivity)
|
|
|
- &&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
|
|
|
- &&vipGroupCourseSchedules.size() >= Integer.parseInt(vipGroupActivity.getAttribute1())){
|
|
|
- giveClassTimes = Integer.parseInt(vipGroupActivity.getAttribute2());
|
|
|
- }
|
|
|
+// if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)
|
|
|
+// &&Objects.nonNull(vipGroupActivity)
|
|
|
+// &&vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)
|
|
|
+// &&vipGroupCourseSchedules.size() >= Integer.parseInt(vipGroupActivity.getAttribute1())){
|
|
|
+// giveClassTimes = Integer.parseInt(vipGroupActivity.getAttribute2());
|
|
|
+// }
|
|
|
|
|
|
StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDaop.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode());
|
|
|
BigDecimal couponFee = new BigDecimal(0);
|
|
|
@@ -245,54 +207,18 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
|
|
|
|
|
|
if (teachModeEnum == TeachModeEnum.ONLINE) {
|
|
|
//学生线上单节课应缴费计算
|
|
|
- switch (vipGroupActivity.getType()) {
|
|
|
- case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
- break;
|
|
|
- case DISCOUNT:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(
|
|
|
- vipGroup.getOnlineClassesUnitPrice().multiply(
|
|
|
- new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
- .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
- .subtract(couponFee)
|
|
|
- );
|
|
|
- break;
|
|
|
- case GIVE_CLASS:
|
|
|
- if (vipGroup.getGiveTeachMode() == teachModeEnum
|
|
|
- && i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
- } else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice().subtract(couponFee));
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("活动类型错误!");
|
|
|
- }
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(
|
|
|
+ vipGroup.getOnlineClassesUnitPrice().multiply(vipGroupActivity.getDiscount())
|
|
|
+ .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee)
|
|
|
+ );
|
|
|
}else{
|
|
|
//学生线下单节课应缴费计算
|
|
|
- switch (vipGroupActivity.getType()) {
|
|
|
- case BASE_ACTIVITY:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
- break;
|
|
|
- case DISCOUNT:
|
|
|
- courseScheduleStudentPayment.setExpectPrice(
|
|
|
- vipGroup.getOfflineClassesUnitPrice().multiply(
|
|
|
- new BigDecimal(vipGroupActivity.getAttribute1()))
|
|
|
- .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
- .subtract(couponFee)
|
|
|
- );
|
|
|
- break;
|
|
|
- case GIVE_CLASS:
|
|
|
- if (vipGroup.getGiveTeachMode() == teachModeEnum
|
|
|
- && i >= (courseSchedules.size()-giveClassTimes)) {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
- } else {
|
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice().subtract(couponFee));
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new BizException("活动类型错误!");
|
|
|
- }
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(
|
|
|
+ vipGroup.getOfflineClassesUnitPrice().multiply(vipGroupActivity.getDiscount())
|
|
|
+ .divide(new BigDecimal(100), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .subtract(couponFee)
|
|
|
+ );
|
|
|
}
|
|
|
courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(teachModeEnum)?vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice():vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
|
courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|