|
@@ -33,6 +33,7 @@ import com.yonge.toolset.base.page.PageInfo;
|
|
|
import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
|
import com.yonge.toolset.utils.obj.ObjectUtil;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.redisson.api.RMap;
|
|
@@ -43,6 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -1581,7 +1583,15 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* @Date: 2022/5/27
|
|
|
*/
|
|
|
public PianoRoomTimeVo selectRemainTime(Long teacherId) {
|
|
|
- return pianoRoomTimeDao.selectRemainTime(teacherId);
|
|
|
+ PianoRoomTimeVo roomTimeVo = pianoRoomTimeDao.selectRemainTime(teacherId);
|
|
|
+ if (roomTimeVo != null) {
|
|
|
+ return roomTimeVo;
|
|
|
+ } else {
|
|
|
+ PianoRoomTimeVo pianoRoomTimeVo = new PianoRoomTimeVo();
|
|
|
+ pianoRoomTimeVo.setTeacherId(teacherId);
|
|
|
+ pianoRoomTimeVo.setStudentCount(pianoRoomTimeDao.countStudent(teacherId));
|
|
|
+ return pianoRoomTimeVo;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1619,8 +1629,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
Integer consumeTime = arrangeCourseVo.getConsumeTime();
|
|
|
|
|
|
Integer configValue = Integer.valueOf(sysConfigService.findConfigValue(SysConfigConstant.PIANO_ROOM_MAX_STUDENTS));
|
|
|
- if (studentIds.size()>configValue){
|
|
|
- throw new BizException("成课学员人数超过房间最大容量{}",configValue);
|
|
|
+ if (studentIds.size() > configValue) {
|
|
|
+ throw new BizException("成课学员人数超过房间最大容量{}", configValue);
|
|
|
}
|
|
|
|
|
|
//校验课时
|
|
@@ -1635,7 +1645,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
|
|
|
//校验上下课时间
|
|
|
for (int i = 0; i < timeList.size(); i++) {
|
|
|
- if (timeList.get(i).getStartTime().before(new Date())){
|
|
|
+ if (timeList.get(i).getStartTime().before(new Date())) {
|
|
|
throw new BizException("上课时间必须大于当前时间");
|
|
|
}
|
|
|
if (!DateUtil.offsetMinute(timeList.get(i).getStartTime(), singleClssTime).equals(timeList.get(i).getEndTime())) {
|
|
@@ -1739,9 +1749,9 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
|
|
|
//创建群聊
|
|
|
try {
|
|
|
- imGroupService.autoCreate(courseGroup.getId(),CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
|
|
|
+ imGroupService.autoCreate(courseGroup.getId(), CourseScheduleEnum.PIANO_ROOM_CLASS.getCode());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("琴房课程组id:{},创建群聊失败:{}",courseGroup.getId(),e);
|
|
|
+ log.error("琴房课程组id:{},创建群聊失败:{}", courseGroup.getId(), e);
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
@@ -1847,7 +1857,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
try {
|
|
|
imGroupService.dismiss(String.valueOf(groupId));
|
|
|
} catch (Exception e) {
|
|
|
- log.error("琴房课程组id:{},关闭群聊失败:{}",groupId,e);
|
|
|
+ log.error("琴房课程组id:{},关闭群聊失败:{}", groupId, e);
|
|
|
}
|
|
|
} else {
|
|
|
courseGroupService.update(null, Wrappers.<CourseGroup>lambdaUpdate()
|
|
@@ -1875,7 +1885,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
courseTime.setEndTime(endTime);
|
|
|
List<CourseTimeEntity> timeList = Arrays.asList(courseTime);
|
|
|
|
|
|
- if (startTime.before(new Date())){
|
|
|
+ if (startTime.before(new Date())) {
|
|
|
throw new BizException("上课时间必须大于当前时间");
|
|
|
}
|
|
|
|
|
@@ -1928,8 +1938,8 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
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 (studentIds.size() > configValue) {
|
|
|
+ throw new BizException("成课学员人数超过房间最大容量{}", configValue);
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isEmpty(studentIds)) {
|