|
@@ -2170,7 +2170,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if (Objects.isNull(groupId)) {
|
|
if (Objects.isNull(groupId)) {
|
|
throw new BizException("请指定课程组");
|
|
throw new BizException("请指定课程组");
|
|
}
|
|
}
|
|
- // groupType -> PRACTICE, VIP, LIVE
|
|
|
|
if ("PRACTICE".equals(groupType)) {
|
|
if ("PRACTICE".equals(groupType)) {
|
|
PracticeGroup practiceGroup = practiceGroupService.get(groupId);
|
|
PracticeGroup practiceGroup = practiceGroupService.get(groupId);
|
|
if (Objects.isNull(practiceGroup)) {
|
|
if (Objects.isNull(practiceGroup)) {
|
|
@@ -2469,38 +2468,30 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if (exist) {
|
|
if (exist) {
|
|
throw new BizException("您已加入此课程");
|
|
throw new BizException("您已加入此课程");
|
|
}
|
|
}
|
|
-//
|
|
|
|
-// if(classGroup.getStudentNum()>0 && (VipGroupStatusEnum.APPLYING.equals(practiceGroup.getGroupStatus()))){
|
|
|
|
-// int i = studentPaymentOrderDao.countGroupOrderWithoutFailed(vipGroupId.toString(), GroupType.PRACTICE);
|
|
|
|
-// if(i<=0){
|
|
|
|
-// throw new BizException("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(practiceGroup.getCourseScheduleJson(), CourseSchedule.class);
|
|
List<CourseSchedule> courseSchedules = JSON.parseArray(practiceGroup.getCourseScheduleJson(), CourseSchedule.class);
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
|
|
courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
|
|
} else {
|
|
} else {
|
|
VipGroup vipGroup = get(vipGroupId.longValue());
|
|
VipGroup vipGroup = get(vipGroupId.longValue());
|
|
- if (Objects.nonNull(vipGroup.getStudentIdList())) {
|
|
|
|
- Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
|
|
|
|
- if (!userIds.contains(userId)) {
|
|
|
|
- throw new BizException("您无法购买此课程");
|
|
|
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), vipGroup.getGroupType());
|
|
|
|
+ if("VIP".equals(vipGroup.getGroupType())){
|
|
|
|
+ if (StringUtils.isNotEmpty(vipGroup.getStudentIdList())) {
|
|
|
|
+ Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
|
|
|
|
+ if (!userIds.contains(userId)) {
|
|
|
|
+ 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("该课程已经无法通过购买加入,请联系教务老师!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId.longValue(), vipGroup.getGroupType());
|
|
|
|
//是否已经购买
|
|
//是否已经购买
|
|
Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
|
|
if (exist) {
|
|
if (exist) {
|
|
throw new BizException("您已加入此课程");
|
|
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);
|
|
}
|
|
}
|
|
@@ -2659,7 +2650,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
- studentPaymentOrder.setOrganId(vipGroup.getOrganId());
|
|
|
|
|
|
+ studentPaymentOrder.setOrganId(user.getOrganId());
|
|
studentPaymentOrder.setVersion(0);
|
|
studentPaymentOrder.setVersion(0);
|
|
studentPaymentOrder.setActivityBuyNum(vipGroup.getOnlineClassesNum() + vipGroup.getOfflineClassesNum());
|
|
studentPaymentOrder.setActivityBuyNum(vipGroup.getOnlineClassesNum() + vipGroup.getOfflineClassesNum());
|
|
Integer vipGroupActivityId = vipGroup.getVipGroupActivityId();
|
|
Integer vipGroupActivityId = vipGroup.getVipGroupActivityId();
|
|
@@ -2675,14 +2666,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
if (userCashAccount.getBalance().subtract(amount).doubleValue() >= 0) {
|
|
if (userCashAccount.getBalance().subtract(amount).doubleValue() >= 0) {
|
|
- studentPaymentRouteOrderService.addRouteOrder(orderNo, vipGroup.getOrganId(), vipGroup.getTotalPrice());
|
|
|
|
|
|
+ studentPaymentRouteOrderService.addRouteOrder(orderNo, user.getOrganId(), vipGroup.getTotalPrice());
|
|
// 更新订单信息
|
|
// 更新订单信息
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
studentPaymentOrder.setActualAmount(new BigDecimal(0));
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
studentPaymentOrder.setBalancePaymentAmount(amount);
|
|
studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
- studentPaymentOrder.setOrganId(vipGroup.getOrganId());
|
|
|
|
- studentPaymentOrder.setRoutingOrganId(vipGroup.getOrganId());
|
|
|
|
|
|
+ studentPaymentOrder.setOrganId(user.getOrganId());
|
|
|
|
+ studentPaymentOrder.setRoutingOrganId(user.getOrganId());
|
|
|
|
|
|
this.orderCallback(studentPaymentOrder);
|
|
this.orderCallback(studentPaymentOrder);
|
|
|
|
|
|
@@ -2725,12 +2716,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
groupType.getDesc() + "购买",
|
|
groupType.getDesc() + "购买",
|
|
vipGroup.getName(),
|
|
vipGroup.getName(),
|
|
- vipGroup.getOrganId(),
|
|
|
|
|
|
+ user.getOrganId(),
|
|
orderTypeEnum.getCode()
|
|
orderTypeEnum.getCode()
|
|
);
|
|
);
|
|
|
|
|
|
- studentPaymentOrder.setOrganId(vipGroup.getOrganId());
|
|
|
|
- studentPaymentOrder.setRoutingOrganId(vipGroup.getOrganId());
|
|
|
|
|
|
+ studentPaymentOrder.setOrganId(user.getOrganId());
|
|
|
|
+ studentPaymentOrder.setRoutingOrganId(user.getOrganId());
|
|
studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
studentPaymentOrder.setUpdateTime(date);
|
|
@@ -4452,28 +4443,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void stopVipGroupWithNoCreate(Integer tenantId) {
|
|
public void stopVipGroupWithNoCreate(Integer tenantId) {
|
|
- List<VipGroup> noCreateSuccessVipGroups = vipGroupDao.findNoCreateSuccessVipGroup(tenantId,null);
|
|
|
|
|
|
+ List<VipGroup> noCreateSuccessVipGroups = vipGroupDao.findNoCreateSuccessVipGroup(tenantId,"VIP");
|
|
if (CollectionUtils.isEmpty(noCreateSuccessVipGroups)) {
|
|
if (CollectionUtils.isEmpty(noCreateSuccessVipGroups)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-// List<VipGroup> vipGroup = noCreateSuccessVipGroups.stream().filter(e -> StringUtils.equals("VIP",e.getGroupType())).collect(Collectors.toList());
|
|
|
|
-// List<VipGroup> liveGroup = noCreateSuccessVipGroups.stream().filter(e -> StringUtils.equals("LIVE",e.getGroupType())).collect(Collectors.toList());
|
|
|
|
-// List<VipGroup> noStudentGroup = vipGroups.stream().filter(e -> StringUtils.isEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
-// List<VipGroup> hasStudentGroup = vipGroups.stream().filter(e -> StringUtils.isNotEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
-// if(!CollectionUtils.isEmpty(noStudentGroup)){
|
|
|
|
-// 关闭课程组
|
|
|
|
-// }
|
|
|
|
-// if(!CollectionUtils.isEmpty(hasStudentGroup)){
|
|
|
|
-// 排课
|
|
|
|
-// }
|
|
|
|
//用户账户资金变动信息列表
|
|
//用户账户资金变动信息列表
|
|
List<SysUserCashAccountDetail> userCashAccountDetails = new ArrayList<>();
|
|
List<SysUserCashAccountDetail> userCashAccountDetails = new ArrayList<>();
|
|
- List<Long> groupIds = noCreateSuccessVipGroups.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
|
- List<ClassGroupStudentMapper> classGroupStudentMappers = classGroupStudentMapperDao.findByVipGroups(groupIds);
|
|
|
|
- Map<Long, Integer> quitUserMap = new HashMap<>();
|
|
|
|
- if(!CollectionUtils.isEmpty(classGroupStudentMappers)){
|
|
|
|
- quitUserMap = classGroupStudentMappers.stream().collect(Collectors.groupingBy(e -> Long.parseLong(e.getMusicGroupId()), Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0).getUserId())));
|
|
|
|
- }
|
|
|
|
for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) {
|
|
for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) {
|
|
GroupType groupType = GroupType.VIP;
|
|
GroupType groupType = GroupType.VIP;
|
|
OrderTypeEnum orderTypeEnum = OrderTypeEnum.SMALL_CLASS_TO_BUY;
|
|
OrderTypeEnum orderTypeEnum = OrderTypeEnum.SMALL_CLASS_TO_BUY;
|
|
@@ -4486,13 +4461,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
noCreateSuccessVipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
noCreateSuccessVipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
- List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryByDealStatus(noCreateSuccessVipGroup.getId().toString(),
|
|
|
|
|
|
+ List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryVipQuitOrder(noCreateSuccessVipGroup.getId(),
|
|
orderTypeEnum, DealStatusEnum.SUCCESS);
|
|
orderTypeEnum, DealStatusEnum.SUCCESS);
|
|
|
|
|
|
for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrders) {
|
|
for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrders) {
|
|
- if(studentPaymentOrder.getUserId().equals(quitUserMap.get(noCreateSuccessVipGroup.getId()))){
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
//生成账户资金明细
|
|
//生成账户资金明细
|
|
if (studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
if(Objects.equals("关闭订单,实际支付成功,退到用户余额",studentPaymentOrder.getMemo())){
|
|
if(Objects.equals("关闭订单,实际支付成功,退到用户余额",studentPaymentOrder.getMemo())){
|
|
@@ -4531,6 +4503,138 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void createLiveCourse() {
|
|
|
|
+ List<VipGroup> vipGroups = vipGroupDao.findNoCreateSuccessVipGroup(null,"LIVE");
|
|
|
|
+ if(!CollectionUtils.isEmpty(vipGroups)){
|
|
|
|
+ List<VipGroup> noStudentGroup = vipGroups.stream().filter(e -> StringUtils.isEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
+ List<VipGroup> hasStudentGroup = vipGroups.stream().filter(e -> StringUtils.isNotEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
+ if(!CollectionUtils.isEmpty(noStudentGroup)){
|
|
|
|
+ noStudentGroup.forEach(e->e.setStatus(VipGroupStatusEnum.CANCEL));
|
|
|
|
+ //关闭课程组
|
|
|
|
+ vipGroupDao.batchUpdate(noStudentGroup);
|
|
|
|
+ }
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ if(!CollectionUtils.isEmpty(hasStudentGroup)){
|
|
|
|
+ //排课
|
|
|
|
+ for (VipGroup vipGroup : hasStudentGroup) {
|
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroup.getId(),vipGroup.getGroupType());
|
|
|
|
+ vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
|
|
|
|
+ Integer tenantId = vipGroup.getTenantId();
|
|
|
|
+ for (String s : vipGroup.getStudentIdList().split(",")) {
|
|
|
|
+ Integer userId = Integer.parseInt(s);
|
|
|
|
+ //生成班级学员关联
|
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
|
|
|
|
+ classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
|
|
|
|
+ classGroupStudentMapper.setClassGroupId(classGroup.getId());
|
|
|
|
+ classGroupStudentMapper.setUserId(userId);
|
|
|
|
+ classGroupStudentMapper.setCreateTime(now);
|
|
|
|
+ classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
|
|
|
|
+ classGroupStudentMapper.setGroupType(GroupType.LIVE);
|
|
|
|
+ classGroupStudentMapperDao.insert(classGroupStudentMapper);
|
|
|
|
+
|
|
|
|
+ classGroup.setDelFlag(0);
|
|
|
|
+ VipGroupDefaultClassesUnitPrice vipGroupDefaultClassesUnitPrice = vipGroupDefaultClassesUnitPriceDao.getByVipGroupCategory(vipGroup.getVipGroupCategoryId(),
|
|
|
|
+ vipGroup.getOrganId(), vipGroup.getGroupType());
|
|
|
|
+
|
|
|
|
+ //生成课表
|
|
|
|
+ List<CourseSchedule> courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
|
|
|
|
+ classGroup.setTotalClassTimes(courseSchedules.size());
|
|
|
|
+
|
|
|
|
+ courseScheduleService.batchAddCourseSchedule1(courseSchedules);
|
|
|
|
+
|
|
|
|
+ //考勤信息
|
|
|
|
+ List<TeacherAttendance> teacherAttendances = new ArrayList<>();
|
|
|
|
+ //创建课酬信息
|
|
|
|
+ List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries = new ArrayList<>();
|
|
|
|
+ Map<String, BigDecimal> stringBigDecimalMap = countVipGroupPredictFee1(vipGroup, vipGroup.getUserId(), null);
|
|
|
|
+ for (CourseSchedule courseSchedule : courseSchedules) {
|
|
|
|
+ //创建教师课程薪水记录
|
|
|
|
+ CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
|
+ courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
|
|
+ courseScheduleTeacherSalary.setGroupType(courseSchedule.getGroupType());
|
|
|
|
+ courseScheduleTeacherSalary.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
|
+ courseScheduleTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
|
+ courseScheduleTeacherSalary.setUserId(courseSchedule.getActualTeacherId().intValue());
|
|
|
|
+ courseScheduleTeacherSalary.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
|
+ courseScheduleTeacherSalary.setExpectSalary(stringBigDecimalMap.get("offlineTeacherSalary"));
|
|
|
|
+ courseScheduleTeacherSalary.setActualSalary(null);
|
|
|
|
+ courseScheduleTeacherSalary.setTenantId(tenantId);
|
|
|
|
+ courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
|
|
|
|
+
|
|
|
|
+ TeacherAttendance teacherAttendance = new TeacherAttendance();
|
|
|
|
+ teacherAttendance.setGroupType(courseSchedule.getGroupType());
|
|
|
|
+ teacherAttendance.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
|
+ teacherAttendance.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
|
+ teacherAttendance.setTeacherId(courseSchedule.getActualTeacherId());
|
|
|
|
+ teacherAttendance.setCourseScheduleId(courseSchedule.getId());
|
|
|
|
+ teacherAttendance.setTenantId(tenantId);
|
|
|
|
+ teacherAttendances.add(teacherAttendance);
|
|
|
|
+ }
|
|
|
|
+ courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
|
|
|
|
+ teacherAttendanceDao.batchInsert(teacherAttendances);
|
|
|
|
+
|
|
|
|
+ //群聊数据
|
|
|
|
+ Map<Integer, String> userRoleMap = new HashMap<Integer, String>(5);
|
|
|
|
+ if (Objects.nonNull(vipGroup.getEducationalTeacherId())) {
|
|
|
|
+ userRoleMap.put(vipGroup.getEducationalTeacherId(), "乐团主管");
|
|
|
|
+ }
|
|
|
|
+ userRoleMap.put(vipGroup.getUserId(), "指导老师");
|
|
|
|
+ //生成课程学员关联
|
|
|
|
+ List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
|
|
|
|
+ List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
|
|
|
|
+
|
|
|
|
+ List<Integer> studentIdList = classGroupStudents.stream().map(e -> e.getUserId()).collect(Collectors.toList());
|
|
|
|
+ for (ClassGroupStudentMapper classGroupStudent : classGroupStudents) {
|
|
|
|
+ StudentPaymentOrder successOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroup.getId(), classGroupStudent.getUserId(), "SUCCESS","VIP".equals(vipGroup.getGroupType())?"SMALL_CLASS_TO_BUY":"LIVE_GROUP_BUY");
|
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
|
+ BigDecimal actualPrice = successOrder.getExpectAmount();
|
|
|
|
+ BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), ROUND_DOWN);
|
|
|
|
+ BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(courseSchedules.size()))).add(divide);
|
|
|
|
+ for (int i = 0; i < courseSchedules.size(); i++) {
|
|
|
|
+ CourseSchedule courseSchedule = courseSchedules.get(i);
|
|
|
|
+ CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
|
|
|
|
+ courseScheduleStudentPayment.setUserId(classGroupStudent.getUserId());
|
|
|
|
+ courseScheduleStudentPayment.setGroupType(courseSchedule.getGroupType());
|
|
|
|
+ courseScheduleStudentPayment.setMusicGroupId(courseSchedule.getMusicGroupId());
|
|
|
|
+ courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
|
+ courseScheduleStudentPayment.setClassGroupId(courseSchedule.getClassGroupId());
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
|
+ } else {
|
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
|
+ }
|
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(TeachModeEnum.ONLINE.equals(courseSchedule.getTeachMode()) ? vipGroupDefaultClassesUnitPrice.getOnlineClassesUnitPrice() : vipGroupDefaultClassesUnitPrice.getOfflineClassesUnitPrice());
|
|
|
|
+ courseScheduleStudentPayment.setActualPrice(courseScheduleStudentPayment.getExpectPrice());
|
|
|
|
+ courseScheduleStudentPayments.add(courseScheduleStudentPayment);
|
|
|
|
+ }
|
|
|
|
+ userRoleMap.put(classGroupStudent.getUserId(), null);
|
|
|
|
+ }
|
|
|
|
+ studentDao.updateStudentServiceTag(null, studentIdList, YesOrNoEnum.YES.getCode());
|
|
|
|
+
|
|
|
|
+ courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
|
|
|
|
+
|
|
|
|
+ imGroupService.create(classGroup.getId().toString(), null, classGroup.getName(), classGroup.getName(),
|
|
|
|
+ vipGroup.getName(), null, null, vipGroup.getGroupType(), ImGroup.GroupTypeEnum.valueOf(vipGroup.getGroupType()));
|
|
|
|
+ imGroupMemberService.join(classGroup.getId().toString(), userRoleMap);
|
|
|
|
+ imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
|
|
|
|
+ //更新所属分部列表
|
|
|
|
+ List<Integer> organIds = classGroupDao.findStudentOrganIdsByClassGroup(classGroup.getId().longValue());
|
|
|
|
+ organIds.add(vipGroup.getOrganId());
|
|
|
|
+ HashSet<Integer> hashSet = new HashSet<>(organIds);
|
|
|
|
+ String organIdsString = StringUtils.join(hashSet, ",");
|
|
|
|
+ vipGroup.setOrganIdList(organIdsString);
|
|
|
|
+ vipGroupDao.update(vipGroup);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
public void updateVipGroupStatusToFinished() {
|
|
public void updateVipGroupStatusToFinished() {
|
|
@@ -4738,23 +4842,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
- public void createLiveCourse() {
|
|
|
|
- List<VipGroup> vipGroups = vipGroupDao.findNoCreateSuccessVipGroup(null,"LIVE");
|
|
|
|
- if(!CollectionUtils.isEmpty(vipGroups)){
|
|
|
|
- List<VipGroup> noStudentGroup = vipGroups.stream().filter(e -> StringUtils.isEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
- List<VipGroup> hasStudentGroup = vipGroups.stream().filter(e -> StringUtils.isNotEmpty(e.getStudentIdList())).collect(Collectors.toList());
|
|
|
|
- if(!CollectionUtils.isEmpty(noStudentGroup)){
|
|
|
|
- //关闭课程组
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if(!CollectionUtils.isEmpty(hasStudentGroup)){
|
|
|
|
- //排课
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 学生列表
|
|
* 学生列表
|
|
@@ -4811,11 +4898,52 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 学生休学状态
|
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(query.getLiveGroupId(), GroupType.LIVE.getCode());
|
|
|
|
+ if (Objects.isNull(classGroup)) {
|
|
|
|
+ return livedStudentList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ClassGroupStudentMapper> studentMapperList = classGroupStudentMapperDao.findAllByClassGroup(classGroup.getId().longValue());
|
|
|
|
+ if (CollectionUtils.isEmpty(studentMapperList)) {
|
|
|
|
+ return livedStudentList;
|
|
|
|
+ }
|
|
|
|
+ Map<Integer, ClassGroupStudentMapper> studentMapperMap = studentMapperList.stream().collect(Collectors.toMap(ClassGroupStudentMapper::getUserId, o->o ,(k1,k2)->k2));
|
|
|
|
+
|
|
|
|
+ List<StudentApplyRefunds> applyRefunds = studentApplyRefundsDao.findByGroupAndType(query.getLiveGroupId().toString(), GroupType.LIVE.getCode());
|
|
|
|
+ Map<Integer, List<StudentApplyRefunds>> studentApplyRefundsMap = applyRefunds.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(StudentApplyRefunds::getUserId));
|
|
|
|
+ records.forEach(data -> {
|
|
|
|
+ ClassGroupStudentMapper classGroupStudentMapper = studentMapperMap.get(data.getStudentId().intValue());
|
|
|
|
+ if (Objects.isNull(classGroupStudentMapper)) {
|
|
|
|
+ data.setStudentStatus(0);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (classGroupStudentMapper.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)) {
|
|
|
|
+ data.setStudentStatus(1);
|
|
|
|
+ return;
|
|
|
|
+ } else if (classGroupStudentMapper.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)) {
|
|
|
|
+ data.setStudentStatus(3);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsMap.get(data.getStudentId().intValue());
|
|
|
|
+ if (!CollectionUtils.isEmpty(studentApplyRefunds)) {
|
|
|
|
+ StudentApplyRefunds studentApplyRefund = studentApplyRefunds.get(0);
|
|
|
|
+ if (data.getStudentStatus() == 0 && studentApplyRefund.getStatus().equals(StudentApplyRefundsStatus.ING)) {
|
|
|
|
+ data.setStudentStatus(2);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ data.setStudentStatus(0);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
return livedStudentList.setRecords(records);
|
|
return livedStudentList.setRecords(records);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<CourseSchedule> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query) {
|
|
|
|
|
|
+ public Map<String, Object> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query) {
|
|
|
|
|
|
VipGroup vipGroup = this.get(query.getLiveGroupId());
|
|
VipGroup vipGroup = this.get(query.getLiveGroupId());
|
|
if (Objects.isNull(vipGroup)) {
|
|
if (Objects.isNull(vipGroup)) {
|
|
@@ -4825,10 +4953,30 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
throw new BizException("此课程不是直播课程");
|
|
throw new BizException("此课程不是直播课程");
|
|
}
|
|
}
|
|
// 报名中的课程直接返回json数据
|
|
// 报名中的课程直接返回json数据
|
|
|
|
+ List<CourseSchedule> courseSchedules;
|
|
if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
|
|
if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
|
|
- return JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
|
|
|
|
|
|
+ courseSchedules = JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
|
|
} else {
|
|
} else {
|
|
- return courseScheduleDao.findGroupCourseSchedules(vipGroup.getId().toString(), GroupType.LIVE.getCode());
|
|
|
|
|
|
+ courseSchedules = courseScheduleDao.findGroupCourseSchedules(vipGroup.getId().toString(), GroupType.LIVE.getCode());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
+ result.put("list", courseSchedules);
|
|
|
|
+ result.put("singleClassMinutes", vipGroup.getSingleClassMinutes());
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 直播课程提醒
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public void liveCourseRemind() {
|
|
|
|
+ // 查询30分钟内要开始的并且没有直播通知的直播课
|
|
|
|
+ List<CourseSchedule> courseSchedules = courseScheduleDao.liveCourseRemind();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|