|
@@ -2,20 +2,14 @@ package com.zhongzheng.modules.course.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
-import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
|
|
|
import com.zhongzheng.modules.course.domain.CourseSection;
|
|
|
-import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
|
|
|
import com.zhongzheng.modules.course.service.ICourseSectionService;
|
|
|
import com.zhongzheng.modules.course.vo.CourseSectionVo;
|
|
|
-import com.zhongzheng.modules.polyv.service.IPolyvVideoService;
|
|
|
-import com.zhongzheng.modules.polyv.vo.PolyvVideoQuerVo;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -31,17 +25,11 @@ import java.util.stream.Collectors;
|
|
|
* 课程小节Service业务层处理
|
|
|
*
|
|
|
* @author hjl
|
|
|
- * @date 2021-05-19
|
|
|
+ * @date 2021-10-11
|
|
|
*/
|
|
|
@Service
|
|
|
public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, CourseSection> implements ICourseSectionService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private IPolyvVideoService iPolyvVideoService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private CourseSectionMapper courseSectionMapper;
|
|
|
-
|
|
|
@Override
|
|
|
public CourseSectionVo queryById(Long sectionId){
|
|
|
CourseSection db = this.baseMapper.selectById(sectionId);
|
|
@@ -51,19 +39,21 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
@Override
|
|
|
public List<CourseSectionVo> queryList(CourseSectionQueryBo bo) {
|
|
|
LambdaQueryWrapper<CourseSection> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(bo.getChapterId() != null, CourseSection::getChapterId, bo.getChapterId());
|
|
|
lqw.like(StrUtil.isNotBlank(bo.getName()), CourseSection::getName, bo.getName());
|
|
|
- lqw.eq(StrUtil.isNotBlank(bo.getVideoUrl()), CourseSection::getVideoUrl, bo.getVideoUrl());
|
|
|
- lqw.eq(bo.getVideoTime() != null, CourseSection::getVideoTime, bo.getVideoTime());
|
|
|
- lqw.in(bo.getStatus() != null, CourseSection::getStatus, bo.getStatus());
|
|
|
+ lqw.eq(bo.getSort() != null, CourseSection::getSort, bo.getSort());
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getPrefixName()), CourseSection::getPrefixName, bo.getPrefixName());
|
|
|
+ lqw.eq(bo.getStatus() != null, CourseSection::getStatus, bo.getStatus());
|
|
|
+ lqw.eq(bo.getSectionType() != null, CourseSection::getSectionType, bo.getSectionType());
|
|
|
+ lqw.eq(bo.getPublishStatus() != null, CourseSection::getPublishStatus, bo.getPublishStatus());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getLiveUrl()), CourseSection::getLiveUrl, bo.getLiveUrl());
|
|
|
+ lqw.eq(bo.getLiveStartTime() != null, CourseSection::getLiveStartTime, bo.getLiveStartTime());
|
|
|
+ lqw.eq(bo.getLiveEndTime() != null, CourseSection::getLiveEndTime, bo.getLiveEndTime());
|
|
|
+ lqw.eq(bo.getLiveDuration() != null, CourseSection::getLiveDuration, bo.getLiveDuration());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getRecordingUrl()), CourseSection::getRecordingUrl, bo.getRecordingUrl());
|
|
|
+ lqw.eq(bo.getRecordingDuration() != null, CourseSection::getRecordingDuration, bo.getRecordingDuration());
|
|
|
return entity2Vo(this.list(lqw));
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<CourseSectionVo> selectList(CourseSectionQueryBo bo) {
|
|
|
- return courseSectionMapper.selectCourseSectionList(bo);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 实体类转化成视图对象
|
|
|
*
|
|
@@ -106,21 +96,8 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
|
|
|
*
|
|
|
* @param entity 实体类数据
|
|
|
*/
|
|
|
- private void validEntityBeforeSave(CourseSection entity) {
|
|
|
+ private void validEntityBeforeSave(CourseSection entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
- if(StringUtils.isNotBlank(entity.getVid())){
|
|
|
- try{
|
|
|
- PolyvVideoQuerVo polyvVideo = iPolyvVideoService.queryById(entity.getVid());
|
|
|
- if(polyvVideo == null){
|
|
|
- throw new CustomException("保利威视频不存在");
|
|
|
- }
|
|
|
- entity.setPolyvId(polyvVideo.getPolyvId());
|
|
|
- }catch (Exception e){
|
|
|
- throw new CustomException("保利威视频错误");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|