|
@@ -131,6 +131,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
@Autowired
|
|
|
private RedisTemplate<Object, Object> redisTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICommunityArticleAtService communityArticleAtService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询文章列表
|
|
|
*
|
|
@@ -748,6 +751,29 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
collectionArticleService.saveBatch(collectionArticles);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // at 人插入at通知表 判断是不是草稿箱 草稿箱不需要通知
|
|
|
+ if (!communityArticle.getIsDraft()) {
|
|
|
+ //拿到需要At人的ID
|
|
|
+ List<Long> atUserIds = communityArticle.getAtUserIds();
|
|
|
+
|
|
|
+ if (atUserIds != null && !atUserIds.isEmpty()) {
|
|
|
+ List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
|
|
|
+ CommunityArticleAt communityArticleAt = null;
|
|
|
+ for (Long atUserId : atUserIds) {
|
|
|
+ communityArticleAt = new CommunityArticleAt();
|
|
|
+ communityArticleAt.setType(0L);
|
|
|
+ communityArticleAt.setArticleId(communityArticle.getId());
|
|
|
+ communityArticleAt.setUserId(userId);
|
|
|
+ communityArticleAt.setPeerId(atUserId);
|
|
|
+ communityArticleAt.setCreateBy(userId);
|
|
|
+ communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ communityArticleAts.add(communityArticleAt);
|
|
|
+ }
|
|
|
+ communityArticleAtService.saveBatch(communityArticleAts);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -882,7 +908,6 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
//插入合集
|
|
|
List<String> collectionIds = communityArticle.getCollectionIds();
|
|
|
|
|
|
-
|
|
|
if (collectionIds != null && !collectionIds.isEmpty()) {
|
|
|
//插入合集 都失效
|
|
|
collectionArticleService.update(
|
|
@@ -909,6 +934,29 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
collectionArticleService.saveBatch(collectionArticles);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ // at 人插入at通知表 判断是不是草稿箱 草稿箱不需要通知
|
|
|
+ if (!communityArticle.getIsDraft()) {
|
|
|
+ //拿到需要At人的ID
|
|
|
+ List<Long> atUserIds = communityArticle.getAtUserIds();
|
|
|
+
|
|
|
+ if (atUserIds != null && !atUserIds.isEmpty()) {
|
|
|
+ List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
|
|
|
+ CommunityArticleAt communityArticleAt = null;
|
|
|
+ for (Long atUserId : atUserIds) {
|
|
|
+ communityArticleAt = new CommunityArticleAt();
|
|
|
+ communityArticleAt.setType(0L);
|
|
|
+ communityArticleAt.setArticleId(communityArticle.getId());
|
|
|
+ communityArticleAt.setUserId(userId);
|
|
|
+ communityArticleAt.setPeerId(atUserId);
|
|
|
+ communityArticleAt.setCreateBy(userId);
|
|
|
+ communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ communityArticleAts.add(communityArticleAt);
|
|
|
+ }
|
|
|
+ communityArticleAtService.saveBatch(communityArticleAts);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -934,8 +982,26 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
}
|
|
|
|
|
|
communityArticleComment.setAddress(address);
|
|
|
-
|
|
|
communityArticleCommentMapper.insert(communityArticleComment);
|
|
|
+
|
|
|
+ //拿到需要At人的ID
|
|
|
+ List<Long> atUserIds = communityArticleComment.getAtUserIds();
|
|
|
+ if (atUserIds != null && !atUserIds.isEmpty()) {
|
|
|
+ List<CommunityArticleAt> communityArticleAts = new ArrayList<>();
|
|
|
+ CommunityArticleAt communityArticleAt = null;
|
|
|
+ for (Long atUserId : atUserIds) {
|
|
|
+ communityArticleAt = new CommunityArticleAt();
|
|
|
+ communityArticleAt.setType(1L);
|
|
|
+ communityArticleAt.setArticleId(communityArticleComment.getArticleId());
|
|
|
+ communityArticleAt.setCommentId(communityArticleComment.getId());
|
|
|
+ communityArticleAt.setUserId(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ communityArticleAt.setPeerId(atUserId);
|
|
|
+ communityArticleAt.setCreateBy(SecurityUtils.getLoginUser().getUserId());
|
|
|
+ communityArticleAt.setCreateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
+ communityArticleAts.add(communityArticleAt);
|
|
|
+ }
|
|
|
+ communityArticleAtService.saveBatch(communityArticleAts);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|