|
@@ -2433,7 +2433,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("您无法购买此课程");
|
|
|
}
|
|
|
}
|
|
|
-// ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupId.toString(), "PRACTICE");
|
|
|
+ ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupId.toString(), "PRACTICE");
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
|
+ if(exist){
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
+ }
|
|
|
//
|
|
|
// if(classGroup.getStudentNum()>0 && (VipGroupStatusEnum.APPLYING.equals(practiceGroup.getGroupStatus()))){
|
|
|
// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.PRACTICE);
|
|
@@ -2452,15 +2456,19 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("您无法购买此课程");
|
|
|
}
|
|
|
}
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), null);
|
|
|
+ //是否已经购买
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
|
+ if(exist){
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
+ }
|
|
|
|
|
|
-// ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), null);
|
|
|
-//
|
|
|
-// if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
-// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
-// if(i <= 0){
|
|
|
-// throw new BizException("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
+ int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
+ if(i <= 0){
|
|
|
+ throw new BizException("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules,false,false);
|
|
@@ -2570,17 +2578,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
OrderTypeEnum.SMALL_CLASS_TO_BUY);
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
-
|
|
|
+ if(Objects.isNull(classGroup)){
|
|
|
+ throw new BizException("班级信息错误");
|
|
|
+ }
|
|
|
classGroup = classGroupDao.lockClassGroup(classGroup.getId());
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), vipGroupBuyParams.getUserId());
|
|
|
+ if(exist){
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
+ }
|
|
|
VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
|
|
|
int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(),"VIP");
|
|
|
if(vipGroup.getStatus() != VipGroupStatusEnum.APPLYING || classGroup.getDelFlag() != 1 || courseNum > 0){
|
|
|
throw new BizException("当前VIP课已无法通过购买加入,请联系教务老师");
|
|
|
}
|
|
|
|
|
|
- if(Objects.isNull(classGroup)){
|
|
|
- throw new BizException("班级信息错误");
|
|
|
- }
|
|
|
if (list.size() > 0) {
|
|
|
StudentPaymentOrder applyOrder = list.get(list.size() - 1);
|
|
|
// 查询订单状态
|
|
@@ -4032,12 +4043,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
|
|
|
-// if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
- int num = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
- if(num > 0){
|
|
|
- throw new BizException("已有学员购买了该课程组,无法添加,请走学员购买流程!");
|
|
|
+ if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
+ int num = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
+ if(num > 0){
|
|
|
+ throw new BizException("已有学员购买了该课程组,无法添加,请走学员购买流程!");
|
|
|
+ }
|
|
|
}
|
|
|
-// }
|
|
|
|
|
|
VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
|
|
|
if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
|