|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.ruoyi.app.domain.*;
|
|
|
+import com.ruoyi.app.domain.vo.AppMemberVo;
|
|
|
import com.ruoyi.app.service.*;
|
|
|
import com.ruoyi.common.constant.HttpStatus;
|
|
|
import com.ruoyi.common.core.page.PageDomain;
|
|
@@ -40,6 +41,8 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
private ITbPublishCommentService commentService;
|
|
|
@Autowired
|
|
|
private ITbAppUserService userService;
|
|
|
+ @Autowired
|
|
|
+ private ITbMyFriendsService friendsService;
|
|
|
|
|
|
protected void startPage() {
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
@@ -110,6 +113,9 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITbFamilyService familyService;
|
|
|
+
|
|
|
/**
|
|
|
* 我的近况详情
|
|
|
* @param id
|
|
@@ -119,6 +125,20 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
public TbMyPublish getPublish(Long id) {
|
|
|
TbMyPublish publish = this.getById(id);
|
|
|
if (publish != null) {
|
|
|
+ Long familyId = null;
|
|
|
+ TbFamilyMember member = memberService.getOne(new LambdaQueryWrapper<TbFamilyMember>()
|
|
|
+ .eq(TbFamilyMember::getAppUserId,publish.getAppUserId())
|
|
|
+ .last("limit 1")
|
|
|
+ );
|
|
|
+ if (member != null) {
|
|
|
+ TbFamily family = familyService.myFamily(member.getId());
|
|
|
+ if (family != null) {
|
|
|
+ familyId = family.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 只能看好友和族友的点赞、评论
|
|
|
+ List<Long> fids = getMyFrientIds(publish.getAppUserId(), familyId);
|
|
|
+
|
|
|
// 图片列表
|
|
|
List<TbPublishImg> publishImgs = imgService.list(new LambdaQueryWrapper<TbPublishImg>()
|
|
|
.in(TbPublishImg::getPublishId, id)
|
|
@@ -126,10 +146,12 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
// 点赞列表
|
|
|
List<TbPublishThumbs> thumbsList = thumbsService.selectList(new LambdaQueryWrapper<TbPublishThumbs>()
|
|
|
.in(TbPublishThumbs::getPublishId, id)
|
|
|
+ .in(fids.size() > 0,TbPublishThumbs::getAppUserId, fids)
|
|
|
);
|
|
|
// 评论列表
|
|
|
List<TbPublishComment> commentList = commentService.selectList(new LambdaQueryWrapper<TbPublishComment>()
|
|
|
.in(TbPublishComment::getPublishId, id)
|
|
|
+ .in(fids.size() > 0,TbPublishComment::getAppUserId, fids)
|
|
|
);
|
|
|
//点赞数
|
|
|
int thumbs = this.getThumbs(id);
|
|
@@ -235,6 +257,8 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
return commentService.removeById(id);
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITbFamilyMemberService memberService;
|
|
|
|
|
|
/**
|
|
|
* 族友圈列表
|
|
@@ -250,15 +274,20 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
list.forEach(item -> {
|
|
|
ids.add(item.getId());
|
|
|
});
|
|
|
+ // 只能看好友和族友的点赞、评论
|
|
|
+ List<Long> fids = getMyFrientIds(appUserId, familyId);
|
|
|
+
|
|
|
// 族友圈中放入图片列表 点赞列表 评论列表
|
|
|
List<TbPublishImg> imgList = imgService.list(new LambdaQueryWrapper<TbPublishImg>()
|
|
|
.in(TbPublishImg::getPublishId, ids)
|
|
|
);
|
|
|
List<TbPublishThumbs> thumbsList = thumbsService.selectList(new LambdaQueryWrapper<TbPublishThumbs>()
|
|
|
.in(TbPublishThumbs::getPublishId, ids)
|
|
|
+ .in(fids.size() > 0,TbPublishThumbs::getAppUserId, fids)
|
|
|
);
|
|
|
List<TbPublishComment> commentList = commentService.selectList(new LambdaQueryWrapper<TbPublishComment>()
|
|
|
.in(TbPublishComment::getPublishId, ids)
|
|
|
+ .in(fids.size() > 0,TbPublishComment::getAppUserId, fids)
|
|
|
);
|
|
|
list.forEach(item -> {
|
|
|
// 加入图片列表
|
|
@@ -288,4 +317,38 @@ public class TbMyPublishServiceImpl extends ServiceImpl<TbMyPublishMapper, TbMyP
|
|
|
});
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取好友、族友的id
|
|
|
+ * @param appUserId
|
|
|
+ * @param familyId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<Long> getMyFrientIds(Long appUserId, Long familyId){
|
|
|
+ List<Long> fids = new ArrayList<>();
|
|
|
+ if (appUserId != null) {
|
|
|
+ // 好友列表
|
|
|
+ TbMyFriends tbMyFriends = new TbMyFriends();
|
|
|
+ tbMyFriends.setAppUserId(appUserId);
|
|
|
+ tbMyFriends.setStatus("2");
|
|
|
+ List<TbMyFriends> friendsList = friendsService.pageList(tbMyFriends);
|
|
|
+ if (friendsList.size() > 0) {
|
|
|
+ friendsList.forEach(item -> {
|
|
|
+ fids.add(item.getAppUserId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (familyId != null) {
|
|
|
+ // 族友列表
|
|
|
+ AppMemberVo memberVo = new AppMemberVo();
|
|
|
+ memberVo.setFamilyId(familyId);
|
|
|
+ List<AppMemberVo> memberList = memberService.selectFamilyMember(memberVo);
|
|
|
+ if (memberList.size() > 0) {
|
|
|
+ memberList.forEach(item -> {
|
|
|
+ fids.add(item.getUserId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return fids;
|
|
|
+ }
|
|
|
}
|