liujc 1 year ago
parent
commit
4fbc53a0af
24 changed files with 613 additions and 128 deletions
  1. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  2. 18 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseShareDao.java
  3. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java
  4. 31 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseShareDto.java
  5. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java
  6. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java
  7. 49 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseShare.java
  8. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java
  9. 23 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ShareModeEnum.java
  10. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseShareService.java
  11. 0 9
      mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java
  12. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  13. 184 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseShareServiceImpl.java
  14. 31 96
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  15. 2 2
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  16. 11 1
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  17. 109 0
      mec-biz/src/main/resources/config/mybatis/CourseShareMapper.xml
  18. 6 0
      mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml
  19. 2 3
      mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml
  20. 1 1
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  21. 18 0
      mec-im/src/main/java/com/ym/controller/UserController.java
  22. 11 6
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
  23. 0 8
      mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java
  24. 63 0
      mec-web/src/main/java/com/ym/mec/web/controller/CourseShareController.java

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -2054,4 +2054,16 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @param liveRemind 通知状态
      */
     void updateLiveRemind(@Param("courseScheduleId") Long courseScheduleId, @Param("liveRemind") int liveRemind);
+
+    /**
+     * 获取下一次连堂课
+     *
+     * @param classGroupId 班级编号
+     * @param classDate 上课时间
+     * @param teacherId 老师编号
+     * @return List<CourseSchedule>
+     */
+    List<CourseSchedule> getTeacherContinuousCourse(@Param("classGroupId") Integer classGroupId,
+                                                    @Param("classDate") Date classDate,
+                                                    @Param("teacherId") Integer teacherId);
 }

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseShareDao.java

@@ -0,0 +1,18 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.CourseShare;
+import com.ym.mec.common.dal.BaseDAO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CourseShareDao extends BaseDAO<Integer, CourseShare> {
+
+    int batchInsert(@Param("courseShares") List<CourseShare> courseShares);
+
+    List<CourseShare> selectByCourseId(@Param("courseId") Integer courseId);
+
+    void deleteByCourseId(@Param("courseId") Integer courseId);
+
+    void deleteByIds(@Param("ids") List<Integer> ids);
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -325,7 +325,7 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      * @author Joburgess
      * @date 2019/12/3
      */
-    List<VipGroup> queryNormalStatusList(@Param("groupType") String groupType);
+    List<VipGroup> queryNormalStatusList();
 
     int countUserRepeatVipGroupInCourseStartEndTime(@Param("userId") Integer userId,
                                                     @Param("courseStartDate") Date courseStartDate,

+ 31 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseShareDto.java

@@ -0,0 +1,31 @@
+package com.ym.mec.biz.dal.dto;
+
+
+import com.ym.mec.biz.dal.enums.ShareModeEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @author 袁亮
+ * @apiNote 课程分享模型
+ */
+@ApiModel(value = "课程分享模型")
+@Data
+@NoArgsConstructor
+public class CourseShareDto {
+
+    @NotNull(message = "课程不能为空")
+    @ApiModelProperty(value = "课程ID")
+    private Integer courseId;
+
+    @ApiModelProperty(value = "课程ID,OPEN:公开,PRIVATE:私有")
+    private ShareModeEnum shareMode;
+
+    @ApiModelProperty(value = "学生列表")
+    private List<Integer> userIds;
+}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java

@@ -229,7 +229,7 @@ public class CourseSchedule  extends BaseEntity{
 	private Integer liveRemind;
 
 
-    @ApiModelProperty(value = "是否连堂课 continuous_coourse_")
+    @ApiModelProperty(value = "是否连堂课 continuous_course_")
     private Boolean continuousCourse;
 
     public Boolean getContinuousCourse() {

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseScheduleStudentPayment.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.dal.entity;
 
 import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.JoinCourseType;
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -68,6 +69,9 @@ public class CourseScheduleStudentPayment extends BaseEntity implements Comparab
 	@ApiModelProperty(value = "关联的云教练缴费项目编号",required = false)
 	private Long calenderId;
 
+	@ApiModelProperty(value = "加入课程类型")
+	private JoinCourseType joinCourseType;
+
 	public BigDecimal getExpectPriceBak() {
 		return expectPriceBak;
 	}
@@ -251,6 +255,14 @@ public class CourseScheduleStudentPayment extends BaseEntity implements Comparab
 		this.courseSchedule = courseSchedule;
 	}
 
+	public JoinCourseType getJoinCourseType() {
+		return joinCourseType;
+	}
+
+	public void setJoinCourseType(JoinCourseType joinCourseType) {
+		this.joinCourseType = joinCourseType;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 49 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseShare.java

@@ -0,0 +1,49 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ym.mec.biz.dal.enums.ShareModeEnum;
+import com.ym.mec.common.entity.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @author 袁亮
+ * @apiNote 课程分享实体模型
+ */
+@ApiModel(value = "课程分享DB模型")
+@TableName("course_share")
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class CourseShare extends BaseEntity {
+
+    @ApiModelProperty(value = "主键id")
+    @TableId(value = "id_", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "课程ID")
+    @TableField(value = "course_id_")
+    private Integer courseId;
+
+    @ApiModelProperty(value = "分享模式")
+    @TableField(value = "share_mode_")
+    private ShareModeEnum shareMode;
+
+    @ApiModelProperty(value = "学生用户ID")
+    @TableField(value = "user_id_")
+    private Integer userId;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "create_time_")
+    private Date createTime;
+
+    @ApiModelProperty(value = "创建人")
+    @TableField(value = "create_by_")
+    private Integer createBy;
+}

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -51,6 +51,11 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_SMS_VIP_COURSE_ADD("TEACHER_SMS_VIP_COURSE_ADD", "VIP课新增"),
     TEACHER_PUSH_VIP_COURSE_STOP("TEACHER_PUSH_VIP_COURSE_STOP", "VIP课停止"),
     TEACHER_PUSH_LIVE_COURSE_STOP("TEACHER_PUSH_LIVE_COURSE_STOP", "直播课停止"),
+    JIGUANG_TEACHER_LIVE_PROGRESS("JIGUANG_TEACHER_LIVE_PROGRESS", "直播课成课"),
+    JIGUANG_EDUCATION_LIVE_PROGRESS("JIGUANG_EDUCATION_LIVE_PROGRESS", "直播课成课"),
+    JIGUANG_TEACHER_LIVE_CANCEL("JIGUANG_TEACHER_LIVE_CANCEL", "直播课取消"),
+    JIGUANG_EDUCATION_LIVE_CANCEL("JIGUANG_EDUCATION_LIVE_CANCEL", "直播课取消"),
+    JIGUANG_STUDENT_QUIT_VIP("JIGUANG_STUDENT_QUIT_VIP", "退学成功"),
     //    TEACHER_PUSH_ACTION_COURSE_MESSAGE("TEACHER_PUSH_ACTION_COURSE_MESSAGE", "开课提醒"),
     TEACHER_PUSH_HAVE_COURSE_MESSAGE("TEACHER_PUSH_HAVE_COURSE_MESSAGE", "有课提醒"),
     TEACHER_PUSH_ATTEND_CLASS_MESSAGE("TEACHER_PUSH_ATTEND_CLASS_MESSAGE", "上课提醒"),

+ 23 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ShareModeEnum.java

@@ -0,0 +1,23 @@
+package com.ym.mec.biz.dal.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.ym.mec.common.enums.BaseEnum;
+import lombok.Getter;
+
+
+/**
+ * @author 袁亮
+ * @apiNote 课程共享方式:开放/私有
+ */
+@Getter
+public enum ShareModeEnum implements BaseEnum<String, ShareModeEnum> {
+    OPEN("OPEN"),
+    PRIVATE("PRIVATE");
+
+    @EnumValue
+    private final String code;
+
+    ShareModeEnum(String code) {
+        this.code = code;
+    }
+}

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseShareService.java

@@ -0,0 +1,19 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.dto.CourseShareDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.entity.CourseShare;
+import com.ym.mec.common.service.BaseService;
+
+import java.util.List;
+
+public interface CourseShareService extends BaseService<Integer, CourseShare> {
+
+    List<CourseShare> create(Integer tenantId, CourseShareDto courseShareDto);
+
+    List<StudentManageListDto> queryCourseSharedStudent(Integer tenantId, Integer courseId);
+
+    List<StudentManageListDto> queryStudentList(Integer tenantId, Integer organId, Integer subjectId);
+
+    boolean createPaymentRecord(Integer tenantId, Long courseId, Integer userId);
+}

+ 0 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -249,15 +249,6 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
     void orderCallback(StudentPaymentOrder order);
 
     /**
-     * @Author: Joburgess
-     * @Date: 2019/10/3
-     * @params [vipGroupId, studentId]
-     * @return void
-     * @describe 申请退课
-     */
-    void applyRefund(Long vipGroupId);
-
-    /**
      * @describe 给指定学生退课
      * @author Joburgess
      * @date 2019/11/15

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -5987,6 +5987,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			continueCourseTime = "5";
 		}
 
+		// 连堂课标准:同一个老师,同一天,同一课程组,连续上课
+
+
+
 		CourseSchedule schedule = courseSchedule;
 		// 如果当前课程是连堂课,那么获取第一节课的课程编号
 		while (true) {

+ 184 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseShareServiceImpl.java

@@ -0,0 +1,184 @@
+package com.ym.mec.biz.service.impl;
+
+import com.google.common.collect.Lists;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
+import com.ym.mec.biz.dal.dao.CourseShareDao;
+import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.biz.dal.dao.StudentManageDao;
+import com.ym.mec.biz.dal.dto.CourseShareDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.entity.CourseShare;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.enums.JoinCourseType;
+import com.ym.mec.biz.dal.enums.ShareModeEnum;
+import com.ym.mec.biz.service.CourseShareService;
+import com.ym.mec.biz.service.SysUserService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * @author 袁亮
+ * @apiNote 课程分享业务实现类
+ */
+@Service
+public class CourseShareServiceImpl extends BaseServiceImpl<Integer, CourseShare> implements CourseShareService {
+
+    /**
+     * 批量操作,分批数据最大限制
+     */
+    private static final int BATCH_OPE_MAX_SIZE = 500;
+
+    private static final String TENANT_ID = "tenantId";
+
+    @Autowired
+    private CourseShareDao courseShareDao;
+
+    @Autowired
+    private StudentManageDao studentManageDao;
+
+    @Autowired
+    private StudentDao studentDao;
+
+    @Autowired
+    private SysUserService userService;
+
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+
+    @Override
+    public BaseDAO<Integer, CourseShare> getDAO() {
+        return courseShareDao;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public List<CourseShare> create(Integer tenantId, CourseShareDto courseShareDto) {
+        List<CourseShare> courseShares = new ArrayList<>();
+        Integer userId = userService.getUserId();
+        if (ShareModeEnum.PRIVATE.equals(courseShareDto.getShareMode())) {
+            if (CollectionUtils.isEmpty(courseShareDto.getUserIds())) {
+                // 不分享,清理数据并返回
+                courseShareDao.deleteByCourseId(courseShareDto.getCourseId());
+                return new ArrayList<>();
+            }
+            List<Student> students = studentDao.findByStudentIds(courseShareDto.getUserIds());
+            courseShares = students.stream().map(next -> {
+                CourseShare courseShare = new CourseShare();
+                BeanUtils.copyProperties(courseShareDto, courseShare);
+                courseShare.setUserId(next.getUserId());
+                courseShare.setTenantId(tenantId);
+                courseShare.setCreateTime(new Date());
+                courseShare.setCreateBy(userId);
+                return courseShare;
+            }).collect(Collectors.toList());
+        } else {
+            CourseShare courseShare = new CourseShare();
+            BeanUtils.copyProperties(courseShareDto, courseShare);
+            courseShare.setTenantId(tenantId);
+            courseShare.setCreateTime(new Date());
+            courseShare.setCreateBy(userId);
+            courseShares.add(courseShare);
+        }
+
+        // 处理已经分享过的数据
+        List<CourseShare> existShares = courseShareDao.selectByCourseId(courseShareDto.getCourseId());
+        if (CollectionUtils.isNotEmpty(existShares) && (courseShareDto.getShareMode().equals(ShareModeEnum.PRIVATE))) {
+            // 私有分享,删除历史数据
+            List<Integer> sharedHistoryRecords = existShares.stream()
+                    .map(CourseShare::getId)
+                    .collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(sharedHistoryRecords)) {
+                courseShareDao.deleteByIds(sharedHistoryRecords);
+            }
+        }
+        // 数据入库
+        List<List<CourseShare>> groupList = Lists.partition(courseShares, BATCH_OPE_MAX_SIZE);
+        for (List<CourseShare> shares : groupList) {
+            courseShareDao.batchInsert(shares);
+        }
+        return courseShareDao.selectByCourseId(courseShareDto.getCourseId());
+    }
+
+    @Override
+    public List<StudentManageListDto> queryCourseSharedStudent(Integer tenantId, Integer courseId) {
+        // 查询该课程已经分享的学生列表
+        Map<String, Object> courseParam = new HashMap<>(2);
+        courseParam.put("courseId", courseId);
+        courseParam.put(TENANT_ID, tenantId);
+        List<CourseShare> courseShareRecords = courseShareDao.findAll(courseParam);
+        if (CollectionUtils.isEmpty(courseShareRecords)) {
+            return new ArrayList<>();
+        }
+
+        // 查询学生列表
+        Map<String, Object> param = new HashMap<>(2);
+        param.put(TENANT_ID, tenantId);
+        param.put("userIds", courseShareRecords.stream().map(CourseShare::getUserId).toArray());
+        return studentManageDao.findStudentsByOrganId(param);
+    }
+
+    @Override
+    public List<StudentManageListDto> queryStudentList(Integer tenantId, Integer organId, Integer subjectId) {
+        Map<String, Object> param = new HashMap<>(2);
+        if (organId != null) {
+            param.put("organIds", new int[]{organId});
+        }
+        if (subjectId != null) {
+            param.put("subjectId", subjectId);
+        }
+        param.put(TENANT_ID, tenantId);
+        // 查询指定分部和声部对应的学生列表
+        return studentManageDao.findStudentsByOrganId(param);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public boolean createPaymentRecord(Integer tenantId, Long courseId, Integer userId) {
+        // 查询是否已经进入直播间,进入即表示存在记录,不需要重复插入数据
+        int haveCourse = courseScheduleStudentPaymentDao.checkStudentHaveCourse(courseId, userId);
+        if (haveCourse == 0) {
+            List<CourseSchedule> schedules =
+                    courseScheduleDao.findByCourseScheduleIds(Collections.singletonList(courseId));
+            CourseSchedule schedule = schedules.get(0);
+            CourseScheduleStudentPayment payment = new CourseScheduleStudentPayment();
+            payment.setGroupType(schedule.getGroupType());
+            payment.setMusicGroupId(schedule.getMusicGroupId());
+            payment.setUserId(userId);
+            // 分享方式下,价格为0
+            BigDecimal sharePrice = new BigDecimal(0);
+            payment.setOriginalPrice(sharePrice);
+            payment.setExpectPrice(sharePrice);
+            payment.setActualPrice(sharePrice);
+            payment.setExpectPriceBak(sharePrice);
+            payment.setActualPriceBak(sharePrice);
+            payment.setCreateTime(new Date());
+            payment.setTenantId(tenantId);
+            payment.setClassGroupId(schedule.getClassGroupId());
+            payment.setJoinCourseType(JoinCourseType.SHARE);
+            courseScheduleStudentPaymentDao.insert(payment);
+        }
+        return true;
+    }
+
+}

+ 31 - 96
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -2046,9 +2046,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = vipGroupDao.findVipGroupStudents(params);
-            List<StudentApplyRefunds> applyRefunds = studentApplyRefundsDao.findByGroupAndType(queryInfo.getVipGroupId().toString(), queryInfo.getGroupType());
-            Map<Integer, List<StudentApplyRefunds>> studentApplyRefundsMap = applyRefunds.stream()
-                    .collect(Collectors.groupingBy(StudentApplyRefunds::getUserId));
             //获取学员基本信息
             List<Integer> userIds = dataList.stream().map(e -> e.getId()).collect(Collectors.toList());
             List<Integer> subjectIds = dataList.stream().map(e -> e.getSubjectId()).collect(Collectors.toList());
@@ -2062,15 +2059,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             Map<Integer, String> organMap = getMap("organization", "id_", "name_", organIds,queryInfo.getTenantId(), Integer.class, String.class);
             Map<Integer, String> subjectMap = getMap("subject", "id_", "name_", subjectIds,queryInfo.getTenantId(), Integer.class, String.class);
             dataList.forEach(data -> {
-                List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsMap.get(data.getId());
-                if (!CollectionUtils.isEmpty(studentApplyRefunds)) {
-                    StudentApplyRefunds studentApplyRefund = studentApplyRefunds.get(0);
-                    if (data.getStudentStatus() == 0 && studentApplyRefund.getStatus().equals(StudentApplyRefundsStatus.ING)) {
-                        data.setStudentStatus(2);
-                    }
-                } else if (data.getStudentStatus() == 0) {
-                    data.setRefundDate(null);
-                }
+                data.setRefundDate(null);
                 SimpleUserDto userDto = studentInfoMap.get(data.getId());
                 if(Objects.nonNull(userDto)){
                     data.setUserName(userDto.getNickName());
@@ -2984,70 +2973,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         classGroupDao.update(classGroup);
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public void applyRefund(Long vipGroupId) {
-        if (true) {
-            throw new BizException("暂不支持退课");
-        }
-        SysUser sysUser = sysUserService.getUser();
-        Integer userId = sysUser.getId();
-        VipGroup vipGroup = vipGroupDao.get(vipGroupId);
-        StudentApplyRefunds studentApplyRefunds = new StudentApplyRefunds();
-        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode(),"VIP".equals(vipGroup.getGroupType())?"SMALL_CLASS_TO_BUY":"LIVE_GROUP_BUY");
-        if (null == studentPaymentOrder) {
-            throw new BizException("未找到相关订单信息!");
-        }
-        //剩余课时数
-        int surplusCourses = studentPaymentOrderDao.countSurplusCourseByMusicGroupAndUser(vipGroup.getId().toString(), userId);
-        if (surplusCourses <= 0) {
-            throw new BizException("此vip课程没有剩余排课");
-        }
-        Date now = new Date();
-        BigDecimal surplusCourseFee;
-        List<StudentCourseInfoDto> userCourseInfos = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), userId, null);
-        if (CollectionUtils.isEmpty(userCourseInfos) && vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
-            if (Objects.isNull(studentPaymentOrder)) {
-                surplusCourseFee = new BigDecimal(0);
-            } else {
-                surplusCourseFee = studentPaymentOrder.getActualAmount();
-            }
-        } else if (!CollectionUtils.isEmpty(userCourseInfos)) {
-            BigDecimal historyPrice = new BigDecimal(0);
-            BigDecimal allPrice = new BigDecimal(0);
-            for (StudentCourseInfoDto userCourseInfo : userCourseInfos) {
-                allPrice = allPrice.add(userCourseInfo.getExpectPrice());
-                if (now.after(userCourseInfo.getStartClassTime())) {
-                    historyPrice = historyPrice.add(userCourseInfo.getTeachMode().equals(TeachModeEnum.ONLINE) ? vipGroup.getOnlineClassesUnitPrice() : vipGroup.getOfflineClassesUnitPrice());
-                }
-            }
-            surplusCourseFee = allPrice.subtract(historyPrice);
-            if (surplusCourseFee.longValue() < 0) {
-                surplusCourseFee = new BigDecimal(0);
-            }
-        } else {
-            surplusCourseFee = new BigDecimal(0);
-        }
-        if (Objects.isNull(surplusCourseFee)) {
-            surplusCourseFee = new BigDecimal(0);
-        }
-        VipGroupCategory vipGroupCategory = vipGroupCategoryService.get(vipGroup.getVipGroupCategoryId().intValue());
-        surplusCourseFee = sysUserCashAccountLogService.vipReturnFeeCharges(surplusCourseFee, vipGroupCategory == null ? 0 : vipGroupCategory.getStudentNum());
-
-        studentApplyRefunds.setExpectAmount(surplusCourseFee);
-        studentApplyRefunds.setStatus(StudentApplyRefundsStatus.ING);
-        String orderNo = StringUtils.join(new String[]{userId.toString(), String.valueOf(System.currentTimeMillis())});
-        studentApplyRefunds.setOrderNo(orderNo);
-        studentApplyRefunds.setOrigPaymentOrderId(studentPaymentOrder.getId());
-        studentApplyRefunds.setUserId(userId);
-        studentApplyRefundsDao.insert(studentApplyRefunds);
-        Map<String, Object> memo = new HashMap<>(2);
-        memo.put("Id", studentApplyRefunds.getId());
-        memo.put("type", "VIPGROUP");
-        sendSeoMessageSource.sendSeoMessage(sysUser.getOrganId(), new SysUserRoleEnum[]{ORGAN_MANAGER},
-                JSONObject.toJSONString(memo), vipGroup.getEducationalTeacherId(), MessageTypeEnum.BACKSTAGE_STUDENT_APPLY_QUIT_COURSE, sysUser.getUsername());
-    }
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult applyRefundForStudent(ReturnFeeDto returnFeeDto) {
@@ -3069,11 +2994,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         VipGroupCategory vipGroupCategory = vipGroupCategoryService.get(vipGroup.getVipGroupCategoryId());
 
-        List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(), vipGroup.getGroupType(), studentId);
-        if (!CollectionUtils.isEmpty(studentApplyRefunds)) {
-            throw new BizException("此学生存在退课申请,请到系统日志中查看");
-        }
-
         ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, vipGroup.getGroupType());
 
         ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
@@ -3125,13 +3045,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if (!vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING) || (Objects.nonNull(vipGroupCategory) && vipGroupCategory.getMusicTheory())) {
             courseScheduleTeacherSalaryService.updateVipGroupCourseTeacherSalary(vipGroupId.intValue(), vipGroup.getUserId());
         }
-
         classGroup.setStudentNum(classGroup.getStudentNum() - 1);
-
         classGroupDao.update(classGroup);
 
         //学员退出班级群
         imGroupMemberService.quit(classGroup.getId().toString(), studentId);
+        //退学通知
+        Map<Integer, String> studentMap = new HashMap<>(1);
+        studentMap.put(studentId,studentId.toString());
+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
+                MessageTypeEnum.JIGUANG_STUDENT_QUIT_VIP, studentMap, null, 0, null, "STUDENT",vipGroup.getName());
         return BaseController.succeed();
     }
 
@@ -3161,11 +3084,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             throw new BizException("课程 {} {} 不支持退学", vipGroupId, vipGroup.getName());
         }
 
-        List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsDao.findByGroupAndUser(vipGroupId.toString(),vipGroup.getGroupType(), studentId);
-        if (!CollectionUtils.isEmpty(studentApplyRefunds)) {
-            throw new BizException("学生 {} {} 存在退课申请", studentId, user.getUsername());
-        }
-
         ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, vipGroup.getGroupType());
 
         ClassGroupStudentMapper classStudentMapperByUserIdAndClassGroupId = classGroupStudentMapperDao.query(classGroup.getId(),
@@ -3179,7 +3097,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             throw new BizException("学生 {} {} 已经是退学状态", studentId, user.getUsername());
         }
         //不再校验退费金额
-        /*BigDecimal amount = returnFeeDto.getAmount();
+        BigDecimal amount = returnFeeDto.getAmount();
         if (!classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)) {
             if (Objects.isNull(amount)) {
                 throw new BizException("请确定退费金额");
@@ -3189,7 +3107,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             if (amount.compareTo(suplusCourseFee) > 0) {
                 throw new BizException("学员 {} {} 最大可退费金额为{}元", studentId, user.getUsername(), suplusCourseFee.toString());
             }
-        }*/
+        }
     }
 
     @Override
@@ -3642,14 +3560,20 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if (vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) {
             throw new BizException("不能对已停止的课程进行退课操作");
         }
+        GroupType groupType = GroupType.VIP;
+        String orderType = "SMALL_CLASS_TO_BUY";
+        if("LIVE".equals(vipGroup.getGroupType())){
+            groupType = GroupType.LIVE;
+            orderType = "LIVE_GROUP_BUY";
+        }
         VipGroupCategory vipGroupCategory = vipGroupCategoryService.get(vipGroup.getVipGroupCategoryId().intValue());
         Map<String, BigDecimal> result = new HashMap<>();
         Date now = new Date();
         BigDecimal bigDecimal = ZERO;
-        List<StudentCourseInfoDto> userCourseInfos  = courseScheduleDao.findUserCourseInfos(GroupType.VIP, vipGroupId.toString(), studentId, null);
+        List<StudentCourseInfoDto> userCourseInfos  = courseScheduleDao.findUserCourseInfos(groupType, vipGroupId.toString(), studentId, null);
 
         if (CollectionUtils.isEmpty(userCourseInfos) && vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
-            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode(),"VIP".equals(vipGroup.getGroupType())?"SMALL_CLASS_TO_BUY":"LIVE_GROUP_BUY");
+            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode(),orderType);
             if (Objects.nonNull(studentPaymentOrder)) {
                 bigDecimal = studentPaymentOrder.getActualAmount().add(studentPaymentOrder.getBalancePaymentAmount());
             }
@@ -3681,7 +3605,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         result.put("suplusCourseFee", bigDecimal);
 
         if (VipGroupStatusEnum.APPLYING.equals(vipGroup.getStatus())) {
-            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode(),"VIP".equals(vipGroup.getGroupType())?"SMALL_CLASS_TO_BUY":"LIVE_GROUP_BUY");
+            StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, studentId, DealStatusEnum.SUCCESS.getCode(),orderType);
             if (Objects.nonNull(studentPaymentOrder)) {
                 BigDecimal suplusCourseOriginalFee = studentPaymentOrder.getActualAmount().add(studentPaymentOrder.getBalancePaymentAmount());
                 result.put("suplusCourseOriginalFee", suplusCourseOriginalFee);
@@ -4560,14 +4484,25 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 try {
                     ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroup.getId(),vipGroup.getGroupType());
                     List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
+                    Map<Integer, String> teacherMap = new HashMap<>(1);
+                    teacherMap.put(vipGroup.getUserId(),vipGroup.getUserId().toString());
+                    Map<Integer, String> eduMap = new HashMap<>(1);
+                    eduMap.put(vipGroup.getEducationalTeacherId(),vipGroup.getEducationalTeacherId().toString());
                     if(CollectionUtils.isEmpty(classGroupStudents)){
                         vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
+                        //推送
+                        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.JIGUANG_TEACHER_LIVE_CANCEL,
+                                teacherMap, null, 0, null, "TEACHER", vipGroup.getName());
+                        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.JIGUANG_EDUCATION_LIVE_CANCEL,
+                                eduMap, null, 0, null, "SYSTEM", vipGroup.getName());
                     }else {
                         //生成课程群聊相关信息
                         this.liveProgress(vipGroup,classGroup,classGroupStudents);
                         //推送
-//                        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.TEACHER_PUSH_VIP_STOP,
-//                                map2, null, 0, 2, "TEACHER", vipGroupName);
+                        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.JIGUANG_TEACHER_LIVE_PROGRESS,
+                                teacherMap, null, 0, "2", "TEACHER", vipGroup.getName());
+                        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.JIGUANG_EDUCATION_LIVE_PROGRESS,
+                                eduMap, null, 0, "2", "SYSTEM", vipGroup.getName());
                     }
                     vipGroupDao.update(vipGroup);
                 }catch (Exception e){
@@ -4712,7 +4647,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
         
         //更新到报名中
-        List<VipGroup> normalVipGroupList = vipGroupDao.queryNormalStatusList("VIP");
+        List<VipGroup> normalVipGroupList = vipGroupDao.queryNormalStatusList();
         if (!CollectionUtils.isEmpty(normalVipGroupList)) {
             List<VipGroup> needUpdateVipGroups = new ArrayList<>();
             for (VipGroup vipGroup : normalVipGroupList) {

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -1566,7 +1566,7 @@
                     AND INTE_ARRAY(mg.organ_id_list_,#{organIds})
                 </if>
                 <if test="groupType != 'LIVE'">
-                    FIND_IN_SET(mg.organ_id_,#{organIds})
+                   AND FIND_IN_SET(mg.organ_id_,#{organIds})
                 </if>
             </if>
             <if test="educationUserId != null">
@@ -1605,7 +1605,7 @@
         <if test="groupType == 'MUSIC'">
             LEFT JOIN music_group mg ON mg.id_ = cg.music_group_id_
         </if>
-        <if test="groupType == 'VIP'">
+        <if test="groupType == 'VIP' or groupType == 'LIVE'">
             LEFT JOIN vip_group mg ON mg.id_ = cg.music_group_id_
         </if>
         <if test="groupType == 'PRACTICE'">

+ 11 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -47,6 +47,8 @@
         <result column="service_provider_" property="serviceProvider"/>
         <result column="mute_all_" property="muteAll"/>
         <result column="live_remind_" property="liveRemind"/>
+        <result column="live_room_id_" property="liveRoomId" />
+        <result column="continuous_course_" property="continuousCourse" />
     </resultMap>
 
     <resultMap type="com.ym.mec.biz.dal.dto.Mapper" id="Mapper">
@@ -184,7 +186,8 @@
         cs.evaluate_flag_,
         cs.service_provider_,
         cs.mute_all_,
-        cs.live_room_id_
+        cs.live_room_id_,
+        cs.continuous_course_
     </sql>
 
     <sql id="courseIgnore">
@@ -4374,4 +4377,11 @@
     <update id="updateLiveRemind">
         update course_schedule set live_remind_ = #{liveRemind} where id_ = #{courseScheduleId}
     </update>
+
+    <select id="getTeacherContinuousCourse" resultMap="CourseSchedule">
+        SELECT <include refid="resultSql"/> FROM course_schedule cs
+        WHERE cs.class_group_id_ = #{classGroupId}
+        AND cs.actual_teacher_id_ = #{teacherId} AND cs.pre_course_flag_ = 0
+        ORDER BY cs.class_date_ DESC,cs.end_class_time_ DESC
+    </select>
 </mapper>

+ 109 - 0
mec-biz/src/main/resources/config/mybatis/CourseShareMapper.xml

@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE  mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.ym.mec.biz.dal.dao.CourseShareDao">
+    <resultMap type="com.ym.mec.biz.dal.entity.CourseShare" id="courseShare">
+        <result column="id_" property="id"/>
+        <result column="course_id_" property="courseId"/>
+        <result column="share_mode_" property="shareMode"/>
+        <result column="user_id_" property="userId"/>
+        <result column="create_time_" property="createTime"/>
+        <result column="create_by_" property="createBy"/>
+        <result column="tenant_id_" property="tenantId"/>
+    </resultMap>
+
+    <sql id="queryCondition">
+        <where>
+            tenant_id_ = #{tenantId}
+            <if test="courseId != null and courseId != ''">
+                AND course_id_= #{courseId}
+            </if>
+        </where>
+    </sql>
+
+    <!-- 根据主键查询一条记录 -->
+    <select id="get" resultMap="courseShare">
+        SELECT *
+        FROM course_share
+        WHERE id_ = #{id}
+    </select>
+
+    <!-- 全查询 -->
+    <select id="findAll" resultMap="courseShare">
+        SELECT *
+        FROM course_share
+        <include refid="queryCondition"/>
+        ORDER BY id_
+    </select>
+
+    <!-- 向数据库增加一条记录 -->
+    <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseShare" useGeneratedKeys="true" keyColumn="id"
+            keyProperty="id">
+        INSERT INTO course_share (id_, course_id_, share_mode_, user_id_, create_time_, create_by_, tenant_id_)
+        VALUES (#{id}, #{courseId}, #{shareMode}, #{userId}, NOW(), #{createBy}, #{tenantId})
+    </insert>
+
+    <!-- 根据主键查询一条记录 -->
+    <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseShare">
+        UPDATE course_share
+        <set>
+            <if test="courseId != null">
+                course_id_ = #{courseId},
+            </if>
+            <if test="shareMode != null">
+                share_mode_ = #{shareMode},
+            </if>
+            <if test="userId != null">
+                user_id_ = #{userId},
+            </if>
+        </set>
+        WHERE id_ = #{id} and tenant_id_ = #{tenantId}
+    </update>
+
+    <!-- 根据主键删除一条记录 -->
+    <delete id="delete">
+        DELETE
+        FROM course_share
+        WHERE id_ = #{id}
+    </delete>
+
+    <!-- 分页查询 -->
+    <select id="queryPage" resultMap="courseShare" parameterType="map">
+        SELECT * FROM course_share where tenant_id_ = #{tenantId} ORDER BY id_
+        <include refid="global.limit"/>
+    </select>
+
+    <!-- 查询当前表的总记录数 -->
+    <select id="queryCount" resultType="int">
+        SELECT COUNT(*)
+        FROM course_share
+        where tenant_id_ = #{tenantId}
+    </select>
+
+    <select id="selectByCourseId" resultMap="courseShare">
+        select id_, course_id_, share_mode_, user_id_, create_time_, create_by_, tenant_id_
+        from course_share
+        where course_id_ = #{courseId}
+    </select>
+
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+        INSERT INTO course_share (id_, course_id_, share_mode_, user_id_, create_time_, create_by_, tenant_id_)
+        VALUES
+        <foreach collection="courseShares" item="item" separator=",">
+            (#{item.id},#{item.courseId},#{item.shareMode},
+            #{item.userId},NOW(),#{item.createBy},#{item.tenantId})
+        </foreach>
+    </insert>
+
+    <delete id="deleteByCourseId">
+        DELETE
+        FROM course_share
+        WHERE course_id_ = #{courseId}
+    </delete>
+
+    <delete id="deleteByIds">
+        DELETE FROM course_share WHERE id_ IN
+        <foreach collection="ids" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -177,6 +177,12 @@
                     #{organId}
                 </foreach>
             </if>
+            <if test="userIds != null and userIds.length>0">
+                AND s.user_id_ IN
+                <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
+                    #{userId}
+                </foreach>
+            </if>
             <if test="isRecord != null">
                 <if test="isRecord == 0">
                     AND smcr.user_id_ IS NULL

+ 2 - 3
mec-biz/src/main/resources/config/mybatis/StudentPaymentOrderMapper.xml

@@ -501,9 +501,7 @@
           and spo.type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
     </select>
     <select id="findByStudentVipGroup" resultMap="StudentPaymentOrder">
-        SELECT
-        spo.*
-        FROM
+        SELECT spo.* FROM
         student_payment_order spo
         WHERE spo.user_id_ = #{userId}
         AND spo.music_group_id_ = #{vipGroupId}
@@ -516,6 +514,7 @@
         <if test="orderType == null or orderType == ''">
             AND spo.type_ = 'SMALL_CLASS_TO_BUY'
         </if>
+        order by id_ DESC LIMIT 1
     </select>
     <select id="sumSurplusCourseFee" resultType="java.math.BigDecimal">
         SELECT SUM(cssp.expect_price_)

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -1082,7 +1082,7 @@
     <select id="queryNormalStatusList" resultMap="VipGroup">
         SELECT *
         FROM vip_group
-        WHERE group_status_ = 0 AND group_type_ = #{groupType}
+        WHERE group_status_ = 0
     </select>
 
     <select id="findVipGroupInfo" resultMap="VipGroup">

+ 18 - 0
mec-im/src/main/java/com/ym/controller/UserController.java

@@ -127,6 +127,24 @@ public class UserController {
             callbackOnMemberStateChange.setOptPlatform(optPlatform);
             if (callbackOnMemberStateChange.getGroupId().startsWith("LIVE")) {
                 imLiveBroadcastRoomService.callbackOnMemberStateChange(callbackOnMemberStateChange);
+
+                // 直播课学生签退
+                String[] values = callbackOnMemberStateChange.getGroupId().split("-");
+                String roomId = values.length > 2 ? values[1] : "";
+
+                if ((roomId.startsWith("S") || roomId.startsWith("I"))
+                        && CollectionUtils.isNotEmpty(callbackOnMemberStateChange.getMemberList())
+                        && "Offline".equals(callbackOnMemberStateChange.getEventType())) {
+
+                    // 学生编号
+                    String userId = callbackOnMemberStateChange.getMemberList().get(0).getMemberAccount();
+                    try {
+                        roomService.leaveRoomSuccess(roomId, userId, null);
+                    } catch (Exception e) {
+                        log.error("tencentImCallback leaveRoomSuccess error, roomId={}, userId={}", roomId, userId, e);
+                    }
+
+                }
             }
 
 

+ 11 - 6
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -227,6 +227,11 @@ public class RoomServiceImpl implements RoomService {
             }
         }
         Long courseId = Long.parseLong(roomId);
+        // 默认获取首节课的课程信息
+        if (Objects.isNull(schedule)) {
+            schedule = courseScheduleDao.get(courseId);
+        }
+
         //记录用户实际选择的房间
         if (courseSchedule.getGroupType() == GroupType.COMM) {
             roomId = "I" + roomId;
@@ -284,17 +289,17 @@ public class RoomServiceImpl implements RoomService {
 
             // 直播形式网络课
             ImLiveBroadcastRoom liveRoom;
-            if (StringUtils.isNotBlank(courseSchedule.getLiveRoomId())) {
+            if (StringUtils.isNotBlank(schedule.getLiveRoomId())) {
 
                 // 直播间状态判断
                 liveRoom = imLiveBroadcastRoomService.lambdaQuery()
-                        .eq(ImLiveBroadcastRoom::getRoomUid, courseSchedule.getLiveRoomId())
+                        .eq(ImLiveBroadcastRoom::getRoomUid, schedule.getLiveRoomId())
                         .last("LIMIT 1")
                         .one();
 
                 if (Objects.isNull(liveRoom)) {
                     // 创建网络课直播教室
-                    liveRoom = createVipGroupLiveRoom(roomId, courseSchedule);
+                    liveRoom = createVipGroupLiveRoom(roomId, schedule);
                 }
 
                 // 直播间状态不在进行中
@@ -315,7 +320,7 @@ public class RoomServiceImpl implements RoomService {
             } else {
 
                 // 创建网络课直播教室
-                liveRoom = createVipGroupLiveRoom(roomId, courseSchedule);
+                liveRoom = createVipGroupLiveRoom(roomId, schedule);
             }
 
             // 返回直播间配置参数
@@ -329,11 +334,11 @@ public class RoomServiceImpl implements RoomService {
             // 创建聊天群组
             if (Optional.ofNullable(joinRoom).orElse(true)) {
                 // 创建IM群聊
-                this.joinImGroup(roomId, courseSchedule.getActualTeacherId(), courseSchedule);
+                this.joinImGroup(roomId, schedule.getActualTeacherId(), schedule);
             }
 
             // RTC房间网络课
-            genRtcRoomMemberInfoConfig(roomId, joinRoom, sysUser, userId, teacher, courseSchedule, curTime, roomResult, courseId);
+            genRtcRoomMemberInfoConfig(roomId, joinRoom, sysUser, userId, teacher, schedule, curTime, roomResult, courseId);
         }
 
         log.info("join room: roomId = {}, userId = {}", roomId, userId);

+ 0 - 8
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -93,14 +93,6 @@ public class StudentVipGroupController extends BaseController {
         return vipGroupService.buyVipGroup(vipGroupBuyParams);
     }
 
-    @ApiOperation(value = "vip课退课")
-    @PostMapping("/applyRefund")
-    @AuditLogAnnotation(operateName = "vip课退课")
-	public HttpResponseResult applyRefund(Long vipGroupId) {
-		vipGroupService.applyRefund(vipGroupId);
-		return succeed();
-	}
-
     @ApiOperation(value = "获取vip购买信息")
     @PostMapping("/getVipGroupPayInfo")
 	public HttpResponseResult<VipGroupPayInfoDto> getVipGroupPayInfo(Integer vipGroupId){

+ 63 - 0
mec-web/src/main/java/com/ym/mec/web/controller/CourseShareController.java

@@ -0,0 +1,63 @@
+package com.ym.mec.web.controller;
+
+
+import com.ym.mec.biz.dal.dto.CourseShareDto;
+import com.ym.mec.biz.dal.dto.StudentManageListDto;
+import com.ym.mec.biz.dal.entity.CourseShare;
+import com.ym.mec.biz.service.CourseShareService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.tenant.TenantContextHolder;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @author 袁亮
+ * @version v1.0
+ * @apiNote 课程分享接口
+ */
+@Api(tags = "课程分享接口控制器")
+@RequestMapping("courseShare")
+@RestController
+public class CourseShareController extends BaseController {
+
+    @Autowired
+    private CourseShareService courseShareService;
+
+    @ApiOperation(value = "创建分享")
+    @PostMapping("/create")
+    @PreAuthorize("@pcs.hasPermissions('courseShare/create')")
+    public HttpResponseResult<List<CourseShare>> create(@RequestBody CourseShareDto courseShareDto) {
+        Integer tenantId = TenantContextHolder.getTenantId();
+        return succeed(courseShareService.create(tenantId, courseShareDto));
+    }
+
+    @ApiOperation(value = "查询已经分享过的学生")
+    @GetMapping("/queryCourseSharedStudent")
+    @PreAuthorize("@pcs.hasPermissions('courseShare/queryCourseSharedStudent')")
+    public HttpResponseResult<List<StudentManageListDto>> queryCourseSharedStudent(
+            @RequestParam(value = "courseId") Integer courseId) {
+        Integer tenantId = TenantContextHolder.getTenantId();
+        return succeed(courseShareService.queryCourseSharedStudent(tenantId,courseId));
+    }
+
+    @ApiOperation(value = "查询学生列表")
+    @GetMapping("/queryStudentList")
+    @PreAuthorize("@pcs.hasPermissions('courseShare/queryStudentList')")
+    public HttpResponseResult<List<StudentManageListDto>> queryStudentList(
+            @RequestParam(value = "organId", required = false) Integer organId,
+            @RequestParam(value = "subjectId", required = false) Integer subjectId) {
+        Integer tenantId = TenantContextHolder.getTenantId();
+        return succeed(courseShareService.queryStudentList(tenantId, organId, subjectId));
+    }
+}