|  | @@ -22,6 +22,7 @@ import java.util.function.Function;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @@ -149,31 +150,6 @@ import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.VipGroupTeachingRecordQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.event.source.SendSeoMessageSource;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ActivityUserMapperService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ClassGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ContractService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.GroupClassService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImGroupMemberService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.ImUserFriendService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.PayService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.PracticeGroupService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentPaymentOrderService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysConfigService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysCouponCodeService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysTenantConfigService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysUserCashAccountDetailService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysUserCashAccountLogService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.SysUserCashAccountService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.TeacherCourseRewardService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.TeacherService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.VipGroupCategoryService;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.service.VipGroupService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.constant.CommonConstants;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.dal.BaseDAO;
 | 
	
	
		
			
				|  | @@ -210,7 +186,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private VipGroupCategoryService vipGroupCategoryService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  | -    private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  | +    private SysUserService sysUserService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private TeacherDefaultVipGroupSalaryDao teacherDefaultVipGroupSalaryDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
	
		
			
				|  | @@ -1044,7 +1020,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
 | 
	
		
			
				|  |  |          if (repeatVipGroups > 0) {
 | 
	
		
			
				|  |  | -            SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
 | 
	
		
			
				|  |  | +            SysUser sysUser = sysUserService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
 | 
	
		
			
				|  |  |              throw new BizException("{}课程时间冲突({}-{})", sysUser.getRealName(), DateUtil.dateToString(firstCourseSchedule.getStartClassTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.dateToString(latestCourseSchedule.getEndClassTime(), "HH:mm:ss"));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1233,8 +1209,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                      classGroupTeacherSalary.getSalary());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Map<Integer, String> userRoleMap = new HashMap<>();
 | 
	
	
		
			
				|  | @@ -1286,6 +1260,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |              imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
 | 
	
		
			
				|  |  |              //发送推送
 | 
	
		
			
				|  |  |              Map<Integer, String> map = new HashMap<>(1);
 | 
	
		
			
				|  |  | +            SysUser sysUser = sysUserService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
 | 
	
		
			
				|  |  |              map.put(vipGroupApplyBaseInfoDto.getUserId(), sysUser.getPhone());
 | 
	
		
			
				|  |  |              sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.CHILDREN_DAY_VIP_COURSE_TEACHER_PUSH,
 | 
	
		
			
				|  |  |                      map, null, 0, "", "TEACHER", StringUtils.join(studentNames, ","), vipGroupApplyBaseInfoDto.getName());
 | 
	
	
		
			
				|  | @@ -1885,7 +1860,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          VipGroupManageDetailDto vipGroupBaseInfo = vipGroupDao.getVipGroupBaseInfo(vipGroupId);
 | 
	
		
			
				|  |  |          if (Objects.nonNull(vipGroupBaseInfo.getEducationalTeacherId())) {
 | 
	
		
			
				|  |  | -            SysUser eduUser = sysUserFeignService.queryUserById(vipGroupBaseInfo.getEducationalTeacherId());
 | 
	
		
			
				|  |  | +            SysUser eduUser = sysUserService.queryUserById(vipGroupBaseInfo.getEducationalTeacherId());
 | 
	
		
			
				|  |  |              if (Objects.nonNull(eduUser)) {
 | 
	
		
			
				|  |  |                  vipGroupBaseInfo.setEducationalTeacherName(eduUser.getRealName());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -2296,8 +2271,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                      classGroupTeacherSalary.getSalary());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        SysUser sysUser = sysUserFeignService.queryUserById(vipGroup.getUserId());
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          Map<Integer, String> userRoleMap = new HashMap<Integer, String>();
 | 
	
	
		
			
				|  | @@ -2328,6 +2301,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |              imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
 | 
	
		
			
				|  |  |              //发送推送短信
 | 
	
		
			
				|  |  |              Map<Integer, String> map = new HashMap<>(1);
 | 
	
		
			
				|  |  | +            SysUser sysUser = sysUserService.queryUserById(vipGroup.getUserId());
 | 
	
		
			
				|  |  |              map.put(vipGroup.getUserId(), sysUser.getPhone());
 | 
	
		
			
				|  |  |              sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.TEACHER_SMS_VIP_COURSE_ADD,
 | 
	
		
			
				|  |  |                      map, null, 0, "", "", vipGroup.getName());
 | 
	
	
		
			
				|  | @@ -2337,34 +2311,44 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  |      public HttpResponseResult buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
 | 
	
		
			
				|  |  | -        SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | -        if (user == null) {
 | 
	
		
			
				|  |  | -            throw new BizException("用户信息获取失败");
 | 
	
		
			
				|  |  | +        SysUser user = sysUserService.getUser();
 | 
	
		
			
				|  |  | +        vipGroupBuyParams.setUserId(user.getId());
 | 
	
		
			
				|  |  | +        Integer userId = vipGroupBuyParams.getUserId();
 | 
	
		
			
				|  |  | +        VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
 | 
	
		
			
				|  |  | +        if(Objects.isNull(vipGroup)){
 | 
	
		
			
				|  |  | +            throw new BizException("课程信息不存在");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        // 判断是否存在支付中的记录
 | 
	
		
			
				|  |  | -        List<StudentPaymentOrder> list = studentPaymentOrderService
 | 
	
		
			
				|  |  | -                .queryByCondition(GroupType.VIP,
 | 
	
		
			
				|  |  | -                        vipGroupBuyParams.getVipGroupId().toString(),
 | 
	
		
			
				|  |  | -                        vipGroupBuyParams.getUserId(),
 | 
	
		
			
				|  |  | -                        DealStatusEnum.ING,
 | 
	
		
			
				|  |  | -                        OrderTypeEnum.SMALL_CLASS_TO_BUY);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(), ClassGroupTypeEnum.VIP.getCode());
 | 
	
		
			
				|  |  | +        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(),vipGroup.getGroupType());
 | 
	
		
			
				|  |  |          if (Objects.isNull(classGroup)) {
 | 
	
		
			
				|  |  |              throw new BizException("班级信息错误");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          classGroup = classGroupDao.lockClassGroup(classGroup.getId());
 | 
	
		
			
				|  |  | -        Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), vipGroupBuyParams.getUserId());
 | 
	
		
			
				|  |  | +        Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
 | 
	
		
			
				|  |  |          if (exist) {
 | 
	
		
			
				|  |  |              throw new BizException("您已加入此课程");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
 | 
	
		
			
				|  |  | -        int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(), "VIP");
 | 
	
		
			
				|  |  | +        int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(), vipGroup.getGroupType());
 | 
	
		
			
				|  |  |          if (vipGroup.getStatus() != VipGroupStatusEnum.APPLYING || classGroup.getDelFlag() != 1 || courseNum > 0) {
 | 
	
		
			
				|  |  | -            throw new BizException("当前VIP课已无法通过购买加入,请联系教务老师");
 | 
	
		
			
				|  |  | +            throw new BizException("当前课程已无法通过购买加入,请联系教务老师");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        GroupType groupType = GroupType.VIP;
 | 
	
		
			
				|  |  | +        OrderTypeEnum orderTypeEnum = OrderTypeEnum.SMALL_CLASS_TO_BUY;
 | 
	
		
			
				|  |  | +        CouponDetailTypeEnum couponDetailTypeEnum = CouponDetailTypeEnum.VIP;
 | 
	
		
			
				|  |  | +        if("LIVE".equals(vipGroup.getGroupType())){
 | 
	
		
			
				|  |  | +            groupType = GroupType.LIVE;
 | 
	
		
			
				|  |  | +            orderTypeEnum = OrderTypeEnum.LIVE_GROUP_BUY;
 | 
	
		
			
				|  |  | +            couponDetailTypeEnum = CouponDetailTypeEnum.LIVE;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        // 判断是否存在支付中的记录
 | 
	
		
			
				|  |  | +        List<StudentPaymentOrder> list = studentPaymentOrderService
 | 
	
		
			
				|  |  | +                .queryByCondition(groupType,
 | 
	
		
			
				|  |  | +                        vipGroupBuyParams.getVipGroupId().toString(),
 | 
	
		
			
				|  |  | +                        userId,
 | 
	
		
			
				|  |  | +                        DealStatusEnum.ING,
 | 
	
		
			
				|  |  | +                        orderTypeEnum);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (list.size() > 0) {
 | 
	
		
			
				|  |  |              StudentPaymentOrder applyOrder = list.get(list.size() - 1);
 | 
	
	
		
			
				|  | @@ -2379,7 +2363,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (classGroup.getStudentNum() >= classGroup.getExpectStudentNum()) {
 | 
	
		
			
				|  |  | -            throw new BizException("该VIP课人数已满,请联系教务老师!");
 | 
	
		
			
				|  |  | +            throw new BizException("该课程组人数已满,请联系教务老师!");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          VipGroupActivity vipGroupActivity = null;
 | 
	
	
		
			
				|  | @@ -2388,7 +2372,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
 | 
	
		
			
				|  |  | -            int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), user.getId());
 | 
	
		
			
				|  |  | +            int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), userId);
 | 
	
		
			
				|  |  |              if (useNum >= vipGroupActivity.getStudentMaxUsedTimes()) {
 | 
	
		
			
				|  |  |                  throw new BizException("您已超过该活动购买限制{}次", vipGroupActivity.getStudentMaxUsedTimes());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -2400,7 +2384,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (Objects.nonNull(vipGroup.getStudentIdList())) {
 | 
	
		
			
				|  |  |              Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
 | 
	
		
			
				|  |  | -            if (!userIds.contains(user.getId())) {
 | 
	
		
			
				|  |  | +            if (!userIds.contains(userId)) {
 | 
	
		
			
				|  |  |                  throw new BizException("您无法购买此课程");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -2412,14 +2396,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          //校验优惠券
 | 
	
		
			
				|  |  | -        String[] checkCoupon = CouponDetailTypeEnum.getAllowType(CouponDetailTypeEnum.VIP);
 | 
	
		
			
				|  |  | +        String[] checkCoupon = CouponDetailTypeEnum.getAllowType(couponDetailTypeEnum);
 | 
	
		
			
				|  |  |          StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(vipGroupBuyParams.getCouponIdList(), vipGroup.getTotalPrice(), true, checkCoupon);
 | 
	
		
			
				|  |  | -        studentPaymentOrder.setUserId(user.getId());
 | 
	
		
			
				|  |  | -        studentPaymentOrder.setGroupType(GroupType.VIP);
 | 
	
		
			
				|  |  | +        studentPaymentOrder.setUserId(userId);
 | 
	
		
			
				|  |  | +        studentPaymentOrder.setGroupType(groupType);
 | 
	
		
			
				|  |  |          String orderNo = idGeneratorService.generatorId("payment") + "";
 | 
	
		
			
				|  |  |          studentPaymentOrder.setOrderNo(orderNo);
 | 
	
		
			
				|  |  |          studentPaymentOrder.setStatus(DealStatusEnum.ING);
 | 
	
		
			
				|  |  | -        studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
 | 
	
		
			
				|  |  | +        studentPaymentOrder.setType(orderTypeEnum);
 | 
	
		
			
				|  |  |          studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
 | 
	
		
			
				|  |  |          studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
 | 
	
		
			
				|  |  |          studentPaymentOrder.setClassGroupId(classGroup.getId());
 | 
	
	
		
			
				|  | @@ -2433,7 +2417,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          BigDecimal amount = studentPaymentOrder.getActualAmount();
 | 
	
		
			
				|  |  |          BigDecimal balance = BigDecimal.ZERO;
 | 
	
		
			
				|  |  |          if (vipGroupBuyParams.isUseBalancePayment() || amount.doubleValue() == 0) {
 | 
	
		
			
				|  |  | -            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(user.getId());
 | 
	
		
			
				|  |  | +            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
 | 
	
		
			
				|  |  |              if (userCashAccount == null) {
 | 
	
		
			
				|  |  |                  throw new BizException("用户账户找不到");
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -2450,7 +2434,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  this.orderCallback(studentPaymentOrder);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                sysUserCashAccountService.updateBalance(user.getId(), amount.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
 | 
	
		
			
				|  |  | +                sysUserCashAccountService.updateBalance(userId, amount.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, groupType.getDesc() + "购买");
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  Map<String, Object> result = new HashMap<>();
 | 
	
		
			
				|  |  |                  result.put("orderNo", studentPaymentOrder.getOrderNo());
 | 
	
	
		
			
				|  | @@ -2459,7 +2443,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  |                  if (userCashAccount.getBalance().doubleValue() > 0) {
 | 
	
		
			
				|  |  |                      balance = userCashAccount.getBalance();
 | 
	
		
			
				|  |  | -                    sysUserCashAccountService.updateBalance(user.getId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
 | 
	
		
			
				|  |  | +                    sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, groupType.getDesc() + "购买");
 | 
	
		
			
				|  |  |                      amount = amount.subtract(userCashAccount.getBalance());
 | 
	
		
			
				|  |  |                      studentPaymentOrder.setActualAmount(amount);
 | 
	
		
			
				|  |  |                      studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
 | 
	
	
		
			
				|  | @@ -2469,9 +2453,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            contractService.register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
 | 
	
		
			
				|  |  | +            contractService.register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
 | 
	
		
			
				|  |  |          } catch (Exception e) {
 | 
	
		
			
				|  |  | -            LOGGER.error("[{}]小课购买协议生成错误:{}", vipGroup.getId(), e.getCause());
 | 
	
		
			
				|  |  | +            LOGGER.error("[{}]课程购买协议生成错误:{}", vipGroup.getId(), e.getCause());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
 | 
	
	
		
			
				|  | @@ -2487,10 +2471,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                  orderNo,
 | 
	
		
			
				|  |  |                  baseApiUrl + "/api-student/studentOrder/callback",
 | 
	
		
			
				|  |  |                  baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
 | 
	
		
			
				|  |  | -                "vip课购买",
 | 
	
		
			
				|  |  | +                groupType.getDesc() + "购买",
 | 
	
		
			
				|  |  |                  vipGroup.getName(),
 | 
	
		
			
				|  |  |                  vipGroup.getOrganId(),
 | 
	
		
			
				|  |  | -                "vipBuy"
 | 
	
		
			
				|  |  | +                orderTypeEnum.getCode()
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          studentPaymentOrder.setOrganId(vipGroup.getOrganId());
 | 
	
	
		
			
				|  | @@ -2503,14 +2487,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 | 
	
		
			
				|  |  |      public void orderCallback(StudentPaymentOrder order) {
 | 
	
		
			
				|  |  |          Integer userId = order.getUserId();
 | 
	
		
			
				|  |  |          Integer tenantId = order.getTenantId();
 | 
	
		
			
				|  |  | -        /*StudentPaymentOrder order = studentPaymentOrderDao.lockOrder(studentPaymentOrder.getId());
 | 
	
		
			
				|  |  | -        if (!order.getStatus().equals(DealStatusEnum.ING)) {
 | 
	
		
			
				|  |  | -            return;
 | 
	
		
			
				|  |  | -        }*/
 | 
	
		
			
				|  |  |          //更新订单状态
 | 
	
		
			
				|  |  |          int updateCount = studentPaymentOrderService.update(order);
 | 
	
		
			
				|  |  |          if (updateCount <= 0) {
 | 
	
	
		
			
				|  | @@ -2520,6 +2500,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          ClassGroup classGroup = classGroupDao.get(order.getClassGroupId());
 | 
	
		
			
				|  |  |          if (order.getStatus() == DealStatusEnum.SUCCESS) {
 | 
	
		
			
				|  |  |              VipGroup vipGroup = vipGroupDao.get(Long.parseLong(classGroup.getMusicGroupId()));
 | 
	
		
			
				|  |  | +            GroupType groupType = GroupType.VIP;
 | 
	
		
			
				|  |  | +            MessageTypeEnum messageTypeEnum = MessageTypeEnum.STUDENT_PUSH_VIP_BUY;
 | 
	
		
			
				|  |  | +            if("LIVE".equals(vipGroup.getGroupType())){
 | 
	
		
			
				|  |  | +                groupType = GroupType.LIVE;
 | 
	
		
			
				|  |  | +                messageTypeEnum = MessageTypeEnum.STUDENT_PUSH_LIVE_BUY;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              if (vipGroup.getStatus() == VipGroupStatusEnum.DELETE ||
 | 
	
		
			
				|  |  |                      vipGroup.getStatus() == VipGroupStatusEnum.CANCEL ||
 | 
	
		
			
				|  |  |                      vipGroup.getStatus() == VipGroupStatusEnum.PAUSE) {
 | 
	
	
		
			
				|  | @@ -2541,11 +2527,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                  classGroupStudentMapper.setUserId(userId);
 | 
	
		
			
				|  |  |                  classGroupStudentMapper.setCreateTime(date);
 | 
	
		
			
				|  |  |                  classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
 | 
	
		
			
				|  |  | -                classGroupStudentMapper.setGroupType(GroupType.VIP);
 | 
	
		
			
				|  |  | +                classGroupStudentMapper.setGroupType(groupType);
 | 
	
		
			
				|  |  |                  classGroupStudentMapperDao.insert(classGroupStudentMapper);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  //获取班级实际人数
 | 
	
		
			
				|  |  | -                Integer studentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  | +                Integer studentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(groupType, classGroup.getMusicGroupId());
 | 
	
		
			
				|  |  |                  //课程组人数已满,变更状态
 | 
	
		
			
				|  |  |                  if (studentNum.equals(classGroup.getExpectStudentNum())) {
 | 
	
		
			
				|  |  |                      vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
 | 
	
	
		
			
				|  | @@ -2631,7 +2617,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                      courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      imGroupService.create(classGroup.getId().toString(), null, classGroup.getName(), classGroup.getName(),
 | 
	
		
			
				|  |  | -                            vipGroup.getName(), null, null, GroupType.VIP.getCode(), ImGroup.GroupTypeEnum.VIP);
 | 
	
		
			
				|  |  | +                            vipGroup.getName(), null, null, groupType.getCode(), ImGroup.GroupTypeEnum.valueOf(groupType.name()));
 | 
	
		
			
				|  |  |                      imGroupMemberService.join(classGroup.getId().toString(), userRoleMap);
 | 
	
		
			
				|  |  |                      imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -2670,7 +2656,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  Map<Integer, String> map = new HashMap<>(1);
 | 
	
		
			
				|  |  |                  map.put(userId, userId.toString());
 | 
	
		
			
				|  |  | -                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_VIP_BUY, map, null, 0, "2", "STUDENT",
 | 
	
		
			
				|  |  | +                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, messageTypeEnum, map, null, 0, "2", "STUDENT",
 | 
	
		
			
				|  |  |                          vipGroup.getName());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  //更新所属分部列表
 | 
	
	
		
			
				|  | @@ -2683,14 +2669,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |                  try {
 | 
	
		
			
				|  |  |                      contractService.transferVipGroupCoursesContract(userId, vipGroup.getId(), order.getType());
 | 
	
		
			
				|  |  |                  } catch (Exception e) {
 | 
	
		
			
				|  |  | -                    LOGGER.error(MessageFormatter.arrayFormat("小课[{}]购买协议错误:{}", vipGroup.getId(), e.getMessage()), e);
 | 
	
		
			
				|  |  | +                    LOGGER.error(MessageFormatter.arrayFormat("课程[{}]购买协议错误:{}", vipGroup.getId(), e.getMessage()), e);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              classGroup.setStudentNum(classGroup.getStudentNum() - 1);
 | 
	
		
			
				|  |  |              if (order.getBalancePaymentAmount() != null && order.getBalancePaymentAmount().doubleValue() > 0) {
 | 
	
		
			
				|  |  |                  sysUserCashAccountService.updateBalance(userId, order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS,
 | 
	
		
			
				|  |  | -                        "VIP课购买失败");
 | 
	
		
			
				|  |  | +                        "小课购买失败");
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              sysCouponCodeService.quit(order.getCouponCodeId());
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -2703,10 +2689,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |          if (true) {
 | 
	
		
			
				|  |  |              throw new BizException("暂不支持退课");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | -        if (null == sysUser) {
 | 
	
		
			
				|  |  | -            throw new BizException("获取用户信息失败");
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserService.getUser();
 | 
	
		
			
				|  |  |          Integer userId = sysUser.getId();
 | 
	
		
			
				|  |  |          StudentApplyRefunds studentApplyRefunds = new StudentApplyRefunds();
 | 
	
		
			
				|  |  |          StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode());
 | 
	
	
		
			
				|  | @@ -4373,7 +4356,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public VipGroupPayInfoDto getVipGroupPayInfo(Integer vipGroupId, Integer userId) {
 | 
	
		
			
				|  |  |          if (Objects.isNull(vipGroupId)) {
 | 
	
		
			
				|  |  | -            throw new BizException("请指定需要购买的小课");
 | 
	
		
			
				|  |  | +            throw new BizException("请指定需要购买的课程");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          VipGroup vipGroup = vipGroupDao.get(vipGroupId.longValue());
 | 
	
		
			
				|  |  |          if (Objects.isNull(vipGroup)) {
 |