Преглед изворни кода

Merge branch 'feature/0529-live' of http://git.dayaedu.com/yonge/mec into feature/0529-live

liujc пре 2 година
родитељ
комит
ad00cfaa39

+ 8 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -3201,13 +3201,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
             classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
             studentPauseInfoDao.deleteUserPauseInfoWithGroup(groupType, vipGroupId.toString(), studentId);
-
-            classGroup.setStudentNum(classGroup.getStudentNum() - 1);
-            classGroupDao.update(classGroup);
+            classGroupDao.modifyStudentNum(classGroup.getId(),-1);
             return;
         }
 
-
         classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
         classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
         List<CourseSchedule> musicGroupCourseSchedules = courseScheduleDao.findMusicGroupCourseSchedulesWithStudent(vipGroupId.toString(), groupType.getCode(), CourseStatusEnum.NOT_START.getCode(), studentId);
@@ -3217,7 +3214,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     .collect(Collectors.toList());
             courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudent(courseScheduleIds, studentId);
             studentAttendanceDao.deleteByCourseAndUser(courseScheduleIds,studentId);
-            if(groupType == LIVE){
+            /*if(groupType == LIVE){
                 List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentDao.findByCourseScheduleIds(courseScheduleIds);
                 Map<Long, Integer> courseStudentNumMap = studentPayments.stream().filter(e -> e.getJoinCourseType() == JoinCourseType.PURCHASE)
                         .collect(Collectors.groupingBy(e -> e.getCourseScheduleId(), Collectors.collectingAndThen(Collectors.toList(), v -> v.size())));
@@ -3266,17 +3263,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                         log.error("liveRoom error", e);
                     }
                 }
-            }
+            }*/
         }
 
         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);
-
+        classGroupDao.modifyStudentNum(classGroup.getId(),-1);
         //学员退出班级群
         imGroupMemberService.quit(classGroup.getId().toString(), studentId);
     }
@@ -5191,7 +5185,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if (!vipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) {
             throw new BizException("课程组不是取消状态");
         }
-
+        List<CourseSchedule> schedules = courseScheduleDao.findGroupCourseSchedules(id.toString(), vipGroup.getGroupType());
+        if(!CollectionUtils.isEmpty(schedules)){
+            throw new BizException("当前课程组已排课");
+        }
         vipGroupDao.del(id);
         return true;
     }

+ 19 - 6
mec-web/src/main/java/com/ym/mec/web/controller/CourseScheduleController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.ClassGroupDao;
 import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -15,6 +16,7 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
+import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -59,6 +61,8 @@ public class CourseScheduleController extends BaseController {
     private OrganizationService organizationService;
     @Autowired
     private VipGroupDao vipGroupDao;
+    @Autowired
+    private SysConfigDao sysConfigDao;
 
     @ApiOperation(value = "课表详情")
     @GetMapping("/query")
@@ -188,12 +192,21 @@ public class CourseScheduleController extends BaseController {
             }
 
             // 直播课
-            if (GroupType.LIVE.equals(oldCourseSchedule.getGroupType())
-                    && org.apache.commons.lang3.StringUtils.isNotBlank(oldCourseSchedule.getLiveRoomId())) {
-                // 重置连堂课,关联直播间,消息推送状态
-                courseSchedule.setLiveRemind(0);
-                courseSchedule.setContinuousCourse(false);
-                courseSchedule.setLiveRoomId("");
+            if (GroupType.LIVE.equals(oldCourseSchedule.getGroupType())){
+                if(org.apache.commons.lang3.StringUtils.isNotBlank(oldCourseSchedule.getLiveRoomId())){
+                    // 重置连堂课,关联直播间,消息推送状态
+                    courseSchedule.setLiveRemind(0);
+                    courseSchedule.setContinuousCourse(false);
+                    courseSchedule.setLiveRoomId("");
+                }
+                String startRemindTime = sysConfigDao.findConfigValue("live_class_start_remind_time");
+                if(StringUtils.isEmpty(startRemindTime)){
+                    startRemindTime = "30";
+                }
+                if(DateUtil.minutesBetween(new Date(),oldCourseSchedule.getStartClassTime()) < Integer.parseInt(startRemindTime)
+                 && DateUtil.minutesBetween(new Date(),oldCourseSchedule.getEndClassTime()) >= 0){
+                    throw new BizException("直播课课程开始前{}分钟不允许调整",startRemindTime);
+                }
             }
         }
         if(Objects.isNull(courseSchedule.getClassGroupId())){

+ 0 - 1
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -449,7 +449,6 @@ public class VipGroupManageController extends BaseController {
     @ApiOperation(value = "删除直播课")
     @GetMapping(value = "/delLiveGroup/{id}")
     public HttpResponseResult<Object> delLiveGroup(@PathVariable Integer id){
-
         return succeed(vipGroupService.del(id));
     }
 }