|
@@ -1665,7 +1665,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
if (!CollectionUtils.isEmpty(vipGroupStudentCoursePrices)) {
|
|
if (!CollectionUtils.isEmpty(vipGroupStudentCoursePrices)) {
|
|
|
userPriceMap = vipGroupStudentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v -> v, (v1, v2) -> v1));
|
|
userPriceMap = vipGroupStudentCoursePrices.stream().collect(Collectors.toMap(VipGroupStudentCoursePrice::getStudentId, v -> v, (v1, v2) -> v1));
|
|
|
}
|
|
}
|
|
|
|
|
+ VipGroup vipGroup = vipGroupDao.get(queryInfo.getVipGroupId());
|
|
|
|
|
+ List<Integer> studentIds = dataList.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
|
|
+ ActivityUserQueryInfo activityUserQueryInfo = new ActivityUserQueryInfo();
|
|
|
|
|
+ activityUserQueryInfo.setCategoryId(vipGroup.getVipGroupCategoryId());
|
|
|
|
|
+ activityUserQueryInfo.setOrganIds(queryInfo.getOrganId());
|
|
|
|
|
+ activityUserQueryInfo.setSingleCourseTime(vipGroup.getSingleClassMinutes());
|
|
|
|
|
+ activityUserQueryInfo.setStudentIds(studentIds);
|
|
|
|
|
+ List<ActivityUserDto> activityUserDtos = activityUserMapperService.queryActivityStudentList(activityUserQueryInfo);
|
|
|
|
|
+ Map<Integer, Integer> collect = new HashMap<>();
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(activityUserDtos)){
|
|
|
|
|
+ collect = activityUserDtos.stream().
|
|
|
|
|
+ collect(Collectors.groupingBy(ActivityUserDto::getUserId, Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0).getSubCourseNum())));
|
|
|
|
|
+ }
|
|
|
for (VipGroupStudentDto vipGroupStudentDto : dataList) {
|
|
for (VipGroupStudentDto vipGroupStudentDto : dataList) {
|
|
|
|
|
+ vipGroupStudentDto.setTotalClassTimes(collect.get(vipGroupStudentDto.getId()));
|
|
|
if (!userPriceMap.containsKey(Integer.valueOf(vipGroupStudentDto.getId().toString()))) {
|
|
if (!userPriceMap.containsKey(Integer.valueOf(vipGroupStudentDto.getId().toString()))) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
@@ -3050,15 +3064,38 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
|
|
|
|
|
+ //获取账户信息
|
|
|
|
|
+ SysUserCashAccount cashAccount = sysUserCashAccountService.getLocked(studentRecoverInfo.getUserId());
|
|
|
|
|
+ if (cashAccount == null) {
|
|
|
|
|
+ throw new BizException("用户[{}]现金账户不存在", studentRecoverInfo.getUserId());
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal courseBalance = cashAccount.getCourseBalance();
|
|
|
|
|
+ //获取学员排课资格
|
|
|
|
|
+ List studentIdList = new ArrayList<>();
|
|
|
|
|
+ studentIdList.add(studentRecoverInfo.getUserId());
|
|
|
|
|
+ //获取学员付费排课资格
|
|
|
|
|
+ List<ActivityUserMapper> activityUserMappers = activityUserMapperService.getDao().findByStudents(studentIdList,vipGroup.getVipGroupCategoryId(),vipGroup.getSingleClassMinutes());
|
|
|
|
|
+ //获取学员赠送排课资格
|
|
|
|
|
+ List<ActivityUserMapper> freeActivityUserMappers = activityUserMapperService.getDao().findByStudents1(studentIdList,vipGroup.getVipGroupCategoryId(),vipGroup.getSingleClassMinutes());
|
|
|
|
|
+ int j = 0;
|
|
|
|
|
+ int a = 0;
|
|
|
for (int i = 0; i < surplusCourseWithGroup.size(); i++) {
|
|
for (int i = 0; i < surplusCourseWithGroup.size(); i++) {
|
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
|
|
+ BigDecimal actualPrice = coursePrices.get(i);
|
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(actualPrice);
|
|
|
|
|
+ //按课扣除课程余额
|
|
|
|
|
+ if(courseBalance.compareTo(actualPrice) >= 0){
|
|
|
|
|
+ courseBalance = courseBalance.subtract(actualPrice);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ //扣除排课资格
|
|
|
|
|
+ actualPrice = activityUserMapperService.use(activityUserMappers,freeActivityUserMappers,j,a,vipGroup.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ courseScheduleStudentPayment.setActualPrice(actualPrice);
|
|
|
courseScheduleStudentPayment.setGroupType(GroupType.VIP);
|
|
courseScheduleStudentPayment.setGroupType(GroupType.VIP);
|
|
|
courseScheduleStudentPayment.setMusicGroupId(studentRecoverInfo.getVipGroupId().toString());
|
|
courseScheduleStudentPayment.setMusicGroupId(studentRecoverInfo.getVipGroupId().toString());
|
|
|
courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(surplusCourseWithGroup.get(i).getId());
|
|
courseScheduleStudentPayment.setCourseScheduleId(surplusCourseWithGroup.get(i).getId());
|
|
|
courseScheduleStudentPayment.setUserId(studentRecoverInfo.getUserId());
|
|
courseScheduleStudentPayment.setUserId(studentRecoverInfo.getUserId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(coursePrices.get(i));
|
|
|
|
|
- courseScheduleStudentPayment.setActualPrice(coursePrices.get(i));
|
|
|
|
|
courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(surplusCourseWithGroup.get(i)) ? vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice() : vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(surplusCourseWithGroup.get(i)) ? vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice() : vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|
|
@@ -3070,7 +3107,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
studentDao.updateStudentServiceTag(studentRecoverInfo.getUserId(), null, YesOrNoEnum.YES.getCode());
|
|
studentDao.updateStudentServiceTag(studentRecoverInfo.getUserId(), null, YesOrNoEnum.YES.getCode());
|
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
|
|
courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
|
|
|
}
|
|
}
|
|
|
- sysUserCashAccountService.appendCourseBalance(studentRecoverInfo.getUserId(), surplusCourseFee.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "学生复学扣除课程余额");
|
|
|
|
|
|
|
+ //扣余额,如果余额不足,那么扣排课资格
|
|
|
|
|
+ if(cashAccount.getCourseBalance().compareTo(courseBalance) != 0){
|
|
|
|
|
+ sysUserCashAccountService.appendCourseBalance(studentRecoverInfo.getUserId(), cashAccount.getCourseBalance().subtract(courseBalance).negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "学生复学扣除课程余额");
|
|
|
|
|
+ }
|
|
|
|
|
+ //更新资格
|
|
|
|
|
+ activityUserMappers.addAll(freeActivityUserMappers);
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(activityUserMappers)){
|
|
|
|
|
+ activityUserMapperService.getDao().batchUpdate(activityUserMappers);
|
|
|
|
|
+ }
|
|
|
studentPauseInfo.setDelFlag(1);
|
|
studentPauseInfo.setDelFlag(1);
|
|
|
studentPauseInfoDao.update(studentPauseInfo);
|
|
studentPauseInfoDao.update(studentPauseInfo);
|
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
@@ -3744,11 +3789,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroup(vipGroup.getId());
|
|
|
|
|
-// if(Objects.isNull(vipGroupDefaultClassesUnitPrice)){
|
|
|
|
|
-// throw new BizException("课程单价设置错误");
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
if (VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())
|
|
if (VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())
|
|
|
|| VipGroupStatusEnum.FINISHED.equals(vipGroup.getStatus())
|
|
|| VipGroupStatusEnum.FINISHED.equals(vipGroup.getStatus())
|
|
|
|| VipGroupStatusEnum.CANCEL.equals(vipGroup.getStatus())) {
|
|
|| VipGroupStatusEnum.CANCEL.equals(vipGroup.getStatus())) {
|