|
@@ -28,6 +28,7 @@ import com.yonge.cooleshow.common.page.PageInfo;
|
|
|
import com.yonge.toolset.utils.date.DateUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.redisson.api.RMap;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -49,7 +50,6 @@ import java.util.function.Function;
|
|
|
* @author hgw
|
|
|
* @since 2022-03-18 15:29:11
|
|
|
*/
|
|
|
-@Validated
|
|
|
@Service("courseScheduleService")
|
|
|
public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, CourseSchedule> implements CourseScheduleService {
|
|
|
|
|
@@ -201,46 +201,6 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 锁定课时
|
|
|
- *
|
|
|
- * @param id 课程id
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @Override
|
|
|
- public void lockCourseTime(Long id) {
|
|
|
- CourseSchedule course = new CourseSchedule();
|
|
|
- course.setId(id);
|
|
|
- course.setLock(1);
|
|
|
- course.setLockTime(new Date());
|
|
|
- this.updateById(course);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 解锁
|
|
|
- *
|
|
|
- * @param id 课程id
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @Override
|
|
|
- public void unlockCourseTime(Long id) {
|
|
|
- CourseSchedule course = new CourseSchedule();
|
|
|
- course.setId(id);
|
|
|
- course.setLock(0);
|
|
|
- course.setLockTime(new Date());
|
|
|
- this.updateById(course);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加课时
|
|
|
- */
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- @Override
|
|
|
- public void add(@Valid CourseSchedule course) {
|
|
|
- CourseScheduleEnum.existCourseType(course.getType(), "课程类型不正确");
|
|
|
- this.save(course);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 创建直播课时选课时的日历
|
|
|
* <P>主要查询该老师目前的课程时间
|
|
|
* <P>根据传入的单课时时长将时间分片后来匹配数据库中课程时间,得到每日空余时间
|
|
@@ -678,7 +638,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
*/
|
|
|
public MyCourseSearch monthToDate(MyCourseSearch search) {
|
|
|
String classMonth = search.getClassMonth();
|
|
|
- if (StringUtils.isBlank(classMonth)){
|
|
|
+ if (StringUtils.isBlank(classMonth)) {
|
|
|
return search;
|
|
|
}
|
|
|
String[] classDateSp = classMonth.split("-");
|
|
@@ -742,22 +702,22 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* @Date: 2022/4/18
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String,Object> queryCourseUser(MyCourseSearch search) {
|
|
|
+ public Map<String, Object> queryCourseUser(MyCourseSearch search) {
|
|
|
List<CourseStudent> studentList = baseMapper.queryCourseUser(search);
|
|
|
|
|
|
Map<String, String> sysConfig = new HashMap<>();
|
|
|
//提前XX分钟创建/进入陪练课房间时间
|
|
|
- sysConfig.put("practiceStartTime",sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PRACTICE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("practiceStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PRACTICE_ROOM_MINUTE));
|
|
|
//陪练课结束后,XX分钟关闭房间
|
|
|
- sysConfig.put("practiceEndTime",sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PRACTICE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("practiceEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PRACTICE_ROOM_MINUTE));
|
|
|
//提前XX分钟创建/进入直播房间的时间
|
|
|
- sysConfig.put("liveStartTime",sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("liveStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
|
|
|
//直播结束后,XX分钟关闭房间
|
|
|
- sysConfig.put("liveEndTime",sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("liveEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
|
|
|
|
|
|
- Map map=new HashMap();
|
|
|
- map.put("sysConfig",sysConfig);
|
|
|
- map.put("studentList",studentList);
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("sysConfig", sysConfig);
|
|
|
+ map.put("studentList", studentList);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -770,10 +730,10 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
public IPage<PracticeTeacherVo> teacherList(IPage<PracticeTeacherVo> page, PracticeTeacherSearch search) {
|
|
|
String collation = search.getCollation();//排序规则
|
|
|
String sortField = search.getSortField();//排序字段
|
|
|
- if (StringUtils.isNotBlank(sortField)){
|
|
|
- if (StringUtils.isNotBlank(collation)){
|
|
|
- search.setSort(sortField+" "+collation);
|
|
|
- }else search.setSort(sortField);
|
|
|
+ if (StringUtils.isNotBlank(sortField)) {
|
|
|
+ if (StringUtils.isNotBlank(collation)) {
|
|
|
+ search.setSort(sortField + " " + collation);
|
|
|
+ } else search.setSort(sortField);
|
|
|
}
|
|
|
return page.setRecords(baseMapper.teacherList(page, search));
|
|
|
}
|
|
@@ -783,22 +743,51 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
|
|
|
* @Author: cy
|
|
|
* @Date: 2022/4/20
|
|
|
*/
|
|
|
- public Map<String,Object> queryCourseTeacher(MyCourseSearch search) {
|
|
|
- List<CourseStudent> teacherList=baseMapper.queryCourseTeacher(search);
|
|
|
+ public Map<String, Object> queryCourseTeacher(MyCourseSearch search) {
|
|
|
+ List<CourseStudent> teacherList = baseMapper.queryCourseTeacher(search);
|
|
|
Map<String, String> sysConfig = new HashMap<>();
|
|
|
//提前XX分钟创建/进入陪练课房间时间
|
|
|
- sysConfig.put("practiceStartTime",sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PRACTICE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("practiceStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_PRACTICE_ROOM_MINUTE));
|
|
|
//陪练课结束后,XX分钟关闭房间
|
|
|
- sysConfig.put("practiceEndTime",sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PRACTICE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("practiceEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_PRACTICE_ROOM_MINUTE));
|
|
|
//提前XX分钟创建/进入直播房间的时间
|
|
|
- sysConfig.put("liveStartTime",sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("liveStartTime", sysConfigService.findConfigValue(SysConfigConstant.PRE_CREATE_LIVE_ROOM_MINUTE));
|
|
|
//直播结束后,XX分钟关闭房间
|
|
|
- sysConfig.put("liveEndTime",sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
|
|
|
+ sysConfig.put("liveEndTime", sysConfigService.findConfigValue(SysConfigConstant.DESTROY_EXPIRED_LIVE_ROOM_MINUTE));
|
|
|
|
|
|
- Map map=new HashMap();
|
|
|
- map.put("sysConfig",sysConfig);
|
|
|
- map.put("studentList",teacherList);
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("sysConfig", sysConfig);
|
|
|
+ map.put("studentList", teacherList);
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 学生-查询直播课
|
|
|
+ *
|
|
|
+ * @param param 传入参数
|
|
|
+ * <p> - studentId 学生id
|
|
|
+ * <p> - courseState 课程状态 NOT_START未开始 ING进行中 COMPLETE已完成 CANCEL已取消
|
|
|
+ * <p> - classDate 查询时间-年月
|
|
|
+ * <p> - subjectId 声部id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<CourseStudent> queryStudentLiveCourse(Map<String, Object> param) {
|
|
|
+ String classDate = WrapperUtil.toStr(param, "classDate");
|
|
|
+ String[] classDateSp = classDate.split("-");
|
|
|
+ LocalDate firstDay;
|
|
|
+ try {
|
|
|
+ firstDay = LocalDate.of(Integer.parseInt(classDateSp[0]), Integer.parseInt(classDateSp[1]), 1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BizException("查询时间格式不正确 [" + classDate + "]");
|
|
|
+ }
|
|
|
+ //本月的最后一天
|
|
|
+ LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
+ param.put("type", CourseScheduleEnum.LIVE.getCode());
|
|
|
+ param.put("startDate", firstDay.toString());
|
|
|
+ param.put("endDate", lastDay.toString());
|
|
|
+ return baseMapper.queryStudentLiveCourse(param);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|