|
@@ -2647,6 +2647,15 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
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);
|
|
|
+ }else {
|
|
|
+ vipGroupDao.updateStudentIdList(vipGroup.getId(),userId);
|
|
|
}
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(userId);
|
|
|
//插入缴费明细
|
|
@@ -2685,14 +2694,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
map.put(userId, userId.toString());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, messageTypeEnum, map, null, 0, "2", "STUDENT",
|
|
|
vipGroup.getName());
|
|
|
-
|
|
|
- //更新所属分部列表
|
|
|
- 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);
|
|
|
try {
|
|
|
contractService.transferVipGroupCoursesContract(userId, vipGroup.getId(), order.getType());
|
|
|
} catch (Exception e) {
|
|
@@ -4227,27 +4228,53 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void stopVipGroupWithNoCreate(Integer tenantId) {
|
|
|
- List<VipGroup> noCreateSuccessVipGroups = vipGroupDao.findNoCreateSuccessVipGroup(tenantId);
|
|
|
+ List<VipGroup> noCreateSuccessVipGroups = vipGroupDao.findNoCreateSuccessVipGroup(tenantId,null);
|
|
|
if (CollectionUtils.isEmpty(noCreateSuccessVipGroups)) {
|
|
|
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<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) {
|
|
|
- int i = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(GroupType.VIP, noCreateSuccessVipGroup.getId().toString());
|
|
|
+ GroupType groupType = GroupType.VIP;
|
|
|
+ OrderTypeEnum orderTypeEnum = OrderTypeEnum.SMALL_CLASS_TO_BUY;
|
|
|
+ if("LIVE".equals(noCreateSuccessVipGroup.getGroupType())){
|
|
|
+ groupType = GroupType.LIVE;
|
|
|
+ orderTypeEnum = OrderTypeEnum.LIVE_GROUP_BUY;
|
|
|
+ }
|
|
|
+ int i = courseScheduleStudentPaymentDao.countStudentCourseNumWithGroup(groupType, noCreateSuccessVipGroup.getId().toString());
|
|
|
if (i > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
noCreateSuccessVipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
|
List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryByDealStatus(noCreateSuccessVipGroup.getId().toString(),
|
|
|
- OrderTypeEnum.SMALL_CLASS_TO_BUY, DealStatusEnum.SUCCESS);
|
|
|
+ orderTypeEnum, DealStatusEnum.SUCCESS);
|
|
|
|
|
|
for (StudentPaymentOrder studentPaymentOrder : studentPaymentOrders) {
|
|
|
+ if(studentPaymentOrder.getUserId().equals(quitUserMap.get(noCreateSuccessVipGroup.getId()))){
|
|
|
+
|
|
|
+ }
|
|
|
//生成账户资金明细
|
|
|
if (studentPaymentOrder.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
if(Objects.equals("关闭订单,实际支付成功,退到用户余额",studentPaymentOrder.getMemo())){
|
|
|
continue;
|
|
|
}
|
|
|
+ //是否退课
|
|
|
sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getExpectAmount());
|
|
|
SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentPaymentOrder.getUserId());
|
|
|
SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail();
|
|
@@ -4485,4 +4512,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return vipGroupApplyDto;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @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)){
|
|
|
+ //排课
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|