diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java index 9b5e26f..04bf79b 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java @@ -96,14 +96,17 @@ public class PublishController { */ @ApiOperation(value = "精选/取消精选") @GetMapping("elite") - public R elitePublish(@NotNull(message = "社区id不能为空") + public R elitePublish(@NotNull(message = "租户id不能为空") + @ApiParam(value = "租户id") + @Valid Long tenantId, + @NotNull(message = "社区id不能为空") @ApiParam(value = "社区id") @Valid Long communityId, @NotNull(message = "发布文章id不能为空") @ApiParam(value = "发布文章id") @Valid Long publishId) { - publishService.elitePublish(communityId, publishId); - return R.ok(); + + return publishService.elitePublish(tenantId, communityId, publishId); } /** diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java index 756fcb7..ad5133a 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java @@ -44,7 +44,7 @@ public interface PublishMapper extends BaseMapper { @Param("communityId") Long communityId); - void elitePublish(@Param("communityId") Long communityId, @Param("publishId") Long publishId); + void elitePublish(@Param("tenantId") Long tenantId, @Param("communityId") Long communityId, @Param("publishId") Long publishId); @InterceptorIgnore(tenantLine = "true") List publishList(Page page, @Param("publishPageRes") PublishPageRes publishPageRes); @@ -62,4 +62,7 @@ public interface PublishMapper extends BaseMapper { @InterceptorIgnore(tenantLine = "true") void removePublish(@Param("publishRemoveRes") PublishRemoveRes publishRemoveRes); + + @InterceptorIgnore(tenantLine = "true") + void updateLikeNum(@Param("publish") Publish publish); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java index a7a0570..c9d78f1 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java @@ -31,7 +31,7 @@ public interface PublishService extends IService { TableDataInfo publishFile(@Valid PublishPageRes publishPageRes); - void elitePublish(Long communityId, Long publishId); + R elitePublish(Long tenantId, Long communityId, Long publishId); TableDataInfo publishList(PublishPageRes publishPageRes); diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCollectServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCollectServiceImpl.java index 2e9c4a9..59a4c38 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCollectServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCollectServiceImpl.java @@ -34,7 +34,6 @@ public class PublishCollectServiceImpl extends ServiceImpl page = initPage(myPublishCollectPageRes); @@ -45,6 +44,23 @@ public class PublishCollectServiceImpl extends ServiceImpl impl } @Override - public void elitePublish(Long communityId, Long publishId) { - baseMapper.elitePublish(communityId, publishId); + public R elitePublish(Long tenantId, Long communityId, Long publishId) { + + CommunityUser communityUser = communityUserMapper.selectCommunityUser(tenantId, communityId, SecurityUtils.getUserId()); + if (Objects.isNull(communityUser)) { + return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是该社区成员"); + } + if ("1".equals(communityUser.getIsBlack())) { + return R.fail(HttpStatus.SHOW_ERROR_MSG, "您已被拉黑"); + } + if (communityUser.getUserType() != 2) { + return R.fail(HttpStatus.SHOW_ERROR_MSG, "您不是群主"); + } + baseMapper.elitePublish(tenantId, communityId, publishId); + return R.ok(); } @Override @@ -331,7 +343,7 @@ public class PublishServiceImpl extends ServiceImpl impl return; } - if (publishCollect.getDelFlag().equals("0")) { + if ("0".equals(publishCollect.getDelFlag())) { publishCollect.setDelFlag("2"); } else { publishCollect.setDelFlag("0"); diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishCollectMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishCollectMapper.xml index aa7cf4d..b57b25d 100644 --- a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishCollectMapper.xml +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishCollectMapper.xml @@ -17,23 +17,22 @@ select id, tenant_id, @@ -108,10 +118,6 @@ select p.*, u.nick_name as user_name, u.avatar from cc_publish p left join sys_user u on p.user_id = u.user_id - left join cc_publish_like pl on pl.tenant_id = p.tenant_id and pl.community_id = p.community_id and p.id = - pl.publish_id - left join cc_publish_collect pc on p.id = pc.publish_id and p.tenant_id = pc.tenant_id and - p.community_id = pc.community_id and p.tenant_id = #{publishPageRes.tenantId} and p.community_id = #{publishPageRes.communityId}