| 
					
				 | 
			
			
				@@ -26,6 +26,7 @@ import com.yonge.cooleshow.common.constant.SysConfigConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.cooleshow.common.entity.HttpResponseResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.exception.BizException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.base.page.PageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yonge.toolset.base.string.MessageFormatter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.mybatis.support.PageUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yonge.toolset.utils.date.DateUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -35,7 +36,9 @@ import org.redisson.api.RMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.redisson.api.RedissonClient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.slf4j.LoggerFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.BeanUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.context.annotation.Bean; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -104,6 +107,16 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public LiveCourseInfoVo queryLiveCourseInfo(Long groupId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return queryLiveCourseInfo(groupId,getSysUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 查询课程组详情-直播课详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param groupId 课程组id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private LiveCourseInfoVo queryLiveCourseInfo(Long groupId,SysUser sysUser) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CourseGroup group = Optional.ofNullable(groupId).map(this::getById) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .orElseThrow(() -> new BizException("课程组信息不存在")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -123,12 +136,14 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.setSalesEndDate(group.getSalesEndDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.setMixStudentNum(group.getMixStudentNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.setImGroupId(group.getImGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Optional.ofNullable(group.getTeacherId()).map(this::getSysUser) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                .ifPresent(sysUser -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    result.setTeacherName(sysUser.getRealName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    result.setUserName(sysUser.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    result.setAvatar(sysUser.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser teacher = getSysUser(group.getTeacherId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (teacher == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new BizException("用户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setTeacherName(teacher.getRealName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setUserName(teacher.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setAvatar(teacher.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Optional.ofNullable(group.getSubjectId()).map(subjectService::get) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .ifPresent(subject -> result.setSubjectName(subject.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //课程组计划 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -139,7 +154,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         param.put("orderState", OrderStatusEnum.PAID.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         result.setStudentList(courseScheduleStudentPaymentService.queryStudentInfoByGroupId(param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //查询是否购买过该课程组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Long id = getSysUser().getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long id = sysUser.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //这里修改为,订单完成后才算购买过,待支付和支付中订单不算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //因为页面再点击购买按钮时,会请求/userOrder/getPendingOrder接口,如果有支付中的订单,用户选择继续支付或取消订单 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1197,5 +1212,27 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return detailPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ShareProfitVo shareLiveCourseProfit(SysUser sysUser, Long liveGroupId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LiveCourseInfoVo liveCourseInfoVo = queryLiveCourseInfo(liveGroupId, sysUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SysUser teacher = this.getSysUser(liveCourseInfoVo.getTeacherId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LiveCourseGroupShareVo liveCourseGroupShareVo = new LiveCourseGroupShareVo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BeanUtils.copyProperties(liveCourseInfoVo,liveCourseGroupShareVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liveCourseGroupShareVo.setShareTeacherAvatar(teacher.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        liveCourseGroupShareVo.setShareTeacherName(teacher.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String teacherLiveGroupShareProfitUrl= sysConfigService.findConfigValue(SysConfigConstant.TEACHER_LIVE_GROUP_SHARE_PROFIT_URL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ShareProfitVo result = new ShareProfitVo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setTeacherId(sysUser.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setType("LIVE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setLiveCourseGroup(liveCourseGroupShareVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setUrl(MessageFormatter.arrayFormat(teacherLiveGroupShareProfitUrl,liveGroupId, sysUser.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setName(sysUser.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        result.setAvatar(sysUser.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |