|
@@ -20,7 +20,6 @@ import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.service.*;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherAuthEntryRecordVo;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherHomeVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
|
|
|
import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.toolset.base.exception.BizException;
|
|
@@ -36,6 +35,7 @@ import com.yonge.cooleshow.biz.dal.dao.TeacherDao;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -148,8 +148,8 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
|
|
|
|
|
|
@Override
|
|
|
public HttpResponseResult<Boolean> openLive(Long id) {
|
|
|
- TeacherTotalVo totalVo = (TeacherTotalVo) redissonClient.getBucket(CacheNameEnum.TEACHER_TOTAL.getRedisKey(id)).get();
|
|
|
- if (null == totalVo) {
|
|
|
+ TeacherTotal teacherTotal = (TeacherTotal) redissonClient.getBucket(CacheNameEnum.TEACHER_TOTAL.getRedisKey(id)).get();
|
|
|
+ if (null == teacherTotal) {
|
|
|
return HttpResponseResult.succeed(false);
|
|
|
}
|
|
|
//开通直播需要粉丝数
|
|
@@ -157,7 +157,7 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
|
|
|
//开通直播需要已完成课时数
|
|
|
Integer overClass = Integer.parseInt(sysConfigService.findByParamName(SysConfigConstant.OPEN_LIVE_OVER_CLASS).getParamValue());
|
|
|
//根据老师规则,判断老师直播权限
|
|
|
- if (totalVo.getFansNum() >= fansNum && totalVo.getExpTime() >= overClass) {
|
|
|
+ if (teacherTotal.getFansNum() >= fansNum && teacherTotal.getExpTime() >= overClass) {
|
|
|
Teacher teacher = new Teacher();
|
|
|
teacher.setUserId(id);
|
|
|
teacher.setLiveFlag(YesOrNoEnum.YES);
|
|
@@ -300,7 +300,10 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
|
|
|
|
|
|
@Override
|
|
|
public Integer setSubject(Long id, String subjectIds) {
|
|
|
- return baseMapper.setSubject(id, subjectIds);
|
|
|
+ Integer integer = baseMapper.setSubject(id, subjectIds);
|
|
|
+ //清除老师声部缓存
|
|
|
+ redissonClient.getBucket(CacheNameEnum.TEACHER_SUBJECT_ITEM.getRedisKey(id)).delete();
|
|
|
+ return integer;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -354,4 +357,16 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
|
|
|
Integer num = baseMapper.addHomeBrowse(userId);
|
|
|
return HttpResponseResult.succeed(num > 0);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Subject> querySubjectItem(Long id) {
|
|
|
+ List<Subject> subjectList = (List<Subject>) redissonClient.getBucket(CacheNameEnum.TEACHER_SUBJECT_ITEM.getRedisKey(id)).get();
|
|
|
+ if (null == subjectList) {
|
|
|
+ subjectList = baseMapper.querySubjectItem(id);
|
|
|
+ redissonClient.getBucket(CacheNameEnum.TEACHER_SUBJECT_ITEM.getRedisKey(id))
|
|
|
+ .set(subjectList, CacheNameEnum.TEACHER_SUBJECT_ITEM.getDuration().toHours(),
|
|
|
+ TimeUnit.HOURS);
|
|
|
+ }
|
|
|
+ return subjectList;
|
|
|
+ }
|
|
|
}
|