|
@@ -305,8 +305,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
//检测课程信息是否存在冲突
|
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules);
|
|
|
+ //只需要更新的课程走课程调整流程
|
|
|
+ courseScheduleService.classStartDateAdjust(updateCourseSchedules);
|
|
|
|
|
|
-
|
|
|
+ //新增的课程需要重新创建相关信息
|
|
|
+ courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
|
|
|
+ //创建老师单节课课酬信息
|
|
|
+ courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroupUpdateInfo,
|
|
|
+ newCourseSchedules,
|
|
|
+ vipGroupUpdateInfo.getOnlineTeacherSalary(),
|
|
|
+ vipGroupUpdateInfo.getOfflineTeacherSalary());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -679,7 +687,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateVipGroupStudentNumAndStatus(Long vipGroupId, Integer num) {
|
|
|
+ public void updateVipGroupStudentNumAndStatus(Long vipGroupId, Integer num, boolean updateVipStatus) {
|
|
|
VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
|
|
|
if(Objects.isNull(vipGroup)){
|
|
|
throw new BizException("指定的vip课程不存在");
|
|
@@ -689,7 +697,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("未找到关联班级");
|
|
|
}
|
|
|
classGroup.setStudentNum(classGroup.getStudentNum()+num);
|
|
|
- if(classGroup.getStudentNum().equals(classGroup.getExpectStudentNum())){
|
|
|
+ if(classGroup.getStudentNum().equals(classGroup.getExpectStudentNum())&&updateVipStatus){
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.FINISH);
|
|
|
vipGroupDao.update(vipGroup);
|
|
|
}
|
|
@@ -701,16 +709,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
|
|
|
SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
|
|
|
+
|
|
|
+ if(vipGroup.getStatus()!=VipGroupStatusEnum.APPLYING){
|
|
|
+ throw new BizException("该课程已结束报名!");
|
|
|
+ }
|
|
|
+
|
|
|
StudentPaymentOrder byStudentVipGroup = studentPaymentOrderDao.findByStudentVipGroup(vipGroupBuyParams.getVipGroupId(), user.getId());
|
|
|
|
|
|
if(Objects.nonNull(byStudentVipGroup)){
|
|
|
- throw new BizException("订单已存在!");
|
|
|
- }
|
|
|
|
|
|
- VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
|
|
|
+ //生成回调地址
|
|
|
+ Map payMap = payService.getPayMap(
|
|
|
+ vipGroup.getTotalPrice(),
|
|
|
+ byStudentVipGroup.getOrderNo(),
|
|
|
+ "https://dyme.utools.club/api-student/studentOrder/notify",
|
|
|
+ "http://mstudev.dayaedu.com/#/paymentResult",
|
|
|
+ "vip课购买",
|
|
|
+ vipGroup.getName());
|
|
|
|
|
|
- if(vipGroup.getStatus()!=VipGroupStatusEnum.APPLYING){
|
|
|
- throw new BizException("该课程已结束报名!");
|
|
|
+ return payMap;
|
|
|
}
|
|
|
|
|
|
VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroup.getId());
|
|
@@ -719,7 +737,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("课程信息错误");
|
|
|
}
|
|
|
|
|
|
- VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
|
|
|
+ ClassGroup classGroup = classGroupDao.get(vipGroupClassGroupMapper.getClassGroupId());
|
|
|
+ if(Objects.isNull(classGroup)){
|
|
|
+ throw new BizException("课程信息错误");
|
|
|
+ }
|
|
|
+ if(classGroup.getStudentNum()>=classGroup.getExpectStudentNum()){
|
|
|
+ throw new BizException("该课程人数已达上限");
|
|
|
+ }
|
|
|
+
|
|
|
+// VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
|
|
|
StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
|
|
|
studentPaymentOrder.setUserId(user.getId());
|
|
|
String orderNo=StringUtils.join(new String[]{user.getId().toString(),String.valueOf(System.currentTimeMillis())});
|
|
@@ -728,11 +754,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
|
|
|
studentPaymentOrder.setExpectAmount(vipGroup.getTotalPrice());
|
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
|
- if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.DISCOUNT){
|
|
|
- studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount().multiply(new BigDecimal(vipGroupActivity.getAttribute1())));
|
|
|
- }else{
|
|
|
- studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
- }
|
|
|
+// if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.DISCOUNT){
|
|
|
+// studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount().multiply(new BigDecimal(vipGroupActivity.getAttribute1())));
|
|
|
+// }else{
|
|
|
+ studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
+// }
|
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
|
studentPaymentOrder.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
|
|
|
studentPaymentOrderDao.insert(studentPaymentOrder);
|
|
@@ -745,7 +771,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentVipGroupPaymentDao.insert(studentVipGroupPayment);
|
|
|
|
|
|
//更新班级人数,如果订单支付失败则减少
|
|
|
- updateVipGroupStudentNumAndStatus(vipGroup.getId(),1);
|
|
|
+ updateVipGroupStudentNumAndStatus(vipGroup.getId(),1,false);
|
|
|
|
|
|
//生成回调地址
|
|
|
Map payMap = payService.getPayMap(
|
|
@@ -774,8 +800,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
//将学生加入到班级,更新班级报名状态及人数信息
|
|
|
if(!isOk){
|
|
|
- updateVipGroupStudentNumAndStatus(vipGroupId,-1);
|
|
|
+ updateVipGroupStudentNumAndStatus(vipGroupId,-1,false);
|
|
|
}else{
|
|
|
+ updateVipGroupStudentNumAndStatus(vipGroupId,0,true);
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
|
|
|
//插入缴费明细
|
|
|
//收入
|