|
@@ -2665,36 +2665,32 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
classGroupDao.modifyStudentNum(classGroup.getId(),-1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
Date date = new Date();
|
|
|
|
|
|
- if (groupType == VIP && classGroup.getStudentNum() >= classGroup.getExpectStudentNum()) {
|
|
|
- throw new BizException("该课程组人数已满,请联系教务老师!");
|
|
|
- }
|
|
|
-
|
|
|
VipGroupActivity vipGroupActivity = null;
|
|
|
if (Objects.nonNull(vipGroup.getVipGroupActivityId())) {
|
|
|
vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId());
|
|
|
}
|
|
|
-
|
|
|
if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
|
|
|
int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), userId);
|
|
|
if (useNum >= vipGroupActivity.getStudentMaxUsedTimes()) {
|
|
|
throw new BizException("您已超过该活动购买限制{}次", vipGroupActivity.getStudentMaxUsedTimes());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (vipGroup.getPaymentExpireDate().before(date)) {
|
|
|
throw new BizException("该课程已结束报名!");
|
|
|
}
|
|
|
-
|
|
|
if (groupType == VIP && Objects.nonNull(vipGroup.getStudentIdList())) {
|
|
|
Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
|
|
|
if (!userIds.contains(userId)) {
|
|
|
throw new BizException("您无法购买此课程");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if(groupType == GroupType.VIP){
|
|
|
+ if (classGroupDao.checkStudentNum(classGroup.getId())) {
|
|
|
+ throw new BizException("该课程组人数已满,请联系教务老师!");
|
|
|
+ }
|
|
|
//增加学员数
|
|
|
classGroupDao.modifyStudentNum(classGroup.getId(),1);
|
|
|
}
|