|
@@ -45,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
@@ -101,6 +100,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
private UserBindingTeacherDao userBindingTeacherDao;
|
|
|
@Autowired
|
|
|
private CourseScheduleRecordDao recordDao;
|
|
|
+ @Autowired
|
|
|
+ private ImGroupService imGroupService;
|
|
|
|
|
|
@Override
|
|
|
public CourseScheduleDao getDao() {
|
|
@@ -1610,6 +1611,11 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
List<CourseTimeEntity> timeList = arrangeCourseVo.getTimeList();//选课时间
|
|
|
Integer consumeTime = arrangeCourseVo.getConsumeTime();
|
|
|
|
|
|
+ Integer configValue = Integer.valueOf(sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_MAX_STUDENTS));
|
|
|
+ if (studentIds.size()>configValue){
|
|
|
+ throw new BizException("成课学员人数超过房间最大容量{}",configValue);
|
|
|
+ }
|
|
|
+
|
|
|
//校验课时
|
|
|
if (timeList.size() != classNum) {
|
|
|
throw new BizException("课时数与排课数不符");
|
|
@@ -1723,6 +1729,14 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
roomTime.setRemainTime(remainTime - consumTime);
|
|
|
roomTime.setFrozenTime(frozenTime + consumTime);
|
|
|
pianoRoomTimeDao.update(roomTime, Wrappers.<PianoRoomTime>lambdaQuery().eq(PianoRoomTime::getTeacherId, teacherId));
|
|
|
+
|
|
|
+ //创建群聊
|
|
|
+ try {
|
|
|
+ imGroupService.autoCreate(courseGroup.getId(),CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("琴房课程组id:{},创建群聊失败:{}",courseGroup.getId(),e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1819,8 +1833,15 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
//更新组课程数
|
|
|
Long groupId = schedule.getCourseGroupId();
|
|
|
Integer count = baseMapper.selectCount(Wrappers.<CourseSchedule>lambdaQuery().eq(CourseSchedule::getCourseGroupId, groupId));
|
|
|
- if (count == 0) {
|
|
|
+ if (count == 0) {//组内课程为0,删除课程组
|
|
|
courseGroupService.getDao().deleteById(groupId);
|
|
|
+
|
|
|
+ //解散群聊
|
|
|
+ try {
|
|
|
+ imGroupService.dismiss(String.valueOf(groupId));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("琴房课程组id:{},关闭群聊失败:{}",groupId,e);
|
|
|
+ }
|
|
|
} else {
|
|
|
courseGroupService.update(null, Wrappers.<CourseGroup>lambdaUpdate()
|
|
|
.eq(CourseGroup::getId, groupId)
|
|
@@ -1898,6 +1919,12 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Long teacherId = WrapperUtil.toLong(param, "teacherId", "老师id不能为空!");
|
|
|
List<Integer> studentIdsList = (List<Integer>) param.get("studentIds");
|
|
|
List<Long> studentIds = JSONArray.parseArray(studentIdsList.toString(), Long.class);
|
|
|
+
|
|
|
+ Integer configValue = Integer.valueOf(sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_MAX_STUDENTS));
|
|
|
+ if (studentIds.size()>configValue){
|
|
|
+ throw new BizException("成课学员人数超过房间最大容量{}",configValue);
|
|
|
+ }
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(studentIds)) {
|
|
|
throw new BizException("学生id不能为空");
|
|
|
}
|