|
@@ -11,10 +11,17 @@ import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupClassGroupMapper;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.mapper.LiveGroupPlusMapper;
|
|
|
+import com.ym.mec.biz.dal.wrapper.LiveGroupWrapper;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
+import org.apache.commons.collections.MapUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -31,7 +38,6 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.ClassGroupDao;
|
|
|
import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
|
|
@@ -60,38 +66,7 @@ import com.ym.mec.biz.dal.dao.VipGroupDao;
|
|
|
import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesCycleDao;
|
|
|
import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesUnitPriceDao;
|
|
|
import com.ym.mec.biz.dal.dao.VipGroupStudentCoursePriceDao;
|
|
|
-import com.ym.mec.biz.dal.entity.ActivityUserMapper;
|
|
|
-import com.ym.mec.biz.dal.entity.ClassGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
|
|
|
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
|
|
|
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary;
|
|
|
-import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
|
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
|
|
|
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
|
|
|
-import com.ym.mec.biz.dal.entity.Employee;
|
|
|
-import com.ym.mec.biz.dal.entity.ImGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.Organization;
|
|
|
-import com.ym.mec.biz.dal.entity.PracticeGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.School;
|
|
|
-import com.ym.mec.biz.dal.entity.Student;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
|
|
|
import com.ym.mec.biz.dal.entity.StudentApplyRefunds.StudentApplyRefundsStatus;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPauseInfo;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentRecoverDto;
|
|
|
-import com.ym.mec.biz.dal.entity.SysConfig;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
-import com.ym.mec.biz.dal.entity.SysUserCashAccountLog;
|
|
|
-import com.ym.mec.biz.dal.entity.Teacher;
|
|
|
-import com.ym.mec.biz.dal.entity.TeacherAttendance;
|
|
|
-import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupActivity;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupCategory;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesCycle;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesUnitPrice;
|
|
|
-import com.ym.mec.biz.dal.entity.VipGroupStudentCoursePrice;
|
|
|
import com.ym.mec.biz.dal.enums.ActivityCourseType;
|
|
|
import com.ym.mec.biz.dal.enums.AuditStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
@@ -230,6 +205,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Autowired
|
|
|
private OrganizationDao organizationDao;
|
|
|
@Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+ @Autowired
|
|
|
private GroupClassService groupClassService;
|
|
|
@Autowired
|
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
@@ -251,6 +228,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
@Autowired
|
|
|
private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private LiveGroupPlusMapper liveGroupPlusMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CooperationOrganService cooperationOrganService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SubjectService subjectService;
|
|
|
+
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(VipGroup.class);
|
|
|
|
|
|
@Override
|
|
@@ -258,6 +247,237 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
return vipGroupDao;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
+ @Override
|
|
|
+ public HttpResponseResult updateLiveGroup(VipGroupApplyDto vipGroup) {
|
|
|
+
|
|
|
+
|
|
|
+ if (vipGroup.getVipGroupApplyBaseInfo().getId() == null) {
|
|
|
+ throw new BizException("课程id不能为空");
|
|
|
+ }
|
|
|
+ VipGroup vipGroup1 = vipGroupDao.get(vipGroup.getVipGroupApplyBaseInfo().getId());
|
|
|
+ if (vipGroup1 == null) {
|
|
|
+ throw new BizException("课程不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 声部
|
|
|
+ VipGroupApplyDto vipGroupApplyDto = liveGroupDetail(vipGroup1.getId());
|
|
|
+ // 检测是否有学生已经购买直播课
|
|
|
+ IPage<LiveGroupWrapper.LiveGroupStudentList> livedStudentList = this.liveStudentList(new Page<>(1, 1),
|
|
|
+ LiveGroupWrapper.LiveGroupStudentQuery.builder().liveGroupId(vipGroup1.getId()).build());
|
|
|
+ if (livedStudentList.getRecords().size() >0) {
|
|
|
+ // 有人购买过直播课 不可修改判断
|
|
|
+
|
|
|
+ // 声部
|
|
|
+ if (!vipGroupApplyDto.getVipGroupApplyBaseInfo().getSubjectIdList().equals(vipGroup.getVipGroupApplyBaseInfo().getSubjectIdList())) {
|
|
|
+ throw new BizException("已有学生购买直播课,不可修改声部");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 课时数
|
|
|
+ if (!vipGroupApplyDto.getVipGroupApplyBaseInfo().getOnlineClassesNum().equals(vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())) {
|
|
|
+ throw new BizException("已有学生购买直播课,不可修改课时数");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 课程时长
|
|
|
+ if (!vipGroupApplyDto.getVipGroupApplyBaseInfo().getSingleClassMinutes().equals(vipGroup.getVipGroupApplyBaseInfo().getSingleClassMinutes())) {
|
|
|
+ throw new BizException("已有学生购买直播课,不可修改课程时长");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// 现价
|
|
|
+ if (vipGroupApplyDto.getVipGroupApplyBaseInfo().getOnlineClassesUnitPrice().compareTo(vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesUnitPrice()) != 0) {
|
|
|
+ throw new BizException("已有学生购买直播课,不可修改现价");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 原价
|
|
|
+ if (vipGroupApplyDto.getVipGroupApplyBaseInfo().getOfflineClassesUnitPrice().compareTo(vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesUnitPrice()) != 0) {
|
|
|
+ throw new BizException("已有学生购买直播课,不可修改原价");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // VIP, LIVE课程公共参数校验
|
|
|
+ if (Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getUserId())) {
|
|
|
+ throw new BizException("请选择指导老师");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vipGroup.getCourseSchedules().size() != (vipGroup.getVipGroupApplyBaseInfo().getOfflineClassesNum() + vipGroup.getVipGroupApplyBaseInfo().getOnlineClassesNum())) {
|
|
|
+ throw new BizException("建课失败,当前课程存在未排课课程,请调整相关设置");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 学生购买价格,老师课薪设置校验
|
|
|
+ VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto = vipGroup.getVipGroupApplyBaseInfo();
|
|
|
+
|
|
|
+ if (Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice())
|
|
|
+ && Objects.isNull(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice())) {
|
|
|
+ throw new BizException("请设置课程单价");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.isNull(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())) {
|
|
|
+ throw new BizException("请设置教师课酬");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 课程时间校验
|
|
|
+ Integer totalClassTimes = vipGroupApplyBaseInfoDto.getOnlineClassesNum() + vipGroupApplyBaseInfoDto.getOfflineClassesNum();
|
|
|
+ //获取第一节课
|
|
|
+ CourseSchedule firstCourseSchedule = vipGroup.getCourseSchedules().stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get();
|
|
|
+ //获取最后一节课
|
|
|
+ CourseSchedule latestCourseSchedule = vipGroup.getCourseSchedules().stream().max(Comparator.comparing(CourseSchedule::getEndClassTime)).get();
|
|
|
+
|
|
|
+ if (firstCourseSchedule.getStartClassTime().before(new Date())) {
|
|
|
+ throw new BizException("开课时间不能小于当前时间");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vipGroupApplyBaseInfoDto.getRegistrationStartTime().after(vipGroupApplyBaseInfoDto.getPaymentExpireDate())) {
|
|
|
+ throw new BizException("报名开始时间必须在报名截至时间之前");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (vipGroupApplyBaseInfoDto.getPaymentExpireDate().after(firstCourseSchedule.getStartClassTime())
|
|
|
+ || DateUtil.isSameDay(vipGroupApplyBaseInfoDto.getPaymentExpireDate(), firstCourseSchedule.getEndClassTime())) {
|
|
|
+ throw new BizException("创建失败,报名截止时间必须在开课时间前一天");
|
|
|
+ }
|
|
|
+
|
|
|
+ VipGroupCategory vipGroupCategory = vipGroupCategoryService.get(vipGroupApplyBaseInfoDto.getVipGroupCategoryId());
|
|
|
+ if (Objects.isNull(vipGroupCategory)) {
|
|
|
+ throw new BizException("课程形式不存在");
|
|
|
+ }
|
|
|
+ Date now = new Date();
|
|
|
+ // VIP课,LIVE课参数校验
|
|
|
+ String groupType = vipGroup.getVipGroupApplyBaseInfo().getGroupType();
|
|
|
+
|
|
|
+ // 购买学生列表
|
|
|
+ List<Integer> canBuyStudentIds = Lists.newArrayList();
|
|
|
+ if (StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())) {
|
|
|
+ canBuyStudentIds = Arrays.stream(vipGroupApplyBaseInfoDto.getStudentIdList().split(",")).map(Integer::valueOf).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ List<VipGroupStudentCoursePrice> vscps = vipGroup.getVipGroupApplyBaseInfo().getVipGroupStudentCoursePrices();
|
|
|
+
|
|
|
+ // VIP课参数校验
|
|
|
+ if (CourseSchedule.CourseScheduleType.VIP.getCode().equals(groupType)) {
|
|
|
+
|
|
|
+ // 校验VIP课参数
|
|
|
+ vipGroupRequestParamValid(vipGroup, vipGroupApplyBaseInfoDto, totalClassTimes, firstCourseSchedule, latestCourseSchedule);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // LIVE课参数校验
|
|
|
+ if (CourseSchedule.CourseScheduleType.LIVE.getCode().equals(groupType)) {
|
|
|
+
|
|
|
+ ImLiveBroadcastRoomDto liveRoom = vipGroup.getLiveBroadcastRoom();
|
|
|
+ if (Objects.isNull(liveRoom) || Objects.isNull(liveRoom.getRoomConfig())) {
|
|
|
+ throw new BizException("直播间参数错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isAnyBlank(liveRoom.getRoomTitle(), liveRoom.getLiveRemark(), liveRoom.getOs())
|
|
|
+ || Objects.isNull(liveRoom.getUseScene())) {
|
|
|
+ throw new BizException("直播间参数错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置默认参数
|
|
|
+ liveRoom.groupType(vipGroup.getVipGroupApplyBaseInfo().getGroupType())
|
|
|
+ .subjectId(vipGroup.getVipGroupApplyBaseInfo().getSubjectIdList())
|
|
|
+ .setTenantId(TenantContextHolder.getTenantId());
|
|
|
+
|
|
|
+ vipGroup.getVipGroupApplyBaseInfo().setLiveConfigJson(JSON.toJSONString(liveRoom));
|
|
|
+ }
|
|
|
+ vipGroupDao.update(vipGroupApplyBaseInfoDto);
|
|
|
+
|
|
|
+
|
|
|
+ ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroup1.getId(), vipGroup1.getGroupType());
|
|
|
+ //更新班级信息
|
|
|
+ if (classGroup == null) {
|
|
|
+ classGroup =new ClassGroup();
|
|
|
+ }
|
|
|
+ classGroup.setSubjectIdList(vipGroupApplyBaseInfoDto.getSubjectIdList());
|
|
|
+ //如果是乐理课实际人数为所选学员数量
|
|
|
+ if (Boolean.TRUE.equals(vipGroupCategory.getMusicTheory())) {
|
|
|
+ classGroup.setExpectStudentNum(canBuyStudentIds.size());
|
|
|
+ } else {
|
|
|
+ classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum());
|
|
|
+ }
|
|
|
+ classGroup.setStudentNum(0);
|
|
|
+ classGroup.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ classGroup.setTotalClassTimes(totalClassTimes);
|
|
|
+ classGroup.setType(ClassGroupTypeEnum.valueOf(groupType));
|
|
|
+ classGroup.setDelFlag(1);
|
|
|
+ classGroup.setGroupType(GroupType.valueOf(groupType));
|
|
|
+ classGroup.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+
|
|
|
+ classGroup.setUpdateTime(now);
|
|
|
+ if (classGroup.getId() == null) {
|
|
|
+ classGroup.setCreateTime(now);
|
|
|
+ classGroupDao.insert(classGroup);
|
|
|
+ } else {
|
|
|
+ classGroupDao.update(classGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ClassGroupTeacherMapper classGroupTeacherMapper = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroup.getId(), TeachTypeEnum.BISHOP);
|
|
|
+ if (classGroupTeacherMapper == null) {
|
|
|
+ classGroupTeacherMapper = new ClassGroupTeacherMapper();
|
|
|
+ }
|
|
|
+ //更新班级老师关联记录
|
|
|
+ classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroupTeacherMapper.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
+ classGroupTeacherMapper.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ classGroupTeacherMapper.setGroupType(GroupType.valueOf(groupType));
|
|
|
+
|
|
|
+ classGroupTeacherMapper.setUpdateTime(now);
|
|
|
+ if (classGroupTeacherMapper.getId() == null) {
|
|
|
+ classGroupTeacherMapper.setCreateTime(now);
|
|
|
+ classGroupTeacherMapperDao.insert(classGroupTeacherMapper);
|
|
|
+ } else {
|
|
|
+ classGroupTeacherMapperDao.update(classGroupTeacherMapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ ClassGroupTeacherSalary classGroupTeacherSalary = classGroupTeacherSalaryDao
|
|
|
+ .findByVipGoupAndTeacher(vipGroup1.getId().intValue(), vipGroupApplyDto.getLiveBroadcastRoom().getSpeakerId());
|
|
|
+ if (classGroupTeacherSalary == null) {
|
|
|
+ classGroupTeacherSalary = new ClassGroupTeacherSalary();
|
|
|
+ }
|
|
|
+ //更新班级与老师课酬记录
|
|
|
+ classGroupTeacherSalary.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ classGroupTeacherSalary.setClassGroupId(classGroup.getId());
|
|
|
+ classGroupTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
|
|
|
+ classGroupTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ classGroupTeacherSalary.setSalary(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setOnlineClassesSalary(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary());
|
|
|
+ classGroupTeacherSalary.setGroupType(GroupType.valueOf(groupType));
|
|
|
+ classGroupTeacherSalary.setUpdateTime(now);
|
|
|
+ if (classGroupTeacherSalary.getId() == null) {
|
|
|
+ classGroupTeacherSalary.setCreateTime(now);
|
|
|
+ classGroupTeacherSalaryDao.insert(classGroupTeacherSalary);
|
|
|
+ } else {
|
|
|
+ classGroupTeacherSalaryDao.update(classGroupTeacherSalary);
|
|
|
+ }
|
|
|
+
|
|
|
+ //课程信息调整
|
|
|
+ List<CourseSchedule> courseSchedules = vipGroup.getCourseSchedules();
|
|
|
+ ClassGroup finalClassGroup = classGroup;
|
|
|
+ courseSchedules.forEach(courseSchedule -> {
|
|
|
+ courseSchedule.setGroupType(GroupType.valueOf(groupType));
|
|
|
+ courseSchedule.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString());
|
|
|
+ if (courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)) {
|
|
|
+ courseSchedule.setSchoolId(vipGroup.getVipGroupApplyBaseInfo().getTeacherSchoolId());
|
|
|
+ }
|
|
|
+ courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ courseSchedule.setActualTeacherId(vipGroupApplyBaseInfoDto.getUserId());
|
|
|
+ courseSchedule.setStatus(CourseStatusEnum.NOT_START);
|
|
|
+ courseSchedule.setType(CourseSchedule.CourseScheduleType.valueOf(groupType));
|
|
|
+ courseSchedule.setClassGroupId(finalClassGroup.getId());
|
|
|
+ courseSchedule.setName(vipGroupApplyBaseInfoDto.getName());
|
|
|
+ courseSchedule.setOrganId(vipGroupApplyBaseInfoDto.getOrganId());
|
|
|
+ });
|
|
|
+
|
|
|
+ courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
|
|
|
+ vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(courseSchedules));
|
|
|
+ vipGroupDao.update(vipGroupApplyBaseInfoDto);
|
|
|
+ return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
@Override
|
|
|
public HttpResponseResult createVipGroup(VipGroupApplyDto vipGroup) {
|
|
@@ -345,6 +565,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
throw new BizException("直播间参数错误");
|
|
|
}
|
|
|
|
|
|
+ // 直播间默认方案
|
|
|
+ String liveClient = sysConfigDao.findConfigValue("live_client");
|
|
|
+ liveRoom.setServiceProvider(liveClient);
|
|
|
+
|
|
|
// 设置默认参数
|
|
|
liveRoom.groupType(vipGroup.getVipGroupApplyBaseInfo().getGroupType())
|
|
|
.subjectId(vipGroup.getVipGroupApplyBaseInfo().getSubjectIdList())
|
|
@@ -4503,6 +4727,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
|
|
|
String subjectId = imLiveBroadcastRoomDto.getSubjectId();
|
|
|
+ baseInfoDto.setSubjectIdList(subjectId);
|
|
|
if ("-1".equals(subjectId)) {
|
|
|
baseInfoDto.setSubjectName("乐理");
|
|
|
} else {
|
|
@@ -4529,4 +4754,81 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 学生列表
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public IPage<LiveGroupWrapper.LiveGroupStudentList> liveStudentList(IPage<LiveGroupWrapper.LiveGroupStudentList> page, LiveGroupWrapper.LiveGroupStudentQuery query) {
|
|
|
+ IPage<LiveGroupWrapper.LiveGroupStudentList> livedStudentList = liveGroupPlusMapper.liveStudentList(page, query);
|
|
|
+ List<LiveGroupWrapper.LiveGroupStudentList> records = livedStudentList.getRecords();
|
|
|
+ if (CollectionUtils.isEmpty(records)) {
|
|
|
+ return livedStudentList;
|
|
|
+ }
|
|
|
+ // 学生ID集合
|
|
|
+ List<Integer> studentIds = records.stream().map(LiveGroupWrapper.LiveGroupStudentList::getStudentId).map(o -> o.intValue()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 学生信息
|
|
|
+ Map<Integer, Student> studentMap = studentService.getMapByIds(studentIds);
|
|
|
+ if (MapUtils.isEmpty(studentMap)) {
|
|
|
+ return livedStudentList;
|
|
|
+ }
|
|
|
+ // 手机号
|
|
|
+ List<SimpleUserDto> usersSimpleInfo = teacherDao.getUsersSimpleInfo(studentIds);
|
|
|
+
|
|
|
+ Set<Integer> subjectIds = new HashSet<>();
|
|
|
+ Set<Integer> coopIds = new HashSet<>();
|
|
|
+ Set<Integer> organIds = new HashSet<>();
|
|
|
+ studentMap.values().forEach(student -> {
|
|
|
+ subjectIds.add(Integer.parseInt(student.getSubjectIdList()));
|
|
|
+ coopIds.add(student.getCooperationOrganId());
|
|
|
+ organIds.add(student.getOrganId());
|
|
|
+ });
|
|
|
+ // 分部
|
|
|
+ Map<Integer, Organization> organizationMap = organizationService.getMapById(new ArrayList<>(organIds));
|
|
|
+
|
|
|
+ // 学校
|
|
|
+ Map<Integer, CooperationOrgan> cooperationOrganMap = cooperationOrganService.getMapByIds(new ArrayList<>(coopIds));
|
|
|
+
|
|
|
+ // 声部
|
|
|
+ Map<Integer, StudentSubjectDto> studentSubjectDtoMap = subjectService.getSubjectByStudentId(studentIds.stream().map(Integer::longValue).collect(Collectors.toSet()));
|
|
|
+
|
|
|
+ Map<Integer,SimpleUserDto> userMap = new HashMap<>();
|
|
|
+ if (!CollectionUtils.isEmpty(usersSimpleInfo)) {
|
|
|
+ userMap = usersSimpleInfo.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, Function.identity()));
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LiveGroupWrapper.LiveGroupStudentList record : records) {
|
|
|
+ Student student = studentMap.get(record.getStudentId());
|
|
|
+ if (Objects.nonNull(student)) {
|
|
|
+ record.setStudentName(student.getUsername());
|
|
|
+ record.setOrganName(organizationMap.getOrDefault(student.getOrganId(), new Organization()).getName());
|
|
|
+ record.setSchoolName(cooperationOrganMap.getOrDefault(student.getCooperationOrganId(), new CooperationOrgan()).getName());
|
|
|
+ record.setSubjectName(studentSubjectDtoMap.getOrDefault(student.getUserId(), new StudentSubjectDto()).getSubjectName());
|
|
|
+ record.setPhone(userMap.getOrDefault(student.getUserId(),new SimpleUserDto()).getPhone());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return livedStudentList.setRecords(records);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CourseSchedule> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query) {
|
|
|
+
|
|
|
+ VipGroup vipGroup = this.get(query.getLiveGroupId());
|
|
|
+ if (Objects.isNull(vipGroup)) {
|
|
|
+ throw new BizException("课程组不存在");
|
|
|
+ }
|
|
|
+ if (!"LIVE".equals(vipGroup.getGroupType())) {
|
|
|
+ throw new BizException("此课程不是直播课程");
|
|
|
+ }
|
|
|
+ // 报名中的课程直接返回json数据
|
|
|
+ if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
|
|
|
+ return JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
|
|
|
+ } else {
|
|
|
+ return courseScheduleDao.findGroupCourseSchedules(vipGroup.getId().toString(), GroupType.LIVE.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|