|
@@ -259,7 +259,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
|
|
List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
- return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员已超过该活动购买次数限制");
|
|
|
|
|
|
+ throw new BizException("该活动{}学员已超过该活动购买次数限制",studentNames);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//判断课程安排是否超出范围
|
|
//判断课程安排是否超出范围
|
|
@@ -1202,9 +1202,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
Boolean giveFlag = vipGroup.getGiveFlag();
|
|
Boolean giveFlag = vipGroup.getGiveFlag();
|
|
List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toList());
|
|
- if(studentIdList.size() > vipGroupCategory.getStudentNum()){
|
|
|
|
- throw new BizException("{}课程最多支持{}人",vipGroupCategory.getName(),vipGroupCategory.getStudentNum());
|
|
|
|
|
|
+ if(!vipGroupCategory.getMusicTheory()){
|
|
|
|
+ if(studentIdList.size() != vipGroupCategory.getStudentNum()){
|
|
|
|
+ throw new BizException("学员数量异常");
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if(studentIdList.size() > vipGroupCategory.getStudentNum()){
|
|
|
|
+ throw new BizException("{}课程最多支持{}人",vipGroupCategory.getName(),vipGroupCategory.getStudentNum());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
//获取学员排课资格
|
|
//获取学员排课资格
|
|
List<ActivityUserMapper> activityUserMappers = activityUserMapperService.findByStudentIdList(activity.getId(),studentIds,giveFlag?"GIVE_VIP":"VIP");
|
|
List<ActivityUserMapper> activityUserMappers = activityUserMapperService.findByStudentIdList(activity.getId(),studentIds,giveFlag?"GIVE_VIP":"VIP");
|
|
if(studentIdList.size() != activityUserMappers.size()){
|
|
if(studentIdList.size() != activityUserMappers.size()){
|
|
@@ -2191,7 +2198,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
vipGroupDetail.setCourseSchedules(collect);
|
|
vipGroupDetail.setCourseSchedules(collect);
|
|
vipGroupDetail.setTotalClassTimes(collect.size());
|
|
vipGroupDetail.setTotalClassTimes(collect.size());
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId());
|
|
|
|
+ vipGroupDetail.setCategoryName(vipGroupCategory.getName());
|
|
vipGroupDetail.setNumberOfClasses(vipGroupDao.countTeacherVipGroups(vipGroupDetail.getTeacherId().longValue()));
|
|
vipGroupDetail.setNumberOfClasses(vipGroupDao.countTeacherVipGroups(vipGroupDetail.getTeacherId().longValue()));
|
|
return vipGroupDetail;
|
|
return vipGroupDetail;
|
|
}
|
|
}
|
|
@@ -2425,7 +2433,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
throw new BizException("您无法购买此课程");
|
|
throw new BizException("您无法购买此课程");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-// ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupId.toString(), "PRACTICE");
|
|
|
|
|
|
+ ClassGroup classGroup = classGroupDao.findByGroupAndType(vipGroupId.toString(), "PRACTICE");
|
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
|
|
+ if(exist){
|
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
|
+ }
|
|
//
|
|
//
|
|
// if(classGroup.getStudentNum()>0 && (VipGroupStatusEnum.APPLYING.equals(practiceGroup.getGroupStatus()))){
|
|
// if(classGroup.getStudentNum()>0 && (VipGroupStatusEnum.APPLYING.equals(practiceGroup.getGroupStatus()))){
|
|
// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.PRACTICE);
|
|
// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.PRACTICE);
|
|
@@ -2444,15 +2456,19 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
throw new BizException("您无法购买此课程");
|
|
throw new BizException("您无法购买此课程");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), null);
|
|
|
|
+ //是否已经购买
|
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
|
|
+ if(exist){
|
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
|
+ }
|
|
|
|
|
|
-// ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), null);
|
|
|
|
-//
|
|
|
|
-// if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
|
-// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
|
-// if(i <= 0){
|
|
|
|
-// throw new BizException("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
|
+ int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
|
+ if(i <= 0){
|
|
|
|
+ throw new BizException("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules,false,false);
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules,false,false);
|
|
@@ -2562,12 +2578,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
OrderTypeEnum.SMALL_CLASS_TO_BUY);
|
|
OrderTypeEnum.SMALL_CLASS_TO_BUY);
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(),ClassGroupTypeEnum.VIP.getCode());
|
|
-
|
|
|
|
- classGroup = classGroupDao.lockClassGroup(classGroup.getId());
|
|
|
|
-
|
|
|
|
if(Objects.isNull(classGroup)){
|
|
if(Objects.isNull(classGroup)){
|
|
throw new BizException("班级信息错误");
|
|
throw new BizException("班级信息错误");
|
|
}
|
|
}
|
|
|
|
+ classGroup = classGroupDao.lockClassGroup(classGroup.getId());
|
|
|
|
+ Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), vipGroupBuyParams.getUserId());
|
|
|
|
+ if(exist){
|
|
|
|
+ throw new BizException("您已加入此课程");
|
|
|
|
+ }
|
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
|
|
|
|
+ int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(),"VIP");
|
|
|
|
+ if(vipGroup.getStatus() != VipGroupStatusEnum.APPLYING || classGroup.getDelFlag() != 1 || courseNum > 0){
|
|
|
|
+ throw new BizException("当前VIP课已无法通过购买加入,请联系教务老师");
|
|
|
|
+ }
|
|
|
|
+
|
|
if (list.size() > 0) {
|
|
if (list.size() > 0) {
|
|
StudentPaymentOrder applyOrder = list.get(list.size() - 1);
|
|
StudentPaymentOrder applyOrder = list.get(list.size() - 1);
|
|
// 查询订单状态
|
|
// 查询订单状态
|
|
@@ -2594,8 +2618,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
Date date = new Date();
|
|
Date date = new Date();
|
|
|
|
|
|
- VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
|
|
|
|
-
|
|
|
|
if(classGroup.getStudentNum() >= classGroup.getExpectStudentNum()){
|
|
if(classGroup.getStudentNum() >= classGroup.getExpectStudentNum()){
|
|
throw new BizException("该VIP课人数已满,请联系教务老师!");
|
|
throw new BizException("该VIP课人数已满,请联系教务老师!");
|
|
}
|
|
}
|
|
@@ -2765,6 +2787,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if(classGroup.getStudentNum().equals(classGroup.getExpectStudentNum())){
|
|
if(classGroup.getStudentNum().equals(classGroup.getExpectStudentNum())){
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
classGroup.setDelFlag(0);
|
|
classGroup.setDelFlag(0);
|
|
|
|
+ VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupCategoryId(), vipGroup.getOrganId());
|
|
|
|
+
|
|
//生成课表
|
|
//生成课表
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(),CourseSchedule.class);
|
|
classGroup.setTotalClassTimes(courseSchedules.size());
|
|
classGroup.setTotalClassTimes(courseSchedules.size());
|
|
@@ -2797,6 +2821,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
teacherAttendance.setCourseScheduleId(courseSchedule.getId());
|
|
teacherAttendance.setCourseScheduleId(courseSchedule.getId());
|
|
teacherAttendances.add(teacherAttendance);
|
|
teacherAttendances.add(teacherAttendance);
|
|
}
|
|
}
|
|
|
|
+ courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
|
+ teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
+
|
|
//群聊数据
|
|
//群聊数据
|
|
Map<Integer,String> userRoleMap = new HashMap<Integer, String>(5);
|
|
Map<Integer,String> userRoleMap = new HashMap<Integer, String>(5);
|
|
if(Objects.nonNull(vipGroup.getEducationalTeacherId())){
|
|
if(Objects.nonNull(vipGroup.getEducationalTeacherId())){
|
|
@@ -2806,7 +2833,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
//生成课程学员关联
|
|
//生成课程学员关联
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
|
|
List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
|
|
- VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupCategoryId(), vipGroup.getOrganId());
|
|
|
|
|
|
+
|
|
List<Integer> studentIdList = classGroupStudents.stream().map(e -> e.getUserId()).collect(Collectors.toList());
|
|
List<Integer> studentIdList = classGroupStudents.stream().map(e -> e.getUserId()).collect(Collectors.toList());
|
|
for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
StudentPaymentOrder successOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroup.getId(), classGroupStudent.getUserId(), "SUCCESS");
|
|
StudentPaymentOrder successOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroup.getId(), classGroupStudent.getUserId(), "SUCCESS");
|
|
@@ -2836,8 +2863,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
|
|
studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
|
|
|
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
- courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
|
- teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
|
|
|
|
imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroup.getName(), null, null, GroupType.VIP.getCode());
|
|
imGroupService.create(classGroup.getId().longValue(), null, classGroup.getName(), classGroup.getName(), vipGroup.getName(), null, null, GroupType.VIP.getCode());
|
|
imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
|
|
imGroupMemberService.join(classGroup.getId().longValue(), userRoleMap);
|
|
@@ -3407,14 +3432,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if(CollectionUtils.isEmpty(userCourseInfos) && vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
if(CollectionUtils.isEmpty(userCourseInfos) && vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)){
|
|
StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode());
|
|
if(Objects.isNull(studentPaymentOrder)){
|
|
if(Objects.isNull(studentPaymentOrder)){
|
|
- bigDecimal = new BigDecimal(0);
|
|
|
|
|
|
+ bigDecimal = ZERO;
|
|
}else{
|
|
}else{
|
|
bigDecimal = studentPaymentOrder.getActualAmount().add(studentPaymentOrder.getBalancePaymentAmount());
|
|
bigDecimal = studentPaymentOrder.getActualAmount().add(studentPaymentOrder.getBalancePaymentAmount());
|
|
}
|
|
}
|
|
result.put("suplusCourseOriginalFee", bigDecimal);
|
|
result.put("suplusCourseOriginalFee", bigDecimal);
|
|
}else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
}else if(!CollectionUtils.isEmpty(userCourseInfos)){
|
|
- BigDecimal historyPrice = new BigDecimal(0);
|
|
|
|
- BigDecimal allPrice = new BigDecimal(0);
|
|
|
|
|
|
+ BigDecimal historyPrice = ZERO;
|
|
|
|
+ BigDecimal allPrice = ZERO;
|
|
for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
|
|
allPrice = allPrice.add(userCourseInfo.getExpectPrice());
|
|
allPrice = allPrice.add(userCourseInfo.getExpectPrice());
|
|
if(now.after(userCourseInfo.getStartClassTime())){
|
|
if(now.after(userCourseInfo.getStartClassTime())){
|
|
@@ -3422,8 +3447,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
bigDecimal = allPrice.subtract(historyPrice);
|
|
bigDecimal = allPrice.subtract(historyPrice);
|
|
- if(bigDecimal.longValue() < 0){
|
|
|
|
- bigDecimal = new BigDecimal(0);
|
|
|
|
|
|
+ if(bigDecimal.compareTo(ZERO) < 0){
|
|
|
|
+ bigDecimal = ZERO;
|
|
}
|
|
}
|
|
result.put("suplusCourseOriginalFee", allPrice);
|
|
result.put("suplusCourseOriginalFee", allPrice);
|
|
}else{
|
|
}else{
|
|
@@ -4011,16 +4036,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if(Objects.isNull(vipGroupId)){
|
|
if(Objects.isNull(vipGroupId)){
|
|
throw new BizException("请指定vip课程");
|
|
throw new BizException("请指定vip课程");
|
|
}
|
|
}
|
|
- VipGroup vipGroup=vipGroupDao.get(vipGroupId);
|
|
|
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(vipGroupId);
|
|
if(Objects.isNull(vipGroup)){
|
|
if(Objects.isNull(vipGroup)){
|
|
throw new BizException("未找到指定的vip课程");
|
|
throw new BizException("未找到指定的vip课程");
|
|
}
|
|
}
|
|
|
|
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null);
|
|
|
|
|
|
- if(classGroup.getStudentNum()>0&&(VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
|
- int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
|
- if(i>0){
|
|
|
|
|
|
+ if(classGroup.getStudentNum() > 0 && (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus()))){
|
|
|
|
+ int num = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.VIP);
|
|
|
|
+ if(num > 0){
|
|
throw new BizException("已有学员购买了该课程组,无法添加,请走学员购买流程!");
|
|
throw new BizException("已有学员购买了该课程组,无法添加,请走学员购买流程!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -4037,12 +4062,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
|
|
|
|
Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
|
|
Integer exitStudentNum = classGroupStudentMapperDao.countClassGroupExitStudentNum(classGroup.getId(), studentIds);
|
|
- if(exitStudentNum>0){
|
|
|
|
|
|
+ if(exitStudentNum > 0){
|
|
throw new BizException("选择的学生中存在此课程中已存在的学生");
|
|
throw new BizException("选择的学生中存在此课程中已存在的学生");
|
|
}
|
|
}
|
|
|
|
|
|
Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
|
|
Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
|
|
- if(studentNum.compareTo(classGroup.getExpectStudentNum())>=0){
|
|
|
|
|
|
+ if(studentNum.compareTo(classGroup.getExpectStudentNum()) >= 0){
|
|
throw new BizException("该班级人数已达上限");
|
|
throw new BizException("该班级人数已达上限");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4135,9 +4160,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
|
|
|
|
Integer currentStudentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
|
|
Integer currentStudentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
|
|
- if((!vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED)
|
|
|
|
- ||!vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL))
|
|
|
|
- &¤tStudentNum.compareTo(classGroup.getExpectStudentNum())>=0){
|
|
|
|
|
|
+ if((!vipGroup.getStatus().equals(VipGroupStatusEnum.FINISHED) || !vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL))
|
|
|
|
+ && currentStudentNum.compareTo(classGroup.getExpectStudentNum()) >= 0){
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
vipGroupDao.update(vipGroup);
|
|
vipGroupDao.update(vipGroup);
|
|
}
|
|
}
|
|
@@ -4155,19 +4179,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- BigDecimal surplusCoursesPrice=new BigDecimal(0);
|
|
|
|
- boolean hasGiveClass=false;
|
|
|
|
- int onlineCourseTimes=0,
|
|
|
|
- offlineCourseTimes=0,
|
|
|
|
- onlineCourseTotalTimes=0,
|
|
|
|
- offlineCourseTotalTimes=0,
|
|
|
|
- giveClassTimes=0;
|
|
|
|
|
|
+ BigDecimal surplusCoursesPrice = new BigDecimal(0);
|
|
|
|
|
|
//生成学生单课缴费信息
|
|
//生成学生单课缴费信息
|
|
for (Integer studentId:studentIds) {
|
|
for (Integer studentId:studentIds) {
|
|
- offlineCourseTimes=0;
|
|
|
|
- onlineCourseTimes=0;
|
|
|
|
- surplusCoursesPrice=new BigDecimal(0);
|
|
|
|
|
|
+ surplusCoursesPrice = new BigDecimal(0);
|
|
|
|
|
|
if(studentCoursePriceMap.containsKey(studentId)){
|
|
if(studentCoursePriceMap.containsKey(studentId)){
|
|
VipGroupStudentCoursePrice vipGroupStudentCoursePrice = studentCoursePriceMap.get(studentId);
|
|
VipGroupStudentCoursePrice vipGroupStudentCoursePrice = studentCoursePriceMap.get(studentId);
|
|
@@ -4179,23 +4195,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
for (int i = 0;i < surplusCourses.size();i++) {
|
|
for (int i = 0;i < surplusCourses.size();i++) {
|
|
CourseSchedule courseSchedule = surplusCourses.get(i);
|
|
CourseSchedule courseSchedule = surplusCourses.get(i);
|
|
if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
- offlineCourseTimes += 1;
|
|
|
|
- }else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
|
|
- onlineCourseTimes += 1;
|
|
|
|
- }
|
|
|
|
- if(hasGiveClass && vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
|
|
|
|
- if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)
|
|
|
|
- && offlineCourseTimes > (offlineCourseTotalTimes - giveClassTimes)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if(hasGiveClass && vipGroup.getGiveTeachMode() == courseSchedule.getTeachMode()){
|
|
|
|
- if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE) && onlineCourseTimes > (onlineCourseTotalTimes-giveClassTimes)){
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
|
|
surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOfflineClassesUnitPrice());
|
|
surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOfflineClassesUnitPrice());
|
|
}else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
}else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice());
|
|
surplusCoursesPrice = surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice());
|
|
@@ -4210,42 +4209,36 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
sysUserCashAccountService.subtractFromCourseBalanceAndBalance(studentId,surplusCoursesPrice,PlatformCashAccountDetailTypeEnum.PAY_FEE, "后台添加学员金额扣减");
|
|
sysUserCashAccountService.subtractFromCourseBalanceAndBalance(studentId,surplusCoursesPrice,PlatformCashAccountDetailTypeEnum.PAY_FEE, "后台添加学员金额扣减");
|
|
|
|
|
|
- List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
|
|
|
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
|
|
|
- offlineCourseTimes = 0;
|
|
|
|
- onlineCourseTimes = 0;
|
|
|
|
- for (CourseSchedule vipGroupCourseSchedule : surplusCourses) {
|
|
|
|
- if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
|
|
- offlineCourseTimes += 1;
|
|
|
|
- }else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
|
|
- onlineCourseTimes += 1;
|
|
|
|
- }
|
|
|
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
|
+ BigDecimal divide = ZERO;
|
|
|
|
+ BigDecimal firstAmount = ZERO;
|
|
|
|
+
|
|
|
|
+ if(surplusCoursesPrice.compareTo(ZERO) > 0){
|
|
|
|
+ divide = surplusCoursesPrice.divide(new BigDecimal(surplusCourses.size()), ROUND_DOWN);
|
|
|
|
+ firstAmount = surplusCoursesPrice.subtract(divide.multiply(new BigDecimal(surplusCourses.size()))).add(divide);
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < surplusCourses.size(); i++) {
|
|
|
|
+ CourseSchedule vipGroupCourseSchedule = surplusCourses.get(i);
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
courseScheduleStudentPayment.setGroupType(GroupType.VIP);
|
|
courseScheduleStudentPayment.setGroupType(GroupType.VIP);
|
|
courseScheduleStudentPayment.setMusicGroupId(vipGroupId.toString());
|
|
courseScheduleStudentPayment.setMusicGroupId(vipGroupId.toString());
|
|
courseScheduleStudentPayment.setClassGroupId(vipGroupCourseSchedule.getClassGroupId());
|
|
courseScheduleStudentPayment.setClassGroupId(vipGroupCourseSchedule.getClassGroupId());
|
|
courseScheduleStudentPayment.setCourseScheduleId(vipGroupCourseSchedule.getId());
|
|
courseScheduleStudentPayment.setCourseScheduleId(vipGroupCourseSchedule.getId());
|
|
courseScheduleStudentPayment.setUserId(studentId);
|
|
courseScheduleStudentPayment.setUserId(studentId);
|
|
|
|
+ if(i == 0){
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
|
+ courseScheduleStudentPayment.setActualPrice(firstAmount);
|
|
|
|
+ }else {
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
|
+ courseScheduleStudentPayment.setActualPrice(divide);
|
|
|
|
+ }
|
|
if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOfflineClassesUnitPrice());
|
|
|
|
courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
}else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
}else if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){
|
|
- courseScheduleStudentPayment.setExpectPrice(vipGroup.getOnlineClassesUnitPrice());
|
|
|
|
courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
|
|
courseScheduleStudentPayment.setOriginalPrice(vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice());
|
|
}
|
|
}
|
|
- if(hasGiveClass && vipGroup.getGiveTeachMode() == vipGroupCourseSchedule.getTeachMode()){
|
|
|
|
- if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)
|
|
|
|
- &&offlineCourseTimes>(offlineCourseTotalTimes-giveClassTimes)){
|
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
|
- }
|
|
|
|
- if(vipGroupCourseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)
|
|
|
|
- &&onlineCourseTimes>(onlineCourseTotalTimes-giveClassTimes)){
|
|
|
|
- courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(Objects.nonNull(discount)){
|
|
|
|
- courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().multiply(discount).setScale(CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP));
|
|
|
|
- }
|
|
|
|
courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|
|
courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|