|
@@ -195,6 +195,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("开课时间不能小于当前时间");
|
|
|
}
|
|
|
|
|
|
+ if(vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())){
|
|
|
+ throw new BizException("报名开始时间必须在报名截至时间之前");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
|
|
|
+ ||DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(),firstCourseSchedule.getEndClassTime())){
|
|
|
+ throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
|
|
|
+ }
|
|
|
+
|
|
|
//判断课程安排是否超出范围
|
|
|
if(Objects.nonNull(vipGroupActivity.getCoursesEndTime())||Objects.nonNull(vipGroupActivity.getCoursesStartTime())){
|
|
|
if(latestCourseSchedule.getEndClassTime().after(vipGroupActivity.getCoursesEndTime())
|
|
@@ -251,13 +260,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
// throw new BizException("教师总课酬不能高于课程总价60%");
|
|
|
// }
|
|
|
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
+
|
|
|
//如果默认课酬与实际课酬不匹配则需要审批
|
|
|
if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())<0||
|
|
|
costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())<0
|
|
|
&&StringUtils.isBlank(studentIds)){
|
|
|
vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
- }else{
|
|
|
- vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS);
|
|
|
}
|
|
|
|
|
|
vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
|
|
@@ -266,19 +275,38 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}else{
|
|
|
vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
|
|
|
}
|
|
|
-// Teacher teacher = teacherService.get(sysUser.getId());
|
|
|
-// if(teacher.getOrganId().indexOf(",")!=-1){
|
|
|
-// throw new BizException("教师部门异常");
|
|
|
-// }
|
|
|
+ Teacher teacher = teacherService.get(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ if(Objects.isNull(teacher)){
|
|
|
+ throw new BizException("教师不存在");
|
|
|
+ }
|
|
|
+ if(Objects.isNull(teacher.getTeacherOrganId())){
|
|
|
+ throw new BizException("教师部门异常");
|
|
|
+ }
|
|
|
// vipGroupApplyBaseInfoDto.setOrganId(Integer.parseInt(teacher.getOrganId()));
|
|
|
//开课时间为排课的第一节课的开始时间
|
|
|
vipGroupApplyBaseInfoDto.setCourseStartDate(firstCourseSchedule.getStartClassTime());
|
|
|
//课程结束时间为排课的最后一节课的结束时间
|
|
|
vipGroupApplyBaseInfoDto.setCoursesExpireDate(latestCourseSchedule.getEndClassTime());
|
|
|
- vipGroupDao.insert(vipGroupApplyBaseInfoDto);
|
|
|
|
|
|
- //获取vip课类型信息
|
|
|
- VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId().intValue());
|
|
|
+ //获取vip课类型信息
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId().intValue());
|
|
|
+
|
|
|
+ VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupApplyBaseInfo().getVipGroupCategoryId(), teacher.getTeacherOrganId());
|
|
|
+
|
|
|
+ if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ }else{
|
|
|
+ if(Objects.nonNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
|
|
|
+ &&vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice())!=0){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ }
|
|
|
+ if(Objects.nonNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())
|
|
|
+ &&vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().compareTo(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice())!=0){
|
|
|
+ vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ vipGroupDao.insert(vipGroupApplyBaseInfoDto);
|
|
|
|
|
|
//创建班级信息
|
|
|
ClassGroup classGroup=new ClassGroup();
|
|
@@ -347,7 +375,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
|
|
|
Map<String,Long> memo = new HashMap<>(1);
|
|
|
memo.put("vipGroupId",vipGroupApplyBaseInfoDto.getId());
|
|
|
- Teacher teacher = teacherDao.get(vipGroup.getVipGroupApplyBaseInfo().getUserId());
|
|
|
// SysUser sysUser = sysUserFeignService.queryUserById(vipGroup.getVipGroupApplyBaseInfo().getUserId());
|
|
|
if(Objects.isNull(teacher)){
|
|
|
throw new BizException("该用户不存在");
|
|
@@ -1634,7 +1661,59 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return studentRecoverInfoDto;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
+// @Override
|
|
|
+// @Transactional(rollbackFor = Exception.class)
|
|
|
+// public Map<String, BigDecimal> getStudentSurplusCourseFee(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("未找到指定vip课");
|
|
|
+// }
|
|
|
+// if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
+// throw new BizException("不能对已停止的课程进行退课操作");
|
|
|
+// }
|
|
|
+// Date now = new Date();
|
|
|
+// BigDecimal bigDecimal;
|
|
|
+// List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
|
|
|
+// if(CollectionUtils.isEmpty(userCourseInfos)&&vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
+// StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+// if(Objects.isNull(studentPaymentOrder)){
|
|
|
+// bigDecimal=new BigDecimal(0);
|
|
|
+// }else{
|
|
|
+// bigDecimal=studentPaymentOrder.getActualAmount();
|
|
|
+// }
|
|
|
+// }else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
|
+// BigDecimal historyPrice=new BigDecimal(0);
|
|
|
+// BigDecimal allPrice=new BigDecimal(0);
|
|
|
+// for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
|
+// allPrice=allPrice.add(userCourseInfo.getExpectPrice());
|
|
|
+// if(now.after(userCourseInfo.getStartClassTime())){
|
|
|
+// historyPrice=historyPrice.add(userCourseInfo.getTeachMode().equals(TeachModeEnum.ONLINE)?vipGroup.getOnlineClassesUnitPrice():vipGroup.getOfflineClassesUnitPrice());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// bigDecimal=allPrice.subtract(historyPrice);
|
|
|
+// if(bigDecimal.longValue()<0){
|
|
|
+// bigDecimal=new BigDecimal(0);
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// bigDecimal=new BigDecimal(0);
|
|
|
+// }
|
|
|
+// Map<String,BigDecimal> result=new HashMap<>();
|
|
|
+// ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
+// if(Objects.isNull(classGroup)){
|
|
|
+// throw new BizException("未找到对应班级");
|
|
|
+// }
|
|
|
+// if(Objects.isNull(bigDecimal)){
|
|
|
+// bigDecimal = new BigDecimal(0);
|
|
|
+// }
|
|
|
+// bigDecimal = bigDecimal.multiply(new BigDecimal(0.8)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_HALF_UP);
|
|
|
+// result.put("suplusCourseFee", bigDecimal);
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Map<String, BigDecimal> getStudentSurplusCourseFee(Long vipGroupId, Integer studentId) {
|
|
|
if(Objects.isNull(vipGroupId)||Objects.isNull(studentId)){
|
|
@@ -1647,37 +1726,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)){
|
|
|
throw new BizException("不能对已停止的课程进行退课操作");
|
|
|
}
|
|
|
- Date now = new Date();
|
|
|
- BigDecimal bigDecimal;
|
|
|
- List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
|
|
|
- if(CollectionUtils.isEmpty(userCourseInfos)&&vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
- StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
- if(Objects.isNull(studentPaymentOrder)){
|
|
|
- bigDecimal=new BigDecimal(0);
|
|
|
- }else{
|
|
|
- bigDecimal=studentPaymentOrder.getActualAmount();
|
|
|
- }
|
|
|
- }else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
|
- BigDecimal historyPrice=new BigDecimal(0);
|
|
|
- BigDecimal allPrice=new BigDecimal(0);
|
|
|
- for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
|
- allPrice=allPrice.add(userCourseInfo.getExpectPrice());
|
|
|
- if(now.after(userCourseInfo.getStartClassTime())){
|
|
|
- historyPrice=historyPrice.add(userCourseInfo.getTeachMode().equals(TeachModeEnum.ONLINE)?vipGroup.getOnlineClassesUnitPrice():vipGroup.getOfflineClassesUnitPrice());
|
|
|
- }
|
|
|
- }
|
|
|
- bigDecimal=allPrice.subtract(historyPrice);
|
|
|
- if(bigDecimal.longValue()<0){
|
|
|
- bigDecimal=new BigDecimal(0);
|
|
|
- }
|
|
|
- }else{
|
|
|
- bigDecimal=new BigDecimal(0);
|
|
|
- }
|
|
|
- Map<String,BigDecimal> result=new HashMap<>();
|
|
|
+ Map<String,BigDecimal> result=new HashMap<>();
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
|
+ if(Objects.isNull(studentPaymentOrder)){
|
|
|
+ BigDecimal surplusCourseFee = studentPaymentOrderDao.sumSurplusCourseFee(vipGroupId.toString(), studentId);
|
|
|
+ if(Objects.isNull(surplusCourseFee)){
|
|
|
+ result.put("suplusCourseFee",new BigDecimal(0));
|
|
|
+ }else{
|
|
|
+ result.put("suplusCourseFee",surplusCourseFee);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ result.put("suplusCourseFee",studentPaymentOrder.getActualAmount());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
if(Objects.isNull(classGroup)){
|
|
|
throw new BizException("未找到对应班级");
|
|
|
}
|
|
|
+ BigDecimal bigDecimal = courseScheduleStudentPaymentDao.countSurplusCourseFee(classGroup.getId(), studentId);
|
|
|
if(Objects.isNull(bigDecimal)){
|
|
|
bigDecimal = new BigDecimal(0);
|
|
|
}
|