|
@@ -1202,6 +1202,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void applyRefundForStudent(Long vipGroupId, Integer studentId, BigDecimal amount) {
|
|
|
if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
throw new BizException("请指定小课与学生");
|
|
@@ -1267,6 +1268,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
throw new BizException("请指定课程和学生");
|
|
@@ -1831,8 +1833,48 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode());
|
|
|
+
|
|
|
+ List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
|
|
|
+
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudentsList = classGroupStudentMapperDao.findByClassGroupAndStudent(classGroup.getId(), studentIds);
|
|
|
+ Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentsList.stream()
|
|
|
+ .collect(Collectors.groupingBy(ClassGroupStudentMapper::getUserId));
|
|
|
+
|
|
|
if(CollectionUtils.isEmpty(surplusCourses)){
|
|
|
- throw new BizException("此vip课程没有剩余课程计划");
|
|
|
+ for (Integer studentId:studentIds) {
|
|
|
+ //创建班级学生关联记录
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper;
|
|
|
+
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentsMap.get(studentId);
|
|
|
+ if(!CollectionUtils.isEmpty(classGroupStudents)){
|
|
|
+ classGroupStudentMapper = classGroupStudents.get(0);
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapperDao.update(classGroupStudentMapper);
|
|
|
+ }else{
|
|
|
+ classGroupStudentMapper=new ClassGroupStudentMapper();
|
|
|
+ classGroupStudentMapper.setGroupType(classGroup.getGroupType());
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
+ classGroupStudentMapper.setUserId(studentId);
|
|
|
+ classGroupStudentMappers.add(classGroupStudentMapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ imGroupMemberList.add(new ImGroupMember(studentId.toString()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!CollectionUtils.isEmpty(classGroupStudentMappers)){
|
|
|
+ classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMappers);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]);
|
|
|
+ // 创建群组
|
|
|
+ imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
BigDecimal surplusCourseNum = new BigDecimal(surplusCourses.size());
|
|
@@ -1847,13 +1889,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
BigDecimal avgCourseFee = surplusCoursesPrice.divide(surplusCourseNum,CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
- List<ImGroupMember> imGroupMemberList = new ArrayList<>();
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentMappers=new ArrayList<>();
|
|
|
-
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentsList = classGroupStudentMapperDao.findByClassGroupAndStudent(classGroup.getId(), studentIds);
|
|
|
- Map<Integer, List<ClassGroupStudentMapper>> classGroupStudentsMap = classGroupStudentsList.stream()
|
|
|
- .collect(Collectors.groupingBy(ClassGroupStudentMapper::getUserId));
|
|
|
-
|
|
|
//生成学生单课缴费信息
|
|
|
for (Integer studentId:studentIds) {
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);
|