|
|
@@ -2,6 +2,7 @@ package com.fs.course.service.impl;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.fs.common.core.domain.R;
|
|
|
@@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fs.course.param.FsCourseWatchCommentListParam;
|
|
|
import com.fs.course.param.FsCourseWatchCommentPageParam;
|
|
|
import com.fs.course.param.FsCourseWatchCommentSaveParam;
|
|
|
+import com.fs.course.vo.CommentImportTemplate;
|
|
|
import com.fs.course.vo.FsCourseWatchCommentListVO;
|
|
|
import com.fs.course.vo.FsCourseWatchCommentVO;
|
|
|
import com.fs.qw.mapper.QwExternalContactMapper;
|
|
|
@@ -42,7 +44,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
private QwExternalContactMapper qwExternalContactMapper;
|
|
|
|
|
|
@Autowired
|
|
|
- public RedisTemplate<String,String> redisTemplate;
|
|
|
+ public RedisTemplate<String, String> redisTemplate;
|
|
|
|
|
|
@Autowired
|
|
|
private SysKeywordMapper mapper;
|
|
|
@@ -54,8 +56,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 看课评论
|
|
|
*/
|
|
|
@Override
|
|
|
- public FsCourseWatchComment selectFsCourseWatchCommentByCommentId(Long commentId)
|
|
|
- {
|
|
|
+ public FsCourseWatchComment selectFsCourseWatchCommentByCommentId(Long commentId) {
|
|
|
return baseMapper.selectFsCourseWatchCommentByCommentId(commentId);
|
|
|
}
|
|
|
|
|
|
@@ -66,8 +67,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 看课评论
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam)
|
|
|
- {
|
|
|
+ public List<FsCourseWatchCommentListVO> selectFsCourseWatchCommentList(FsCourseWatchCommentPageParam fsCourseWatchCommentPageParam) {
|
|
|
return baseMapper.selectFsCourseWatchCommentList(fsCourseWatchCommentPageParam);
|
|
|
}
|
|
|
|
|
|
@@ -78,12 +78,23 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int insertFsCourseWatchComment(FsCourseWatchComment fsCourseWatchComment)
|
|
|
- {
|
|
|
+ public int insertFsCourseWatchComment(FsCourseWatchComment fsCourseWatchComment) {
|
|
|
fsCourseWatchComment.setCreateTime(DateUtils.getNowDate());
|
|
|
return baseMapper.insertFsCourseWatchComment(fsCourseWatchComment);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public int insertBatch(List<CommentImportTemplate> list) {
|
|
|
+ AtomicInteger i = new AtomicInteger(0);
|
|
|
+ list.forEach(item -> {
|
|
|
+ FsCourseWatchComment fsCourseWatchComment = new FsCourseWatchComment();
|
|
|
+ BeanUtils.copyProperties(item, fsCourseWatchComment);
|
|
|
+ fsCourseWatchComment.setCreateTime(DateUtils.getNowDate());
|
|
|
+ i.addAndGet(baseMapper.insertFsCourseWatchComment(fsCourseWatchComment));
|
|
|
+ });
|
|
|
+ return i.get();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改看课评论
|
|
|
*
|
|
|
@@ -91,8 +102,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int updateFsCourseWatchComment(FsCourseWatchComment fsCourseWatchComment)
|
|
|
- {
|
|
|
+ public int updateFsCourseWatchComment(FsCourseWatchComment fsCourseWatchComment) {
|
|
|
fsCourseWatchComment.setUpdateTime(DateUtils.getNowDate());
|
|
|
return baseMapper.updateFsCourseWatchComment(fsCourseWatchComment);
|
|
|
}
|
|
|
@@ -104,8 +114,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteFsCourseWatchCommentByCommentIds(Long[] commentIds)
|
|
|
- {
|
|
|
+ public int deleteFsCourseWatchCommentByCommentIds(Long[] commentIds) {
|
|
|
return baseMapper.deleteFsCourseWatchCommentByCommentIds(commentIds);
|
|
|
}
|
|
|
|
|
|
@@ -116,21 +125,20 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
- public int deleteFsCourseWatchCommentByCommentId(Long commentId)
|
|
|
- {
|
|
|
+ public int deleteFsCourseWatchCommentByCommentId(Long commentId) {
|
|
|
return baseMapper.deleteFsCourseWatchCommentByCommentId(commentId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public R saveH5CourseWatchComment(FsCourseWatchCommentSaveParam param) {
|
|
|
// 需求:查询是否包含关键字,包含则不保存,并且需要将用户标记为黑名单;
|
|
|
- Set<String> keywords = redisTemplate.opsForSet().members(REDIS_KEY);
|
|
|
- if(keywords == null || keywords.isEmpty()){
|
|
|
+ Set<String> keywords = redisTemplate.opsForSet().members(REDIS_KEY);
|
|
|
+ if (keywords == null || keywords.isEmpty()) {
|
|
|
SysKeyword sysKeywordParam = new SysKeyword();
|
|
|
List<SysKeyword> sysKeywords = mapper.selectSysKeywordList(sysKeywordParam);
|
|
|
keywords = sysKeywords.stream().map(SysKeyword::getKeyword).collect(Collectors.toSet());
|
|
|
}
|
|
|
- if(!keywords.isEmpty()){
|
|
|
+ if (!keywords.isEmpty()) {
|
|
|
for (String keyword : keywords) {
|
|
|
if (param.getContent().contains(keyword)) {
|
|
|
//标记用户为黑名单,并且不保存数据
|
|
|
@@ -153,7 +161,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
@Override
|
|
|
public R revokeH5CourseWatchComment(Long commentId) {
|
|
|
int i = baseMapper.revokeH5CourseWatchComment(commentId);
|
|
|
- if (i > 0){
|
|
|
+ if (i > 0) {
|
|
|
return R.ok();
|
|
|
} else {
|
|
|
return R.error();
|
|
|
@@ -162,7 +170,7 @@ public class FsCourseWatchCommentServiceImpl extends ServiceImpl<FsCourseWatchCo
|
|
|
|
|
|
@Override
|
|
|
public List<FsCourseWatchCommentVO> selectH5CourseWatchComments(FsCourseWatchCommentListParam param) {
|
|
|
- if(param.getOpenCommentStatus() != null && 2 == param.getOpenCommentStatus()){
|
|
|
+ if (param.getOpenCommentStatus() != null && 2 == param.getOpenCommentStatus()) {
|
|
|
return baseMapper.selectH5CourseWatchCommentsRound(param);
|
|
|
} else {
|
|
|
return baseMapper.selectH5CourseWatchComments(param);
|