|
@@ -231,7 +231,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice"));
|
|
|
if(StringUtils.isNotBlank(studentIds)){
|
|
|
- vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.FINISH);
|
|
|
+ vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
}else{
|
|
|
vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
|
|
|
}
|
|
@@ -820,12 +820,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void updateVipGroupStudentNumAndStatus(Long vipGroupId, Integer num, boolean updateVipStatus) {
|
|
|
+ public void updateVipGroupStudentNumAndStatus(Long vipGroupId , ClassGroup classGroup, Integer num, boolean updateVipStatus) {
|
|
|
VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
|
|
|
if(Objects.isNull(vipGroup)){
|
|
|
throw new BizException("指定的vip课程不存在");
|
|
|
}
|
|
|
- ClassGroup classGroup=classGroupDao.findByMusicGroupAndType(vipGroupId.toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
if(Objects.isNull(classGroup)){
|
|
|
throw new BizException("未找到关联班级");
|
|
|
}
|
|
@@ -838,12 +837,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
Integer studentPaymentNum=studentPaymentOrderDao.countStudentPaymentNum(vipGroupId.toString());
|
|
|
if(studentPaymentNum.equals(classGroup.getExpectStudentNum())&&updateVipStatus){
|
|
|
classGroup.setDelFlag(YesOrNoEnum.NO);
|
|
|
- vipGroup.setStatus(VipGroupStatusEnum.FINISH);
|
|
|
+ vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
vipGroupDao.update(vipGroup);
|
|
|
createVipGroupCourseScheInfo(vipGroupId);
|
|
|
}
|
|
|
- System.out.println(studentPaymentNum+"------"+JSON.toJSONString(classGroup));
|
|
|
- classGroupDao.update(classGroup);
|
|
|
+ if(num>0){
|
|
|
+ classGroupDao.update(classGroup);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -912,7 +912,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("您已购买过此课程");
|
|
|
}
|
|
|
|
|
|
- ClassGroup classGroup= classGroupDao.findByMusicGroupAndType(vipGroup.getId().toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
+ ClassGroup classGroup= classGroupDao.lockByMusicGroupAndType(vipGroup.getId().toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
if(Objects.isNull(classGroup)){
|
|
|
throw new BizException("课程信息错误");
|
|
|
}
|
|
@@ -928,7 +928,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("该课程人数已达上限");
|
|
|
}
|
|
|
//更新班级人数,如果订单支付失败则减少
|
|
|
- this.updateVipGroupStudentNumAndStatus(vipGroup.getId(),1,false);
|
|
|
+ this.updateVipGroupStudentNumAndStatus(vipGroup.getId(),classGroup,1,false);
|
|
|
|
|
|
ClassGroupStudentMapper classGroupStudentMapper=new ClassGroupStudentMapper(classGroup.getId(),user.getId().intValue());
|
|
|
classGroupStudentMapper.setGroupType(GroupType.VIP);
|
|
@@ -990,14 +990,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
studentPaymentOrderDao.update(order);
|
|
|
|
|
|
+ ClassGroup classGroup=classGroupDao.lockByMusicGroupAndType(vipGroupId.toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
+
|
|
|
//将学生加入到班级,更新班级报名状态及人数信息
|
|
|
if(!isOk){
|
|
|
- updateVipGroupStudentNumAndStatus(vipGroupId,-1,false);
|
|
|
+ updateVipGroupStudentNumAndStatus(vipGroupId,classGroup,-1,false);
|
|
|
classGroupStudentMapperDao.deleteStudentByMusicGroupId(vipGroupId.toString(),userId);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- updateVipGroupStudentNumAndStatus(vipGroupId,0,true);
|
|
|
+
|
|
|
+ updateVipGroupStudentNumAndStatus(vipGroupId, classGroup,0,true);
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
|
|
|
|
|
|
VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
@@ -1027,8 +1030,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_VIP_BUY, map, null, 0, "2",
|
|
|
vipGroup.getName());
|
|
|
|
|
|
- ClassGroup classGroup=classGroupDao.findByMusicGroupAndType(vipGroupId.toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
|
-
|
|
|
//更新所属分部列表
|
|
|
List<Integer> organIds = classGroupDao.findStudentOrganIdsByClassGroup(classGroup.getId().longValue());
|
|
|
organIds.add(vipGroup.getOrganId());
|
|
@@ -1325,7 +1326,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if(CollectionUtils.isEmpty(maps)||(maps.size()==1&&Objects.isNull(maps.get(0)))){
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
|
vipGroupDao.update(vipGroup);
|
|
|
- if(vipGroup.getStatus().equals(VipGroupStatusEnum.FINISH)){
|
|
|
+ if(vipGroup.getStatus().equals(VipGroupStatusEnum.PROGRESS)){
|
|
|
courseScheduleDao.batchDeleteCourseSchedules(courseScheduleIds);
|
|
|
courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
|
|
|
}
|