ソースを参照

feat:vip课活动购买限制

Joburgess 4 年 前
コミット
abbed7ab13

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -247,7 +247,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			for (String studentIdStr : tempStudentIds) {
 				int useNum = vipGroupDao.countStudentUserActivityNum(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId(), Integer.valueOf(studentIdStr));
 				if(useNum>=vipGroupActivity.getStudentMaxUsedTimes()){
-					throw new BizException("创建失败:当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+					SysUser student = teacherDao.getUser(Integer.valueOf(studentIdStr));
+					throw new BizException("{}学员已超过该活动购买次数限制", student.getUsername());
 				}
 			}
 		}
@@ -1515,7 +1516,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1){
 			int useNum = vipGroupDao.countStudentUseingActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(user.getId()));
 			if(useNum>vipGroupActivity.getStudentMaxUsedTimes()){
-				throw new BizException("当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+				throw new BizException("您已超过该活动购买次数限制", vipGroupActivity.getStudentMaxUsedTimes());
 			}
 		}
 
@@ -2913,7 +2914,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			for (Integer studentId : studentIds) {
 				int useNum = vipGroupDao.countStudentUseingActivityNum(vipGroup.getVipGroupActivityId(), Integer.valueOf(studentId));
 				if(useNum>vipGroupActivity.getStudentMaxUsedTimes()){
-					throw new BizException("当前活动可购买次数为{}次", vipGroupActivity.getStudentMaxUsedTimes());
+					SysUser student = teacherDao.getUser(studentId);
+					throw new BizException("{}学员已超过该活动购买次数限制", student.getUsername());
 				}
 			}
 		}