|
@@ -517,6 +517,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
+ List<Student> studentDetail = studentDao.findByStudentIds(studentIdList);
|
|
|
|
+ List<SimpleUserDto> studentSimpleInfos = teacherDao.getUsersSimpleInfo(studentIdList);
|
|
|
|
+ if(studentDetail.size()!=studentSimpleInfos.size()){
|
|
|
|
+ throw new BizException("学员信息错误");
|
|
|
|
+ }
|
|
|
|
+ Map<Integer, SimpleUserDto> idUserInfoMap = studentSimpleInfos.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s -> s, (s1, s2) -> s1));
|
|
|
|
+ for (Student student : studentDetail) {
|
|
|
|
+ if(StringUtils.isEmpty(student.getActivityCourseDetail())){
|
|
|
|
+ SimpleUserDto studentInfo = idUserInfoMap.get(student.getUserId());
|
|
|
|
+ throw new BizException("{}暂无排课资格", studentInfo.getNickName());
|
|
|
|
+ }
|
|
|
|
+ JSONObject courseDetail = JSON.parseObject(student.getActivityCourseDetail());
|
|
|
|
+ Integer surplusTimes = courseDetail.getInteger(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType().getCode());
|
|
|
|
+ if(surplusTimes<=0){
|
|
|
|
+ SimpleUserDto studentInfo = idUserInfoMap.get(student.getUserId());
|
|
|
|
+ throw new BizException("{}暂无排课资格", studentInfo.getNickName());
|
|
|
|
+ }
|
|
|
|
+ courseDetail.fluentPut(vipGroup.getVipGroupApplyBaseInfo().getActivityCourseType().getCode(), surplusTimes-1);
|
|
|
|
+ }
|
|
|
|
+
|
|
Date now=new Date();
|
|
Date now=new Date();
|
|
|
|
|
|
VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
|
|
VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
|
|
@@ -559,9 +579,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(errStudentIds.size()>0){
|
|
if(errStudentIds.size()>0){
|
|
- List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
|
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
- String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
|
|
|
|
+ String studentNames = StringUtils.join(studentSimpleInfos.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员创建及成课之和已达上限,是否继续创建该课程?");
|
|
return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员创建及成课之和已达上限,是否继续创建该课程?");
|
|
}
|
|
}
|
|
}
|
|
}
|