|
@@ -149,7 +149,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("线上课课时数量安排有误");
|
|
|
}
|
|
|
|
|
|
- if(vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum()>0
|
|
|
+ if(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum()>0
|
|
|
&&Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId())){
|
|
|
throw new BizException("请设置教学点");
|
|
|
}
|
|
@@ -176,6 +176,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("请设置教师课酬");
|
|
|
}
|
|
|
|
|
|
+ if(Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())){
|
|
|
+ vipGroupApplyBaseInfoDto.setOnlineTeacherSalary(new BigDecimal(0));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())){
|
|
|
+ vipGroupApplyBaseInfoDto.setOfflineTeacherSalary(new BigDecimal(0));
|
|
|
+ }
|
|
|
+
|
|
|
//获取活动信息
|
|
|
VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId().intValue());
|
|
|
Integer totalClassTimes=vipGroupApplyBaseInfoDto.getOnlineClassesNum()+vipGroupApplyBaseInfoDto.getOfflineClassesNum();
|
|
@@ -804,6 +812,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ }else{
|
|
|
+ results.put("onlineTeacherSalary", new BigDecimal(0));
|
|
|
}
|
|
|
|
|
|
//教师线下单课酬计算
|
|
@@ -834,6 +844,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("未指定课酬结算标准!");
|
|
|
}
|
|
|
}
|
|
|
+ }else{
|
|
|
+ results.put("offlineTeacherSalary", new BigDecimal(0));
|
|
|
}
|
|
|
|
|
|
if(Objects.isNull(vipGroupActivity.getType())){
|
|
@@ -1357,9 +1369,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
List<StudentCourseInfoDto> userSurplusCourseInfoByGroup = courseScheduleDao.findUserSurplusCourseInfoByGroup(GroupType.VIP, vipGroupId.toString(), studentId);
|
|
|
int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
|
|
|
List<BigDecimal> coursePrices = new ArrayList<>();
|
|
|
+ List<Long> courseScheduleIds=new ArrayList<>();
|
|
|
for (int i=0;i<userSurplusCourseInfoByGroup.size();i++) {
|
|
|
teachModeSequence[i] = userSurplusCourseInfoByGroup.get(i).getTeachMode().equals(TeachModeEnum.ONLINE)?1:0;
|
|
|
coursePrices.add(userSurplusCourseInfoByGroup.get(i).getExpectPrice());
|
|
|
+ courseScheduleIds.add(userSurplusCourseInfoByGroup.get(i).getId());
|
|
|
}
|
|
|
pauseInfos.put("teaChModeSequence", Arrays.toString(teachModeSequence));
|
|
|
pauseInfos.put("coursePriceInfo",coursePrices);
|
|
@@ -1373,6 +1387,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
studentPauseInfoDao.insert(studentPauseInfo);
|
|
|
|
|
|
+ courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(),-1,vipGroup.getStatus());
|
|
|
+
|
|
|
sysUserCashAccountService.updateCourseBalance(studentId, surplusCourseFee);
|
|
|
classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT_SCHOOL);
|
|
|
classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
@@ -1382,15 +1398,23 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
courseScheduleStudentPaymentDao.batchDeleteWithID(studentPaymentIds);
|
|
|
}
|
|
|
|
|
|
+ int studentCourseNum = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(GroupType.VIP, vipGroupId.toString());
|
|
|
+ if(studentCourseNum<=0){
|
|
|
+ vipGroup.setStatus(VipGroupStatusEnum.PAUSE);
|
|
|
+ courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
+ courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
+ vipGroupDao.update(vipGroup);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void recoverForStudent(Long vipGroupId, Integer studentId) {
|
|
|
- if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
|
+ public void recoverForStudent(StudentRecoverDto studentRecoverInfo) {
|
|
|
+ if(Objects.isNull(studentRecoverInfo.getVipGroupId())||Objects.isNull(studentRecoverInfo.getUserId())){
|
|
|
throw new BizException("请指定小课与学生");
|
|
|
}
|
|
|
- VipGroup vipGroup=vipGroupDao.get(vipGroupId);
|
|
|
+ VipGroup vipGroup=vipGroupDao.get(studentRecoverInfo.getVipGroupId().longValue());
|
|
|
if(Objects.isNull(vipGroup)){
|
|
|
throw new BizException("指定的课程不存在");
|
|
|
}
|
|
@@ -1400,15 +1424,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)){
|
|
|
throw new BizException("此课程已结束");
|
|
|
}
|
|
|
- List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), GroupType.VIP.getCode(), studentId);
|
|
|
+ List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(studentRecoverInfo.getVipGroupId().toString(), GroupType.VIP.getCode(), studentRecoverInfo.getUserId());
|
|
|
if(!CollectionUtils.isEmpty(studentApplyRefunds)){
|
|
|
throw new BizException("此学生存在退课申请,请到系统日志中查看");
|
|
|
}
|
|
|
|
|
|
- ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(studentRecoverInfo.getVipGroupId().longValue(), null);
|
|
|
|
|
|
ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
|
|
|
- studentId);
|
|
|
+ studentRecoverInfo.getUserId());
|
|
|
|
|
|
if(Objects.isNull(classStudentMapperByUserIdAndClassGroupId)){
|
|
|
throw new BizException("指定学生不在此课程中");
|
|
@@ -1418,7 +1442,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("当前学生不是休学状态");
|
|
|
}
|
|
|
|
|
|
- StudentPauseInfo studentPauseInfo = studentPauseInfoDao.findByGroupAndUser(GroupType.VIP, vipGroupId.toString(), studentId);
|
|
|
+ StudentPauseInfo studentPauseInfo = studentPauseInfoDao.findByGroupAndUser(GroupType.VIP, studentRecoverInfo.getVipGroupId().toString(), studentRecoverInfo.getUserId());
|
|
|
Map<String, Object> courseInfo = JSON.parseObject(studentPauseInfo.getCoursesJson(), Map.class);
|
|
|
List<BigDecimal> coursePrices = (List<BigDecimal>) courseInfo.get("coursePriceInfo");
|
|
|
coursePrices.sort(Comparator.naturalOrder());
|
|
@@ -1427,17 +1451,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
Date now=new Date();
|
|
|
|
|
|
- List<CourseSchedule> surplusCourseWithGroup = courseScheduleDao.findSurplusCourseWithGroup(GroupType.VIP, vipGroupId.toString());
|
|
|
+ List<CourseSchedule> surplusCourseWithGroup = courseScheduleDao.findSurplusCourseWithGroup(GroupType.VIP, studentRecoverInfo.getVipGroupId().toString());
|
|
|
surplusCourseWithGroup.sort(Comparator.comparing(CourseSchedule::getStartClassTime));
|
|
|
|
|
|
+ if(coursePrices.size()<surplusCourseFee.signum()){
|
|
|
+ throw new BizException("剩余课时不足,无法与现有课时对齐");
|
|
|
+ }
|
|
|
+
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
|
|
|
for (int i=0;i<surplusCourseWithGroup.size();i++) {
|
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
courseScheduleStudentPayment.setGroupType(GroupType.VIP);
|
|
|
- courseScheduleStudentPayment.setMusicGroupId(vipGroupId.toString());
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(studentRecoverInfo.getVipGroupId().toString());
|
|
|
courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(surplusCourseWithGroup.get(i).getId());
|
|
|
- courseScheduleStudentPayment.setUserId(studentId);
|
|
|
+ courseScheduleStudentPayment.setUserId(studentRecoverInfo.getUserId());
|
|
|
courseScheduleStudentPayment.setExpectPrice(coursePrices.get(i));
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|
|
@@ -1448,7 +1476,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(!CollectionUtils.isEmpty(courseScheduleStudentPaymentList)){
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
|
|
|
}
|
|
|
- sysUserCashAccountService.updateCourseBalance(studentId, surplusCourseFee);
|
|
|
+ sysUserCashAccountService.updateCourseBalance(studentRecoverInfo.getUserId(), surplusCourseFee);
|
|
|
classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
|
|
|
studentPauseInfo.setDelFlag(1);
|