|
@@ -34,6 +34,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -1377,7 +1378,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
coursePrices.add(userSurplusCourseInfoByGroup.get(i).getExpectPrice());
|
|
|
courseScheduleIds.add(userSurplusCourseInfoByGroup.get(i).getId());
|
|
|
}
|
|
|
- pauseInfos.put("teaChModeSequence", Arrays.toString(teachModeSequence));
|
|
|
+ pauseInfos.put("teaChModeSequence", teachModeSequence);
|
|
|
pauseInfos.put("coursePriceInfo",coursePrices);
|
|
|
|
|
|
StudentPauseInfo studentPauseInfo=new StudentPauseInfo();
|
|
@@ -1403,8 +1404,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
int studentCourseNum = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(GroupType.VIP, vipGroupId.toString());
|
|
|
if(studentCourseNum<=0){
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.PAUSE);
|
|
|
- courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
- courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
+ if(!CollectionUtils.isEmpty(courseScheduleIds)){
|
|
|
+ courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
+ courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
+ }
|
|
|
vipGroupDao.update(vipGroup);
|
|
|
}
|
|
|
|
|
@@ -1431,6 +1434,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("此学生存在退课申请,请到系统日志中查看");
|
|
|
}
|
|
|
|
|
|
+ if(Objects.nonNull(studentRecoverInfo.getTeacherId())&&!studentRecoverInfo.getTeacherId().equals(vipGroup.getUserId())){
|
|
|
+ vipGroup.setUserId(studentRecoverInfo.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(studentRecoverInfo.getVipGroupId().longValue(), null);
|
|
|
|
|
|
ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
|
|
@@ -1445,10 +1452,39 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
StudentPauseInfo studentPauseInfo = studentPauseInfoDao.findByGroupAndUser(GroupType.VIP, studentRecoverInfo.getVipGroupId().toString(), studentRecoverInfo.getUserId());
|
|
|
+ if(Objects.isNull(studentPauseInfo)){
|
|
|
+ throw new BizException("未找到休学信息");
|
|
|
+ }
|
|
|
Map<String, Object> courseInfo = JSON.parseObject(studentPauseInfo.getCoursesJson(), Map.class);
|
|
|
+ Integer[] teachModeSequence=JSON.parseArray(courseInfo.get("teaChModeSequence").toString(), Integer.class).stream().toArray(Integer[]::new);
|
|
|
List<BigDecimal> coursePrices = (List<BigDecimal>) courseInfo.get("coursePriceInfo");
|
|
|
coursePrices.sort(Comparator.naturalOrder());
|
|
|
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.PAUSE)){
|
|
|
+ studentRecoverInfo.setCourseCount(teachModeSequence.length);
|
|
|
+ List<CourseSchedule> newCourseSchedules = courseScheduleService.createCourses(studentRecoverInfo);
|
|
|
+ for(int i=0;i<newCourseSchedules.size();i++){
|
|
|
+ newCourseSchedules.get(i).setGroupType(GroupType.VIP);
|
|
|
+ newCourseSchedules.get(i).setMusicGroupId(vipGroup.getId().toString());
|
|
|
+ newCourseSchedules.get(i).setClassGroupId(classGroup.getId());
|
|
|
+ newCourseSchedules.get(i).setStatus(CourseStatusEnum.NOT_START);
|
|
|
+ newCourseSchedules.get(i).setSchoolId(vipGroup.getTeacherSchoolId());
|
|
|
+ newCourseSchedules.get(i).setActualTeacherId(vipGroup.getUserId());
|
|
|
+ newCourseSchedules.get(i).setTeacherId(vipGroup.getUserId());
|
|
|
+ newCourseSchedules.get(i).setType(CourseSchedule.CourseScheduleType.VIP);
|
|
|
+ newCourseSchedules.get(i).setTeachMode(teachModeSequence[i]==0?TeachModeEnum.OFFLINE:TeachModeEnum.ONLINE);
|
|
|
+ }
|
|
|
+ courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
|
|
|
+
|
|
|
+ TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId(), vipGroup.getVipGroupCategoryId());
|
|
|
+
|
|
|
+ //创建老师单节课课酬信息
|
|
|
+ courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroup,
|
|
|
+ newCourseSchedules,
|
|
|
+ teacherDefaultVipGroupSalary.getOnlineClassesSalary(),
|
|
|
+ teacherDefaultVipGroupSalary.getOfflineClassesSalary());
|
|
|
+ }
|
|
|
+
|
|
|
BigDecimal surplusCourseFee = new BigDecimal(0);
|
|
|
|
|
|
Date now=new Date();
|
|
@@ -1483,9 +1519,54 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
|
studentPauseInfo.setDelFlag(1);
|
|
|
studentPauseInfoDao.update(studentPauseInfo);
|
|
|
+ vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
+ vipGroupDao.update(vipGroup);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public StudentRecoverInfoDto getStudentPauseInfo(Long vipGroupId, Integer studentId) {
|
|
|
+ if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
+ throw new BizException("请指定小课与学生");
|
|
|
+ }
|
|
|
+ VipGroup vipGroup=vipGroupDao.get(vipGroupId);
|
|
|
+ if(Objects.isNull(vipGroup)){
|
|
|
+ throw new BizException("指定的课程不存在");
|
|
|
+ }
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
+ throw new BizException("不能对已停止的课程进行此操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
+
|
|
|
+ ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),studentId);
|
|
|
+
|
|
|
+ if(Objects.isNull(classStudentMapperByUserIdAndClassGroupId)){
|
|
|
+ throw new BizException("未找到指定学生");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)){
|
|
|
+ throw new BizException("当前学生不是休学状态");
|
|
|
+ }
|
|
|
+
|
|
|
+ StudentPauseInfo studentPauseInfo = studentPauseInfoDao.findByGroupAndUser(GroupType.VIP, vipGroupId.toString(), studentId);
|
|
|
+ if(Objects.isNull(studentPauseInfo)){
|
|
|
+ throw new BizException("未找到此学生休学信息");
|
|
|
+ }
|
|
|
+ Map<String, Object> courseInfo = JSON.parseObject(studentPauseInfo.getCoursesJson(), Map.class);
|
|
|
+ List<BigDecimal> coursePrices = (List<BigDecimal>) courseInfo.get("coursePriceInfo");
|
|
|
+
|
|
|
+ StudentRecoverInfoDto studentRecoverInfoDto=new StudentRecoverInfoDto();
|
|
|
+ studentRecoverInfoDto.setVipGroupId(vipGroupId.intValue());
|
|
|
+ studentRecoverInfoDto.setTeacherId(vipGroup.getUserId());
|
|
|
+ studentRecoverInfoDto.setStudentId(studentPauseInfo.getUserId());
|
|
|
+ studentRecoverInfoDto.setIsPause(vipGroup.getStatus().equals(VipGroupStatusEnum.PAUSE)?1:0);
|
|
|
+ studentRecoverInfoDto.setTotalCourseTimes(coursePrices.size());
|
|
|
+ Map<BigDecimal, Long> collect = coursePrices.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
|
|
|
+ studentRecoverInfoDto.setGiveCourseTimes(Objects.isNull(collect.get(new BigDecimal(0.00)))?0:collect.get(new BigDecimal(0.00)).intValue());
|
|
|
+ return studentRecoverInfoDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
@@ -2038,6 +2119,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(Objects.isNull(vipGroup)){
|
|
|
throw new BizException("未找到指定的vip课程");
|
|
|
}
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.NOT_START)){
|
|
|
+ throw new BizException("此课程还未开始");
|
|
|
+ }
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
|
|
|
Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
|
|
@@ -2328,6 +2412,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(Objects.isNull(vipGroup.getRegistrationStartTime())){
|
|
|
continue;
|
|
|
}
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.PAUSE)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(now.before(vipGroup.getRegistrationStartTime())){
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.NOT_START);
|
|
|
}
|
|
@@ -2383,4 +2470,19 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
public VipBuyResultDto findVipBuyResultInfo(Integer vipGroupId) {
|
|
|
return vipGroupDao.getVipBuyResultInfo(vipGroupId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<TeacherBasicDto> findTeacherWithVipGroupOrganAndSubject(Long vipGroupId) {
|
|
|
+ if(Objects.isNull(vipGroupId)){
|
|
|
+ throw new BizException("请指定小课");
|
|
|
+ }
|
|
|
+ VipGroup vipGroup=vipGroupDao.get(vipGroupId.longValue());
|
|
|
+ if(Objects.isNull(vipGroup)) {
|
|
|
+ throw new BizException("未找到指定课程");
|
|
|
+ }
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), null);
|
|
|
+ List<TeacherBasicDto> teacherByOrganAndSubject = teacherDao.findTeacherByOrganAndSubject(vipGroup.getOrganId().toString(), classGroup.getSubjectIdList());
|
|
|
+
|
|
|
+ return teacherByOrganAndSubject;
|
|
|
+ }
|
|
|
}
|