From d9ff507e5f4b1b013b0979f88370319abc1aeaea Mon Sep 17 00:00:00 2001 From: hy001 Date: Sun, 17 May 2026 14:48:11 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E5=8E=BB=E6=8E=89=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=A8=A1=E5=9D=97"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 94b9063dd634128125744c2b538695e13c305077. --- .../business/core/enums/CommonErrorEnum.java | 15 +- .../core/enums/DataApprovalTypeEnum.java | 28 +- .../core/enums/DynamicEventTypeEnum.java | 41 ++ .../business/enums/DynamicMessageEnum.java | 73 +++ .../event/approval/ApprovalDynamicEvent.java | 105 ++++ .../event/approval/CensorProfileEvent.java | 48 +- .../model/event/dynamic/DynamicEvent.java | 64 +++ .../event/gift/GiveAwayGiftBatchEvent.java | 9 +- .../business/constant/QueueNameConstant.java | 9 +- .../business/producer/DynamicMqMessage.java | 35 ++ .../rocket/business/streams/DynamicSink.java | 13 + .../console/inner/error/ConsoleErrorCode.java | 9 +- .../model/enums/message/NewsletterEvent.java | 11 +- .../ApprovalDataInfoClient.java | 30 +- .../dynamic/ApprovalDynamicClient.java | 15 + .../dynamic/ApprovalDynamicReportClient.java | 15 + .../ApprovalFamilySettingDataClient.java | 30 +- .../ApprovalUserSettingInfoClient.java | 30 +- .../dynamic/DynamicBlacklistClient.java | 15 + .../endpoint/dynamic/DynamicCacheClient.java | 15 + .../dynamic/DynamicContentClient.java | 15 + .../dynamic/DynamicPictureClient.java | 15 + .../endpoint/dynamic/DynamicTagClient.java | 15 + .../dynamic/DynamicTimelineClient.java | 15 + .../endpoint/dynamic/TopDynamicClient.java | 15 + .../api/ApprovalDataInfoClientApi.java | 38 +- .../dynamic/api/ApprovalDynamicClientApi.java | 34 ++ .../api/ApprovalDynamicReportClientApi.java | 26 + .../ApprovalFamilySettingDataClientApi.java | 52 +- .../api/ApprovalUserSettingInfoClientApi.java | 56 +- .../api/DynamicBlacklistClientApi.java | 32 ++ .../dynamic/api/DynamicCacheClientApi.java | 25 + .../dynamic/api/DynamicContentClientApi.java | 41 ++ .../dynamic/api/DynamicPictureClientApi.java | 26 + .../dynamic/api/DynamicTagClientApi.java | 31 ++ .../dynamic/api/DynamicTimelineClientApi.java | 20 + .../dynamic/api/TopDynamicClientApi.java | 24 + .../other/inner/asserts/DynamicErrorCode.java | 113 ++++ .../other/inner/asserts/OtherErrorCode.java | 483 +++++++++--------- .../cmd/approval/ApprovalDynamicCmd.java | 28 + .../approval/ApprovalDynamicContentCmd.java | 79 +++ .../cmd/approval/ApprovalDynamicQryCmd.java | 54 ++ .../approval/ApprovalDynamicReportCmd.java | 43 ++ .../approval/ApprovalDynamicReportQryCmd.java | 49 ++ .../cmd/dynamic/CreateDynamicVideoCmd.java | 74 +++ .../cmd/dynamic/DelDynamicContentCmd.java | 28 + .../cmd/dynamic/DynamicBlacklistCmd.java | 43 ++ .../cmd/dynamic/DynamicBlacklistQryCmd.java | 36 ++ .../model/cmd/dynamic/DynamicContentCmd.java | 81 +++ .../cmd/dynamic/DynamicContentQryCmd.java | 52 ++ .../model/cmd/dynamic/DynamicPictureCmd.java | 87 ++++ .../cmd/dynamic/DynamicPopularConfigCmd.java | 45 ++ .../model/cmd/dynamic/DynamicTagCmd.java | 65 +++ .../model/cmd/dynamic/DynamicTimelineCmd.java | 55 ++ .../cmd/dynamic/PageDynamicTagQryCmd.java | 40 ++ .../model/cmd/dynamic/TopDynamicCmd.java | 51 ++ .../dto/approval/ApprovalDynamicDTO.java | 81 +++ .../approval/ApprovalDynamicReportedDTO.java | 98 ++++ .../model/dto/dynamic/DynamicContentDTO.java | 71 +++ .../model/dto/dynamic/DynamicPictureDTO.java | 107 ++++ .../dto/dynamic/DynamicPopularConfigDTO.java | 44 ++ .../model/dto/dynamic/DynamicTagDTO.java | 79 +++ .../dto/dynamic/PageDynamicBlacklistDTO.java | 68 +++ .../dto/dynamic/PageDynamicContentDTO.java | 83 +++ .../model/dto/user/UserSimpleProfileDTO.java | 2 +- .../wallet/inner/model/enums/GoldOrigin.java | 9 +- .../ApprovalDynamicContentController.java | 54 ++ .../ApprovalDynamicReportRestController.java | 48 ++ .../DynamicBlacklistRestController.java | 55 ++ .../DynamicPopularConfigRestController.java | 44 ++ .../app/dynamic/DynamicTagRestController.java | 47 ++ .../dynamic/UserDynamicListController.java | 83 +++ .../approval/ApprovalDynamicAppConvertor.java | 15 + .../ApprovalDynamicReportAppConvertor.java | 16 + .../dynamic/DynamicAppConvertor.java | 17 + .../approval/ApprovalDataInfoServiceImpl.java | 2 +- .../ApprovalDynamicContentServiceImpl.java | 98 ++++ .../ApprovalDynamicReportServiceImpl.java | 75 +++ .../ApprovalFamilySettingDataServiceImpl.java | 2 +- .../ApprovalUserSettingInfoServiceImpl.java | 2 +- .../datav/CountryDashboardServiceImpl.java | 5 + .../dynamic/DynamicBlacklistServiceImpl.java | 66 +++ .../dynamic/DynamicContentServiceImpl.java | 198 +++++++ .../DynamicPopularConfigServiceImpl.java | 41 ++ .../app/dynamic/DynamicTagServiceImpl.java | 39 ++ .../app/dynamic/TopDynamicServiceImpl.java | 36 ++ .../approval/ApprovalDynamicCO.java | 83 +++ .../approval/ApprovalDynamicReportedCO.java | 105 ++++ .../dynamic/PageDynamicContentCO.java | 87 ++++ .../ApprovalDynamicContentService.java | 21 + .../ApprovalDynamicReportService.java | 17 + .../app/dynamic/DynamicBlacklistService.java | 24 + .../app/dynamic/DynamicContentService.java | 37 ++ .../dynamic/DynamicPopularConfigService.java | 21 + .../app/dynamic/DynamicTagService.java | 24 + .../app/dynamic/DynamicTimelineService.java | 19 + .../app/dynamic/TopDynamicService.java | 25 + .../app/dynamic/DynamicRestController.java | 392 ++++++++++++++ .../app/dynamic/ThumbsUpRestController.java | 59 +++ .../ActivityConsumeRewardReceiveCmdExe.java | 4 +- .../activity/ClaimActivityRewardBadgeExe.java | 8 +- .../activity/ClaimActivityRewardExe.java | 8 +- .../dynamic/DynamicBlacklistAddCmdExe.java | 43 ++ .../dynamic/DynamicBlacklistDelCmdExe.java | 38 ++ .../DynamicCheckSendPermissionCmdExe.java | 72 +++ .../command/dynamic/DynamicCommentCmdExe.java | 234 +++++++++ .../dynamic/DynamicCommentLikeCmdExe.java | 165 ++++++ .../command/dynamic/DynamicLikeCmdExe.java | 123 +++++ .../DynamicMessageUpdateReadCmdExe.java | 32 ++ .../command/dynamic/DynamicReportCmdExe.java | 53 ++ .../app/command/dynamic/DynamicTagCmdExe.java | 39 ++ .../dynamic/UserRelationThumbsUpCmdExe.java | 39 ++ .../dynamic/add/DynamicContentAddCmdExe.java | 304 +++++++++++ .../delete/DynamicCommentDelCmdExe.java | 183 +++++++ .../delete/DynamicContentDelCmdExe.java | 96 ++++ .../delete/DynamicMessageAllDelCmdExe.java | 33 ++ .../delete/DynamicMessageDelCmdExe.java | 36 ++ .../query/DynamicChildCommentQryExe.java | 113 ++++ .../dynamic/query/DynamicCommentQryExe.java | 155 ++++++ .../dynamic/query/DynamicDetailsQryExe.java | 147 ++++++ .../dynamic/query/DynamicFollowQryExe.java | 209 ++++++++ .../dynamic/query/DynamicGiftQryExe.java | 86 ++++ .../dynamic/query/DynamicLatestQryExe.java | 154 ++++++ .../dynamic/query/DynamicLikeQryExe.java | 82 +++ .../dynamic/query/DynamicListQryByTagExe.java | 147 ++++++ .../dynamic/query/DynamicMessageQryExe.java | 145 ++++++ .../dynamic/query/DynamicMyQryExe.java | 148 ++++++ .../dynamic/query/DynamicPopularQryExe.java | 274 ++++++++++ .../dynamic/query/DynamicTagQryExe.java | 46 ++ .../query/UserRelationThumsUpQryExe.java | 29 ++ .../command/family/ApplyJoinFamilyExe.java | 2 +- .../app/command/family/FamilyCreateExe.java | 8 +- .../app/command/family/FamilyInfoEditExe.java | 6 +- .../game/trumpet/GameTrumpetSendExe.java | 4 +- .../command/gift/BlessingsGiftGiveCmdExe.java | 10 +- .../command/gift/GiftGiveAwayBatchCmdExe.java | 16 +- .../app/command/gift/LuckyGiftGiveCmdExe.java | 1 + .../room/LiveVoiceRoomCreateCmdExe.java | 4 +- .../command/room/UpdateRoomProfileCmdExe.java | 6 +- .../command/team/TeamHandleUserApplyExe.java | 6 +- .../team/query/TeamUserApplyRecordQryExe.java | 4 +- .../command/user/UpdateUserProfileCmdExe.java | 4 +- .../user/query/UserCountMessageQryExe.java | 39 +- .../other/app/common/room/DynamicCommon.java | 196 +++++++ .../app/common/task/TaskCenterGoClient.java | 2 + .../convertor/material/GiftAppConvertor.java | 9 +- .../enums/violation/ViolationTypeEnum.java | 17 +- .../other/app/listener/ApprovalListener.java | 8 +- .../app/listener/CensorProfileListener.java | 121 ++++- .../other/app/listener/RcDynamicListener.java | 87 ++++ .../app/listener/gift/GiveGiftsListener.java | 9 +- .../gift/strategy/GiftCountStrategy.java | 112 +++- .../ApprovalDynamicContentStrategy.java | 111 ++++ .../ApprovalDynamicReportStrategy.java | 63 +++ .../scheduler/DynamicCommentHotScoreTask.java | 254 +++++++++ .../service/dynamic/DynamicServiceImpl.java | 237 +++++++++ .../UserRelationThumbsUpServiceImpl.java | 30 ++ .../UserProfileApproveServiceImpl.java | 32 +- .../dynamic/DynamicCommentListCO.java | 108 ++++ .../dynamic/DynamicGiftListCO.java | 91 ++++ .../dynamic/DynamicLikeListCO.java | 66 +++ .../clientobject/dynamic/DynamicListCO.java | 118 +++++ .../dynamic/DynamicMessageListCO.java | 87 ++++ .../dynamic/DynamicPictureCO.java | 63 +++ .../dynamic/DynamicSendRestrictCO.java | 35 ++ .../clientobject/dynamic/DynamicTagCO.java | 48 ++ .../clientobject/dynamic/MessageItemCO.java | 18 + .../clientobject/dynamic/UserThumbsUpCO.java | 31 ++ .../UserFriendCardCountMessageCO.java | 9 +- .../cmd/dynamic/DynamicBlacklistAddCmd.java | 26 + .../cmd/dynamic/DynamicBlacklistDelCmd.java | 26 + .../dto/cmd/dynamic/DynamicByTagLimitCmd.java | 34 ++ .../dynamic/DynamicChildCommentLimitCmd.java | 35 ++ .../dto/cmd/dynamic/DynamicCommentCmd.java | 52 ++ .../cmd/dynamic/DynamicCommentLimitCmd.java | 35 ++ .../dto/cmd/dynamic/DynamicContentAddCmd.java | 38 ++ .../dto/cmd/dynamic/DynamicGiftLimitCmd.java | 35 ++ .../app/dto/cmd/dynamic/DynamicLikeCmd.java | 49 ++ .../dto/cmd/dynamic/DynamicLikeLimitCmd.java | 35 ++ .../app/dto/cmd/dynamic/DynamicLimitCmd.java | 28 + .../dto/cmd/dynamic/DynamicMyLimitCmd.java | 31 ++ .../app/dto/cmd/dynamic/DynamicPageCmd.java | 28 + .../app/dto/cmd/dynamic/DynamicReportCmd.java | 44 ++ .../cmd/dynamic/UserRelationThumbsUpCmd.java | 25 + .../dto/cmd/gift/GiveAwayGiftBatchCmd.java | 9 +- .../app/service/dynamic/DynamicService.java | 166 ++++++ .../dynamic/UserRelationThumbsUpService.java | 15 + .../aspect/CreateAccountAspect.java | 4 +- .../entity/dynamic/DynamicTagConfigCache.java | 46 ++ .../cache/entity/dynamic/TopDynamicCache.java | 56 ++ .../infra/database/cache/key/DynamicKeys.java | 80 +++ .../service/other/DynamicCacheService.java | 230 +++++++++ .../other/impl/DynamicCacheServiceImpl.java | 294 +++++++++++ .../mongo/entity/dynamic/DynamicPopular.java | 76 +++ .../entity/gift/GiftGiveRunningWater.java | 9 +- .../dynamic/DynamicPopularService.java | 37 ++ .../impl/DynamicPopularServiceImpl.java | 155 ++++++ .../impl/GiftGiveRunningWaterServiceImpl.java | 3 +- .../impl/RoomProfileManagerServiceImpl.java | 4 +- .../approval/ApprovalDynamicContentDAO.java | 17 + .../rds/dao/dynamic/DynamicBlacklistDAO.java | 17 + .../rds/dao/dynamic/DynamicCommentDAO.java | 26 + .../dao/dynamic/DynamicCommentLikeDAO.java | 17 + .../rds/dao/dynamic/DynamicContentDAO.java | 23 + .../rds/dao/dynamic/DynamicGiftDAO.java | 14 + .../rds/dao/dynamic/DynamicLikeDAO.java | 26 + .../rds/dao/dynamic/DynamicMessageDAO.java | 17 + .../rds/dao/dynamic/DynamicPictureDAO.java | 24 + .../rds/dao/dynamic/DynamicReportDAO.java | 17 + .../rds/dao/dynamic/DynamicTagDAO.java | 16 + .../rds/dao/dynamic/DynamicTimelineDAO.java | 17 + .../rds/dao/dynamic/TopDynamicDAO.java | 17 + .../rds/dao/dynamic/UserThumbsUpDAO.java | 16 + .../approval/ApprovalDynamicContent.java | 66 +++ .../rds/entity/dynamic/DynamicBlacklist.java | 72 +++ .../rds/entity/dynamic/DynamicComment.java | 69 +++ .../entity/dynamic/DynamicCommentLike.java | 78 +++ .../rds/entity/dynamic/DynamicContent.java | 107 ++++ .../rds/entity/dynamic/DynamicGift.java | 88 ++++ .../rds/entity/dynamic/DynamicLike.java | 66 +++ .../rds/entity/dynamic/DynamicMessage.java | 78 +++ .../rds/entity/dynamic/DynamicPicture.java | 81 +++ .../rds/entity/dynamic/DynamicReport.java | 108 ++++ .../rds/entity/dynamic/DynamicTag.java | 101 ++++ .../rds/entity/dynamic/DynamicTimeline.java | 77 +++ .../rds/entity/dynamic/TopDynamic.java | 58 +++ .../rds/entity/dynamic/UserThumbsUp.java | 46 ++ .../database/rds/enums/CacheKeysEnum.java | 69 ++- .../ApprovalDynamicContentService.java | 40 ++ .../ApprovalDynamicContentServiceImpl.java | 107 ++++ .../ApprovalUserSettingDataServiceImpl.java | 2 +- .../dynamic/DynamicBlacklistService.java | 33 ++ .../dynamic/DynamicCommentLikeService.java | 64 +++ .../dynamic/DynamicCommentService.java | 132 +++++ .../dynamic/DynamicContentService.java | 118 +++++ .../service/dynamic/DynamicGiftService.java | 60 +++ .../service/dynamic/DynamicLikeService.java | 61 +++ .../dynamic/DynamicMessageService.java | 59 +++ .../dynamic/DynamicPictureService.java | 129 +++++ .../service/dynamic/DynamicReportService.java | 28 + .../service/dynamic/DynamicTagService.java | 41 ++ .../dynamic/DynamicTimelineService.java | 72 +++ .../service/dynamic/TopDynamicService.java | 27 + .../service/dynamic/UserThumbsUpService.java | 21 + .../impl/DynamicBlacklistServiceImpl.java | 75 +++ .../impl/DynamicCommentLikeServiceImpl.java | 107 ++++ .../impl/DynamicCommentServiceImpl.java | 234 +++++++++ .../impl/DynamicContentServiceImpl.java | 214 ++++++++ .../dynamic/impl/DynamicGiftServiceImpl.java | 128 +++++ .../dynamic/impl/DynamicLikeServiceImpl.java | 124 +++++ .../impl/DynamicMessageServiceImpl.java | 120 +++++ .../impl/DynamicPictureServiceImpl.java | 190 +++++++ .../impl/DynamicReportServiceImpl.java | 82 +++ .../dynamic/impl/DynamicTagServiceImpl.java | 91 ++++ .../impl/DynamicTimelineServiceImpl.java | 109 ++++ .../dynamic/impl/TopDynamicServiceImpl.java | 80 +++ .../dynamic/impl/UserThumbsUpServiceImpl.java | 58 +++ .../user/user/impl/BaseInfoServiceImpl.java | 7 +- .../approval/ApprovalDynamicContentDAO.xml | 7 + .../dao/dynamic/DynamicBlacklistDAO.xml | 6 + .../dao/dynamic/DynamicCommentDAO.xml | 14 + .../dao/dynamic/DynamicCommentLikeDAO.xml | 6 + .../dao/dynamic/DynamicContentDAO.xml | 41 ++ .../resources/dao/dynamic/DynamicLikeDAO.xml | 14 + .../dao/dynamic/DynamicMessageDAO.xml | 6 + .../dao/dynamic/DynamicPictureDAO.xml | 21 + .../dao/dynamic/DynamicReportDAO.xml | 6 + .../resources/dao/dynamic/DynamicTagDAO.xml | 6 + .../dao/dynamic/DynamicTimelineDAO.xml | 7 + .../resources/dao/dynamic/TopDynamicDAO.xml | 6 + .../resources/dao/dynamic/UserThumbsUpDAO.xml | 6 + .../approval/ApprovalDynamicConvertor.java | 18 + .../ApprovalDynamicReportConvertor.java | 15 + .../dynamic/DynamicInnerConvertor.java | 37 ++ .../ApprovalDataInfoClientEndpoint.java | 2 +- .../ApprovalDynamicClientEndpoint.java | 52 ++ .../ApprovalDynamicReportClientEndpoint.java | 40 ++ ...provalFamilySettingDataClientEndPoint.java | 2 +- ...ApprovalUserSettingInfoClientEndpoint.java | 2 +- .../DynamicBlacklistClientEndpoint.java | 47 ++ .../dynamic/DynamicCacheClientEndpoint.java | 38 ++ .../dynamic/DynamicContentClientEndpoint.java | 53 ++ .../dynamic/DynamicPictureClientEndpoint.java | 31 ++ .../dynamic/DynamicTagClientEndpoint.java | 46 ++ .../DynamicTimelineClientEndpoint.java | 31 ++ .../dynamic/TopDynamicClientEndpoint.java | 38 ++ .../ApprovalDynamicClientService.java | 23 + .../ApprovalDynamicReportClientService.java | 18 + .../ApprovalDataInfoClientServiceImpl.java | 35 +- .../ApprovalDynamicClientServiceImpl.java | 125 +++++ ...pprovalDynamicReportClientServiceImpl.java | 178 +++++++ .../DynamicBlacklistClientService.java | 23 + .../dynamic/DynamicCacheClientService.java | 20 + .../dynamic/DynamicContentClientService.java | 27 + .../dynamic/DynamicPictureClientService.java | 21 + .../dynamic/DynamicTagClientService.java | 25 + .../dynamic/DynamicTimelineClientService.java | 22 + .../dynamic/TopDynamicClientService.java | 19 + .../DynamicBlacklistClientServiceImpl.java | 47 ++ .../impl/DynamicCacheClientServiceImpl.java | 43 ++ .../impl/DynamicContentClientServiceImpl.java | 107 ++++ .../impl/DynamicPictureClientServiceImpl.java | 36 ++ .../impl/DynamicTagClientServiceImpl.java | 61 +++ .../DynamicTimelineClientServiceImpl.java | 40 ++ .../impl/TopDynamicClientServiceImpl.java | 43 ++ .../ApprovalPhotoWallClientServiceImpl.java | 35 +- 306 files changed, 17128 insertions(+), 576 deletions(-) create mode 100644 rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DynamicEventTypeEnum.java create mode 100644 rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/DynamicMessageEnum.java create mode 100644 rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/ApprovalDynamicEvent.java create mode 100644 rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/dynamic/DynamicEvent.java create mode 100644 rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/producer/DynamicMqMessage.java create mode 100644 rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/streams/DynamicSink.java rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/ApprovalDataInfoClient.java (67%) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicReportClient.java rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/ApprovalFamilySettingDataClient.java (69%) rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/ApprovalUserSettingInfoClient.java (69%) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicBlacklistClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicCacheClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicContentClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicPictureClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTagClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTimelineClient.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/TopDynamicClient.java rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/api/ApprovalDataInfoClientApi.java (86%) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicReportClientApi.java rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/api/ApprovalFamilySettingDataClientApi.java (91%) rename rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/{approval => dynamic}/api/ApprovalUserSettingInfoClientApi.java (92%) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicBlacklistClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicCacheClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicContentClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicPictureClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTagClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTimelineClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/TopDynamicClientApi.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/DynamicErrorCode.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicContentCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicQryCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportQryCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/CreateDynamicVideoCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DelDynamicContentCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistQryCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentQryCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPictureCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPopularConfigCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTagCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTimelineCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/PageDynamicTagQryCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/TopDynamicCmd.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicReportedDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicContentDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPictureDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPopularConfigDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicTagDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicBlacklistDTO.java create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicContentDTO.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicContentController.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicReportRestController.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicBlacklistRestController.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicPopularConfigRestController.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicTagRestController.java create mode 100644 rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/UserDynamicListController.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicAppConvertor.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicReportAppConvertor.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/dynamic/DynamicAppConvertor.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagServiceImpl.java create mode 100644 rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicServiceImpl.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicCO.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicReportedCO.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/dynamic/PageDynamicContentCO.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTimelineService.java create mode 100644 rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicService.java create mode 100644 rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/DynamicRestController.java create mode 100644 rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/ThumbsUpRestController.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistAddCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistDelCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCheckSendPermissionCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentLikeCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicLikeCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicMessageUpdateReadCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicReportCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicTagCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/UserRelationThumbsUpCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicCommentDelCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicContentDelCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageAllDelCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageDelCmdExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicChildCommentQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicCommentQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicDetailsQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicGiftQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLatestQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLikeQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicListQryByTagExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMessageQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMyQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicPopularQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicTagQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/UserRelationThumsUpQryExe.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/DynamicCommon.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/RcDynamicListener.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicContentStrategy.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicReportStrategy.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DynamicCommentHotScoreTask.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/DynamicServiceImpl.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpServiceImpl.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicCommentListCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicGiftListCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicLikeListCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicListCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicMessageListCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicPictureCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicSendRestrictCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicTagCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/MessageItemCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/UserThumbsUpCO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistAddCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistDelCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicByTagLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicChildCommentLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicContentAddCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicGiftLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicMyLimitCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicPageCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicReportCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/UserRelationThumbsUpCmd.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/DynamicService.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/DynamicTagConfigCache.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/TopDynamicCache.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/key/DynamicKeys.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/dynamic/DynamicPopular.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/DynamicPopularService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/impl/DynamicPopularServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/approval/ApprovalDynamicContentDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicBlacklistDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentLikeDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicContentDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicGiftDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicLikeDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicMessageDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicPictureDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicReportDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTagDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTimelineDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/TopDynamicDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/UserThumbsUpDAO.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/approval/ApprovalDynamicContent.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicBlacklist.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicComment.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicCommentLike.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicContent.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicGift.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicLike.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicMessage.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicPicture.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicReport.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTag.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTimeline.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/TopDynamic.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/UserThumbsUp.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/ApprovalDynamicContentService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalDynamicContentServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicBlacklistService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentLikeService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicContentService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicGiftService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicLikeService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicMessageService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicPictureService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicReportService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTagService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTimelineService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/TopDynamicService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/UserThumbsUpService.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicBlacklistServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentLikeServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicContentServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicGiftServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicLikeServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicMessageServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicPictureServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicReportServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTagServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTimelineServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/TopDynamicServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/UserThumbsUpServiceImpl.java create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/approval/ApprovalDynamicContentDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicBlacklistDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentLikeDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicContentDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicLikeDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicMessageDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicPictureDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicReportDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTagDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTimelineDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/TopDynamicDAO.xml create mode 100644 rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/UserThumbsUpDAO.xml create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicConvertor.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicReportConvertor.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/dynamic/DynamicInnerConvertor.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicReportClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicBlacklistClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicCacheClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicContentClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicPictureClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTagClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTimelineClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/TopDynamicClientEndpoint.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicReportClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicReportClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicBlacklistClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicCacheClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicContentClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicPictureClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTagClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTimelineClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/TopDynamicClientService.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicBlacklistClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicCacheClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicContentClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicPictureClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTagClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTimelineClientServiceImpl.java create mode 100644 rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/TopDynamicClientServiceImpl.java diff --git a/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/CommonErrorEnum.java b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/CommonErrorEnum.java index 1d44f382..a2d4801a 100644 --- a/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/CommonErrorEnum.java +++ b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/CommonErrorEnum.java @@ -434,8 +434,19 @@ public enum CommonErrorEnum implements IResponseErrorCode { */ EMOJI_EXIST_DONT_BUY_ERROR(2080, "You already own the emoji, no need to re-purchase"), - /** - * 资源不足. + /** + * 财富与魅力等级过低,无法发布动态. + */ + WEALTH_AND_CHARM_INSUFFICIENT_ERROR(2081, + "Wealth and Charisma levels are not eligible for posting, please upgrade your level"), + + /** + * 今日动态已达上限. + */ + DYNAMIC_QUANTITY_LIMIT_ERROR(2082, "You have reached the maximum number of posts today"), + + /** + * 资源不足. */ LACK_OF_RESOURCES(2083, "lack of resources"), diff --git a/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DataApprovalTypeEnum.java b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DataApprovalTypeEnum.java index 64c8a816..88a7123a 100644 --- a/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DataApprovalTypeEnum.java +++ b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DataApprovalTypeEnum.java @@ -1,8 +1,9 @@ package com.red.circle.common.business.core.enums; -import com.red.circle.tool.core.collection.CollectionUtils; -import java.util.Map; -import lombok.Getter; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Map; +import java.util.Objects; +import lombok.Getter; /** * 资料审批类型. @@ -67,8 +68,18 @@ public enum DataApprovalTypeEnum { */ FAMILY_NOTICE("家族公告", Type.TEXT), - /** - * 团队头像. + /** + * 举报动态. + */ + DYNAMIC_REPORT("举报动态", Type.TEXT), + + /** + * 动态内容. + */ + DYNAMIC_CONTENT("动态内容", Type.IMAGE), + + /** + * 团队头像. */ TEAM_AVATAR("团队头像", Type.IMAGE), @@ -96,7 +107,12 @@ public enum DataApprovalTypeEnum { this.type = type; } - public Map approvalVal(String val) { + public static Boolean checkDynamic(DataApprovalTypeEnum type) { + return Objects.equals(type, DYNAMIC_CONTENT) || + Objects.equals(type, DYNAMIC_REPORT); + } + + public Map approvalVal(String val) { Map paramMap = CollectionUtils.newHashMap(); paramMap.put(this, val); return paramMap; diff --git a/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DynamicEventTypeEnum.java b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DynamicEventTypeEnum.java new file mode 100644 index 00000000..83be2bd6 --- /dev/null +++ b/rc-common-business/common-business-core/src/main/java/com/red/circle/common/business/core/enums/DynamicEventTypeEnum.java @@ -0,0 +1,41 @@ +package com.red.circle.common.business.core.enums; + +import java.util.Objects; + +/** + * 动态业务类型. + * + * @author pengshigang on 2022/4/11 + */ +public enum DynamicEventTypeEnum { + + /** + * 创建动态. + */ + CREATE, + + /** + * 自己删除动态. + */ + DELETE, + + /** + * 系统删除动态. + */ + SYSTEM_DELETE, + + /** + * 取关对方. + */ + UNFOLLOW, + + /** + * 关注对方. + */ + FOLLOW; + + public boolean eq(DynamicEventTypeEnum name) { + return Objects.equals(this, name); + } + +} diff --git a/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/DynamicMessageEnum.java b/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/DynamicMessageEnum.java new file mode 100644 index 00000000..ef3a52f1 --- /dev/null +++ b/rc-common-business/common-business-dto/src/main/java/com/red/circle/common/business/enums/DynamicMessageEnum.java @@ -0,0 +1,73 @@ +package com.red.circle.common.business.enums; + +import java.util.Objects; + +/** + * 动态消息类型. + * + * @author pengshigang on 2022/4/11 + */ +public enum DynamicMessageEnum { + + /** + * 评论了我的动态. + */ + COMMENT_DYNAMIC, + + /** + * 回复了我的评论. + */ + REPLY_COMMENT, + + /** + * 点赞了我的动态. + */ + LIKE_DYNAMIC, + + /** + * 点赞了我的评论. + */ + LIKE_COMMENT, + + /** + * 动态礼物 + */ + DYNAMIC_GIFT, + + /** + * 驳回举报. + */ + REPORT_FAIL, + + /** + * 举报成功. + */ + REPORT_SUCCESS, + + /** + * 我的违规动态已被系统删除. + */ + DYNAMIC_VIOLATION, + ; + + + /** + * 是否为举报相关信息 + * + * @param type 类型 + * @return true是 false不是 + */ + public static Boolean isReportRelated(String type) { + if (Objects.isNull(type)) { + return Boolean.FALSE; + } + + DynamicMessageEnum typeEnum = DynamicMessageEnum.valueOf(type); + + return Objects.equals(typeEnum, REPORT_FAIL) || + Objects.equals(typeEnum, REPORT_SUCCESS) || + Objects.equals(typeEnum, DYNAMIC_VIOLATION); + } + + +} diff --git a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/ApprovalDynamicEvent.java b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/ApprovalDynamicEvent.java new file mode 100644 index 00000000..a4c3c674 --- /dev/null +++ b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/ApprovalDynamicEvent.java @@ -0,0 +1,105 @@ +package com.red.circle.mq.business.model.event.approval; + + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import java.io.Serializable; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import com.red.circle.common.business.core.enums.OpUserType; +import lombok.Data; +import lombok.experimental.Accessors; + + +/** + * @author pengliang on 2020/9/21 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicEvent implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 审批id. + */ + private Long approvalId; + + /** + * 审批人. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long approvalUserId; + + /** + * 操作审批人. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long opsUserId; + + /** + * 操作审批人类型. + */ + private OpUserType opUserType; + + + /** + * 违规类型. + */ + private DataApprovalTypeEnum approvalType; + + /** + * 审批状态. + */ + private ApprovalStatusEnum approvalStatus; + + /** + * 待审批审批信息. + */ + private List waitApprovalUser; + + /** + * 批 true App false 后台管理 + */ + private Boolean originType; + + @JsonIgnore + public List getWaitApprovalUserIds() { + return Optional.ofNullable(waitApprovalUser) + .map(beApprovalList -> beApprovalList.stream().map(ApprovalContentEvent::getUserId) + .distinct().collect(Collectors.toList())) + .orElse(null); + } + + @JsonIgnore + public Set getWaitApprovalUserIdsSet() { + return Optional.ofNullable(waitApprovalUser) + .map(beApprovalList -> beApprovalList.stream().map(ApprovalContentEvent::getUserId) + .collect(Collectors.toSet())) + .orElse(null); + } + + @JsonIgnore + public List getWaitApprovalUserContentIds() { + return Optional.ofNullable(waitApprovalUser) + .map(beApprovalList -> beApprovalList.stream().map(ApprovalContentEvent::getContentId) + .distinct().collect(Collectors.toList())) + .orElse(null); + } + + public boolean approvalPass() { + return Objects.equals(approvalStatus, ApprovalStatusEnum.PASS); + } + + public boolean approvalNotPass() { + return Objects.equals(approvalStatus, ApprovalStatusEnum.NOT_PASS); + } + +} diff --git a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/CensorProfileEvent.java b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/CensorProfileEvent.java index 776a2ed6..17870fb0 100644 --- a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/CensorProfileEvent.java +++ b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/approval/CensorProfileEvent.java @@ -2,15 +2,17 @@ package com.red.circle.mq.business.model.event.approval; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.google.common.collect.Lists; -import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; -import com.red.circle.tool.core.collection.CollectionUtils; -import jakarta.validation.constraints.NotNull; -import java.io.Serial; -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.parse.DataTypeUtils; +import jakarta.validation.constraints.NotNull; +import java.io.Serial; +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; import lombok.Data; import lombok.experimental.Accessors; @@ -50,7 +52,24 @@ public class CensorProfileEvent implements Serializable { */ private Map extValues = CollectionUtils.newHashMap(); - public boolean checkUserAvatar() { + private static final String DYNAMIC_ID = "dynamicId"; + + public Long dynamicId() { + return Optional.ofNullable(extValues.get(DYNAMIC_ID)) + .map(DataTypeUtils::toLong) + .orElse(null); + } + + public CensorProfileEvent putDynamicId(Long dynamicId) { + extValues.put(DYNAMIC_ID, Objects.toString(dynamicId)); + return this; + } + + public boolean checkDynamicContent() { + return Objects.equals(approvalType, DataApprovalTypeEnum.DYNAMIC_CONTENT); + } + + public boolean checkUserAvatar() { return Objects.equals(approvalType, DataApprovalTypeEnum.AVATAR); } @@ -90,10 +109,11 @@ public class CensorProfileEvent implements Serializable { * * @return true 是图片 false 不是图片 */ - public boolean isImageType() { - return checkUserAvatar() - || checkRoomAvatar() - || checkBackgroundPhoto() + public boolean isImageType() { + return checkUserAvatar() + || checkDynamicContent() + || checkRoomAvatar() + || checkBackgroundPhoto() || checkPersonalPhoto(); } diff --git a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/dynamic/DynamicEvent.java b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/dynamic/DynamicEvent.java new file mode 100644 index 00000000..87664e22 --- /dev/null +++ b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/dynamic/DynamicEvent.java @@ -0,0 +1,64 @@ +package com.red.circle.mq.business.model.event.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.common.business.core.enums.DynamicEventTypeEnum; +import java.io.Serial; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 动态事件. + * + * @author pengshigang on 2022/4/11 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class DynamicEvent implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 动态id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicContentId; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 被关注用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long followUserId; + + /** + * 评论id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long commentId; + + /** + * 时间 + */ + private Timestamp timestamp; + + /** + * 业务类型 + */ + private DynamicEventTypeEnum type; + + /** + * 区域. + */ + private String region; +} diff --git a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/gift/GiveAwayGiftBatchEvent.java b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/gift/GiveAwayGiftBatchEvent.java index edea03c9..0a3f1a84 100644 --- a/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/gift/GiveAwayGiftBatchEvent.java +++ b/rc-common-business/common-business-mq/business-mq-model/src/main/java/com/red/circle/mq/business/model/event/gift/GiveAwayGiftBatchEvent.java @@ -83,8 +83,13 @@ public class GiveAwayGiftBatchEvent implements Serializable { */ private Long roomId; - /** - * 跟踪id. + /** + * 动态id + */ + private Long dynamicContentId; + + /** + * 跟踪id. */ @NotNull(message = "giftConfig required.") private Long trackId; diff --git a/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/constant/QueueNameConstant.java b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/constant/QueueNameConstant.java index 88d67727..76127de6 100644 --- a/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/constant/QueueNameConstant.java +++ b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/constant/QueueNameConstant.java @@ -97,8 +97,13 @@ public interface QueueNameConstant { */ String GAME_INDOOR_TEAM_PK = "GAME_INDOOR_TEAM_PK"; - /** - * 用户友谊卡片申请. + /** + * 动态. + */ + String DYNAMIC = "DYNAMIC"; + + /** + * 用户友谊卡片申请. */ String USER_CARD_APPLY = "USER_CARD_APPLY"; diff --git a/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/producer/DynamicMqMessage.java b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/producer/DynamicMqMessage.java new file mode 100644 index 00000000..466cc78f --- /dev/null +++ b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/producer/DynamicMqMessage.java @@ -0,0 +1,35 @@ +package com.red.circle.mq.rocket.business.producer; + +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.component.mq.service.FixedTopic; +import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; +import com.red.circle.mq.rocket.business.service.MessageSenderService; +import com.red.circle.mq.rocket.business.streams.DynamicSink; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态相关. + * + * @author pengshigang on 2022/4/11 + */ +@Component +@RequiredArgsConstructor +public class DynamicMqMessage { + + private final MessageSenderService senderService; + + /** + * 动态 - 业务处理. + */ + public void sendDynamic(String consumeId, DynamicEvent event) { + senderService.sendEventMessage(MessageEvent.builder() + .consumeId(consumeId) + .topic(FixedTopic.RC_DEFAULT_APP_ORDINARY) + .tag(DynamicSink.TAG) + .body(event) + .build()); + } + + +} diff --git a/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/streams/DynamicSink.java b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/streams/DynamicSink.java new file mode 100644 index 00000000..98bc5db6 --- /dev/null +++ b/rc-common-business/common-business-mq/business-rocketmq/src/main/java/com/red/circle/mq/rocket/business/streams/DynamicSink.java @@ -0,0 +1,13 @@ +package com.red.circle.mq.rocket.business.streams; + +import com.red.circle.mq.rocket.business.constant.QueueNameConstant; + +/** + * @author pengshigang on 2022/4/13 + */ +public interface DynamicSink { + + String INPUT = QueueNameConstant.DYNAMIC; + String TAG = "dynamic_v2"; + +} diff --git a/rc-service/rc-inner-api/console-inner-api/src/main/java/com/red/circle/console/inner/error/ConsoleErrorCode.java b/rc-service/rc-inner-api/console-inner-api/src/main/java/com/red/circle/console/inner/error/ConsoleErrorCode.java index 8ef2b9b2..550385cf 100644 --- a/rc-service/rc-inner-api/console-inner-api/src/main/java/com/red/circle/console/inner/error/ConsoleErrorCode.java +++ b/rc-service/rc-inner-api/console-inner-api/src/main/java/com/red/circle/console/inner/error/ConsoleErrorCode.java @@ -181,8 +181,13 @@ public enum ConsoleErrorCode implements IResponseErrorCode { */ PLEASE_SELECT_TIME(10033, "Please select time"), - /** - * 账号无权限 + /** + * 用户动态不能重复插入 + */ + USER_DYNAMICS_CANNOT_BE_INSERTED_REPEATEDLY(10034, "User dynamics cannot be inserted repeatedly"), + + /** + * 账号无权限 */ ACCOUNT_NOT_PERMISSIONS(10035,"The account has no permissions."), diff --git a/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/NewsletterEvent.java b/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/NewsletterEvent.java index 2377b231..b6dbedd8 100644 --- a/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/NewsletterEvent.java +++ b/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/NewsletterEvent.java @@ -90,9 +90,14 @@ public enum NewsletterEvent { */ ACCEPT_NOBLE_VIP, - /** - * 系统拉黑房间用户. - */ + /** + * 动态消息数量. + */ + DYNAMIC_MESSAGE_QUANTITY, + + /** + * 系统拉黑房间用户. + */ SYS_PULL_BLACK_ROOM_USER, /** diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalDataInfoClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDataInfoClient.java similarity index 67% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalDataInfoClient.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDataInfoClient.java index 03be9c90..c7d46d69 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalDataInfoClient.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDataInfoClient.java @@ -1,15 +1,15 @@ -package com.red.circle.other.inner.endpoint.approval; - -import com.red.circle.other.inner.endpoint.approval.api.ApprovalDataInfoClientApi; -import org.springframework.cloud.openfeign.FeignClient; - -/** - * 资料审批 - * - * @author zongpubin on 2024/1/22 - */ -@FeignClient(name = "approvalDateInfoClient", url = "${feign.other.url}" + - ApprovalDataInfoClientApi.API_PREFIX) -public interface ApprovalDataInfoClient extends ApprovalDataInfoClientApi { - -} +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDataInfoClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 资料审批 + * + * @author zongpubin on 2024/1/22 + */ +@FeignClient(name = "approvalDateInfoClient", url = "${feign.other.url}" + + ApprovalDataInfoClientApi.API_PREFIX) +public interface ApprovalDataInfoClient extends ApprovalDataInfoClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicClient.java new file mode 100644 index 00000000..df9be5e0 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDynamicClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 审批动态 + * + * @author zongpubin on 2024/1/19 + */ +@FeignClient(name = "ApprovalDynamicClient", url = "${feign.other.url}" + + ApprovalDynamicClientApi.API_PREFIX) +public interface ApprovalDynamicClient extends ApprovalDynamicClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicReportClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicReportClient.java new file mode 100644 index 00000000..b20aa604 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalDynamicReportClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDynamicReportClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/20 + */ +@FeignClient(name = "approvalDynamicReportClient", url = "${feign.other.url}" + + ApprovalDynamicReportClientApi.API_PREFIX) +public interface ApprovalDynamicReportClient extends ApprovalDynamicReportClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalFamilySettingDataClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalFamilySettingDataClient.java similarity index 69% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalFamilySettingDataClient.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalFamilySettingDataClient.java index eae06afa..c373dfc2 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalFamilySettingDataClient.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalFamilySettingDataClient.java @@ -1,15 +1,15 @@ -package com.red.circle.other.inner.endpoint.approval; - -import com.red.circle.other.inner.endpoint.approval.api.ApprovalFamilySettingDataClientApi; -import org.springframework.cloud.openfeign.FeignClient; - -/** - * 家族资料审批 - * - * @author zongpubin on 2024/1/20 - */ -@FeignClient(name = "approvalFamilySettingDataClient", url = "${feign.other.url}" + - ApprovalFamilySettingDataClientApi.API_PREFIX) -public interface ApprovalFamilySettingDataClient extends ApprovalFamilySettingDataClientApi { - -} +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalFamilySettingDataClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 家族资料审批 + * + * @author zongpubin on 2024/1/20 + */ +@FeignClient(name = "approvalFamilySettingDataClient", url = "${feign.other.url}" + + ApprovalFamilySettingDataClientApi.API_PREFIX) +public interface ApprovalFamilySettingDataClient extends ApprovalFamilySettingDataClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalUserSettingInfoClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalUserSettingInfoClient.java similarity index 69% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalUserSettingInfoClient.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalUserSettingInfoClient.java index 22e37ca3..60db5638 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/ApprovalUserSettingInfoClient.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/ApprovalUserSettingInfoClient.java @@ -1,15 +1,15 @@ -package com.red.circle.other.inner.endpoint.approval; - -import com.red.circle.other.inner.endpoint.approval.api.ApprovalUserSettingInfoClientApi; -import org.springframework.cloud.openfeign.FeignClient; - -/** - * 用户审批相关列表 - * - * @author zongpubin on 2024/1/22 - */ -@FeignClient(name = "approvalUserSettingInfoClient", url = "${feign.other.url}" + - ApprovalUserSettingInfoClientApi.API_PREFIX) -public interface ApprovalUserSettingInfoClient extends ApprovalUserSettingInfoClientApi { - -} +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalUserSettingInfoClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 用户审批相关列表 + * + * @author zongpubin on 2024/1/22 + */ +@FeignClient(name = "approvalUserSettingInfoClient", url = "${feign.other.url}" + + ApprovalUserSettingInfoClientApi.API_PREFIX) +public interface ApprovalUserSettingInfoClient extends ApprovalUserSettingInfoClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicBlacklistClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicBlacklistClient.java new file mode 100644 index 00000000..b0cb04af --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicBlacklistClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicBlacklistClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态-黑名单服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "dynamicBlacklistClient", url = "${feign.other.url}" + + DynamicBlacklistClientApi.API_PREFIX) +public interface DynamicBlacklistClient extends DynamicBlacklistClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicCacheClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicCacheClient.java new file mode 100644 index 00000000..96296110 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicCacheClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicCacheClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态-缓存服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "dynamicCacheClient", url = "${feign.other.url}" + + DynamicCacheClientApi.API_PREFIX) +public interface DynamicCacheClient extends DynamicCacheClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicContentClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicContentClient.java new file mode 100644 index 00000000..22e0bb3c --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicContentClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicContentClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态-内容服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "dynamicContentClient", url = "${feign.other.url}" + + DynamicContentClientApi.API_PREFIX) +public interface DynamicContentClient extends DynamicContentClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicPictureClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicPictureClient.java new file mode 100644 index 00000000..34567ea7 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicPictureClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicPictureClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态-内容服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "dynamicPictureClient", url = "${feign.other.url}" + + DynamicPictureClientApi.API_PREFIX) +public interface DynamicPictureClient extends DynamicPictureClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTagClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTagClient.java new file mode 100644 index 00000000..dd6fd5d8 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTagClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicTagClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态-内容服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "dynamicTagClient", url = "${feign.other.url}" + + DynamicTagClientApi.API_PREFIX) +public interface DynamicTagClient extends DynamicTagClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTimelineClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTimelineClient.java new file mode 100644 index 00000000..bd85d053 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/DynamicTimelineClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicTimelineClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 资料审批 + * + * @author zongpubin on 2024/1/22 + */ +@FeignClient(name = "dynamicTimelineClient", url = "${feign.other.url}" + + DynamicTimelineClientApi.API_PREFIX) +public interface DynamicTimelineClient extends DynamicTimelineClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/TopDynamicClient.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/TopDynamicClient.java new file mode 100644 index 00000000..dc821351 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/TopDynamicClient.java @@ -0,0 +1,15 @@ +package com.red.circle.other.inner.endpoint.dynamic; + +import com.red.circle.other.inner.endpoint.dynamic.api.TopDynamicClientApi; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * 动态服务. + * + * @author lisizhe on 2023/10/5 + */ +@FeignClient(name = "topDynamicClient", url = "${feign.other.url}" + + TopDynamicClientApi.API_PREFIX) +public interface TopDynamicClient extends TopDynamicClientApi { + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalDataInfoClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDataInfoClientApi.java similarity index 86% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalDataInfoClientApi.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDataInfoClientApi.java index f2c23eee..da390b48 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalDataInfoClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDataInfoClientApi.java @@ -1,19 +1,19 @@ -package com.red.circle.other.inner.endpoint.approval.api; - -import com.red.circle.framework.dto.ResultResponse; -import com.red.circle.other.inner.model.cmd.approval.ApprovalDateInfoCmd; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -/** - * 资料审批 - * - * @author zongpubin on 2024/1/22 - */ -public interface ApprovalDataInfoClientApi { - - String API_PREFIX = "/approval/data/client"; - - @PostMapping("/approval") - ResultResponse approval(@RequestBody ApprovalDateInfoCmd cmd); -} +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDateInfoCmd; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 资料审批 + * + * @author zongpubin on 2024/1/22 + */ +public interface ApprovalDataInfoClientApi { + + String API_PREFIX = "/approval/data/client"; + + @PostMapping("/approval") + ResultResponse approval(@RequestBody ApprovalDateInfoCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicClientApi.java new file mode 100644 index 00000000..e5aa4281 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicClientApi.java @@ -0,0 +1,34 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import java.util.Set; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 审批动态 + * + * @author zongpubin on 2024/1/19 + */ +public interface ApprovalDynamicClientApi { + + String API_PREFIX = "/approval/dynamic/client"; + + @PostMapping("/pageApprovalDynamic") + ResultResponse> pageApprovalDynamic( + @RequestBody ApprovalDynamicQryCmd query); + + @PostMapping("/approvalPass") + ResultResponse approvalPass(@RequestBody Set ids); + + @PostMapping("/approvalNotPass") + ResultResponse approvalNotPass(@RequestBody ApprovalDynamicCmd approvalDynamicCmd); + + @PostMapping("/save") + ResultResponse save(@RequestBody ApprovalDynamicContentCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicReportClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicReportClientApi.java new file mode 100644 index 00000000..7c4f418d --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalDynamicReportClientApi.java @@ -0,0 +1,26 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/20 + */ +public interface ApprovalDynamicReportClientApi { + + String API_PREFIX = "/approval/dynamic/report"; + + @PostMapping("/pageData") + ResultResponse> pageData( + @RequestBody ApprovalDynamicReportQryCmd query); + + @PostMapping("/report") + ResultResponse report(@RequestBody ApprovalDynamicReportCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalFamilySettingDataClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalFamilySettingDataClientApi.java similarity index 91% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalFamilySettingDataClientApi.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalFamilySettingDataClientApi.java index eb7140a5..aa8f8818 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalFamilySettingDataClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalFamilySettingDataClientApi.java @@ -1,26 +1,26 @@ -package com.red.circle.other.inner.endpoint.approval.api; - -import com.red.circle.framework.dto.PageResult; -import com.red.circle.framework.dto.ResultResponse; -import com.red.circle.other.inner.model.cmd.approval.ApprovalFamilyCmd; -import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; -import com.red.circle.other.inner.model.dto.approval.ApprovalFamilyDTO; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -/** - * 家族资料审批 - * - * @author zongpubin on 2024/1/20 - */ -public interface ApprovalFamilySettingDataClientApi { - - String API_PREFIX = "/approval/family/client"; - - @PostMapping("/pageFamilyApproval") - ResultResponse> pageFamilyApproval( - @RequestBody ApprovalProfileDescQryCmd query); - - @PostMapping("/notPass") - ResultResponse notPass(@RequestBody ApprovalFamilyCmd cmd); -} +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalFamilyCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalFamilyDTO; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 家族资料审批 + * + * @author zongpubin on 2024/1/20 + */ +public interface ApprovalFamilySettingDataClientApi { + + String API_PREFIX = "/approval/family/client"; + + @PostMapping("/pageFamilyApproval") + ResultResponse> pageFamilyApproval( + @RequestBody ApprovalProfileDescQryCmd query); + + @PostMapping("/notPass") + ResultResponse notPass(@RequestBody ApprovalFamilyCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalUserSettingInfoClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalUserSettingInfoClientApi.java similarity index 92% rename from rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalUserSettingInfoClientApi.java rename to rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalUserSettingInfoClientApi.java index ba2dfb31..d3bf639b 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/approval/api/ApprovalUserSettingInfoClientApi.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/ApprovalUserSettingInfoClientApi.java @@ -1,28 +1,28 @@ -package com.red.circle.other.inner.endpoint.approval.api; - -import com.red.circle.framework.dto.PageResult; -import com.red.circle.framework.dto.ResultResponse; -import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; -import com.red.circle.other.inner.model.cmd.approval.ApprovalUserProfileQryCmd; -import com.red.circle.other.inner.model.dto.approval.ApprovalProfileDescDTO; -import com.red.circle.other.inner.model.dto.approval.ApprovalUserProfileDTO; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -/** - * 用户审批相关列表 - * - * @author zongpubin on 2024/1/22 - */ -public interface ApprovalUserSettingInfoClientApi { - - String API_PREFIX = "/approval/user-setting/client"; - - @PostMapping("/pageProfileDescApproval") - ResultResponse> pageProfileDescApproval( - @RequestBody ApprovalProfileDescQryCmd query); - - @PostMapping("/pageUserProfileApproval") - ResultResponse> pageUserProfileApproval( - @RequestBody ApprovalUserProfileQryCmd query); -} +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalUserProfileQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalProfileDescDTO; +import com.red.circle.other.inner.model.dto.approval.ApprovalUserProfileDTO; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 用户审批相关列表 + * + * @author zongpubin on 2024/1/22 + */ +public interface ApprovalUserSettingInfoClientApi { + + String API_PREFIX = "/approval/user-setting/client"; + + @PostMapping("/pageProfileDescApproval") + ResultResponse> pageProfileDescApproval( + @RequestBody ApprovalProfileDescQryCmd query); + + @PostMapping("/pageUserProfileApproval") + ResultResponse> pageUserProfileApproval( + @RequestBody ApprovalUserProfileQryCmd query); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicBlacklistClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicBlacklistClientApi.java new file mode 100644 index 00000000..cb7e91bd --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicBlacklistClientApi.java @@ -0,0 +1,32 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 动态-黑名单服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface DynamicBlacklistClientApi { + + String API_PREFIX = "/dynamic/blacklist"; + + @GetMapping("/deleteByUserId") + ResultResponse deleteByUserId(@RequestParam("userId") Long userId); + + @PostMapping("/add") + ResultResponse add(@RequestBody DynamicBlacklistCmd cmd); + + @PostMapping("/pageDynamicBlacklist") + ResultResponse> pageDynamicBlacklist( + @RequestBody DynamicBlacklistQryCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicCacheClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicCacheClientApi.java new file mode 100644 index 00000000..c58949d0 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicCacheClientApi.java @@ -0,0 +1,25 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 动态-缓存服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface DynamicCacheClientApi { + + String API_PREFIX = "/dynamic/cache"; + + @GetMapping("/getDynamicPopularConfig") + ResultResponse getDynamicPopularConfig(); + + @PostMapping("/updateDynamicPopularConfig") + ResultResponse updateDynamicPopularConfig(@RequestBody DynamicPopularConfigCmd param); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicContentClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicContentClientApi.java new file mode 100644 index 00000000..9d96101f --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicContentClientApi.java @@ -0,0 +1,41 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicContentDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 动态-内容服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface DynamicContentClientApi { + + String API_PREFIX = "/dynamic/content"; + + @PostMapping("/deleteByIds") + ResultResponse deleteByIds(@RequestBody DelDynamicContentCmd cmd); + + @PostMapping("/pageDynamicContent") + ResultResponse> pageDynamicContent( + @RequestBody DynamicContentQryCmd cmd); + + @GetMapping("/countDynamicMessage") + ResultResponse countDynamicMessage(@RequestParam("userId") Long userId); + + /** + * 添加动态内容 + * @param cmd + */ + @PostMapping("/save") + ResultResponse save(@RequestBody DynamicContentCmd cmd); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicPictureClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicPictureClientApi.java new file mode 100644 index 00000000..0da9e81a --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicPictureClientApi.java @@ -0,0 +1,26 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import java.util.Map; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 动态-标签服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface DynamicPictureClientApi { + + String API_PREFIX = "/dynamic/picture"; + + @PostMapping("/save") + ResultResponse save(@RequestBody DynamicPictureCmd build); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTagClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTagClientApi.java new file mode 100644 index 00000000..894619ec --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTagClientApi.java @@ -0,0 +1,31 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import java.util.Map; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 动态-标签服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface DynamicTagClientApi { + + String API_PREFIX = "/dynamic/tag"; + + @PostMapping("/addOrUpdate") + ResultResponse addOrUpdate(@RequestBody DynamicTagCmd dynamicTag); + + @PostMapping("/pageData") + ResultResponse> pageData(@RequestBody PageDynamicTagQryCmd query); + + @GetMapping("/getAllDynamicTag") + ResultResponse> getAllDynamicTag(); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTimelineClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTimelineClientApi.java new file mode 100644 index 00000000..a8cc04ce --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/DynamicTimelineClientApi.java @@ -0,0 +1,20 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDateInfoCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * 资料审批 + * + * @author zongpubin on 2024/1/22 + */ +public interface DynamicTimelineClientApi { + + String API_PREFIX = "/dynamic/timeline/client"; + + @PostMapping("/save") + ResultResponse save(@RequestBody DynamicTimelineCmd build); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/TopDynamicClientApi.java b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/TopDynamicClientApi.java new file mode 100644 index 00000000..0c23ebfc --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-api/src/main/java/com/red/circle/other/inner/endpoint/dynamic/api/TopDynamicClientApi.java @@ -0,0 +1,24 @@ +package com.red.circle.other.inner.endpoint.dynamic.api; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * 动态-缓存服务. + * + * @author lisizhe on 2023/10/5 + */ +public interface TopDynamicClientApi { + + String API_PREFIX = "/top/dynamic"; + + @PostMapping("/setUpTop") + ResultResponse setUpTop(@RequestBody TopDynamicCmd param); + + @GetMapping("/closeTop") + ResultResponse closeTop(@RequestParam("dynamicId") Long dynamicId); +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/DynamicErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/DynamicErrorCode.java new file mode 100644 index 00000000..81d0d3a3 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/DynamicErrorCode.java @@ -0,0 +1,113 @@ +package com.red.circle.other.inner.asserts; + + +import com.red.circle.framework.dto.IResponseErrorCode; +import com.red.circle.framework.dto.ResErrorCode; + +/** + * 动态相关code, 范围: 2900 ~ 3000 状态. + * + * @author pengliang on 2019/10/19 23:25 + */ + +@ResErrorCode(describe = "动态相关", minCode = 2900, maxCode = 3000) +public enum DynamicErrorCode implements IResponseErrorCode { + + /** + * 重复提交. + */ + REPEATED_SUBMIT(2901, "repeated submit"), + /** + * 今日动态已达上限. + */ + DYNAMIC_QUANTITY_LIMIT_ERROR(2902, "You have reached the maximum number of posts today"), + + /** + * 动态标签不存在. + */ + TAG_IS_NULL(2903, "Tag does not exist"), + + /** + * 动态内容不存在. + */ + CONTENT_IS_NULL(2904, "content does not exist"), + + /** + * 动态内容已删除. + */ + CONTENT_DELETE(2905, "Content has been removed"), + + /** + * 图片最多上传九张. + */ + IMAGE_LIMIT_ERROR(2906, "Upload up to 9 pictures"), + + /** + * 财富与魅力等级过低,无法发布动态. + */ + WEALTH_AND_CHARM_INSUFFICIENT_ERROR(2907, + "Wealth and Charisma levels are not eligible for posting, please upgrade your level"), + + /** + * 未找到相关信息. + */ + NO_RELATED_INFORMATION_FOUND(2908, "No related information found"), + + /** + * 动评论已删除. + */ + COMMENT_DELETED(2909, "Comment deleted"), + + /** + * 当前等级过低. + */ + CURRENT_LEVEL_IS_TOO_LOW(2910, "Current level is too low"), + + /** + * 已点赞. + */ + LIKED(2911, "Liked"), + + /** + * 已取消点赞. + */ + UNLIKED(2912, "Unliked"), + /** + * 重复投诉. + */ + REPEAT_COMPLAINT_ERROR(2913, "Complained"), + /** + *敏感词提示 + */ + SENSITIVE_WORD_ERROR(2915,"Sensitive words, please modify and try again"), + + /** + * 重复投诉. + */ + CONTENT_FAIL(2999, "fail"); + + + private final Integer code; + private final String message; + + DynamicErrorCode(Integer code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getMessage() { + return message; + } + + @Override + public String getErrorCodeName() { + return this.name(); + } + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java index 2adfeaf8..ad611800 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/OtherErrorCode.java @@ -1,240 +1,243 @@ -package com.red.circle.other.inner.asserts; - -import com.red.circle.framework.dto.IResponseErrorCode; -import com.red.circle.framework.dto.ResErrorCode; - -/** - * Other service related error codes. - */ -@ResErrorCode(describe = "other service", minCode = 2900, maxCode = 3300) -public enum OtherErrorCode implements IResponseErrorCode { - - REPEATED_SUBMIT(2901, "repeated submit"), - NO_RELATED_INFORMATION_FOUND(2908, "No related information found"), - SENSITIVE_WORD_ERROR(2915, "Sensitive words, please modify and try again"), - - /** - * 道具券不存在 - */ - PROP_COUPON_NOT_FOUND(3200, "Prop coupon not found"), - - /** - * 道具券不属于当前用户 - */ - PROP_COUPON_NOT_BELONG_TO_USER(3201, "Prop coupon does not belong to the current user"), - - /** - * 道具券已使用 - */ - PROP_COUPON_ALREADY_USED(3202, "Prop coupon has already been used"), - - /** - * 道具券已过期 - */ - PROP_COUPON_EXPIRED(3203, "Prop coupon has expired"), - - /** - * 道具券类型不支持 - */ - PROP_COUPON_TYPE_NOT_SUPPORT(3204, "Prop coupon type not supported"), - - /** - * 道具券已赠送 - */ - PROP_COUPON_ALREADY_SENT(3205, "Prop coupon has already been sent"), - - /** - * 接收人不存在 - */ - PROP_COUPON_RECEIVER_NOT_FOUND(3206, "Receiver not found"), - - /** - * 不能赠送给自己 - */ - PROP_COUPON_CANNOT_SEND_TO_SELF(3207, "Cannot send coupon to yourself"), - - /** - * 道具不存在 - */ - PROP_COUPON_PROP_NOT_FOUND(3208, "Prop not found"), - - /** - * 道具券生成失败 - */ - PROP_COUPON_GENERATE_FAILED(3209, "Prop coupon generation failed"), - - /** - * 操作频繁,请稍后再试 - */ - PROP_COUPON_OPERATION_TOO_FREQUENT(3210, "Operation too frequent, please try again later"), - - /** - * 道具券数量不足 - */ - PROP_COUPON_QUANTITY_NOT_ENOUGH(3211, "Prop coupon quantity not enough"), - - /** - * 批量赠送用户数量超过限制 - */ - PROP_COUPON_BATCH_USER_LIMIT(3212, "Batch user limit exceeded"), - - /** - * 道具券有效天数超过限制 - */ - PROP_COUPON_VALID_DAYS_LIMIT(3213, "Valid days limit exceeded"), - - /** - * 道具已下架 - */ - PROP_COUPON_OFF(3214, "This prop has been taken off the shelves"), - - /** - * 红包不存在 - */ - RED_PACKET_NOT_FOUND(3260, "Red packet not found"), - - /** - * 红包已过期 - */ - RED_PACKET_EXPIRED(3261, "Red packet has expired"), - - /** - * 红包已抢完 - */ - RED_PACKET_FINISHED(3262, "Red packet has been claimed"), - - /** - * 您已经抢过该红包 - */ - RED_PACKET_ALREADY_GRABBED(3263, "You have already claimed this red packet"), - - /** - * 您不在该房间内 - */ - RED_PACKET_NOT_IN_ROOM(3264, "You are not in the room"), - - /** - * 余额不足 - */ - RED_PACKET_INSUFFICIENT_BALANCE(3265, "Insufficient balance"), - - /** - * 红包金额配置错误 - */ - RED_PACKET_AMOUNT_ERROR(3266, "Invalid red packet amount"), - - /** - * 红包数量配置错误 - */ - RED_PACKET_COUNT_ERROR(3267, "Invalid red packet count"), - - /** - * 红包退款失败 - */ - RED_PACKET_REFUND_FAILED(3268, "Red packet refund failed"), - - /** - * 红包创建失败 - */ - RED_PACKET_CREATE_FAILED(3269, "Red packet creation failed"), - - /** - * 红包类型错误 - */ - RED_PACKET_TYPE_ERROR(3270, "Invalid red packet type"), - - /** - * 红包过期时间配置错误 - */ - RED_PACKET_EXPIRE_TIME_ERROR(3271, "Invalid expire time configuration"), - - /** - * 靓号已存在 - */ - SPECIAL_ID_ALREADY_EXISTS(3272, "Special numbers already exist"), - - /** - * 用户充值金额无效 - */ - USER_RECHARGE_INVALID(3273, "The recharge amount is insufficient to claim the reward"), - - /** - * 设备已被其他账号使用 - */ - DEVICE_ALREADY_USED(3274, "Device has been used by another account"), - - CANNOT_SEND_TO_SELF(40301, "You can't give yourself red envelopes"), - - NOT_RED_PACKET_RECEIVER(40302, "You are not a red envelope recipient"), - - /** - * 用户财富等级不足10级 - */ - USER_WEALTH_NEED_THAN_10(40303, "User wealth level needs to be greater than 10"), - - /** - * 签到配置不存在 - */ - SIGN_IN_CONFIG_NOT_FOUND(3280, "Sign-in configuration not found"), - - /** - * 今天已经签到过了 - */ - SIGN_IN_ALREADY_CHECKED(3281, "Already signed in today"), - - /** - * 不能提前签到 - */ - SIGN_IN_CANNOT_ADVANCE(3282, "Cannot sign in advance"), - - /** - * 请先完成之前的签到或补签 - */ - SIGN_IN_NEED_PREVIOUS(3283, "Please complete previous sign-ins or make-up first"), - - /** - * 只能补签过去的日期 - */ - SIGN_IN_SUPPLEMENT_ONLY_PAST(3284, "Can only make up for past dates"), - - /** - * 该日期已经签到 - */ - SIGN_IN_DATE_ALREADY_CHECKED(3285, "This date has already been signed in"), - - /** - * 签到操作频繁 - */ - SIGN_IN_OPERATION_TOO_FREQUENT(3286, "Sign-in operation too frequent, please try again later"), - - CONSECUTIVE_REWARD(3287, "Consecutive Check-in Reward!"), - - /** - * 请先取消cp关系 - */ - CANCEL_CP_RELATION_FIRST(3288, "Please cancel the cp relationship first"), - ; - - private final int code; - private final String message; - - OtherErrorCode(int code, String message) { - this.code = code; - this.message = message; - } - - @Override - public Integer getCode() { - return this.code; - } - - @Override - public String getMessage() { - return this.message; - } - - @Override - public String getErrorCodeName() { - return this.name(); - } -} +package com.red.circle.other.inner.asserts; + +import com.red.circle.framework.dto.IResponseErrorCode; +import com.red.circle.framework.dto.ResErrorCode; + +/** + * 道具券相关错误码 范围:3200 ~ 3300 + * + * @author system + * @date 2025-11-05 + */ +@ResErrorCode(describe = "道具券相关", minCode = 3200, maxCode = 3300) +public enum OtherErrorCode implements IResponseErrorCode { + + /** + * 道具券不存在 + */ + PROP_COUPON_NOT_FOUND(3200, "Prop coupon not found"), + + /** + * 道具券不属于当前用户 + */ + PROP_COUPON_NOT_BELONG_TO_USER(3201, "Prop coupon does not belong to the current user"), + + /** + * 道具券已使用 + */ + PROP_COUPON_ALREADY_USED(3202, "Prop coupon has already been used"), + + /** + * 道具券已过期 + */ + PROP_COUPON_EXPIRED(3203, "Prop coupon has expired"), + + /** + * 道具券类型不支持 + */ + PROP_COUPON_TYPE_NOT_SUPPORT(3204, "Prop coupon type not supported"), + + /** + * 道具券已赠送 + */ + PROP_COUPON_ALREADY_SENT(3205, "Prop coupon has already been sent"), + + /** + * 接收人不存在 + */ + PROP_COUPON_RECEIVER_NOT_FOUND(3206, "Receiver not found"), + + /** + * 不能赠送给自己 + */ + PROP_COUPON_CANNOT_SEND_TO_SELF(3207, "Cannot send coupon to yourself"), + + /** + * 道具不存在 + */ + PROP_COUPON_PROP_NOT_FOUND(3208, "Prop not found"), + + /** + * 道具券生成失败 + */ + PROP_COUPON_GENERATE_FAILED(3209, "Prop coupon generation failed"), + + /** + * 操作频繁,请稍后再试 + */ + PROP_COUPON_OPERATION_TOO_FREQUENT(3210, "Operation too frequent, please try again later"), + + /** + * 道具券数量不足 + */ + PROP_COUPON_QUANTITY_NOT_ENOUGH(3211, "Prop coupon quantity not enough"), + + /** + * 批量赠送用户数量超过限制 + */ + PROP_COUPON_BATCH_USER_LIMIT(3212, "Batch user limit exceeded"), + + /** + * 道具券有效天数超过限制 + */ + PROP_COUPON_VALID_DAYS_LIMIT(3213, "Valid days limit exceeded"), + + /** + * 道具已下架 + */ + PROP_COUPON_OFF(3214, "This prop has been taken off the shelves"), + + // ==================== 红包相关错误码 3260-3279 ==================== + + /** + * 红包不存在 + */ + RED_PACKET_NOT_FOUND(3260, "Red packet not found"), + + /** + * 红包已过期 + */ + RED_PACKET_EXPIRED(3261, "Red packet has expired"), + + /** + * 红包已抢完 + */ + RED_PACKET_FINISHED(3262, "Red packet has been claimed"), + + /** + * 您已经抢过该红包 + */ + RED_PACKET_ALREADY_GRABBED(3263, "You have already claimed this red packet"), + + /** + * 您不在该房间内 + */ + RED_PACKET_NOT_IN_ROOM(3264, "You are not in the room"), + + /** + * 余额不足 + */ + RED_PACKET_INSUFFICIENT_BALANCE(3265, "Insufficient balance"), + + /** + * 红包金额配置错误 + */ + RED_PACKET_AMOUNT_ERROR(3266, "Invalid red packet amount"), + + /** + * 红包数量配置错误 + */ + RED_PACKET_COUNT_ERROR(3267, "Invalid red packet count"), + + /** + * 红包退款失败 + */ + RED_PACKET_REFUND_FAILED(3268, "Red packet refund failed"), + + /** + * 红包创建失败 + */ + RED_PACKET_CREATE_FAILED(3269, "Red packet creation failed"), + + /** + * 红包类型错误 + */ + RED_PACKET_TYPE_ERROR(3270, "Invalid red packet type"), + + /** + * 红包过期时间配置错误 + */ + RED_PACKET_EXPIRE_TIME_ERROR(3271, "Invalid expire time configuration"), + + /** + * 靓号已存在 + */ + SPECIAL_ID_ALREADY_EXISTS(3272, "Special numbers already exist"), + + /** + * 用户充值金额无效 + */ + USER_RECHARGE_INVALID(3273, "The recharge amount is insufficient to claim the reward"), + + /** + * 设备已被其他账号使用 + */ + DEVICE_ALREADY_USED(3274, "Device has been used by another account"), + + CANNOT_SEND_TO_SELF(40301, "You can't give yourself red envelopes"), + + NOT_RED_PACKET_RECEIVER(40302, "You are not a red envelope recipient"), + + /** + * 用户财富等级不足10级 + */ + USER_WEALTH_NEED_THAN_10(40303, "User wealth level needs to be greater than 10"), + + // ==================== 签到相关错误码 3280-3299 ==================== + + /** + * 签到配置不存在 + */ + SIGN_IN_CONFIG_NOT_FOUND(3280, "Sign-in configuration not found"), + + /** + * 今天已经签到过了 + */ + SIGN_IN_ALREADY_CHECKED(3281, "Already signed in today"), + + /** + * 不能提前签到 + */ + SIGN_IN_CANNOT_ADVANCE(3282, "Cannot sign in advance"), + + /** + * 请先完成之前的签到或补签 + */ + SIGN_IN_NEED_PREVIOUS(3283, "Please complete previous sign-ins or make-up first"), + + /** + * 只能补签过去的日期 + */ + SIGN_IN_SUPPLEMENT_ONLY_PAST(3284, "Can only make up for past dates"), + + /** + * 该日期已经签到 + */ + SIGN_IN_DATE_ALREADY_CHECKED(3285, "This date has already been signed in"), + + /** + * 签到操作频繁 + */ + SIGN_IN_OPERATION_TOO_FREQUENT(3286, "Sign-in operation too frequent, please try again later"), + + CONSECUTIVE_REWARD(3287, "Consecutive Check-in Reward!"), + + /** + * 请先取消cp关系 + */ + CANCEL_CP_RELATION_FIRST(3288, "Please cancel the cp relationship first"), + ; + + private final int code; + private final String message; + + OtherErrorCode(int code, String message) { + this.code = code; + this.message = message; + } + + @Override + public Integer getCode() { + return this.code; + } + + @Override + public String getMessage() { + return this.message; + } + + @Override + public String getErrorCodeName() { + return this.name(); + } +} \ No newline at end of file diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicCmd.java new file mode 100644 index 00000000..f5df966b --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicCmd.java @@ -0,0 +1,28 @@ +package com.red.circle.other.inner.model.cmd.approval; + +import java.io.Serializable; +import java.util.Set; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 动态审批 + * @author zongpubin on 2024/1/19 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicCmd implements Serializable { + + private static final long serialVersionUID = 1L; + /** + * 动态ids + */ + private Set ids; + + /** + * 审批用户 + */ + private Long userId; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicContentCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicContentCmd.java new file mode 100644 index 00000000..e8e3128b --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicContentCmd.java @@ -0,0 +1,79 @@ +package com.red.circle.other.inner.model.cmd.approval; + + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 审批内容模型. + * + * @author pengliang on 2020/9/18 + */ +@Data +@Builder +@Accessors(chain = true) +public class ApprovalDynamicContentCmd implements Serializable { + + /** + * 主键标识 + */ + private Long id; + + /** + * 系统来源 + */ + private String sysOrigin; + + /** + * 被审批用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 类型 0图文 1视频 + */ + private Integer dynamicType; + + /** + * 审核状态 + */ + private String approveStatus; + + /** + * 审批来源 1APP 0后台 + */ + private Boolean originType; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 创建用户. + */ + private Long createUser; + + /** + * 修改时间 + */ + private Timestamp updateTime; + + /** + * 修改用户 + */ + private Long updateUser; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicQryCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicQryCmd.java new file mode 100644 index 00000000..fb97de7a --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicQryCmd.java @@ -0,0 +1,54 @@ +package com.red.circle.other.inner.model.cmd.approval; + +import com.red.circle.common.business.dto.cmd.HistoryRangeTimeQryPageCmd; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态审批 + *

+ * + * @author pengshigang + * @since 2022-4-21 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class ApprovalDynamicQryCmd extends HistoryRangeTimeQryPageCmd { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + private Long userId; + + + /** + * 系统 + */ + private String sysOrigin; + + /** + * 状态 + */ + private String approveStatus; + + /** + * 类型 0:图文 1:动态 + */ + private Integer dynamicType; + + /** + * 开始时间 + */ + private LocalDateTime startCreateDate; + + /** + * 结束时间 + */ + private LocalDateTime endCreateDate; +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportCmd.java new file mode 100644 index 00000000..8baf8d6c --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportCmd.java @@ -0,0 +1,43 @@ +package com.red.circle.other.inner.model.cmd.approval; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import jakarta.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Set; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicReportCmd implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 内容id. + */ + @NotNull + private Set contentIds; + + /** + * 状态(0.待处理 1.删除 2.驳回). + */ + @NotNull + private Integer approvalStatus; + + /** + * 审批人. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long approvalUserId; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportQryCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportQryCmd.java new file mode 100644 index 00000000..0e0ea6fc --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/approval/ApprovalDynamicReportQryCmd.java @@ -0,0 +1,49 @@ +package com.red.circle.other.inner.model.cmd.approval; + +import com.red.circle.common.business.dto.cmd.HistoryRangeTimeQryPageCmd; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class ApprovalDynamicReportQryCmd extends HistoryRangeTimeQryPageCmd { + + private static final long serialVersionUID = 1L; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + private Integer approvalStatus; + + /** + * 违规类型 + */ + private Integer reportType; + + /** + * 投诉用户. + */ + private Long reportUserId; + + /** + * 被投诉用户. + */ + private Long reportedUserId; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/CreateDynamicVideoCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/CreateDynamicVideoCmd.java new file mode 100644 index 00000000..49f19d2b --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/CreateDynamicVideoCmd.java @@ -0,0 +1,74 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.CommonCommand; +import java.io.Serial; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @author xiongcheng on 2024/3/26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class CreateDynamicVideoCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + private List dynamicVideoCmdList; + + @Data + @EqualsAndHashCode(callSuper = false) + @Accessors(chain = true) + public static class DynamicVideoCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 归属平台. + */ + private String sysOrigin; + + + /** + * 用户Id. + */ + private Long userId; + + /** + * 类型. + */ + private Integer type; + + /** + * 地址url + */ + private String sourceUrl; + + /** + * 内容 + */ + private String content; + + /** + * 标签 + */ + private String tag; + + /** + * 是否为自己发的朋友圈(1.是 0.否). + */ + private Boolean own; + + /** + * 语言 + */ + private String languageType; + } + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DelDynamicContentCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DelDynamicContentCmd.java new file mode 100644 index 00000000..d840cd04 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DelDynamicContentCmd.java @@ -0,0 +1,28 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.CommonCommand; +import java.io.Serial; +import java.util.Set; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DelDynamicContentCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + private Set ids; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistCmd.java new file mode 100644 index 00000000..d0b68b35 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistCmd.java @@ -0,0 +1,43 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.CommonCommand; +import jakarta.validation.constraints.NotBlank; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-黑名单 . + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class DynamicBlacklistCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 平台. + */ + @NotBlank(message = "请选择系统平台") + private String sysOrigin; + + /** + * 用户. + */ + @NotBlank(message = "输入账号") + private String account; + + /** + * 用户id + */ + private Long userId; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistQryCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistQryCmd.java new file mode 100644 index 00000000..bbb1d65a --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicBlacklistQryCmd.java @@ -0,0 +1,36 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.PageCommand; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态黑名单. + *

+ * + * @author pengshigang + * @since 2022-4-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicBlacklistQryCmd extends PageCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 系统平台 + */ + private String sysOrigin; + + /** + * 用户id + */ + private Long userId; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentCmd.java new file mode 100644 index 00000000..0654b8d9 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentCmd.java @@ -0,0 +1,81 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author xiongcheng on 2024/3/26 + */ +@Data +@Builder +@Accessors(chain = true) +public class DynamicContentCmd implements Serializable { + + /** + * 主键. + */ + private Long id; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 内容. + */ + private String content; + + /** + * 位置. + */ + private String location; + + /** + * 标签ID. + */ + private Long tagId; + + /** + * 是否已删除(0.否 1.是). + */ + private Boolean del; + + /** + * 动态区域 + */ + private String region; + + /** + * 类型 + */ + private Integer type; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 创建用户. + */ + private Long createUser; + + /** + * 修改时间 + */ + private Timestamp updateTime; + + /** + * 修改用户 + */ + private Long updateUser; + + /** + * 语言 + */ + private String languageType; +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentQryCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentQryCmd.java new file mode 100644 index 00000000..5d43c4ae --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicContentQryCmd.java @@ -0,0 +1,52 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.HistoryRangeTimeQryPageCmd; +import java.io.Serial; +import java.time.LocalDateTime; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.checkerframework.common.returnsreceiver.qual.This; + +/** + *

+ * 动态内容. + *

+ * + * @author pengshigang + * @since 2022-4-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicContentQryCmd extends HistoryRangeTimeQryPageCmd { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + private Long userId; + + /** + * 系统 + */ + private String sysOrigin; + + /** + * 是否置顶(true置顶,false不置顶) + */ + private Boolean top; + + /** + * 发布时间 + */ + private LocalDateTime startCreateDate; + + /** + * 发布时间 + */ + private LocalDateTime endCreateDate; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPictureCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPictureCmd.java new file mode 100644 index 00000000..e4673fcf --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPictureCmd.java @@ -0,0 +1,87 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.DTO; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@Builder +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicPictureCmd extends DTO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内容ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 资源图片地址. + */ + private String resourceUrl; + + /** + * 压缩后的资源图片地址. + */ + private String miniResourceUrl; + + /** + * 图片宽. + */ + private Integer width; + + /** + * 图片高. + */ + private Integer height; + + /** + * 序号. + */ + private Integer sort; + + /** + * 违规状态. + */ + private String violation; + + /** + * 机器审核标签. + */ + private String labelNames; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPopularConfigCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPopularConfigCmd.java new file mode 100644 index 00000000..084c5400 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicPopularConfigCmd.java @@ -0,0 +1,45 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-热门权重分设置 . + *

+ * + * @author pengshigang + * @since 2022-4-27 + */ +@Data +@Accessors(chain = true) +public class DynamicPopularConfigCmd implements Serializable { + + /** + * 评论计分. + */ + private Integer commentScore; + + /** + * 点赞计分. + */ + private Integer likeScore; + + /** + * 等级限制. + */ + private Long levelLimit; + + /** + * 数量限制. + */ + private Long quantityLimit; + + /** + * 数量限制. + */ + private Long dynamicFees; + +} + diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTagCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTagCmd.java new file mode 100644 index 00000000..b540c227 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTagCmd.java @@ -0,0 +1,65 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.CommonCommand; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈标签. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicTagCmd extends CommonCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + private Long id; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 标签. + */ + private String tag; + + /** + * 描述. + */ + private String description; + + /** + * 背景图. + */ + private String imageUrl; + + /** + * 0.上架 1.下架. + */ + private Boolean del; + + /** + * 排序. + */ + private Integer sort; + + /** + * 语言类型 + */ + private String languageType; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTimelineCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTimelineCmd.java new file mode 100644 index 00000000..3f23ad66 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/DynamicTimelineCmd.java @@ -0,0 +1,55 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import java.sql.Timestamp; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author xiongcheng on 2024/3/26 + */ +@Data +@Builder +@Accessors(chain = true) +public class DynamicTimelineCmd { + + /** + * ID. + */ + private Long id; + + /** + * 朋友圈信息ID. + */ + private Long dynamicContentId; + + /** + * 是否为自己发的朋友圈(1.是 0.否). + */ + private Boolean own; + + /** + * 动态区域 + */ + private String region; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 创建用户. + */ + private Long createUser; + + /** + * 修改时间 + */ + private Timestamp updateTime; + + /** + * 修改用户 + */ + private Long updateUser; +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/PageDynamicTagQryCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/PageDynamicTagQryCmd.java new file mode 100644 index 00000000..6730a3ee --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/PageDynamicTagQryCmd.java @@ -0,0 +1,40 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import com.red.circle.framework.core.dto.PageCommand; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈标签. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class PageDynamicTagQryCmd extends PageCommand { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 0.上架 1.下架. + */ + private Boolean del; + + /** + * 语言类型 + */ + private String languageType; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/TopDynamicCmd.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/TopDynamicCmd.java new file mode 100644 index 00000000..5302ef35 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/cmd/dynamic/TopDynamicCmd.java @@ -0,0 +1,51 @@ +package com.red.circle.other.inner.model.cmd.dynamic; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import java.io.Serial; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class TopDynamicCmd implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 动态id. + */ + @NotNull + private Long dynamicId; + + /** + * 归属系统. + */ + @NotBlank + private String sysOrigin; + + /** + * 权重. + */ + @NotNull + private Integer weights; + + /** + * 操作人 + */ + private Long operatorId; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicDTO.java new file mode 100644 index 00000000..92fccc23 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicDTO.java @@ -0,0 +1,81 @@ +package com.red.circle.other.inner.model.dto.approval; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import java.io.Serial; +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 审批动态 + *

+ * + * @author pengshigang + * @since 2022-4-21 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicDTO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 动态内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 审批状态. + */ + private String approveStatus; + + /** + * 动态文字内容 + */ + private String dynamicContent; + + /** + * 动态内容图片 + */ + private List pictures; + + /** + * 用户性别:0 女,1 男,2 变性人 + */ + private String userSexName; + + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicReportedDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicReportedDTO.java new file mode 100644 index 00000000..e403dd77 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/approval/ApprovalDynamicReportedDTO.java @@ -0,0 +1,98 @@ +package com.red.circle.other.inner.model.dto.approval; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import java.io.Serial; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 被举报动态 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicReportedDTO implements Serializable { + + + @Serial + private static final long serialVersionUID = 1L; + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 举报用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long reportUserId; + + /** + * 被举报用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long reportedUserId; + + + /** + * 0.非法信息 1.人身攻击 2.不适当的内容 3.发送垃圾邮件 4.诈骗 5.涉及色情. + */ + private Integer reportType; + + /** + * 0.非法信息 1.人身攻击 2.不适当的内容 3.发送垃圾邮件 4.诈骗 5.涉及色情. + */ + private String reportTypeName; + + /** + * 举报类容. + */ + private String reportedContent; + + /** + * 举报图片 + */ + private String reportedUrls; + + /** + * 动态图片. + */ + private List dynamicPictures; + + /** + * 动态内容. + */ + private String dynamicContent; + + /** + * 动态内容ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicContentId; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + private Integer approvalStatus; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + private String approvalStatusName; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicContentDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicContentDTO.java new file mode 100644 index 00000000..95ffc6b2 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicContentDTO.java @@ -0,0 +1,71 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Builder; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author xiongcheng on 2024/3/26 + */ +@Data +@Builder +@Accessors(chain = true) +public class DynamicContentDTO implements Serializable { + + /** + * 主键. + */ + private Long id; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 内容. + */ + private String content; + + /** + * 位置. + */ + private String location; + + /** + * 标签ID. + */ + private Long tagId; + + /** + * 是否已删除(0.否 1.是). + */ + private Boolean del; + + /** + * 动态区域 + */ + private String region; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 创建用户. + */ + private Long createUser; + + /** + * 修改时间 + */ + private Timestamp updateTime; + + /** + * 修改用户 + */ + private Long updateUser; +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPictureDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPictureDTO.java new file mode 100644 index 00000000..b88e97cf --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPictureDTO.java @@ -0,0 +1,107 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.DTO; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicPictureDTO extends DTO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内容ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 创建动态的用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 资源图片地址. + */ + private String resourceUrl; + + /** + * 图片宽. + */ + private Integer width; + + /** + * 图片高. + */ + private Integer height; + + /** + * 序号. + */ + private Integer sort; + + /** + * 违规状态. + */ + private String violation; + private String violationName; + + /** + * 机器审核标签. + */ + private String labelNames; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 年龄. + */ + private Integer age; + + /** + * 用户性别:0 女,1 男. + */ + private String userSexName; + + /** + * 用户性别:0 女,1 男. + */ + private Integer userSex; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPopularConfigDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPopularConfigDTO.java new file mode 100644 index 00000000..e7ade400 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicPopularConfigDTO.java @@ -0,0 +1,44 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-热门权重分设置 . + *

+ * + * @author pengshigang + * @since 2022-4-27 + */ +@Data +@Accessors(chain = true) +public class DynamicPopularConfigDTO implements Serializable { + + /** + * 评论计分. + */ + private Integer commentScore; + + /** + * 点赞计分. + */ + private Integer likeScore; + + /** + * 等级限制. + */ + private Long levelLimit; + + /** + * 数量限制. + */ + private Long quantityLimit; + + /** + * 数量限制. + */ + private Long dynamicFees; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicTagDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicTagDTO.java new file mode 100644 index 00000000..3f283bbf --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/DynamicTagDTO.java @@ -0,0 +1,79 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.DTO; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈标签. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicTagDTO extends DTO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 标签. + */ + private String tag; + + /** + * 描述. + */ + private String description; + + /** + * 背景图. + */ + private String imageUrl; + + /** + * 0.上架 1.下架. + */ + private Boolean del; + + /** + * 排序. + */ + private Integer sort; + + /** + * 语言类型 + */ + private String languageType; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicBlacklistDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicBlacklistDTO.java new file mode 100644 index 00000000..af73a0ad --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicBlacklistDTO.java @@ -0,0 +1,68 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.DTO; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-黑名单. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class PageDynamicBlacklistDTO extends DTO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 归属平台. + */ + private String sysOrigin; + + /** + * 用户ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 创建用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long createUser; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 修改用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long updateUser; + + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicContentDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicContentDTO.java new file mode 100644 index 00000000..3a558d43 --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/dynamic/PageDynamicContentDTO.java @@ -0,0 +1,83 @@ +package com.red.circle.other.inner.model.dto.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.DTO; +import java.sql.Timestamp; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态内容 + *

+ * + * @author pengshigang + * @since 2022-4-27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class PageDynamicContentDTO extends DTO { + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 动态文字内容. + */ + private String content; + + /** + * 是否置顶(true置顶, false不置顶). + */ + private Boolean top; + + /** + * 权重. + */ + private Integer weights; + + /** + * 动态内容图片. + */ + private List pictures; + + /** + * 用户性别:0 女,1 男,2 变性人. + */ + private String userSexName; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 创建用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long createUser; + +} diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserSimpleProfileDTO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserSimpleProfileDTO.java index c200c936..b9eeb922 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserSimpleProfileDTO.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/user/UserSimpleProfileDTO.java @@ -10,7 +10,7 @@ import com.red.circle.other.inner.model.dto.user.props.UserUsePropsDTO; import lombok.Data; /** - * 用户简化资料(用于列表等场景,减少数据传输量). + * 用户简化资料(用于动态列表等场景,减少数据传输量). * * @author pengshigang * @since 2025-01-29 diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/enums/GoldOrigin.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/enums/GoldOrigin.java index 5b579a72..b4d26628 100644 --- a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/enums/GoldOrigin.java +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/model/enums/GoldOrigin.java @@ -534,8 +534,13 @@ public enum GoldOrigin { */ BUY_EMOJI("Buy Emoji"), - /** - * 每周游戏任务奖励. + /** + * 超限制发动态支付金币. + */ + SEND_DYNAMIC_PAY_GOLD("Send a post to pay coins"), + + /** + * 每周游戏任务奖励. */ WEEKLY_GAME_TASKS("Weekly game tasks"), diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicContentController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicContentController.java new file mode 100644 index 00000000..8abf3896 --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicContentController.java @@ -0,0 +1,54 @@ +package com.red.circle.console.adapter.app.approval; + + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicCO; +import com.red.circle.console.app.service.app.approval.ApprovalDynamicContentService; +import com.red.circle.console.infra.annotations.OpsOperationReqLog; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import java.util.Set; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态图片审批 前端控制器 + * + * @author pegnshigang + * @since 2022-4-21 + */ +@Slf4j +@RestController +@RequestMapping("/approval/dynamic/content") +@AllArgsConstructor +public class ApprovalDynamicContentController extends BaseController { + + private final ApprovalDynamicContentService approvalDynamicContentService; + + /** + * 加载动态图片 + */ + @GetMapping("/page") + public PageResult page( + ApprovalDynamicQryCmd query) { + return approvalDynamicContentService.page(query); + } + + @OpsOperationReqLog("动态内容审批-通过") + @PostMapping("/pass") + public void approvalPass(@RequestBody Set ids) { + approvalDynamicContentService.approvalPass(ids); + } + + @OpsOperationReqLog("动态内容审批-不通过") + @PostMapping("/not/pass") + public void approvalNotPass(@RequestBody Set ids) { + approvalDynamicContentService.approvalNotPass(ids, getReqUserId()); + } + +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicReportRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicReportRestController.java new file mode 100644 index 00000000..35e10fc5 --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/approval/ApprovalDynamicReportRestController.java @@ -0,0 +1,48 @@ +package com.red.circle.console.adapter.app.approval; + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicReportedCO; +import com.red.circle.console.app.service.app.approval.ApprovalDynamicReportService; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import lombok.AllArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-投诉 前端控制器. + * + * @author pengshigang + * @since 2022-4-18 + */ +@AllArgsConstructor +@RestController +@RequestMapping("/dynamic/report") +public class ApprovalDynamicReportRestController extends BaseController { + + private final ApprovalDynamicReportService approvalDynamicReportService; + + /** + * 分页 + */ + @GetMapping("/page") + public PageResult pageData(ApprovalDynamicReportQryCmd query) { + return approvalDynamicReportService.pageData(query); + } + + /** + * 处理投诉 + */ + @PostMapping + public void report(@RequestBody @Validated ApprovalDynamicReportCmd cmd) { + cmd.setApprovalUserId(getReqUserId()); + approvalDynamicReportService.report(cmd); + } + + +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicBlacklistRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicBlacklistRestController.java new file mode 100644 index 00000000..7ad5e4db --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicBlacklistRestController.java @@ -0,0 +1,55 @@ +package com.red.circle.console.adapter.app.dynamic; + +import com.red.circle.console.app.service.app.dynamic.DynamicBlacklistService; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-黑名单 前端控制器. + * + * @author pengshigang + * @since 2022-06-30 + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/dynamic/blacklist") +public class DynamicBlacklistRestController extends BaseController { + + private final DynamicBlacklistService dynamicBlacklistService; + + /** + * 分页 + */ + @GetMapping("/page") + public PageResult pageData(DynamicBlacklistQryCmd query) { + return dynamicBlacklistService.page(query); + } + + /** + * 添加. + */ + @PostMapping("/add") + public void add(@RequestBody @Validated DynamicBlacklistCmd param) { + dynamicBlacklistService.add(param); + } + + /** + * 删除. + */ + @GetMapping("/delete/{userId}") + public void deleteByUserId(@PathVariable("userId") Long userId) { + dynamicBlacklistService.deleteByUserId(userId); + } + +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicPopularConfigRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicPopularConfigRestController.java new file mode 100644 index 00000000..a6120cb6 --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicPopularConfigRestController.java @@ -0,0 +1,44 @@ +package com.red.circle.console.adapter.app.dynamic; + +import com.red.circle.console.app.service.app.dynamic.DynamicPopularConfigService; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-热门权重分设置 前端控制器. + * + * @author pengshigang + * @since 2022-4-27 + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/dynamic/popular/config") +public class DynamicPopularConfigRestController extends BaseController { + + private final DynamicPopularConfigService dynamicPopularConfigService; + + /** + * 获得配置 + */ + @GetMapping + public DynamicPopularConfigDTO config() { + + return dynamicPopularConfigService.config(); + } + + /** + * 更新配置 + */ + @PostMapping + public void addOrUpdate(@RequestBody @Validated DynamicPopularConfigCmd cmd) { + dynamicPopularConfigService.addOrUpdate(cmd); + } +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicTagRestController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicTagRestController.java new file mode 100644 index 00000000..8e1cd9f8 --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/DynamicTagRestController.java @@ -0,0 +1,47 @@ +package com.red.circle.console.adapter.app.dynamic; + +import com.red.circle.console.app.service.app.dynamic.DynamicTagService; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-标签 前端控制器. + * + * @author pengshigang + * @since 2022-4-15 + */ +@RequiredArgsConstructor +@RestController +@RequestMapping("/dynamic/tag") +public class DynamicTagRestController extends BaseController { + + private final DynamicTagService dynamicTagService; + + /** + * 分页 + */ + @GetMapping("/page") + public PageResult pageData(PageDynamicTagQryCmd query) { + return dynamicTagService.pageData(query); + } + + /** + * 添加、更新 + */ + @PostMapping("/add-or-update") + public void addOrUpdate(@RequestBody @Validated DynamicTagCmd param) { + dynamicTagService.addOrUpdate(param); + } + + +} diff --git a/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/UserDynamicListController.java b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/UserDynamicListController.java new file mode 100644 index 00000000..aebf321f --- /dev/null +++ b/rc-service/rc-service-console/console-adapter/src/main/java/com/red/circle/console/adapter/app/dynamic/UserDynamicListController.java @@ -0,0 +1,83 @@ +package com.red.circle.console.adapter.app.dynamic; + +import com.red.circle.console.app.dto.clienobject.dynamic.PageDynamicContentCO; +import com.red.circle.console.app.service.app.dynamic.DynamicContentService; +import com.red.circle.console.app.service.app.dynamic.TopDynamicService; +import com.red.circle.console.infra.annotations.OpsOperationReqLog; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.inner.model.cmd.dynamic.CreateDynamicVideoCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 用户动态 前端控制器 + * + * @author pegnshigang + * @since 2022-4-21 + */ +@Slf4j +@RestController +@RequestMapping(value = "/user/dynamic", produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class UserDynamicListController extends BaseController { + + private final TopDynamicService topDynamicService; + private final DynamicContentService dynamicContentService; + + /** + * 加载用户动态. + */ + @GetMapping("/page") + public PageResult page(DynamicContentQryCmd query) { + return dynamicContentService.page(query); + } + + + /** + * 插入动态视频 + */ + @PostMapping("/create/video") + public Integer createVideo(@Validated @RequestBody CreateDynamicVideoCmd cmd) { + return dynamicContentService.createVideo(cmd); + } + + @OpsOperationReqLog("用户动态列表-删除用户动态") + @PostMapping("/delete") + public void deleteDynamic(@RequestBody Set ids) { + DelDynamicContentCmd cmd = new DelDynamicContentCmd(); + cmd.setIds(ids); + cmd.setReqUserId(getReqUserId()); + dynamicContentService.deleteByIds(cmd); + } + + /** + * 关闭置顶. + */ + @GetMapping("/closeTop/{dynamicId}") + public void closeTop(@PathVariable("dynamicId") Long dynamicId) { + topDynamicService.closeTop(dynamicId); + } + + /** + * 添加置顶. + */ + @PostMapping("/setUpTop") + public void setUpTop(@Validated @RequestBody TopDynamicCmd param) { + topDynamicService.setUpTop(param); + } + + +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicAppConvertor.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicAppConvertor.java new file mode 100644 index 00000000..211106b6 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicAppConvertor.java @@ -0,0 +1,15 @@ +package com.red.circle.console.app.convertor.approval; + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicCO; +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import org.mapstruct.Mapper; + +/** + * @author zongpubin on 2024/1/19 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface ApprovalDynamicAppConvertor { + + ApprovalDynamicCO toApprovalDynamicCO(ApprovalDynamicDTO approvalDynamicDTO); +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicReportAppConvertor.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicReportAppConvertor.java new file mode 100644 index 00000000..2f04ddb6 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/approval/ApprovalDynamicReportAppConvertor.java @@ -0,0 +1,16 @@ +package com.red.circle.console.app.convertor.approval; + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicReportedCO; +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import org.mapstruct.Mapper; + +/** + * @author zongpubin on 2024/1/19 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface ApprovalDynamicReportAppConvertor { + + ApprovalDynamicReportedCO toApprovalDynamicReportedCO( + ApprovalDynamicReportedDTO approvalDynamicReportedDTO); +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/dynamic/DynamicAppConvertor.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/dynamic/DynamicAppConvertor.java new file mode 100644 index 00000000..be82a0a6 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/convertor/dynamic/DynamicAppConvertor.java @@ -0,0 +1,17 @@ +package com.red.circle.console.app.convertor.dynamic; + +import com.red.circle.console.app.dto.clienobject.dynamic.PageDynamicContentCO; +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import org.mapstruct.Mapper; + +/** + * @author pengliang on 2023/5/12 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface DynamicAppConvertor { + + PageDynamicContentCO toPageDynamicContentCO(PageDynamicContentDTO dto); + +} + diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDataInfoServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDataInfoServiceImpl.java index 7a8526b1..a13c2544 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDataInfoServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDataInfoServiceImpl.java @@ -1,6 +1,6 @@ package com.red.circle.console.app.service.app.approval; -import com.red.circle.other.inner.endpoint.approval.ApprovalDataInfoClient; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalDataInfoClient; import com.red.circle.other.inner.model.cmd.approval.ApprovalDateInfoCmd; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentServiceImpl.java new file mode 100644 index 00000000..a3748724 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentServiceImpl.java @@ -0,0 +1,98 @@ +package com.red.circle.console.app.service.app.approval; + +import com.red.circle.console.app.convertor.approval.ApprovalDynamicAppConvertor; +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicCO; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalDynamicClient; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 审批动态 + * + * @author zongpubin on 2024/1/12 + */ +@Service +@RequiredArgsConstructor +public class ApprovalDynamicContentServiceImpl implements ApprovalDynamicContentService { + + + private final UserProfileClient userProfileClient; + + private final ApprovalDynamicClient approvalDynamicClient; + private final ApprovalDynamicAppConvertor approvalDynamicAppConvertor; + + @Override + public PageResult page(ApprovalDynamicQryCmd query) { + + PageResult pageResult = ResponseAssert.requiredSuccess( + approvalDynamicClient.pageApprovalDynamic(query)); + if (CollectionUtils.isEmpty(pageResult.getRecords())) { + return pageResult.convert(approvalDynamicAppConvertor::toApprovalDynamicCO); + } + + Map userMap = ResponseAssert.requiredSuccess( + userProfileClient.mapByUserIds(getUserIds(pageResult))); + + return pageResult.convert(approvalDynamicDTO -> { + UserProfileDTO user = userMap.get(approvalDynamicDTO.getUserId()); + + ApprovalDynamicCO approvalDynamicCO = approvalDynamicAppConvertor.toApprovalDynamicCO( + approvalDynamicDTO); + + if (Objects.nonNull(user)) { + approvalDynamicCO.setUserBaseInfo(user); + approvalDynamicCO.setUserSexName(getSexName(user.getUserSex())); + }else{ + approvalDynamicCO.setUserBaseInfo(new UserProfileDTO()); + approvalDynamicCO.setUserSexName(getSexName(2)); + } + + return approvalDynamicCO; + }); + } + + @Override + public void approvalPass(Set ids) { + approvalDynamicClient.approvalPass(ids); + + } + + @Override + public void approvalNotPass(Set ids, Long reqUserId) { + ApprovalDynamicCmd approvalDynamicCmd = new ApprovalDynamicCmd(); + approvalDynamicCmd.setIds(ids); + approvalDynamicCmd.setUserId(reqUserId); + approvalDynamicClient.approvalNotPass(approvalDynamicCmd); + + } + + private String getSexName(Integer sex) { + //用户性别:0 女,1 男,2 变性人 + if (Objects.equals(sex, 0)) { + return "女"; + } + if (Objects.equals(sex, 1)) { + return "男"; + } + return "未知"; + } + + private Set getUserIds(PageResult iPage) { + return iPage.getRecords().stream().map(ApprovalDynamicDTO::getUserId) + .collect(Collectors.toSet()); + } + + +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportServiceImpl.java new file mode 100644 index 00000000..0e7aa0c9 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportServiceImpl.java @@ -0,0 +1,75 @@ +package com.red.circle.console.app.service.app.approval; + +import com.red.circle.console.app.convertor.approval.ApprovalDynamicReportAppConvertor; +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicReportedCO; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalDynamicReportClient; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/19 + */ +@Service +@RequiredArgsConstructor +public class ApprovalDynamicReportServiceImpl implements ApprovalDynamicReportService { + + private final UserProfileClient userProfileClient; + private final ApprovalDynamicReportClient approvalDynamicReportClient; + private final ApprovalDynamicReportAppConvertor approvalDynamicReportAppConvertor; + + @Override + public PageResult pageData(ApprovalDynamicReportQryCmd query) { + PageResult pageResult = ResponseAssert.requiredSuccess( + approvalDynamicReportClient.pageData(query)); + if (CollectionUtils.isEmpty(pageResult.getRecords())) { + return pageResult.convert(approvalDynamicReportAppConvertor::toApprovalDynamicReportedCO); + } + Map userMap = ResponseAssert.requiredSuccess( + userProfileClient.mapByUserIds(getUserIds(pageResult))); + + var result = pageResult.convert(record -> { + UserProfileDTO reportUser = userMap.get(record.getReportUserId()); + UserProfileDTO reportedUser = userMap.get(record.getReportedUserId()); + if (Objects.isNull(reportUser) || Objects.isNull(reportedUser)) { + return null; + } + ApprovalDynamicReportedCO approvalDynamicReportedCO = approvalDynamicReportAppConvertor.toApprovalDynamicReportedCO( + record); + + approvalDynamicReportedCO.setReportUser(reportUser); + approvalDynamicReportedCO.setReportedUser(reportedUser); + return approvalDynamicReportedCO; + }); + result.setRecords(result.getRecords().stream().filter(Objects::nonNull).collect( + Collectors.toList())); + return result; + } + + private Set getUserIds(PageResult iPage) { + Set userIds = iPage.getRecords().stream().map(ApprovalDynamicReportedDTO::getReportUserId) + .collect(Collectors.toSet()); + userIds.addAll( + iPage.getRecords().stream().map(ApprovalDynamicReportedDTO::getReportedUserId).collect( + Collectors.toSet())); + return userIds; + } + + @Override + public void report(ApprovalDynamicReportCmd cmd) { + approvalDynamicReportClient.report(cmd); + } +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalFamilySettingDataServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalFamilySettingDataServiceImpl.java index f4f65130..6101d52a 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalFamilySettingDataServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalFamilySettingDataServiceImpl.java @@ -4,7 +4,7 @@ import com.red.circle.console.app.convertor.approval.ApprovalFamilySettingDataAp import com.red.circle.console.app.dto.clienobject.approval.ApprovalFamilyCO; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.dto.PageResult; -import com.red.circle.other.inner.endpoint.approval.ApprovalFamilySettingDataClient; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalFamilySettingDataClient; import com.red.circle.other.inner.model.cmd.approval.ApprovalFamilyCmd; import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; import com.red.circle.other.inner.model.dto.approval.ApprovalFamilyDTO; diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalUserSettingInfoServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalUserSettingInfoServiceImpl.java index 38a39135..9a0daaad 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalUserSettingInfoServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalUserSettingInfoServiceImpl.java @@ -8,7 +8,7 @@ import com.red.circle.console.infra.database.rds.entity.admin.User; import com.red.circle.console.infra.database.rds.service.admin.UserService; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.dto.PageResult; -import com.red.circle.other.inner.endpoint.approval.ApprovalUserSettingInfoClient; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalUserSettingInfoClient; import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; import com.red.circle.other.inner.model.cmd.approval.ApprovalUserProfileQryCmd; import com.red.circle.other.inner.model.dto.approval.ApprovalProfileDescDTO; diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java index f4faf6c5..8f34b514 100644 --- a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/datav/CountryDashboardServiceImpl.java @@ -416,6 +416,11 @@ public class CountryDashboardServiceImpl implements CountryDashboardService { List criteria = baseGiftCriteria(condition); criteria.add(Criteria.where("luckyGift").ne(Boolean.TRUE)); criteria.add(Criteria.where("originId").regex("^\\d+$")); + criteria.add(new Criteria().orOperator( + Criteria.where("dynamicContentId").exists(false), + Criteria.where("dynamicContentId").is(null), + Criteria.where("dynamicContentId").is("") + )); return aggregateGiftAmount(criteria, "$giftValue.actualAmount", false, condition.statTimezone); } diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistServiceImpl.java new file mode 100644 index 00000000..798da084 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistServiceImpl.java @@ -0,0 +1,66 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.dynamic.DynamicBlacklistClient; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; +import com.red.circle.other.inner.asserts.user.UserErrorCode; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; +import java.util.Map; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-黑名单 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicBlacklistServiceImpl implements DynamicBlacklistService { + + private final UserProfileClient userProfileClient; + private final DynamicBlacklistClient dynamicBlacklistClient; + + + @Override + public void deleteByUserId(Long userId) { + ResponseAssert.requiredSuccess(dynamicBlacklistClient.deleteByUserId(userId)); + } + + @Override + public void add(DynamicBlacklistCmd param) { + + UserProfileDTO userProfile = ResponseAssert.requiredSuccess(userProfileClient + .getByAccount(param.getSysOrigin(), param.getAccount())); + + ResponseAssert.notNull(UserErrorCode.ACCOUNT_NOT_MATCH, userProfile); + param.setUserId(userProfile.getId()); + ResponseAssert.requiredSuccess(dynamicBlacklistClient.add(param)); + } + + @Override + public PageResult page(DynamicBlacklistQryCmd query) { + PageResult pageResult = ResponseAssert.requiredSuccess( + dynamicBlacklistClient.pageDynamicBlacklist(query)); + Map userMap = ResponseAssert.requiredSuccess( + userProfileClient.mapByUserIds( + pageResult.getRecords().stream().map(PageDynamicBlacklistDTO::getUserId) + .collect(Collectors.toSet()))); + + return pageResult.convert(blacklist -> { + UserProfileDTO userProfile = userMap.get(blacklist.getUserId()); + userProfile.setCreateTime(blacklist.getCreateTime()); + return userProfile; + }); + + } + +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentServiceImpl.java new file mode 100644 index 00000000..c57f9876 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentServiceImpl.java @@ -0,0 +1,198 @@ +package com.red.circle.console.app.service.app.dynamic; + +import cn.hutool.core.text.CharSequenceUtil; +import cn.hutool.crypto.digest.DigestUtil; +import com.alibaba.excel.exception.ExcelCommonException; +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.enums.ViolationEnum; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.console.app.convertor.dynamic.DynamicAppConvertor; +import com.red.circle.console.app.dto.clienobject.dynamic.PageDynamicContentCO; +import com.red.circle.console.inner.error.ConsoleErrorCode; +import com.red.circle.external.inner.endpoint.oss.OssServiceClient; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.dynamic.ApprovalDynamicClient; +import com.red.circle.other.inner.endpoint.dynamic.DynamicContentClient; +import com.red.circle.other.inner.endpoint.dynamic.DynamicPictureClient; +import com.red.circle.other.inner.endpoint.dynamic.DynamicTagClient; +import com.red.circle.other.inner.endpoint.dynamic.DynamicTimelineClient; +import com.red.circle.other.inner.endpoint.user.region.RegionConfigClient; +import com.red.circle.other.inner.endpoint.user.user.UserProfileClient; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.CreateDynamicVideoCmd; +import com.red.circle.other.inner.model.cmd.dynamic.CreateDynamicVideoCmd.DynamicVideoCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.sql.Timestamp; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-4-15 + */ + +@Service +@RequiredArgsConstructor +public class DynamicContentServiceImpl implements DynamicContentService { + + private final RedisService redisService; + private final OssServiceClient ossServiceClient; + private final DynamicTagClient dynamicTagClient; + private final UserProfileClient userProfileClient; + private final RegionConfigClient regionConfigClient; + private final DynamicAppConvertor dynamicAppConvertor; + private final DynamicContentClient dynamicContentClient; + private final DynamicPictureClient dynamicPictureClient; + private final DynamicTimelineClient dynamicTimelineClient; + private final ApprovalDynamicClient approvalDynamicClient; + + + @Override + public void deleteByIds(DelDynamicContentCmd cmd) { + ResponseAssert.requiredSuccess(dynamicContentClient.deleteByIds(cmd)); + + } + + @Override + public PageResult page(DynamicContentQryCmd query) { + + PageResult iPage = ResponseAssert.requiredSuccess( + dynamicContentClient.pageDynamicContent(query)); + if (CollectionUtils.isEmpty(iPage.getRecords())) { + return iPage.convert(dynamicAppConvertor::toPageDynamicContentCO); + } + + Map userMap = ResponseAssert.requiredSuccess( + userProfileClient.mapByUserIds(getUserIds(iPage))); + + return iPage.convert(vo -> { + PageDynamicContentCO dynamicContentCO = dynamicAppConvertor.toPageDynamicContentCO(vo); + UserProfileDTO user = userMap.get(vo.getCreateUser()); + if (Objects.nonNull(user)) { + dynamicContentCO.setUserBaseInfo(user); + dynamicContentCO.setUserId(user.getId()); + dynamicContentCO.setUserSexName(getSexName(user.getUserSex())); + } + return dynamicContentCO; + }); + } + + @Override + public Integer createVideo(CreateDynamicVideoCmd cmd) { + // 获取导入的数据列表 + List dynamicVideoCmdList = cmd.getDynamicVideoCmdList(); + if (CollectionUtils.isEmpty(dynamicVideoCmdList)) { + throw new RuntimeException("数据为空!"); + } + String key = "create_user_dynamic_video_" + DigestUtil.md5Hex16(cmd.toString()); + ResponseAssert.isTrue(ConsoleErrorCode.USER_DYNAMICS_CANNOT_BE_INSERTED_REPEATEDLY, + redisService.lock(key, 60 * 5)); + Set userIdSet = dynamicVideoCmdList.stream() + .map(DynamicVideoCmd::getUserId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + //获取用户所在的区域 + Map regionIdMap = regionConfigClient.mapRegionIdByUserIds(userIdSet).getBody(); + //获取所有标签 + Map dynamicTagMap = dynamicTagClient.getAllDynamicTag().getBody(); + dynamicVideoCmdList.forEach(dynamicVideoCmd -> { + Timestamp date = new Timestamp(System.currentTimeMillis()); + Long dynamicId = IdWorkerUtils.getId(); + //获取用户区域 + String regionId = regionIdMap.get(dynamicVideoCmd.getUserId()); + Long tagId = null; + //获取动态标签 + if (CharSequenceUtil.isNotBlank(dynamicVideoCmd.getTag())) { + DynamicTagDTO dynamicTagDTO = dynamicTagMap.get(dynamicVideoCmd.getTag()); + if (Objects.nonNull(dynamicTagDTO)) { + tagId = dynamicTagDTO.getId(); + } + } + dynamicContentClient.save(DynamicContentCmd.builder() + .id(dynamicId) + .sysOrigin(dynamicVideoCmd.getSysOrigin()) + .content(dynamicVideoCmd.getContent()) + .del(Boolean.FALSE) + .location("") + .tagId(tagId) + .region(regionId) + .type(dynamicVideoCmd.getType()) + .languageType(dynamicVideoCmd.getLanguageType()) + .createTime(date) + .createUser(cmd.requiredReqUserId()) + .updateTime(date) + .build() + ); + dynamicPictureClient.save(DynamicPictureCmd.builder() + .id(IdWorkerUtils.getId()) + .dynamicId(dynamicId) + .resourceUrl(ossServiceClient.getAccessUrl(dynamicVideoCmd.getSourceUrl()).getBody()) + .miniResourceUrl( + ossServiceClient.processImgSaveAsCompressZoom(dynamicVideoCmd.getSourceUrl(), + dynamicVideoCmd.getSourceUrl().replace(".", "-MINI-DYNAMIC."), 300).getBody()) + .violation(ViolationEnum.NORMAL.name()) + .createTime(date) + .updateTime(date) + .build() + ); + dynamicTimelineClient.save(DynamicTimelineCmd.builder() + .dynamicContentId(dynamicId) + .own(dynamicVideoCmd.getOwn()) + .region(regionId) + .createTime(date) + .createUser(cmd.requiredReqUserId()) + .updateTime(date) + .build() + ); + approvalDynamicClient.save(ApprovalDynamicContentCmd.builder() + .id(IdWorkerUtils.getId()) + .sysOrigin(dynamicVideoCmd.getSysOrigin()) + .userId(dynamicVideoCmd.getUserId()) + .dynamicId(dynamicId) + .dynamicType(dynamicVideoCmd.getType()) + .approveStatus(ApprovalStatusEnum.PENDING.name()) + .originType(Boolean.FALSE) + .createTime(date) + .createUser(cmd.requiredReqUserId()) + .updateTime(date) + .build() + ); + }); + return dynamicVideoCmdList.size(); + } + + private String getSexName(Integer sex) { + //用户性别:0 女,1 男,2 变性人 + if (Objects.equals(sex, 0)) { + return "女"; + } + if (Objects.equals(sex, 1)) { + return "男"; + } + return "未知"; + } + + private Set getUserIds(PageResult iPage) { + return iPage.getRecords().stream().map(PageDynamicContentDTO::getCreateUser) + .collect(Collectors.toSet()); + } +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigServiceImpl.java new file mode 100644 index 00000000..961aab33 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigServiceImpl.java @@ -0,0 +1,41 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.inner.endpoint.dynamic.DynamicCacheClient; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; + +/** + *

+ * 动态-热门权重分设置 服务类. + *

+ * + * @author pengshigang + * @since 2022-4-15 + */ +@Service +@RequiredArgsConstructor +public class DynamicPopularConfigServiceImpl implements DynamicPopularConfigService { + + private final DynamicCacheClient dynamicCacheClient; + + /** + * 获得配置 + */ + @Override + public DynamicPopularConfigDTO config() { + return ResponseAssert.requiredSuccess(dynamicCacheClient.getDynamicPopularConfig()); + } + + /** + * 更新配置 + */ + @Override + public void addOrUpdate(@RequestBody @Validated DynamicPopularConfigCmd param) { + ResponseAssert.requiredSuccess(dynamicCacheClient.updateDynamicPopularConfig(param)); + } +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagServiceImpl.java new file mode 100644 index 00000000..c12b8e5d --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagServiceImpl.java @@ -0,0 +1,39 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.endpoint.dynamic.DynamicTagClient; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态标签 服务类. + *

+ * + * @author pengshigang + * @since 2022-4-15 + */ + +@Service +@RequiredArgsConstructor +public class DynamicTagServiceImpl implements DynamicTagService { + + private final DynamicTagClient dynamicTagClient; + + @Override + public void addOrUpdate(DynamicTagCmd tag) { + + ResponseAssert.requiredSuccess(dynamicTagClient.addOrUpdate(tag)); + } + + + @Override + public PageResult pageData(PageDynamicTagQryCmd query) { + + return ResponseAssert.requiredSuccess(dynamicTagClient.pageData(query)); + } +} diff --git a/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicServiceImpl.java b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicServiceImpl.java new file mode 100644 index 00000000..e8362675 --- /dev/null +++ b/rc-service/rc-service-console/console-application/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicServiceImpl.java @@ -0,0 +1,36 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.inner.endpoint.dynamic.TopDynamicClient; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 系统置顶动态 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +@Service +@RequiredArgsConstructor +public class TopDynamicServiceImpl implements + TopDynamicService { + + private final TopDynamicClient topDynamicClient; + + @Override + public void setUpTop(TopDynamicCmd param) { + + ResponseAssert.requiredSuccess(topDynamicClient.setUpTop(param)); + + } + + @Override + public void closeTop(Long dynamicId) { + + ResponseAssert.requiredSuccess(topDynamicClient.closeTop(dynamicId)); + } +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicCO.java new file mode 100644 index 00000000..d91ca216 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicCO.java @@ -0,0 +1,83 @@ +package com.red.circle.console.app.dto.clienobject.approval; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 审批动态 + *

+ * + * @author pengshigang + * @since 2022-4-21 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicCO implements Serializable { + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 动态内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 审批状态. + */ + private String approveStatus; + + /** + * 动态文字内容 + */ + private String dynamicContent; + + /** + * 动态内容图片 + */ + private List pictures; + + /** + * 用户性别:0 女,1 男,2 变性人 + */ + private String userSexName; + + /** + * 被审批用户信息 + */ + private UserProfileDTO userBaseInfo; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicReportedCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicReportedCO.java new file mode 100644 index 00000000..a46e499b --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/approval/ApprovalDynamicReportedCO.java @@ -0,0 +1,105 @@ +package com.red.circle.console.app.dto.clienobject.approval; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 被举报动态 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@Accessors(chain = true) +public class ApprovalDynamicReportedCO implements Serializable { + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 举报用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long reportUserId; + + /** + * 被举报用户. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long reportedUserId; + + /** + * 举报用户. + */ + private UserProfileDTO reportUser; + + /** + * 被举报用户. + */ + private UserProfileDTO reportedUser; + + /** + * 0.非法信息 1.人身攻击 2.不适当的内容 3.发送垃圾邮件 4.诈骗 5.涉及色情. + */ + private Integer reportType; + + /** + * 0.非法信息 1.人身攻击 2.不适当的内容 3.发送垃圾邮件 4.诈骗 5.涉及色情. + */ + private String reportTypeName; + + /** + * 举报类容. + */ + private String reportedContent; + + + /** + * 举报图片 + */ + private String reportedUrls; + + /** + * 动态图片. + */ + private List dynamicPictures; + + /** + * 动态内容. + */ + private String dynamicContent; + + /** + * 动态内容ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicContentId; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + private Integer approvalStatus; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + private String approvalStatusName; + + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/dynamic/PageDynamicContentCO.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/dynamic/PageDynamicContentCO.java new file mode 100644 index 00000000..eb228667 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/dto/clienobject/dynamic/PageDynamicContentCO.java @@ -0,0 +1,87 @@ +package com.red.circle.console.app.dto.clienobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + *

+ * 动态内容 + *

+ * + * @author pengshigang + * @since 2022-4-27 + */ +@Data +@Accessors(chain = true) +public class PageDynamicContentCO implements Serializable { + + /** + * 主键. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 用户id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 动态文字内容. + */ + private String content; + + /** + * 是否置顶(true置顶, false不置顶). + */ + private Boolean top; + + /** + * 权重. + */ + private Integer weights; + + /** + * 动态内容图片. + */ + private List pictures; + + /** + * 用户信息. + */ + private UserProfileDTO userBaseInfo; + + /** + * 用户性别:0 女,1 男,2 变性人. + */ + private String userSexName; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 修改时间. + */ + private Timestamp updateTime; + + /** + * 创建用户. + */ + private Long createUser; + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentService.java new file mode 100644 index 00000000..59b09064 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicContentService.java @@ -0,0 +1,21 @@ +package com.red.circle.console.app.service.app.approval; + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicCO; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import java.util.Set; +import org.springframework.web.multipart.MultipartFile; + +/** + * 动态图片审批 + * @author zongpubin on 2024/1/12 + */ +public interface ApprovalDynamicContentService { + + PageResult page(ApprovalDynamicQryCmd query); + + void approvalPass(Set ids); + + void approvalNotPass(Set ids, Long reqUserId); + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportService.java new file mode 100644 index 00000000..3bf6fdef --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/approval/ApprovalDynamicReportService.java @@ -0,0 +1,17 @@ +package com.red.circle.console.app.service.app.approval; + +import com.red.circle.console.app.dto.clienobject.approval.ApprovalDynamicReportedCO; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; + +/** + * 动态投诉 + * @author zongpubin on 2024/1/19 + */ +public interface ApprovalDynamicReportService { + + PageResult pageData(ApprovalDynamicReportQryCmd query); + + void report(ApprovalDynamicReportCmd cmd); +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistService.java new file mode 100644 index 00000000..38866624 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicBlacklistService.java @@ -0,0 +1,24 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; + +/** + *

+ * 动态-黑名单 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicBlacklistService { + + void deleteByUserId(Long userId); + + void add(DynamicBlacklistCmd cmd); + + PageResult page(DynamicBlacklistQryCmd query); + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentService.java new file mode 100644 index 00000000..0aea6f46 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicContentService.java @@ -0,0 +1,37 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.console.app.dto.clienobject.dynamic.PageDynamicContentCO; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.CreateDynamicVideoCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import org.springframework.web.multipart.MultipartFile; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-4-18 + */ +public interface DynamicContentService { + + + /** + * 删除动态. + */ + void deleteByIds(DelDynamicContentCmd delDynamicContentCmd); + + /** + * 动态内容. + */ + PageResult page(DynamicContentQryCmd query); + + /** + * 插入动态视频 + * @param cmd + * @return + */ + Integer createVideo(CreateDynamicVideoCmd cmd); +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigService.java new file mode 100644 index 00000000..31ce71bc --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicPopularConfigService.java @@ -0,0 +1,21 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; + +/** + *

+ * 动态-热门权重分设置 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicPopularConfigService { + + DynamicPopularConfigDTO config(); + + void addOrUpdate(@RequestBody @Validated DynamicPopularConfigCmd param); +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagService.java new file mode 100644 index 00000000..a37bb5e1 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTagService.java @@ -0,0 +1,24 @@ +package com.red.circle.console.app.service.app.dynamic; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; + +/** + *

+ * 动态标签 服务类. + *

+ * + * @author pengshigang + * @since 2022-4-15 + */ +public interface DynamicTagService { + + void addOrUpdate(DynamicTagCmd tag); + + PageResult pageData( + PageDynamicTagQryCmd query); + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTimelineService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTimelineService.java new file mode 100644 index 00000000..03a630ce --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/DynamicTimelineService.java @@ -0,0 +1,19 @@ +package com.red.circle.console.app.service.app.dynamic; + +import java.util.Set; + +/** + *

+ * 动态-时间轴表 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-27 + */ +public interface DynamicTimelineService { + + void deleteByDynamicContentId(Long dynamicId); + + void deleteByDynamicContentIds(Set dynamicIds); + +} diff --git a/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicService.java b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicService.java new file mode 100644 index 00000000..4acd8ca7 --- /dev/null +++ b/rc-service/rc-service-console/console-client/src/main/java/com/red/circle/console/app/service/app/dynamic/TopDynamicService.java @@ -0,0 +1,25 @@ +package com.red.circle.console.app.service.app.dynamic; + +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; + +/** + *

+ * 系统置顶动态 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +public interface TopDynamicService { + + /** + * 是否置顶 + */ + void setUpTop(TopDynamicCmd param); + + /** + * 关闭置顶 + */ + void closeTop(Long dynamicId); + +} diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/DynamicRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/DynamicRestController.java new file mode 100644 index 00000000..8a0b62aa --- /dev/null +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/DynamicRestController.java @@ -0,0 +1,392 @@ +package com.red.circle.other.adapter.app.dynamic; + + +import com.alibaba.nacos.common.utils.StringUtils; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.app.dto.clientobject.dynamic.*; +import com.red.circle.other.app.dto.cmd.dynamic.*; +import com.red.circle.other.app.service.dynamic.DynamicService; +import java.util.List; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态相关接口 + */ +@Slf4j +@RestController +@RequestMapping(value = "/dynamic", produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicRestController extends BaseController { + + private final DynamicService dynamicService; + + /** + * 创建动态. + * + * @eo.name 创建动态. + * @eo.url /create + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/create") + @JsonSerialize(using = ToStringSerializer.class) + public DynamicListCO create(@RequestBody DynamicContentAddCmd cmd) { + return dynamicService.createDynamic(cmd); + } + + /** + * 删除动态. + * + * @eo.name 删除动态. + * @eo.url /delete + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/delete") + public void delete(@RequestBody @Validated IdLongCmd cmd) { + dynamicService.deleteDynamic(cmd); + } + + /** + * 动态评论列表. + * + * @eo.name 动态评论列表. + * @eo.url /list/comment + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/comment") + public PageResult listDynamicComment(@Validated DynamicCommentLimitCmd cmd) { + return dynamicService.listDynamicComment(cmd); + } + + /** + * 动态子评论列表. + * + * @eo.name 动态子评论列表. + * @eo.url /list/comment/children + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/comment/children") + public PageResult listDynamicChildComment( + @Validated DynamicChildCommentLimitCmd cmd) { + return dynamicService.listDynamicChildComment(cmd); + } + + /** + * 动态点赞列表. + * + * @eo.name 动态点赞列表. + * @eo.url /list/like + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/like") + public PageResult listDynamicLike(@Validated DynamicLikeLimitCmd cmd) { + return dynamicService.listDynamicLike(cmd); + } + + /** + * 动态礼物列表. + * + * @eo.name 动态礼物列表. + * @eo.url /list/gift + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/gift") + public PageResult listDynamicGift(@Validated DynamicGiftLimitCmd cmd) { + return dynamicService.listDynamicGift(cmd); + } + + /** + * 动态内容详情. + * + * @eo.name 动态内容详情. + * @eo.url /details + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/details") + public DynamicListCO details(@Validated IdLongCmd cmd) { + return dynamicService.getDynamicDetails(cmd); + } + + /** + * 动态关注列表. + * + * @eo.name 动态关注列表. + * @eo.url /list/follow + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/follow") + public PageResult listDynamicFollow(@Validated DynamicLimitCmd cmd) { + return dynamicService.listDynamicFollow(cmd); + } + + /** + * 我的动态列表. + * + * @eo.name 我的动态列表. + * @eo.url /my/list + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/my/page") + public PageResult listMyDynamic(@Validated DynamicMyLimitCmd cmd) { + return dynamicService.listMyDynamic(cmd); + } + + /** + * 最新动态列表. + * + * @eo.name 最新动态列表. + * @eo.url /list/latest + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/latest") + public PageResult listDynamicLatest(@Validated DynamicLimitCmd cmd) { + return dynamicService.listDynamicLatest(cmd); + } + + /** + * 热门动态列表. + * + * @eo.name 热门动态列表. + * @eo.url /list/popular + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/popular") + public List listDynamicPopular(@Validated DynamicLimitCmd cmd) { + return dynamicService.listDynamicPopular(cmd); + } + + /** + * 根据标签id查询动态列表. + * + * @eo.name 根据标签id查询动态列表. + * @eo.url /list/by/tag + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/by/tag") + public List listDynamicByTagId(@Validated DynamicByTagLimitCmd cmd) { + return dynamicService.listDynamicByTagId(cmd); + } + + /** + * 标签列表. + * + * @eo.name 标签列表. + * @eo.url /list/tag + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/tag") + public List listDynamicTag(AppExtCommand cmd) { + return dynamicService.listDynamicTag(cmd); + } + + /** + * 删除评论. + * + * @eo.name 删除评论. + * @eo.url /delete/comment + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/delete/comment") + public Long deleteComment(@RequestBody @Validated AppIdLongCmd cmd) { + return dynamicService.deleteComment(cmd); + } + + /** + * 评论动态或回复用户. + * + * @return 数量 + * @eo.name 评论动态或回复用户. + * @eo.url /comment + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/comment") + public DynamicCommentListCO comment(@RequestBody @Validated DynamicCommentCmd cmd) { + return dynamicService.comment(cmd); + } + + /** + * 点赞评论. + * + * @return 数量 + * @eo.name 点赞评论. + * @eo.url /like/comment + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/like/comment") + public Long likeComment(@RequestBody @Validated DynamicLikeCmd cmd) { + return dynamicService.likeComment(cmd); + } + + + /** + * 点赞动态. + * + * @return 数量 + * @eo.name 点赞动态. + * @eo.url /like + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/like") + public Long likeDynamic(@RequestBody @Validated DynamicLikeCmd cmd) { + return dynamicService.likeDynamic(cmd); + } + + /** + * 我的消息列表. + * + * @eo.name 我的消息列表. + * @eo.url /list/message + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/list/message") + public PageResult listDynamicMessage(@Validated DynamicLimitCmd cmd) { + return dynamicService.listDynamicMessage(cmd); + } + + /** + * 删除自己全部消息. + * + * @eo.name 删除自己全部消息. + * @eo.url /delete/message/all + * @eo.method post + * @eo.request-type formdata + */ + @PostMapping("/delete/message/all") + public void deleteMessageAll(AppExtCommand cmd) { + dynamicService.deleteMessageAll(cmd); + } + + /** + * 将我的消息设置为已读. + * + * @eo.name 将我的消息设置为已读. + * @eo.url /message/update/read + * @eo.method post + * @eo.request-type formdata + */ + @PostMapping("/message/update/read") + public void updateReadMessage(AppExtCommand cmd) { + dynamicService.updateReadMessage(cmd); + } + + /** + * 删除消息. + * + * @eo.name 删除消息. + * @eo.url /delete/message + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/delete/message") + public void deleteMessage(@RequestBody @Validated IdLongCmd cmd) { + dynamicService.deleteMessage(cmd); + } + + /** + * 根据标签id获得标签. + * + * @eo.name 根据标签id获得标签. + * @eo.url /tag + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/tag") + public DynamicTagCO getDynamicTag(@Validated IdLongCmd cmd) { + return dynamicService.getDynamicTag(cmd); + } + + /** + * 举报. + * + * @eo.name 举报. + * @eo.url /report + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/report") + public void report(@RequestBody @Validated DynamicReportCmd cmd) { + dynamicService.report(cmd); + } + + /** + * 校验发送动态权限. + * + * @eo.name 校验发送动态权限. + * @eo.url /check/send/permission + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/check/send/permission") + public Boolean checkSendPermission(AppExtCommand cmd, Long userId) { + if (userId != null) { + cmd.setReqUserId(userId); + } + return dynamicService.checkSendPermission2(cmd); + } + + /** + * 添加黑名单. + * + * @eo.name 添加黑名单. + * @eo.url /blacklist/add + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/admin/blacklist/add") + public void addBlacklist(@RequestBody @Validated DynamicBlacklistAddCmd cmd) { + dynamicService.addBlacklist(cmd); + } + + /** + * 删除黑名单. + * + * @eo.name 删除黑名单. + * @eo.url /blacklist/delete + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/admin/blacklist/delete") + public void deleteBlacklist(@RequestBody @Validated DynamicBlacklistDelCmd cmd) { + dynamicService.deleteBlacklist(cmd); + } + + /** + * 新增待审核动态 + */ + @PostMapping("/approval") + public void addApprovalDynamic(DynamicContentAddCmd cmd) { + dynamicService.addApprovalDynamic(cmd); + } + +} diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/ThumbsUpRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/ThumbsUpRestController.java new file mode 100644 index 00000000..65133bb5 --- /dev/null +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/dynamic/ThumbsUpRestController.java @@ -0,0 +1,59 @@ +package com.red.circle.other.adapter.app.dynamic; + +import com.red.circle.framework.web.controller.BaseController; +import com.red.circle.other.app.dto.clientobject.dynamic.UserThumbsUpCO; +import com.red.circle.other.app.dto.cmd.dynamic.UserRelationThumbsUpCmd; +import com.red.circle.other.app.service.dynamic.UserRelationThumbsUpService; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 用户点赞列表 前端控制器. + *

+ * + * @author zongpubin on 2023-04-06 11:41 + * @eo.api-type http + * @eo.groupName 动态服务.用户点赞 + * @eo.path /dynamic/thumbs-up + */ +@RestController +@RequestMapping(value = "/dynamic/thumbs-up", produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class ThumbsUpRestController extends BaseController { + + private final UserRelationThumbsUpService userRelationThumbsUpService; + + /** + * 点赞 + * + * @eo.name 点赞 + * @eo.url /like + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/like") + public Boolean like(@RequestBody @Validated UserRelationThumbsUpCmd cmd) { + return userRelationThumbsUpService.thumbsUp(cmd); + } + + /** + * 点赞数量,是否已经点赞 + * + * @eo.name 点赞数量,是否已经点赞 + * @eo.url /info + * @eo.method get + * @eo.request-type formdata + */ + @GetMapping("/info") + public UserThumbsUpCO thumbsUpInfo(UserRelationThumbsUpCmd cmd) { + return userRelationThumbsUpService.thumbsUpInfo(cmd); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityConsumeRewardReceiveCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityConsumeRewardReceiveCmdExe.java index b9bbf923..d04364e0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityConsumeRewardReceiveCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ActivityConsumeRewardReceiveCmdExe.java @@ -12,7 +12,7 @@ import com.red.circle.other.infra.database.mongo.entity.activity.ConsumeActivity import com.red.circle.other.infra.database.mongo.service.activity.ConsumeActivityCountService; import com.red.circle.other.infra.database.rds.entity.activity.PropsActivityRuleConfig; import com.red.circle.other.infra.database.rds.service.activity.PropsActivityRuleConfigService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.PropsErrorCode; import com.red.circle.other.inner.enums.activity.PropsActivityTypeEnum; import com.red.circle.other.inner.model.dto.activity.rule.CumulativeRechargeContent; @@ -72,7 +72,7 @@ public class ActivityConsumeRewardReceiveCmdExe { count.getTarget() >= consumeActivityContent.getQuantity().longValue()); // 防止重复触发领取 3分钟后可重试领取 - ResponseAssert.isTrue(OtherErrorCode.REPEATED_SUBMIT, redisService.setIfAbsent( + ResponseAssert.isTrue(DynamicErrorCode.REPEATED_SUBMIT, redisService.setIfAbsent( PropsActivityTypeEnum.CONSUMPTION_ACTIVITY + ":" + cmd.getReqUserId() + ":" + cmd.getId(), 3, TimeUnit.MINUTES)); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java index 3f0d9e8a..2ecd9576 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardBadgeExe.java @@ -17,7 +17,7 @@ import com.red.circle.other.infra.database.rds.entity.activity.UserActivityRewar import com.red.circle.other.infra.database.rds.service.activity.LotteryDeviceRecordService; import com.red.circle.other.infra.database.rds.service.activity.UserActivityRechargeService; import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileDeviceService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.OtherErrorCode; import com.red.circle.other.inner.endpoint.activity.LotteryTicketClient; import com.red.circle.other.inner.endpoint.material.props.BadgeBackpackClient; @@ -72,7 +72,7 @@ public class ClaimActivityRewardBadgeExe { .findFirst() .orElse(null); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, targetRule); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, targetRule); long count = userActivityRewardClaimDAO.selectCount( new LambdaQueryWrapper() @@ -84,7 +84,7 @@ public class ClaimActivityRewardBadgeExe { ResponseAssert.isFalse(CommonErrorCode.REPEATED_SUBMISSION, count > 0); BigDecimal requiredAmount = parseRequiredAmount(targetRule.getJsonData()); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, requiredAmount); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, requiredAmount); MyTotalDrawCountCO drawCount = lotteryActivityRestService.getMyTotalDrawCount(cmd, cmd.getActivityId()); @@ -98,7 +98,7 @@ public class ClaimActivityRewardBadgeExe { ); List activityRewardProps = group.getActivityRewardProps(); - ResponseAssert.isFalse(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, activityRewardProps.isEmpty()); + ResponseAssert.isFalse(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, activityRewardProps.isEmpty()); ActivityRewardProps rewardProps = activityRewardProps.get(0); badgeBackpackClient.giveBadge(new GiveBadgeCmd() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java index 2adffed7..57bd939d 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/ClaimActivityRewardExe.java @@ -23,7 +23,7 @@ import com.red.circle.other.inner.enums.activity.PropsActivityTypeEnum; import com.red.circle.other.inner.model.cmd.activity.SendActivityRewardCmd; import com.red.circle.other.inner.model.dto.activity.props.ActivityPropsGroup; import com.red.circle.other.inner.model.dto.activity.props.ActivityPropsRule; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardProps; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.json.JacksonUtils; @@ -68,7 +68,7 @@ public class ClaimActivityRewardExe { .findFirst() .orElse(null); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, targetRule); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, targetRule); long count = userActivityRewardClaimDAO.selectCount( new LambdaQueryWrapper() @@ -80,7 +80,7 @@ public class ClaimActivityRewardExe { ResponseAssert.isFalse(CommonErrorCode.REPEATED_SUBMISSION, count > 0); BigDecimal requiredAmount = parseRequiredAmount(targetRule.getJsonData()); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, requiredAmount); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, requiredAmount); BigDecimal userTotalAmount = userActivityRechargeService.getUserTotalAmount( cmd.getReqUserId(), @@ -126,7 +126,7 @@ public class ClaimActivityRewardExe { ); List activityRewardProps = group.getActivityRewardProps(); - ResponseAssert.isFalse(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, activityRewardProps.isEmpty()); + ResponseAssert.isFalse(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, activityRewardProps.isEmpty()); ActivityRewardProps rewardProps = activityRewardProps.get(0); propsActivityClient.sendActivityReward(new SendActivityRewardCmd() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistAddCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistAddCmdExe.java new file mode 100644 index 00000000..c2342453 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistAddCmdExe.java @@ -0,0 +1,43 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicBlacklistAddCmd; +import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 添加黑名单执行器. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Component +@RequiredArgsConstructor +public class DynamicBlacklistAddCmdExe { + + private final AdministratorService administratorService; + private final AdministratorAuthService administratorAuthService; + private final DynamicBlacklistService dynamicBlacklistService; + + public void execute(DynamicBlacklistAddCmd cmd) { + // 验证管理员权限 + ViolationTypeEnum violationTypeEnum = ViolationTypeEnum.CREATE_CONTENT; + ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, + administratorService.existsAdmin(cmd.getReqUserId()) && + administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name())); + + // 添加黑名单 + DynamicBlacklistCmd blacklistCmd = new DynamicBlacklistCmd(); + blacklistCmd.setUserId(cmd.getUserId()); + blacklistCmd.setReqUserId(cmd.getReqUserId()); + blacklistCmd.setSysOrigin(cmd.getReqSysOrigin().getOrigin()); + dynamicBlacklistService.add(blacklistCmd); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistDelCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistDelCmdExe.java new file mode 100644 index 00000000..e90f812a --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicBlacklistDelCmdExe.java @@ -0,0 +1,38 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicBlacklistDelCmd; +import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 删除黑名单执行器. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Component +@RequiredArgsConstructor +public class DynamicBlacklistDelCmdExe { + + private final AdministratorService administratorService; + private final AdministratorAuthService administratorAuthService; + private final DynamicBlacklistService dynamicBlacklistService; + + public void execute(DynamicBlacklistDelCmd cmd) { + // 验证管理员权限 + ViolationTypeEnum violationTypeEnum = ViolationTypeEnum.CREATE_CONTENT; + ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, + administratorService.existsAdmin(cmd.getReqUserId()) && + administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name())); + + // 删除黑名单 + dynamicBlacklistService.deleteByUserId(cmd.getUserId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCheckSendPermissionCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCheckSendPermissionCmdExe.java new file mode 100644 index 00000000..224a2ff3 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCheckSendPermissionCmdExe.java @@ -0,0 +1,72 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicSendRestrictCO; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 校验发送动态权限. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Component +@RequiredArgsConstructor +public class DynamicCheckSendPermissionCmdExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicCacheService dynamicCacheService; + private final DynamicBlacklistService dynamicBlacklistService; + + public DynamicSendRestrictCO execute(AppExtCommand cmd) { + + //该用户为动态黑名单用户 + ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, + dynamicBlacklistService.exist(cmd.getReqUserId())); + + //当前用户今天已发动态数量 +// Long userSentTodayCount = getUserTodayDynamicCount(cmd); + + //限制用户每天发送动态的数量 +// Long quantityLimit = dynamicCacheService.getSendQuantityLimit(); + + return new DynamicSendRestrictCO(); + } + + /** + * 校验用户财富,魅力等级 + */ + private void checkUserLevel(AppExtCommand cmd) { + + //获得用户魅力,财富等级限制 + Long limitLevel = dynamicCacheService.getSendLevelLimit(); + UserConsumptionLevel userLevel = getConsumptionLevel(cmd); + + ResponseAssert.isTrue(DynamicErrorCode.WEALTH_AND_CHARM_INSUFFICIENT_ERROR, + userLevel.getCharmLevel() >= limitLevel && userLevel.getWealthLevel() >= limitLevel); + } + + private UserConsumptionLevel getConsumptionLevel(AppExtCommand cmd) { + return userProfileGateway.getUserConsumptionLevel(cmd.requireReqSysOriginEnum(), + cmd.requiredReqUserId()); + } + + private Long getUserTodayDynamicCount(AppExtCommand cmd) { + return dynamicCacheService.getUserTodayDynamicCount(cmd.getReqUserId()); + } + + public Boolean execute2(AppExtCommand cmd) { + return !dynamicBlacklistService.exist(cmd.getReqUserId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentCmdExe.java new file mode 100644 index 00000000..dacf43a9 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentCmdExe.java @@ -0,0 +1,234 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.common.business.core.ReplaceString; +import com.red.circle.common.business.core.SensitiveWordFilter; +import com.red.circle.common.business.enums.AccountStatusEnum; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.app.common.room.DynamicCommon; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicCommentListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicCommentCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.common.user.UserAccountCommon; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.other.inner.model.cmd.user.account.PunishmentAccountCmd; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.num.NumUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; + +import java.util.Arrays; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-评论. + *

+ * + * @author pengshigang + * @since 2022-04-12 + */ +@Component +@RequiredArgsConstructor +public class DynamicCommentCmdExe { + + private final DynamicCommon dynamicCommon; + private final UserProfileGateway userProfileGateway; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicMessageService dynamicMessageService; + private final DynamicCommentService dynamicCommentService; + private final DynamicPopularService dynamicPopularService; + private final UserAccountCommon userAccountCommon; + private final DynamicPictureService dynamicPictureService; + private final RedisService redisService; + + public DynamicCommentListCO execute(DynamicCommentCmd cmd) { + ResponseAssert.isTrue(DynamicErrorCode.CURRENT_LEVEL_IS_TOO_LOW, commentLimit(cmd)); + + DynamicContent dynamicContent = checkParams(cmd); + + //保存评论 + Long commentId = IdWorkerUtils.getId(); + DynamicComment dynamicComment = saveComment(cmd, commentId); + + incrCommentQuantity(cmd); + + //评论自己创建的动态或者自己回复自己不发送消息 + Set userIdSet = Stream.of(cmd.getReqUserId(), cmd.getToUserId()).filter(Objects::nonNull).collect(Collectors.toSet()); + Map userProfileMap = userProfileGateway.mapByUserIds(userIdSet); + if (isOwnDynamic(cmd, dynamicContent)) { + return convert(dynamicComment, userProfileMap); + } + + dynamicPopularService.updateScore(dynamicContent.getId(), dynamicCacheService.getCommentScore(), + cmd.getReqSysOrigin().getOrigin(), dynamicContent.getRegion()); + + + //content 设置为图片url + if (Objects.isNull(cmd.getToUserId())) { + cmd.setToUserId(dynamicContent.getCreateUser()); + saveDynamicMessage(cmd, commentId, DynamicMessageEnum.COMMENT_DYNAMIC); + } else { + //发送消息给动态被回复人 + saveDynamicMessage(cmd, commentId, DynamicMessageEnum.REPLY_COMMENT); + } + + return convert(dynamicComment, userProfileMap); + } + + private DynamicCommentListCO convert(DynamicComment dynamicComment, Map userProfileMap) { + DynamicCommentListCO commentListCO = new DynamicCommentListCO(); + commentListCO.setId(dynamicComment.getId()); + commentListCO.setDynamicId(dynamicComment.getDynamicContentId()); + commentListCO.setToUserId(dynamicComment.getToUserId()); + commentListCO.setContent(dynamicComment.getContent()); + commentListCO.setCreateTime(dynamicComment.getCreateTime()); + commentListCO.setRootCommentId(Objects.isNull(dynamicComment.getRootCommentId()) ? dynamicComment.getId() : dynamicComment.getRootCommentId()); + commentListCO.setReplyCommentId(dynamicComment.getReplyCommentId()); + + UserProfile userProfile = userProfileMap.get(dynamicComment.getCreateUser()); + if (userProfile != null) { + commentListCO.setUserId(userProfile.getId()); + commentListCO.setUserAvatar(userProfile.getUserAvatar()); + commentListCO.setUserNickname(userProfile.getUserNickname()); + commentListCO.setUserSex(userProfile.getUserSex()); + } + + UserProfile toUser = userProfileMap.get(dynamicComment.getToUserId()); + if (toUser != null) { + commentListCO.setToUserNickname(toUser.getUserNickname()); + } + return commentListCO; + } + + private boolean commentLimit(DynamicCommentCmd cmd) { + + UserConsumptionLevel userLevel = + userProfileGateway.getUserConsumptionLevel( + cmd.requireReqSysOriginEnum(), + cmd.requiredReqUserId() + ); + + if (Objects.isNull(userLevel)) { + return false; + } + + if (Objects.isNull(userLevel.getWealthLevel()) && Objects.isNull(userLevel.getCharmLevel())) { + return false; + } + + Long level = dynamicCacheService.getSendLevelLimit(); + if (Objects.isNull(level)) { + return false; + } + + if (Objects.nonNull(userLevel.getWealthLevel()) && userLevel.getWealthLevel() < level) { + return false; + } + + if (Objects.nonNull(userLevel.getCharmLevel()) && userLevel.getCharmLevel() < level) { + return false; + } + + return true; + } + + private DynamicContent checkParams(DynamicCommentCmd cmd) { + + ResponseAssert.isTrue(DynamicErrorCode.CONTENT_IS_NULL, isNotBlank(cmd)); + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamicContent.getDel()); + return dynamicContent; + } + + private Long incrCommentQuantity(DynamicCommentCmd cmd) { + return dynamicCacheService.updateCommentQuantity(cmd.getId(), 1); + } + + private boolean isOwnDynamic(DynamicCommentCmd cmd, DynamicContent dynamicContent) { + boolean a1 = Objects.isNull(cmd.getToUserId()); + boolean a2 = Objects.equals(dynamicContent.getCreateUser(), cmd.getReqUserId()); + boolean b1 = Objects.equals(cmd.getToUserId(), cmd.getReqUserId()); + return (a1 && a2) || b1; + } + + private void saveDynamicMessage(DynamicCommentCmd cmd, Long commentId, DynamicMessageEnum type) { + + DynamicMessage message = new DynamicMessage(); + message.setContent(cmd.getContent()); + message.setDynamicContentId(cmd.getId()); + message.setDynamicCommentId(commentId); + message.setType(type.name()); + message.setToUserId(cmd.getToUserId()); + message.setCreateTime(TimestampUtils.now()); + message.setCreateUser(cmd.getReqUserId()); + message.setId(IdWorkerUtils.getId()); + dynamicMessageService.save(message); + + } + + private DynamicComment saveComment(DynamicCommentCmd cmd, Long commentId) { + + DynamicComment comment = new DynamicComment(); + comment.setId(commentId); + comment.setDynamicContentId(cmd.getId()); + comment.setToUserId(cmd.getToUserId()); + comment.setContent(cmd.getContent()); + comment.setCreateTime(TimestampUtils.now()); + comment.setCreateUser(cmd.getReqUserId()); + if (Objects.nonNull(cmd.getToUserId())) { + comment.setRootCommentId(cmd.getRootCommentId()); + } + comment.setReplyCommentId(cmd.getCommentId()); + dynamicCommentService.save(comment); + + // 标记根评论需要更新热度(新增子评论时) + if (Objects.nonNull(cmd.getRootCommentId())) { + markCommentForHotScoreUpdate(cmd.getRootCommentId()); + } + + return comment; + } + + /** + * 标记根评论需要更新热度分数 + */ + private void markCommentForHotScoreUpdate(Long rootCommentId) { + if (rootCommentId == null) { + return; + } + try { + redisService.setAdd("comment:hot_score:pending", rootCommentId.toString()); + } catch (Exception e) { + // 标记失败不影响主流程,只记录日志 + // 定时任务会兜底更新 + } + } + + private boolean isNotBlank(DynamicCommentCmd cmd) { + return StringUtils.isNotBlank(cmd.getContent().replaceAll(" ", "")); + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentLikeCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentLikeCmdExe.java new file mode 100644 index 00000000..f4baf674 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicCommentLikeCmdExe.java @@ -0,0 +1,165 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.other.app.common.room.DynamicCommon; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.num.NumUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-点赞评论. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicCommentLikeCmdExe { + + private final DynamicCommon dynamicCommon; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicPopularService dynamicPopularService; + private final DynamicCommentLikeService dynamicCommentLikeService; + private final DynamicMessageService dynamicMessageService; + private final DynamicPictureService dynamicPictureService; + private final com.red.circle.component.redis.service.RedisService redisService; + + public Long execute(DynamicLikeCmd cmd) { + + DynamicContent content = checkParams(cmd); + Long id = IdWorkerUtils.getId(); + + if (Boolean.TRUE.equals(cmd.getLike())) { + + ResponseAssert.isFalse(DynamicErrorCode.LIKED, getExist(cmd)); + save(cmd, id); + + // 标记根评论需要更新热度 + markCommentForHotScoreUpdate(cmd.getRootCommentId()); + + if (Objects.equals(cmd.getReqUserId(), cmd.getToUserId())) { + return getIncrQuantity(cmd); + } + //热门权重 + updateScore(cmd, content, 1); + + // 保存点赞评论消息 + saveDynamicMessage(cmd, DynamicMessageEnum.LIKE_COMMENT); + + return getIncrQuantity(cmd); + } + + ResponseAssert.isTrue(DynamicErrorCode.UNLIKED, getExist(cmd)); + + deleteCommentLike(cmd); + + // 标记根评论需要更新热度 + markCommentForHotScoreUpdate(cmd.getRootCommentId()); + + if (Objects.equals(cmd.getReqUserId(), cmd.getToUserId())) { + return getDecrQuantity(cmd); + } + //热门权重 + updateScore(cmd, content, -1); + + return getDecrQuantity(cmd); + } + + private Long getDecrQuantity(DynamicLikeCmd cmd) { + return dynamicCacheService.decrCommentLikeQuantity(cmd.getDynamicId(), cmd.getCommentId()); +// return NumUtils.formatLong(dynamicCacheService.decrCommentLikeQuantity(cmd.getDynamicId(), cmd.getCommentId())); + } + + private void deleteCommentLike(DynamicLikeCmd cmd) { + dynamicCommentLikeService + .delete(cmd.getDynamicId(), cmd.getCommentId(), cmd.getReqUserId()); + } + + private void updateScore(DynamicLikeCmd cmd, DynamicContent content, Integer score) { + + if (!Objects.equals(content.getCreateUser(), cmd.getReqUserId())) { + dynamicPopularService.updateScore(cmd.getDynamicId(), + score > 0 ? score * dynamicCacheService.getLikeScore() : 0, + cmd.getReqSysOrigin().getOrigin(), + content.getRegion()); + } + } + + private DynamicContent checkParams(DynamicLikeCmd cmd) { + ResponseAssert.isFalse(CommonErrorCode.REQUIRED_FIELDS_CANNOT_BE_IGNORED, + Objects.isNull(cmd.getCommentId()) || Objects.isNull(cmd.getToUserId())); + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getDynamicId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamicContent.getDel()); + return dynamicContent; + } + + private Long getIncrQuantity(DynamicLikeCmd cmd) { + return dynamicCacheService.incrCommentLikeQuantity(cmd.getDynamicId(), cmd.getCommentId()); +// return NumUtils.formatLong(dynamicCacheService.incrCommentLikeQuantity(cmd.getDynamicId(), cmd.getCommentId())); + } + + private void save(DynamicLikeCmd cmd, Long id) { + DynamicCommentLike dynamicLike = new DynamicCommentLike(); + dynamicLike.setId(id); + dynamicLike.setDynamicCommentId(cmd.getCommentId()); + dynamicLike.setDynamicContentId(cmd.getDynamicId()); + dynamicLike.setCreateUser(cmd.getReqUserId()); + dynamicLike.setRootCommentId(cmd.getRootCommentId()); + dynamicLike.setCreateTime(TimestampUtils.now()); + dynamicCommentLikeService.save(dynamicLike); + } + + private Boolean getExist(DynamicLikeCmd cmd) { + return dynamicCommentLikeService + .exist(cmd.getDynamicId(), cmd.getCommentId(), cmd.getReqUserId()); + } + + private void saveDynamicMessage(DynamicLikeCmd cmd, DynamicMessageEnum type) { + DynamicMessage message = new DynamicMessage(); + message.setId(IdWorkerUtils.getId()); + message.setDynamicContentId(cmd.getDynamicId()); + message.setDynamicCommentId(cmd.getCommentId()); + message.setContent(dynamicPictureService.getFirstNormalPic(cmd.getDynamicId())); + message.setType(type.name()); + message.setToUserId(cmd.getToUserId()); + message.setCreateTime(TimestampUtils.now()); + message.setCreateUser(cmd.getReqUserId()); + dynamicMessageService.save(message); + } + + /** + * 标记根评论需要更新热度分数 + */ + private void markCommentForHotScoreUpdate(Long rootCommentId) { + if (rootCommentId == null) { + return; + } + try { + redisService.setAdd("comment:hot_score:pending", rootCommentId.toString()); + } catch (Exception e) { + // 标记失败不影响主流程,只记录日志 + // 定时任务会兜底更新 + } + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicLikeCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicLikeCmdExe.java new file mode 100644 index 00000000..17c35b5c --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicLikeCmdExe.java @@ -0,0 +1,123 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.other.app.common.room.DynamicCommon; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeCmd; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.num.NumUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-点赞. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicLikeCmdExe { + + private final DynamicCommon dynamicCommon; + private final DynamicLikeService dynamicLikeService; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicPopularService dynamicPopularService; + private final DynamicMessageService dynamicMessageService; + private final DynamicPictureService dynamicPictureService; + + public Long execute(DynamicLikeCmd cmd) { + + DynamicContent content = checkParams(cmd); + + Long commentId = IdWorkerUtils.getId(); + //点赞动态 + if (Boolean.TRUE.equals(cmd.getLike())) { + + ResponseAssert.isFalse(DynamicErrorCode.LIKED, getExist(cmd)); + save(cmd, commentId); + + Long quantity = getQuantity(cmd); + + if (Objects.equals(cmd.getReqUserId(), content.getCreateUser())) { + return quantity; + } + + dynamicPopularService.updateScore(content.getId(), dynamicCacheService.getLikeScore(), + cmd.getReqSysOrigin().getOrigin(), content.getRegion()); + + // 保存点赞动态消息 + saveDynamicMessage(cmd, content, DynamicMessageEnum.LIKE_DYNAMIC); + + dynamicCommon.sendMsg(content.getCreateUser()); + return quantity; + } + + ResponseAssert.isTrue(DynamicErrorCode.UNLIKED, getExist(cmd)); + + dynamicLikeService.delete(cmd.getDynamicId(), cmd.getReqUserId()); + + if (Objects.equals(cmd.getReqUserId(), content.getCreateUser())) { + return dynamicCacheService.decrLikeQuantity(cmd.getDynamicId()); + } + + dynamicPopularService.updateScore(content.getId(), + dynamicCacheService.getLikeScore() > 0 ? -dynamicCacheService.getLikeScore() : 0, + cmd.getReqSysOrigin().getOrigin(), content.getRegion()); + + return dynamicCacheService.decrLikeQuantity(cmd.getDynamicId()); + } + + private DynamicContent checkParams(DynamicLikeCmd cmd) { + DynamicContent content = dynamicContentService.getById(cmd.getDynamicId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, content); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, content.getDel()); + return content; + } + + private Long getQuantity(DynamicLikeCmd cmd) { + return dynamicCacheService.incrLikeQuantity(cmd.getDynamicId()); +// return NumUtils.formatLong(dynamicCacheService.incrLikeQuantity(cmd.getDynamicId())); + } + + private void save(DynamicLikeCmd cmd, Long commentId) { + DynamicLike dynamicLike = new DynamicLike(); + dynamicLike.setId(commentId); + dynamicLike.setDynamicContentId(cmd.getDynamicId()); + dynamicLike.setCreateUser(cmd.getReqUserId()); + dynamicLike.setCreateTime(TimestampUtils.now()); + dynamicLikeService.save(dynamicLike); + } + + private Boolean getExist(DynamicLikeCmd cmd) { + return dynamicLikeService.exist(cmd.getDynamicId(), cmd.getReqUserId()); + } + + private void saveDynamicMessage(DynamicLikeCmd cmd, DynamicContent content, DynamicMessageEnum type) { + DynamicMessage message = new DynamicMessage(); + message.setId(IdWorkerUtils.getId()); + message.setDynamicContentId(cmd.getDynamicId()); + message.setContent(dynamicPictureService.getFirstNormalPic(cmd.getDynamicId())); + message.setType(type.name()); + message.setToUserId(content.getCreateUser()); + message.setCreateTime(TimestampUtils.now()); + message.setCreateUser(cmd.getReqUserId()); + dynamicMessageService.save(message); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicMessageUpdateReadCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicMessageUpdateReadCmdExe.java new file mode 100644 index 00000000..86f8dad9 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicMessageUpdateReadCmdExe.java @@ -0,0 +1,32 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-将我的消息置为已读. + *

+ * + * @author pengshigang + * @since 2022-04-22 + */ +@Component +@RequiredArgsConstructor +public class DynamicMessageUpdateReadCmdExe { + + private final DynamicMessageService dynamicMessageService; + + public void execute(AppExtCommand cmd) { + + dynamicMessageService.update() + .set(DynamicMessage::getReading, Boolean.TRUE) + .eq(DynamicMessage::getToUserId, cmd.getReqUserId()) + .execute(); + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicReportCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicReportCmdExe.java new file mode 100644 index 00000000..dd38cc74 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicReportCmdExe.java @@ -0,0 +1,53 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicReportCmd; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicReportService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.text.StringUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Component +@RequiredArgsConstructor +public class DynamicReportCmdExe { + + private final DynamicReportService dynamicReportService; + private final DynamicContentService dynamicContentService; + + public void execute(DynamicReportCmd cmd) { + + DynamicContent content = dynamicContentService.getById(cmd.getDynamicContentId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, content); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, content.getDel()); + +// ResponseAssert.isFalse(DynamicErrorCode.REPEAT_COMPLAINT_ERROR, +// dynamicReportService.exist(cmd.getDynamicContentId(), cmd.getReqUserId())); + + dynamicReportService.save(new DynamicReport() + .setApprovalStatus(0) + .setDynamicContentId(content.getId()) + .setReportedContent(StringUtils.isNotBlank(cmd.getReportedContent()) ? cmd.getReportedContent().replaceFirst(",", "") : "") + .setReportedUrls(cmd.getImageUrls()) + .setReportedUserId(content.getCreateUser()) + .setReportUserId(cmd.getReqUserId()) + .setReportType(cmd.getReportType()) + .setSysOrigin(cmd.getReqSysOrigin().getOrigin()) + .setCreateTime(TimestampUtils.now()) + .setCreateUser(cmd.getReqUserId()) + ); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicTagCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicTagCmdExe.java new file mode 100644 index 00000000..564726fa --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/DynamicTagCmdExe.java @@ -0,0 +1,39 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicTagCO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 获得动态标签. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicTagCmdExe { + + private final DynamicTagService dynamicTagService; + + public DynamicTagCO execute(IdLongCmd cmd) { + + DynamicTag tag = dynamicTagService.getById(cmd.getId()); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, tag); + + return new DynamicTagCO() + .setId(tag.getId()) + .setTag(tag.getTag()) + .setDesc(tag.getDescription()) + .setImageUrl(tag.getImageUrl()); + + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/UserRelationThumbsUpCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/UserRelationThumbsUpCmdExe.java new file mode 100644 index 00000000..24d82a46 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/UserRelationThumbsUpCmdExe.java @@ -0,0 +1,39 @@ +package com.red.circle.other.app.command.dynamic; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.app.dto.cmd.dynamic.UserRelationThumbsUpCmd; +import com.red.circle.other.infra.database.rds.service.dynamic.UserThumbsUpService; +import com.red.circle.other.inner.asserts.user.UserErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 用户关系点赞. + * + * @author zongpuhbin on 2023/04/06 + */ +@Component +@RequiredArgsConstructor +public class UserRelationThumbsUpCmdExe { + + private final UserThumbsUpService userThumbsUpService; + + public Boolean execute(UserRelationThumbsUpCmd cmd) { + // 不可操作自己 + ResponseAssert.notEquals(UserErrorCode.NOT_OPERATION_ME, cmd.requiredReqUserId(), + cmd.getThumbsUpId()); + return userThumbsUpService.checkExist(cmd.requiredReqUserId(), cmd.getThumbsUpId()) + ? Boolean.TRUE + : thumbsUp(cmd); + } + + private Boolean thumbsUp(UserRelationThumbsUpCmd cmd) { + if (!userThumbsUpService.notExistsAdd(cmd.requiredReqUserId(), cmd.getThumbsUpId())) { + // 点赞失败 + return Boolean.FALSE; + } + return Boolean.TRUE; + } + +} + diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java new file mode 100644 index 00000000..7a86ab7e --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/add/DynamicContentAddCmdExe.java @@ -0,0 +1,304 @@ +package com.red.circle.other.app.command.dynamic.add; + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.common.business.core.enums.DynamicEventTypeEnum; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.common.business.enums.PhotoApprovalStatusEnum; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.external.inner.endpoint.message.ImAccountClient; +import com.red.circle.external.inner.endpoint.message.NewsletterClient; +import com.red.circle.external.inner.endpoint.oss.OssServiceClient; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.framework.core.response.ResponseErrorCode; +import com.red.circle.mq.business.model.event.approval.CensorContent; +import com.red.circle.mq.business.model.event.approval.CensorProfileEvent; +import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; +import com.red.circle.mq.rocket.business.producer.CensorMqMessage; +import com.red.circle.mq.rocket.business.producer.DynamicMqMessage; +import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicContentAddCmd; +import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.domain.model.user.UserConsumptionLevel; +import com.red.circle.other.infra.common.user.UserAccountCommon; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.num.ArithmeticUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import com.red.circle.tool.core.text.StringUtils; +import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient; +import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd; +import com.red.circle.wallet.inner.model.enums.GoldOrigin; +import java.sql.Timestamp; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.TimeUnit; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + *

+ * 创建动态内容. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicContentAddCmdExe { + + private final RedisService redisService; + private final ImAccountClient imAccountClient; + private final CensorMqMessage otherMqMessage; + private final OssServiceClient ossServiceClient; + private final DynamicMqMessage dynamicMqMessage; + private final WalletGoldClient walletGoldClient; + private final NewsletterClient newsletterClient; + private final UserRegionGateway userRegionGateway; + private final DynamicTagService dynamicTagService; + private final UserProfileGateway userProfileGateway; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicTimelineService dynamicTimelineService; + private final DynamicBlacklistService dynamicBlacklistService; + private final ApprovalDynamicContentService approvalDynamicContentService; + private final TaskMqMessage taskMqMessage; + private final UserAccountCommon userAccountCommon; + private final AdministratorService administratorService; + private final AdministratorAuthService administratorAuthService; + + public DynamicListCO execute(DynamicContentAddCmd cmd) { + + //校验参数 + checkParameters(cmd); + + Long contentId = IdWorkerUtils.getId(); + + //保存动态 + DynamicListCO save = save(cmd, contentId); + + dynamicCacheService.incrUserTodayDynamicCount(cmd.getReqUserId()); + + if (CollectionUtils.isEmpty(cmd.getPictures())) { + return save; + } + + sendViolationContentMq(cmd); + return save; + } + + private void sendViolationContentMq(DynamicContentAddCmd cmd) { + otherMqMessage.image(new CensorProfileEvent().setUserId(cmd.getReqUserId()) + .setApprovalType(DataApprovalTypeEnum.DYNAMIC_CONTENT).setContents( + cmd.getPictures().stream().map(picture -> new CensorContent().setId(picture.getId()) + .setContent(picture.getResourceUrl())).toList())); + } + + + public void addApprovalDynamic(DynamicContentAddCmd cmd) { + // 验证管理员权限 + ViolationTypeEnum violationTypeEnum = ViolationTypeEnum.DELETE_CONTENT; + ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, + administratorService.existsAdmin(cmd.getReqUserId()) && + administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name())); + + + ApprovalDynamicContent dynamicContent = new ApprovalDynamicContent(); + dynamicContent.setUserId(cmd.getReqUserId()); + dynamicContent.setDynamicId(Long.parseLong(cmd.getContent())); + dynamicContent.setApproveStatus(ApprovalStatusEnum.PENDING.name()); + dynamicContent.setSysOrigin(cmd.requireReqSysOrigin()); + dynamicContent.setCreateTime(TimestampUtils.now()); + dynamicContent.setCreateUser(cmd.getReqUserId()); + approvalDynamicContentService.save(dynamicContent); + } + + /** + * 超出限制发送帖子则支付金币 + */ + private void consumeGold(DynamicContentAddCmd cmd, Long contentId) { + + if (Objects.equals(cmd.getReqSysOrigin().getOrigin(), "YOLO")) { + return; + } + + //当前用户今天已发动态数量 + Long userSentTodayCount = getUserTodayDynamicCount(cmd); + if (userSentTodayCount <= 0) { + return; + } + //限制用户每天发送动态的数量 + Long quantityLimit = dynamicCacheService.getSendQuantityLimit(); + ResponseAssert.isFalse(DynamicErrorCode.DYNAMIC_QUANTITY_LIMIT_ERROR, quantityLimit <= 0); + //超过限额数量后,每条动态按多少金币收费? + Long dynamicFees = dynamicCacheService.getSendDynamicFees(); + if (userSentTodayCount < quantityLimit) { + return; + } + // 这段代码问彭石刚,为什么阻断 + ResponseAssert.failure(DynamicErrorCode.DYNAMIC_QUANTITY_LIMIT_ERROR); + + // 防止重复触发 + ResponseAssert.isTrue(DynamicErrorCode.REPEATED_SUBMIT, + redisService.setIfAbsent("DYNAMIC_CONTENT_CREATE:" + cmd.getReqUserId(), 5, + TimeUnit.SECONDS)); + + walletGoldClient.changeBalance( + GoldReceiptCmd.builder().appExpenditure().userId(cmd.getReqUserId()).eventId(contentId) + .sysOrigin(cmd.requireReqSysOrigin()).origin(GoldOrigin.SEND_DYNAMIC_PAY_GOLD) + .amount(ArithmeticUtils.toBigDecimal(dynamicFees)).build()); + } + + private Long getUserTodayDynamicCount(DynamicContentAddCmd cmd) { + return dynamicCacheService.getUserTodayDynamicCount(cmd.getReqUserId()); + } + + private List validFillParamToEntity(DynamicContentAddCmd cmd, Long contentId) { + + Timestamp date = TimestampUtils.now(); + List pictures = CollectionUtils.newArrayList(); + + for (int i = 0; i < cmd.getPictures().size(); i++) { + var picture = cmd.getPictures().get(i); + + ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR, + StringUtils.isNotBlank(picture.getResourceUrl())); + + DynamicPicture dynamicPicture = new DynamicPicture(); + + long picId = IdWorkerUtils.getId(); + picture.setId(picId); + + dynamicPicture.setId(picId); + dynamicPicture.setDynamicId(contentId); + if (StringUtils.isNotBlank(picture.getResourceUrl())) { + dynamicPicture.setResourceUrl(ResponseAssert.requiredSuccess( + ossServiceClient.getAccessUrl(picture.getResourceUrl()))); + dynamicPicture.setMiniResourceUrl( + ossServiceClient.processImgSaveAsCompressZoom(picture.getResourceUrl(), + picture.getResourceUrl().replace(".", "-MINI-DYNAMIC."), 300) + .getBody()); + } + + if (StringUtils.isBlank(picture.getViolation())) { + dynamicPicture.setViolation(PhotoApprovalStatusEnum.SUSPECTED.name()); + } + dynamicPicture.setHeight(picture.getHeight()); + dynamicPicture.setWidth(picture.getWidth()); + dynamicPicture.setCreateTime(date); + dynamicPicture.setUpdateTime(date); + dynamicPicture.setSort(i + 1); + + pictures.add(dynamicPicture); + } + + return pictures; + } + + private DynamicListCO save(DynamicContentAddCmd cmd, Long contentId) { + Timestamp timestamp = TimestampUtils.now(); + String regionId = userRegionGateway.getRegionId(cmd.getReqUserId()); + + DynamicContent dynamicContent = new DynamicContent() + .setId(contentId) + .setSysOrigin(cmd.requireReqSysOrigin()) + .setContent(cmd.getContent()) + .setDel(Boolean.FALSE).setLocation("") + .setTagId(cmd.getTagId()) + .setCreateUser(cmd.getReqUserId()) + .setCreateTime(timestamp) + .setLanguageType(cmd.getReqLanguage()) + .setRegion(regionId); + dynamicContentService.save(dynamicContent); + + if (CollectionUtils.isNotEmpty(cmd.getPictures())) { + dynamicPictureService.saveBatch(validFillParamToEntity(cmd, contentId)); + } + + dynamicTimelineService.save( + new DynamicTimeline().setDynamicContentId(contentId).setOwn(Boolean.TRUE) + .setRegion(regionId).setCreateUser(cmd.getReqUserId()).setCreateTime(timestamp)); + + dynamicMqMessage.sendDynamic(IdWorkerUtils.getIdStr(), + new DynamicEvent().setDynamicContentId(contentId).setUserId(cmd.getReqUserId()) + .setType(DynamicEventTypeEnum.CREATE).setTimestamp(timestamp).setRegion(regionId)); + + return convert(dynamicContent); + } + + private DynamicListCO convert(DynamicContent dynamicContent) { + DynamicListCO listCO = new DynamicListCO(); + listCO.setDynamicId(dynamicContent.getId()); + listCO.setContent(dynamicContent.getContent()); + listCO.setTagId(dynamicContent.getTagId()); + listCO.setCreateTime(dynamicContent.getCreateTime()); + return listCO; + } + + /** + * 校验参数 + */ + private void checkParameters(DynamicContentAddCmd cmd) { + ResponseAssert.isTrue(DynamicErrorCode.CONTENT_IS_NULL, + StringUtils.isNotBlank(cmd.getContent()) || CollectionUtils.isNotEmpty(cmd.getPictures())); + + if (CollectionUtils.isNotEmpty(cmd.getPictures())) { + ResponseAssert.isTrue(DynamicErrorCode.IMAGE_LIMIT_ERROR, cmd.getPictures().size() <= 9); + } + + if (Objects.nonNull(cmd.getTagId())) { + ResponseAssert.notNull(DynamicErrorCode.TAG_IS_NULL, + dynamicTagService.getById(cmd.getTagId())); + } + + //判断是否为动态黑名单用户,是则不能发动态 + ResponseAssert.isFalse(CommonErrorCode.INSUFFICIENT_PERMISSION, + dynamicBlacklistService.exist(cmd.getReqUserId())); + } + + /** + * 校验用户财富,魅力等级 + */ + private void checkUserLevel(DynamicContentAddCmd cmd) { + + if (Objects.equals(cmd.getReqSysOrigin().getOrigin(), "YOLO")) { + return; + } + + //获得用户魅力,财富等级限制 + Long limitLevel = dynamicCacheService.getSendLevelLimit(); + UserConsumptionLevel userLevel = getConsumptionLevel(cmd); + + ResponseAssert.isTrue(DynamicErrorCode.WEALTH_AND_CHARM_INSUFFICIENT_ERROR, + userLevel.getCharmLevel() >= limitLevel && userLevel.getWealthLevel() >= limitLevel); + } + + private UserConsumptionLevel getConsumptionLevel(DynamicContentAddCmd cmd) { + return userProfileGateway.getUserConsumptionLevel(cmd.requireReqSysOriginEnum(), + cmd.requiredReqUserId()); + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicCommentDelCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicCommentDelCmdExe.java new file mode 100644 index 00000000..9991a2df --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicCommentDelCmdExe.java @@ -0,0 +1,183 @@ +package com.red.circle.other.app.command.dynamic.delete; + +import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.num.NumUtils; + +import java.util.*; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + *

+ * 删除评价列表. + *

+ * + * @author pengshigang + * @since 2022-04-13 + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class DynamicCommentDelCmdExe { + + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicCommentService dynamicCommentService; + private final DynamicPopularService dynamicPopularService; + private final DynamicCommentLikeService dynamicCommentLikeService; + private final AdministratorService administratorService; + private final AdministratorAuthService administratorAuthService; + + public Long execute(AppIdLongCmd cmd) { + + DynamicComment comment = dynamicCommentService.getById(cmd.getId()); + ResponseAssert.notNull(DynamicErrorCode.COMMENT_DELETED, comment); + + //自己和管理员才能删除 + ViolationTypeEnum violationTypeEnum = ViolationTypeEnum.DELETE_COMMENT; + if (!Objects.equals(cmd.getReqUserId(), comment.getCreateUser())) { + ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, + administratorService.existsAdmin(cmd.getReqUserId()) && + administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name())); + } + + + //评论点赞数量 + if (Objects.isNull(comment.getRootCommentId())) { + return deleteAllComment(cmd, comment); + } + + return deleteComment(cmd, comment); + + } + + private Long deleteAllComment(AppIdLongCmd cmd, DynamicComment comment) { + + //修改热门动态权重 + updateScore(cmd, comment); + + dynamicCommentService.deleteByRootCommentId(cmd.getId()); + dynamicCommentService.deleteByReplyCommentId(cmd.getId()); + dynamicCommentLikeService.deleteByRootCommentId(cmd.getId()); + + Integer dynamicCommentCount = dynamicCommentService + .getNumberByDynamicId(comment.getDynamicContentId()); + + return dynamicCacheService.initCommentQuantity(comment.getDynamicContentId(), dynamicCommentCount).longValue(); + } + + private void updateScore(AppIdLongCmd cmd, DynamicComment comment) { + + Integer commentCount = dynamicCommentService + .getNumberByRootIdByNotUserId(cmd.getId(), cmd.getReqUserId()); + + Integer commentLikeCount = dynamicCommentLikeService + .getNumberByRootCommentIdByNotUserId(cmd.getId(), cmd.getReqUserId()); + + commentCount = commentCount * dynamicCacheService.getCommentScore() + + commentLikeCount * dynamicCacheService.getLikeScore(); + + dynamicPopularService + .updateScore(comment.getDynamicContentId(), -commentCount, + cmd.getReqSysOrigin().getOrigin(), null); + } + + private Long deleteComment(AppIdLongCmd cmd, DynamicComment comment) { + + // 收集所有需要删除的评论id(包括子孙评论) + Set idsToDelete = collectCommentTreeSafe(cmd.getId()); + + // 批量删除评论 + if (!idsToDelete.isEmpty()) { + dynamicCommentService.delete() + .in(DynamicComment::getId, idsToDelete) + .execute(); + + // 批量删除点赞记录 + dynamicCommentLikeService.delete() + .in(DynamicCommentLike::getDynamicCommentId, idsToDelete) + .execute(); + } + + // 重新统计评论数 + Integer dynamicCommentCount = dynamicCommentService + .getNumberByDynamicId(comment.getDynamicContentId()); + + return dynamicCacheService.initCommentQuantity(comment.getDynamicContentId(), dynamicCommentCount).longValue(); + } + + /** + * 安全收集评论树(广度优先 + 防环检测) + */ + private Set collectCommentTreeSafe(Long commentId) { + Set allIds = new HashSet<>(); + Queue queue = new LinkedList<>(); + queue.offer(commentId); + + int safetyCounter = 0; + final int MAX_NODES = 10000; // 防止无限循环 + + while (!queue.isEmpty() && safetyCounter++ < MAX_NODES) { + Long currentId = queue.poll(); + + // 防止重复处理 + if (allIds.contains(currentId)) { + continue; + } + + allIds.add(currentId); + + // 查找所有直接回复 + List replies = dynamicCommentService.query() + .eq(DynamicComment::getReplyCommentId, currentId) + .select(DynamicComment::getId) + .list(); + + replies.forEach(r -> queue.offer(r.getId())); + } + + if (safetyCounter >= MAX_NODES) { + log.error("评论树节点数超过限制,可能存在循环引用,rootId={}, collected={}", + commentId, allIds.size()); + } + + return allIds; + } + + private Long getCommentLikeQuantity(DynamicComment comment) { + return dynamicCacheService + .getCommentLikeQuantity(comment.getDynamicContentId(), comment.getId()); + } + + private DynamicContent getContentServiceById(DynamicComment comment) { + DynamicContent content = dynamicContentService.getById(comment.getDynamicContentId()); + ResponseAssert.notNull(DynamicErrorCode.COMMENT_DELETED, content); + ResponseAssert.isFalse(DynamicErrorCode.COMMENT_DELETED, content.getDel()); + return content; + } + + private boolean isEqualsCommon(AppIdLongCmd cmd, DynamicComment comment) { + return Objects.equals(comment.getCreateUser(), cmd.getReqUserId()); + } + + private boolean isEqualsContent(AppIdLongCmd cmd, DynamicContent content) { + return Objects.equals(content.getCreateUser(), cmd.getReqUserId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicContentDelCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicContentDelCmdExe.java new file mode 100644 index 00000000..c3af7549 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicContentDelCmdExe.java @@ -0,0 +1,96 @@ +package com.red.circle.other.app.command.dynamic.delete; + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DynamicEventTypeEnum; +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; +import com.red.circle.mq.rocket.business.producer.DynamicMqMessage; +import com.red.circle.other.app.enums.violation.ViolationTypeEnum; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService; +import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 发布者删除自己的动态内容. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Component +@RequiredArgsConstructor +public class DynamicContentDelCmdExe { + + private final DynamicMqMessage dynamicMqMessage; + private final DynamicContentService dynamicContentService; + private final DynamicPopularService dynamicPopularService; + private final ApprovalDynamicContentService approvalDynamicContentService; + private final AdministratorService administratorService; + private final AdministratorAuthService administratorAuthService; + + public void execute(IdLongCmd cmd) { + + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + + boolean isOwn = Objects.equals(dynamicContent.getCreateUser(), cmd.getReqUserId()); + boolean isAdminAuth = administratorService.existsAdmin(cmd.getReqUserId()) && + administratorAuthService.existsAuth(cmd.requiredReqUserId(), ViolationTypeEnum.DELETE_CONTENT.name()); + ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, isOwn || isAdminAuth); + + // 管理员删除别人的 送入待审核 + if (isAdminAuth && !isOwn) { + ApprovalDynamicContent approvalDynamicContent = new ApprovalDynamicContent(); + approvalDynamicContent.setUserId(cmd.getReqUserId()); + approvalDynamicContent.setDynamicId(dynamicContent.getId()); + approvalDynamicContent.setApproveStatus(ApprovalStatusEnum.PENDING.name()); + approvalDynamicContent.setSysOrigin(dynamicContent.getSysOrigin()); + approvalDynamicContent.setCreateTime(TimestampUtils.now()); + approvalDynamicContent.setCreateUser(cmd.getReqUserId()); + approvalDynamicContentService.save(approvalDynamicContent); + return; + } + + + dynamicContent.setDel(Boolean.TRUE); + dynamicContent.setUpdateUser(cmd.getReqUserId()); + dynamicContentService.updateSelectiveById(dynamicContent); + + dynamicPopularService.removeByDynamicId(dynamicContent.getId()); + + //删除审批内容 + approvalDynamicContentService.deleteByDynamicId(dynamicContent.getId()); + //处理删除动态队列 + sendMessage(dynamicContent.getId()); + + } + + /** + * 处理业务 + * + * @param contentId 动态ID + */ + private void sendMessage(Long contentId) { + dynamicMqMessage.sendDynamic(IdWorkerUtils.getIdStr(), + new DynamicEvent() + .setDynamicContentId(contentId) + .setType(DynamicEventTypeEnum.DELETE) + ); + + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageAllDelCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageAllDelCmdExe.java new file mode 100644 index 00000000..3de72d60 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageAllDelCmdExe.java @@ -0,0 +1,33 @@ +package com.red.circle.other.app.command.dynamic.delete; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-删除我的全部消息. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicMessageAllDelCmdExe { + + private final DynamicMessageService dynamicMessageService; + + public void execute(AppExtCommand cmd) { + + dynamicMessageService.update() + .set(DynamicMessage::getDel, Boolean.TRUE) + .set(DynamicMessage::getReading, Boolean.TRUE) + .eq(DynamicMessage::getToUserId, cmd.getReqUserId()) + .execute(); + + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageDelCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageDelCmdExe.java new file mode 100644 index 00000000..705eae20 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/delete/DynamicMessageDelCmdExe.java @@ -0,0 +1,36 @@ +package com.red.circle.other.app.command.dynamic.delete; + +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-删除我的消息. + *

+ * + * @author pengshigang + * @since 2022-04-13 + */ +@Component +@RequiredArgsConstructor +public class DynamicMessageDelCmdExe { + + private final DynamicMessageService dynamicMessageService; + + public void execute(IdLongCmd cmd) { + + dynamicMessageService.update() + .set(DynamicMessage::getDel, Boolean.TRUE) + .set(DynamicMessage::getReading, Boolean.TRUE) + .eq(DynamicMessage::getId, cmd.getId()) + .eq(DynamicMessage::getToUserId, cmd.getReqUserId()) + .last(PageConstant.LIMIT_ONE) + .execute(); + + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicChildCommentQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicChildCommentQryExe.java new file mode 100644 index 00000000..4bf97edc --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicChildCommentQryExe.java @@ -0,0 +1,113 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicCommentListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicChildCommentLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态子评论列表查询. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Component +@RequiredArgsConstructor +public class DynamicChildCommentQryExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicCacheService dynamicCacheService; + private final DynamicCommentService dynamicCommentService; + private final DynamicCommentLikeService dynamicCommentLikeService; + + public PageResult execute(DynamicChildCommentLimitCmd cmd) { + + PageResult comments = pageData(cmd); + if (CollectionUtils.isEmpty(comments.getRecords())) { + return PageResult.newPageResult(0); + } + + Map userMap = userProfileGateway.mapByUserIds(getUserIds(comments)); + Map commentLikeMap = getCommentLikeMap(cmd, comments); + + return comments.convert(comment -> { + + DynamicCommentListCO listCO = new DynamicCommentListCO(); + UserProfile createUser = userMap.get(comment.getCreateUser()); + if (Objects.isNull(createUser)) { + return null; + } + listCO.setUserAvatar(createUser.getUserAvatar()); + listCO.setUserNickname(createUser.getUserNickname()); + listCO.setUserSex(createUser.getUserSex()); + listCO.setUserId(createUser.getId()); + listCO.setRootCommentId(comment.getRootCommentId()); + listCO.setReplyCommentId(comment.getReplyCommentId()); + + UserProfile toUser = userMap.get(comment.getToUserId()); + if (Objects.nonNull(toUser)) { + listCO.setToUserId(toUser.getId()); + listCO.setToUserNickname(toUser.getUserNickname()); + } + + listCO.setLike(getLike(commentLikeMap, comment)); + listCO.setLikeStrQuantity(getLikeStrQuantity(comment)); + listCO.setId(comment.getId()); + listCO.setDynamicId(comment.getDynamicContentId()); + listCO.setContent(comment.getContent()); + listCO.setCreateTime(comment.getCreateTime()); + + return listCO; + + }); + } + + private Boolean getLike(Map commentLikeMap, DynamicComment comment) { + return Optional.ofNullable(commentLikeMap.get(comment.getId())).orElse(Boolean.FALSE); + } + + private Map getCommentLikeMap(DynamicChildCommentLimitCmd cmd, + PageResult comments) { + return dynamicCommentLikeService + .mapByCommentIdsByUserId(comments.getRecords().stream().map(DynamicComment::getId).collect( + Collectors.toSet()), cmd.getReqUserId()); + } + + private String getLikeStrQuantity(DynamicComment comment) { + return NumUtils.formatLong(Optional.ofNullable( + dynamicCacheService.getCommentLikeQuantity(comment.getDynamicContentId(), comment.getId())) + .orElse(0L)); + } + + private Set getUserIds(PageResult comments) { + + Set userIds = comments.getRecords().stream().map(DynamicComment::getCreateUser) + .filter(Objects::nonNull).collect(Collectors.toSet()); + + userIds.addAll(comments.getRecords().stream().map(DynamicComment::getToUserId) + .filter(Objects::nonNull) + .collect(Collectors.toSet())); + + return userIds; + } + + private PageResult pageData(DynamicChildCommentLimitCmd cmd) { + return dynamicCommentService.pageChildCommentsByTimeDesc(cmd.getPageReq(), + cmd.getRootCommentId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicCommentQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicCommentQryExe.java new file mode 100644 index 00000000..78183510 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicCommentQryExe.java @@ -0,0 +1,155 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicCommentListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicCommentLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态评价列表. + *

+ * + * @author pengshigang + * @since 2022-04-13 + */ +@Component +@RequiredArgsConstructor +public class DynamicCommentQryExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicCommentService dynamicCommentService; + private final DynamicCommentLikeService dynamicCommentLikeService; + + public PageResult execute(DynamicCommentLimitCmd cmd) { + + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getDynamicId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamicContent.getDel()); + + PageResult comments = pageData(cmd); + if (CollectionUtils.isEmpty(comments.getRecords())) { + return PageResult.newPageResult(0); + } + Map userMap = + userProfileGateway.mapByUserIds(getUserIds(comments)); + + Map commentLikeMap = getCommentLikeMap(cmd, comments); + + // 批量查询所有根评论的子评论数量 + Map childCommentCountMap = getChildCommentCountMap(comments); + + return comments.convert(comment -> { + + DynamicCommentListCO listCO = new DynamicCommentListCO(); + UserProfile createUser = userMap.get(comment.getCreateUser()); + if (Objects.isNull(createUser)) { + return null; + } + listCO.setUserAvatar(createUser.getUserAvatar()); + listCO.setUserNickname(createUser.getUserNickname()); + listCO.setUserSex(createUser.getUserSex()); + listCO.setUserId(createUser.getId()); + listCO.setRootCommentId(comment.getRootCommentId()); + listCO.setReplyCommentId(comment.getReplyCommentId()); + + UserProfile toUser = userMap.get(comment.getToUserId()); + if (Objects.nonNull(toUser)) { + listCO.setToUserId(toUser.getId()); + listCO.setToUserNickname(toUser.getUserNickname()); + } + + if (Objects.isNull(comment.getRootCommentId()) && Objects.isNull(comment.getToUserId())) { + listCO.setRootCommentId(comment.getId()); + } + + listCO.setLike(getLike(commentLikeMap, comment)); + + listCO.setLikeStrQuantity(getLikeStrQuantity(cmd, comment)); + listCO.setId(comment.getId()); + listCO.setDynamicId(comment.getDynamicContentId()); + listCO.setContent(comment.getContent()); + listCO.setCreateTime(comment.getCreateTime()); + + // 设置子评论数量(仅根评论有值) + if (Objects.isNull(comment.getRootCommentId())) { + listCO.setChildCommentCount(childCommentCountMap.getOrDefault(comment.getId(), 0)); + } + + return listCO; + + }); + } + + private Boolean getLike(Map commentLikeMap, DynamicComment comment) { + return Optional.ofNullable(commentLikeMap.get(comment.getId())).orElse(Boolean.FALSE); + } + + private Map getCommentLikeMap(DynamicCommentLimitCmd cmd, + PageResult comments) { + return dynamicCommentLikeService + .mapByCommentIdsByUserId(comments.getRecords().stream().map(DynamicComment::getId).collect( + Collectors.toSet()), cmd.getReqUserId()); + } + + private String getLikeStrQuantity(DynamicCommentLimitCmd cmd, DynamicComment comment) { + + return NumUtils.formatLong(Optional.ofNullable( + dynamicCacheService.getCommentLikeQuantity(cmd.getDynamicId(), comment.getId())) + .orElse(0L)); + } + + private Set getUserIds(PageResult comments) { + + Set userIds = comments.getRecords().stream().map(DynamicComment::getCreateUser) + .filter(Objects::nonNull).collect(Collectors.toSet()); + + userIds.addAll(comments.getRecords().stream().map(DynamicComment::getToUserId).filter(Objects::nonNull) + .collect(Collectors.toSet())); + + return userIds; + } + + private PageResult pageData(DynamicCommentLimitCmd cmd) { + return dynamicCommentService.pageRootCommentsByHotScore(cmd.getPageReq(), cmd.getDynamicId()); + } + + /** + * 批量查询根评论的子评论数量 + */ + private Map getChildCommentCountMap(PageResult comments) { + Set rootCommentIds = comments.getRecords().stream() + .filter(comment -> Objects.isNull(comment.getRootCommentId())) + .map(DynamicComment::getId) + .collect(Collectors.toSet()); + + if (CollectionUtils.isEmpty(rootCommentIds)) { + return java.util.Collections.emptyMap(); + } + + return dynamicCommentService.mapChildCommentCount(rootCommentIds); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicDetailsQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicDetailsQryExe.java new file mode 100644 index 00000000..f5452f81 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicDetailsQryExe.java @@ -0,0 +1,147 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Sets; +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicPictureCO; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态内容详情. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicDetailsQryExe { + + private final DynamicTagService dynamicTagService; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicCommentService dynamicCommentService; + private final DynamicGiftService dynamicGiftService; + private final UserSubscriptionService userSubscriptionService; + private final UserProfileAppConvertor userProfileAppConvertor; + private final ApprovalDynamicContentService approvalDynamicContentService; + + public DynamicListCO execute(IdLongCmd cmd) { + + DynamicContent dynamic = dynamicContentService.getById(cmd.getId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamic); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamic.getDel()); + + ApprovalDynamicContent approvalDynamicContent = approvalDynamicContentService.getByDynamicId(dynamic.getId()); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, approvalDynamicContent != null && + !ApprovalStatusEnum.PASS.name().equals(approvalDynamicContent.getApproveStatus())); + + UserProfileDTO baseInfo = userProfileAppConvertor.toUserProfileDTO( + userProfileGateway.getByUserId(dynamic.getCreateUser())); + ResponseAssert.notNull(CommonErrorCode.NO_SUITABLE_CONTENT, dynamic); + + Set contentIds = Sets.newHashSet(dynamic.getId()); + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, contentIds); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(contentIds); + Map giftQuantityMap = dynamicGiftService.mapGiftQuantity(contentIds); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(contentIds); + Map> pictureMap = dynamicPictureService.mapPreviewGroup(contentIds); + + DynamicListCO result = new DynamicListCO(); + processBase(dynamic, result, pictureMap); + processUser(baseInfo, result); + processTag(dynamic, result); + + result.setSubscription(checkSubscription(cmd.getReqUserId(), dynamic.getCreateUser())); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setGiftStrQuantity(NumUtils.formatLong(giftQuantityMap.get(dynamic.getId()))); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + return result; + + } + + + private Map getLikeMap(IdLongCmd cmd, Set contentIds) { + return dynamicLikeService + .mapByContentIdsByUserId(contentIds, cmd.getReqUserId()); + } + + private void processBase(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + + result.setDynamicId(dynamic.getId()); + result.setContent(dynamic.getContent()); + result.setCreateTime(dynamic.getCreateTime()); + List pictures = pictureMap.get(dynamic.getId()); + if (CollectionUtils.isEmpty(pictures)) { + return; + } + result.setPictures(pictures.stream().map(picture -> { + DynamicPictureCO co = new DynamicPictureCO(); + co.setId(picture.getId()); + co.setDynamicId(picture.getDynamicId()); + co.setResourceUrl(picture.getResourceUrl()); + co.setMiniResourceUrl(picture.getMiniResourceUrl()); + co.setHeight(picture.getHeight()); + co.setWidth(picture.getWidth()); + co.setSort(picture.getSort()); + co.setViolation(picture.getViolation()); + return co; + }).collect(Collectors.toList())); + } + + private void processUser(UserProfileDTO baseInfo, DynamicListCO result) { + result.setUserId(baseInfo.getId()); + result.setUserAvatar(baseInfo.getUserAvatar()); + result.setUserSex(baseInfo.getUserSex()); + result.setUserNickname(baseInfo.getUserNickname()); + result.setUserProfile(userProfileAppConvertor.convertToSimpleProfile(baseInfo)); + } + + private void processTag(DynamicContent dynamic, DynamicListCO result) { + + DynamicTag tag = dynamicTagService.getById(dynamic.getTagId()); + if (Objects.nonNull(tag)) { + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + } + + private Boolean checkSubscription(Long userId, Long createUserId) { + return userSubscriptionService.checkSubscription(userId, createUserId); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java new file mode 100644 index 00000000..218b5c08 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicFollowQryExe.java @@ -0,0 +1,209 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.infra.database.rds.entity.user.user.UserSubscription; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.other.infra.database.rds.service.user.user.ShieldBlackService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.other.inner.model.dto.user.UserSimpleProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + *

+ * 关注动态内容列表. + *

+ * + * @author pengshigang + * @since 2022-04-12 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicFollowQryExe { + + private final DynamicTagService dynamicTagService; + private final UserRegionGateway userRegionGateway; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicCommentService dynamicCommentService; + private final DynamicTimelineService dynamicTimelineService; + private final UserProfileAppConvertor userProfileAppConvertor; + private final UserSubscriptionService userSubscriptionService; + private final ShieldBlackService shieldBlackService; + private final ApprovalDynamicContentService approvalDynamicContentService; + + public PageResult execute(DynamicLimitCmd cmd) { + + // 获取黑名单用户列表 + List blackUserIds = shieldBlackService.listBlackUserIds(cmd.getReqUserId()); + Set blackUserSet = CollectionUtils.isEmpty(blackUserIds) ? Sets.newHashSet() : Sets.newHashSet(blackUserIds); + + // 获取待审核动态列表 + List pendingDynamicIds = approvalDynamicContentService.listPendingDynamicIds(); + + // 获取关注人列表,过滤黑名单用户 + List userSubscriptions = userSubscriptionService + .listByUserId(cmd.requiredReqUserId(), null, null); + + if (CollectionUtils.isEmpty(userSubscriptions)) { + return PageResult.newPageResult(0); + } + List list = userSubscriptions.stream() + .map(UserSubscription::getSubscribeUserId) + .filter(userId -> !blackUserSet.contains(userId)) + .toList(); + PageResult timelines = dynamicTimelineService + .pageByTimeDesc(list, null, cmd.getPageReq(), Boolean.TRUE, pendingDynamicIds); + + if (CollectionUtils.isEmpty(timelines.getRecords())) { + return PageResult.newPageResult(0); + } + + Set contentIds = getContentIds(timelines); + if (CollectionUtils.isEmpty(contentIds)) { + return PageResult.newPageResult(0); + } + List contentList = dynamicContentService.listByIds(contentIds); + Set userIds = getUserIds(contentList); + if (CollectionUtils.isEmpty(userIds)) { + return PageResult.newPageResult(0); + } + + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, contentIds); + Map userMap = userProfileGateway.mapByUserIds(userIds); + Map contentMap = mapDynamicContent(contentList); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(contentIds); + Map tagMap = dynamicTagService.mapByIds(getTagIds(contentList)); + Map userProfileMap = userProfileAppConvertor.convertToSimpleProfiles(userProfileGateway.mapByUserIds(userIds)); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(contentIds); + Map> pictureMap = dynamicPictureService.mapPreviewGroup(contentIds); + + List listCOList = timelines.getRecords().stream().map(timeline -> { + + DynamicContent dynamic = contentMap.get(timeline.getDynamicContentId()); + if (Objects.isNull(dynamic) || dynamic.getDel()) { + return null; + } + + UserProfileDTO baseInfo = userProfileAppConvertor.toUserProfileDTO( + userMap.get(dynamic.getCreateUser())); + + DynamicListCO result = new DynamicListCO(); + UserSimpleProfileDTO userProfile = userProfileMap.get(dynamic.getCreateUser()); + if (Objects.nonNull(userProfile)) { + result.setUserProfile(userProfile); + } + + if (Objects.nonNull(baseInfo)) { + processUser(baseInfo, result); + } + + processBase(dynamic, result, pictureMap); + processTag(tagMap, dynamic, result); + + result.setSubscription(Boolean.TRUE); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + + return result; + }).filter(Objects::nonNull).toList(); + + + PageResult result = new PageResult<>(); + result.setRecords(listCOList); + result.setTotal(timelines.getTotal()); + result.setCurrent(timelines.getCurrent()); + result.setSize(timelines.getSize()); + return result; + + } + + private Map getLikeMap(DynamicLimitCmd cmd, Set contentIds) { + return dynamicLikeService + .mapByContentIdsByUserId(contentIds, cmd.getReqUserId()); + } + + private void processBase(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + + DynamicPopularQryExe.processBaseDetails(dynamic, result, pictureMap); + } + + private void processUser(UserProfileDTO baseInfo, DynamicListCO result) { + result.setUserId(baseInfo.getId()); + result.setUserAvatar(baseInfo.getUserAvatar()); + result.setUserSex(baseInfo.getUserSex()); + result.setUserNickname(baseInfo.getUserNickname()); + } + + private void processTag(Map tagMap, DynamicContent dynamic, + DynamicListCO result) { + DynamicTag tag = tagMap.get(dynamic.getTagId()); + if (Objects.nonNull(tag)) { + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + } + + private Set getTagIds(List dynamics) { + return dynamics.stream().map(DynamicContent::getTagId).collect(Collectors.toSet()); + } + + private Set getUserIds(List dynamics) { + + if (CollectionUtils.isEmpty(dynamics)) { + return Sets.newHashSet(); + } + + return dynamics.stream().map(DynamicContent::getCreateUser) + .collect(Collectors.toSet()); + } + + private Set getContentIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicTimeline::getDynamicContentId).collect(Collectors.toSet()); + } + + private Map mapDynamicContent(List contents) { + + if (CollectionUtils.isEmpty(contents)) { + return Maps.newHashMap(); + } + return contents.stream().collect(Collectors.toMap(DynamicContent::getId, v -> v)); + + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicGiftQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicGiftQryExe.java new file mode 100644 index 00000000..3e8a8dd6 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicGiftQryExe.java @@ -0,0 +1,86 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicGiftListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicGiftLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicGift; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态礼物列表查询. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Component +@RequiredArgsConstructor +public class DynamicGiftQryExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicContentService dynamicContentService; + private final DynamicGiftService dynamicGiftService; + + public PageResult execute(DynamicGiftLimitCmd cmd) { + + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getDynamicId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamicContent.getDel()); + + PageResult gifts = pageData(cmd); + if (CollectionUtils.isEmpty(gifts.getRecords())) { + return PageResult.newPageResult(0); + } + + Map userMap = userProfileGateway.mapByUserIds(getUserIds(gifts)); + + return gifts.convert(gift -> { + + DynamicGiftListCO listCO = new DynamicGiftListCO(); + UserProfile createUser = userMap.get(gift.getCreateUser()); + if (Objects.isNull(createUser)) { + return null; + } + listCO.setUserAvatar(createUser.getUserAvatar()); + listCO.setUserNickname(createUser.getUserNickname()); + listCO.setUserSex(createUser.getUserSex()); + listCO.setAge(createUser.getAge()); + listCO.setUserId(createUser.getId()); + + listCO.setId(gift.getId()); + listCO.setDynamicId(gift.getDynamicContentId()); + listCO.setGiftId(gift.getGiftId()); + listCO.setGiftQuantity(gift.getGiftQuantity()); + listCO.setGiftUrl(gift.getGiftUrl()); + listCO.setGiftUnitPrice(gift.getGiftUnitPrice()); + listCO.setUpdateTime(gift.getUpdateTime()); + + return listCO; + + }); + } + + private Set getUserIds(PageResult gifts) { + return gifts.getRecords().stream() + .map(DynamicGift::getCreateUser) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + } + + private PageResult pageData(DynamicGiftLimitCmd cmd) { + return dynamicGiftService.pageByUpdateTimeDesc(cmd.getPageReq(), cmd.getDynamicId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLatestQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLatestQryExe.java new file mode 100644 index 00000000..96dc345f --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLatestQryExe.java @@ -0,0 +1,154 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.user.user.ShieldBlackService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.model.dto.user.UserSimpleProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + *

+ * 最新动态内容列表. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicLatestQryExe { + + private final UserRegionGateway userRegionGateway; + private final DynamicTagService dynamicTagService; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicPictureService dynamicPictureService; + private final DynamicContentService dynamicContentService; + private final DynamicCommentService dynamicCommentService; + private final UserSubscriptionService userSubscriptionService; + private final UserProfileAppConvertor userProfileAppConvertor; + private final ShieldBlackService shieldBlackService; + private final ApprovalDynamicContentService approvalDynamicContentService; + + public PageResult execute(DynamicLimitCmd cmd) { + + List blackUserIds = shieldBlackService.listBlackUserIds(cmd.getReqUserId()); + List pendingDynamicIds = approvalDynamicContentService.listPendingDynamicIds(); + PageResult dynamics = dynamicContentService + .pageByTimeDesc(cmd.getPageReq(), null, cmd.requireReqSysOrigin(), blackUserIds, pendingDynamicIds); + + if (CollectionUtils.isEmpty(dynamics.getRecords())) { + return PageResult.newPageResult(0); + } + + Set ids = getIds(dynamics); + Set userIds = getUserIds(dynamics); + if (CollectionUtils.isEmpty(ids) || CollectionUtils.isEmpty(userIds)) { + return PageResult.newPageResult(0); + } + + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, ids); + Map subscriptionMap = getSubscriptionMap(cmd, userIds); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(ids); + Map tagMap = dynamicTagService.mapByIds(getTagIds(dynamics)); + Map userProfileMap = userProfileAppConvertor.convertToSimpleProfiles(userProfileGateway.mapByUserIds(userIds)); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(ids); + Map> pictureMap = dynamicPictureService.mapPreviewGroup(ids); + + return dynamics.convert(dynamic -> { + + DynamicListCO result = new DynamicListCO(); + UserSimpleProfileDTO userProfile = userProfileMap.get(dynamic.getCreateUser()); + result.setUserProfile(userProfile); + processUser(userProfile, result); + processBase(dynamic, result, pictureMap); + processTag(tagMap, dynamic, result); + result.setSubscription(getSubscription(subscriptionMap, dynamic)); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + + return result; + }); + + } + + private Map getLikeMap(DynamicLimitCmd cmd, Set ids) { + return dynamicLikeService + .mapByContentIdsByUserId(ids, cmd.getReqUserId()); + } + + private Boolean getSubscription(Map subscriptionMap, DynamicContent dynamic) { + return Optional.ofNullable(subscriptionMap.get(dynamic.getCreateUser())).orElse(Boolean.FALSE + ); + } + + private Map getSubscriptionMap(DynamicLimitCmd cmd, Set userIds) { + return userSubscriptionService + .mapIsSubscription(cmd.requiredReqUserId(), userIds + ); + } + + private void processBase(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + + DynamicPopularQryExe.processBaseDetails(dynamic, result, pictureMap); + } + + private void processUser(UserSimpleProfileDTO userProfile, + DynamicListCO result) { + result.setUserId(userProfile.getId()); + result.setUserAvatar(userProfile.getUserAvatar()); + result.setUserNickname(userProfile.getUserNickname()); + } + + private void processTag(Map tagMap, DynamicContent dynamic, + DynamicListCO result) { + + DynamicTag tag = tagMap.get(dynamic.getTagId()); + if (Objects.nonNull(tag)) { + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + } + + private Set getTagIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicContent::getTagId).collect(Collectors.toSet()); + } + + private Set getUserIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicContent::getCreateUser) + .collect(Collectors.toSet()); + } + + private Set getIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicContent::getId).collect(Collectors.toSet()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLikeQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLikeQryExe.java new file mode 100644 index 00000000..e19902d6 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicLikeQryExe.java @@ -0,0 +1,82 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicLikeListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLikeLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.inner.asserts.DynamicErrorCode; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态点赞列表查询. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Component +@RequiredArgsConstructor +public class DynamicLikeQryExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicContentService dynamicContentService; + private final DynamicLikeService dynamicLikeService; + + public PageResult execute(DynamicLikeLimitCmd cmd) { + + DynamicContent dynamicContent = dynamicContentService.getById(cmd.getDynamicId()); + ResponseAssert.notNull(DynamicErrorCode.CONTENT_IS_NULL, dynamicContent); + ResponseAssert.isFalse(DynamicErrorCode.CONTENT_DELETE, dynamicContent.getDel()); + + PageResult likes = pageData(cmd); + if (CollectionUtils.isEmpty(likes.getRecords())) { + return PageResult.newPageResult(0); + } + + Map userMap = userProfileGateway.mapByUserIds(getUserIds(likes)); + + return likes.convert(like -> { + + DynamicLikeListCO listCO = new DynamicLikeListCO(); + UserProfile createUser = userMap.get(like.getCreateUser()); + if (Objects.isNull(createUser)) { + return null; + } + listCO.setUserAvatar(createUser.getUserAvatar()); + listCO.setUserNickname(createUser.getUserNickname()); + listCO.setUserSex(createUser.getUserSex()); + listCO.setAge(createUser.getAge()); + listCO.setUserId(createUser.getId()); + + listCO.setId(like.getId()); + listCO.setDynamicId(like.getDynamicContentId()); + listCO.setCreateTime(like.getCreateTime()); + + return listCO; + + }); + } + + private Set getUserIds(PageResult likes) { + return likes.getRecords().stream() + .map(DynamicLike::getCreateUser) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + } + + private PageResult pageData(DynamicLikeLimitCmd cmd) { + return dynamicLikeService.pageByTimeDesc(cmd.getPageReq(), cmd.getDynamicId()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicListQryByTagExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicListQryByTagExe.java new file mode 100644 index 00000000..66bdacb0 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicListQryByTagExe.java @@ -0,0 +1,147 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicByTagLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.other.inner.model.dto.user.UserSimpleProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 根据标签获得动态列表. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicListQryByTagExe { + + private final DynamicTagService dynamicTagService; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicCommentService dynamicCommentService; + private final UserSubscriptionService userSubscriptionService; + private final UserProfileAppConvertor userProfileAppConvertor; + + public List execute(DynamicByTagLimitCmd cmd) { + + List dynamics = dynamicContentService.pageByTimeDesc(cmd.getTagId(), + cmd.getPageNumber()); + if (CollectionUtils.isEmpty(dynamics)) { + return Lists.newArrayList(); + } + + Set ids = getIds(dynamics); + Set userIds = getUserIds(dynamics); + if (CollectionUtils.isEmpty(ids) || CollectionUtils.isEmpty(userIds)) { + return Lists.newArrayList(); + } + + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, ids); + + Map subscriptionMap = getSubscriptionMap(cmd, userIds); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(ids); + Map tagMap = dynamicTagService.mapByIds(getTagIds(dynamics)); + Map userProfileMap = userProfileAppConvertor.convertToSimpleProfiles(userProfileGateway.mapByUserIds(userIds)); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(ids); + Map> pictureMap = dynamicPictureService.mapPreviewGroup(ids); + + return dynamics.stream().map(dynamic -> { + + UserSimpleProfileDTO baseInfo = userProfileMap.get(dynamic.getCreateUser()); + if (Objects.isNull(baseInfo)) { + return null; + } + DynamicListCO result = new DynamicListCO(); + UserSimpleProfileDTO userProfile = userProfileMap.get(dynamic.getCreateUser()); + if (Objects.nonNull(userProfile)) { + result.setUserProfile(userProfile); + } + processBase(dynamic, result, pictureMap); + processUser(baseInfo, result); + processTag(tagMap, dynamic, result); + result.setSubscription(getSubscription(subscriptionMap, dynamic)); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + + return result; + }).filter(Objects::nonNull).toList(); + + } + + private Map getLikeMap(DynamicByTagLimitCmd cmd, Set ids) { + return dynamicLikeService + .mapByContentIdsByUserId(ids, cmd.getReqUserId()); + } + + private Boolean getSubscription(Map subscriptionMap, DynamicContent dynamic) { + return Optional.ofNullable(subscriptionMap.get(dynamic.getCreateUser())).orElse(Boolean.FALSE + ); + } + + private Map getSubscriptionMap(DynamicByTagLimitCmd cmd, Set userIds) { + return userSubscriptionService + .mapIsSubscription(cmd.requiredReqUserId(), userIds); + } + + private void processBase(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + DynamicPopularQryExe.processBaseDetails(dynamic, result, pictureMap); + } + + private void processUser(UserSimpleProfileDTO baseInfo, DynamicListCO result) { + result.setUserId(baseInfo.getId()); + result.setUserAvatar(baseInfo.getUserAvatar()); + result.setUserSex(baseInfo.getUserSex()); + result.setUserNickname(baseInfo.getUserNickname()); + } + + private void processTag(Map tagMap, DynamicContent dynamic, + DynamicListCO result) { + + DynamicTag tag = tagMap.get(dynamic.getTagId()); + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + + private Set getTagIds(List dynamics) { + return dynamics.stream().map(DynamicContent::getTagId).collect(Collectors.toSet()); + } + + private Set getUserIds(List dynamics) { + return dynamics.stream().map(DynamicContent::getCreateUser) + .collect(Collectors.toSet()); + } + + private Set getIds(List dynamics) { + return dynamics.stream().map(DynamicContent::getId).collect(Collectors.toSet()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMessageQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMessageQryExe.java new file mode 100644 index 00000000..695d9b5f --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMessageQryExe.java @@ -0,0 +1,145 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.alibaba.fastjson.JSON; +import com.alibaba.nacos.common.utils.StringUtils; +import com.google.common.collect.Maps; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicMessageListCO; +import com.red.circle.other.app.dto.clientobject.dynamic.MessageItemCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.tool.core.collection.CollectionUtils; + +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态-我的消息列表. + *

+ * + * @author pengshigang + * @since 2022-04-13 + */ +@Component +@RequiredArgsConstructor +public class DynamicMessageQryExe { + + private final UserProfileGateway userProfileGateway; + private final DynamicContentService dynamicContentService; + private final DynamicMessageService dynamicMessageService; + private final DynamicCommentService dynamicCommentService; + + + public PageResult execute(DynamicLimitCmd cmd) { + + PageResult messages = getMessages(cmd); + if (CollectionUtils.isEmpty(messages.getRecords())) { + return PageResult.newPageResult(0); + } + + Map userMap = userProfileGateway.mapByUserIds(getUserIds(messages)); + Map contentMap = getContentMap(messages); + Map commentMap = getCommentMap(messages); + + return messages.convert(message -> { + + DynamicContent dynamicContent = contentMap.get(message.getDynamicContentId()); + + DynamicMessageListCO messageCO = new DynamicMessageListCO(); + messageCO.setId(message.getId()); + messageCO.setType(message.getType()); + messageCO.setUserId(message.getCreateUser()); + messageCO.setCreateTime(message.getCreateTime()); + messageCO.setDynamicId(message.getDynamicContentId()); + messageCO.setDynamicContent(dynamicContent == null ? "" : dynamicContent.getContent()); + + // 批量查询评论ID对应的 rootCommentId + DynamicComment comment = commentMap.get(message.getDynamicCommentId()); + if (comment != null) { + messageCO.setRootCommentId(comment.getRootCommentId() == null ? comment.getId() : comment.getRootCommentId()); + } + + // 处理messageContent 和 giftCount + parseMessageContent(messageCO, message); + + if (DynamicMessageEnum.isReportRelated(message.getType())) { + return messageCO; + } + + UserProfile user = userMap.get(message.getCreateUser()); + if (Objects.nonNull(user)) { + messageCO.setUserAvatar(user.getUserAvatar()); + messageCO.setUserNickname(user.getUserNickname()); + messageCO.setUserSex(user.getUserSex()); + messageCO.setAge(user.getAge()); + } + return messageCO; + + }); + + } + + private void parseMessageContent(DynamicMessageListCO co, DynamicMessage message) { + if (message == null || co == null) { + return; + } + if (StringUtils.isBlank(message.getContent())) { + return; + } + + if (!DynamicMessageEnum.DYNAMIC_GIFT.name().equals(message.getType())) { + co.setMessageContent(message.getContent()); + return; + } + try { + MessageItemCO messageItemCO = JSON.parseObject(message.getContent(), MessageItemCO.class); + co.setMessageContent(messageItemCO.getMessageContent()); + co.setGiftCount(messageItemCO.getGiftCount()); + } catch (Exception ignored) { + } + } + + private Map getContentMap(PageResult messages) { + return dynamicContentService + .mapByIds(messages.getRecords().stream().map(DynamicMessage::getDynamicContentId).collect( + Collectors.toSet())); + } + + private Map getCommentMap(PageResult messages) { + Set commentIds = messages.getRecords().stream() + .map(DynamicMessage::getDynamicCommentId) + .filter(Objects::nonNull) + .collect(Collectors.toSet()); + + if (CollectionUtils.isEmpty(commentIds)) { + return Maps.newHashMap(); + } + + return dynamicCommentService.mapByIds(commentIds); + } + + private PageResult getMessages(DynamicLimitCmd cmd) { + return dynamicMessageService.pageByTimeDesc(cmd.getPageReq(), cmd.getReqUserId(), cmd.getDynamicMessageEnums()); + } + + private Set getUserIds(PageResult messages) { + + return messages.getRecords().stream().map(DynamicMessage::getCreateUser) + .filter(Objects::nonNull).collect(Collectors.toSet()); + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMyQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMyQryExe.java new file mode 100644 index 00000000..8f483b67 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicMyQryExe.java @@ -0,0 +1,148 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicMyLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; + +import java.util.*; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + *

+ * 我的动态内容列表. + *

+ * + * @author pengshigang + * @since 2022-04-12 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicMyQryExe { + + private final DynamicTagService dynamicTagService; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicPictureService dynamicPictureService; + private final DynamicContentService dynamicContentService; + private final DynamicCommentService dynamicCommentService; + private final UserSubscriptionService userSubscriptionService; + private final UserProfileAppConvertor userProfileAppConvertor; + private final ApprovalDynamicContentService approvalDynamicContentService; + + public PageResult execute(DynamicMyLimitCmd cmd) { + List pendingDynamicIds = approvalDynamicContentService.listPendingDynamicIds(); + + PageResult dynamics = dynamicContentService + .pageByTimeDesc(cmd.getUserId(), cmd.getPageReq(), pendingDynamicIds); + + if (CollectionUtils.isEmpty(dynamics.getRecords())) { + return PageResult.newPageResult(0); + } + + Set ids = getIds(dynamics); + if (CollectionUtils.isEmpty(ids)) { + return PageResult.newPageResult(0); + } + + Boolean isMySubscription = isMySubscription(cmd); + + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, ids); + + UserProfileDTO user = userProfileAppConvertor.toUserProfileDTO( + userProfileGateway.getByUserId(cmd.getUserId()) + ); + ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, user); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(ids); + Map tagMap = dynamicTagService.mapByIds(getTagIds(dynamics)); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(ids); + Map> pictureMap = dynamicPictureService.mapPreviewGroup(ids); + + return dynamics.convert(dynamic -> { + + DynamicListCO result = new DynamicListCO(); + processUser(user, result); + processTag(tagMap, dynamic, result); + processBase(dynamic, result, pictureMap); + result.setSubscription(isMySubscription); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + result.setUserProfile(userProfileAppConvertor.convertToSimpleProfile(user)); + + return result; + }); + + } + + private Boolean isMySubscription(DynamicMyLimitCmd cmd) { + + if (Objects.equals(cmd.getUserId(), cmd.getReqUserId())) { + return Boolean.TRUE; + } + + return Objects.nonNull( + userSubscriptionService.getBySubscription(cmd.getReqUserId(), cmd.getUserId()) + ); + } + + private Map getLikeMap(DynamicMyLimitCmd cmd, Set ids) { + return dynamicLikeService.mapByContentIdsByUserId(ids, cmd.getReqUserId()); + } + + + private void processBase(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + + DynamicPopularQryExe.processBaseDetails(dynamic, result, pictureMap); + } + + private void processUser(UserProfileDTO baseInfo, DynamicListCO result) { + result.setUserId(baseInfo.getId()); + result.setUserAvatar(baseInfo.getUserAvatar()); + result.setUserSex(baseInfo.getUserSex()); + result.setUserNickname(baseInfo.getUserNickname()); + } + + private void processTag(Map tagMap, DynamicContent dynamic, + DynamicListCO result) { + + DynamicTag tag = tagMap.get(dynamic.getTagId()); + if (Objects.nonNull(tag)) { + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + } + + private Set getTagIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicContent::getTagId).collect(Collectors.toSet()); + } + + private Set getIds(PageResult dynamics) { + return dynamics.getRecords().stream().map(DynamicContent::getId).collect(Collectors.toSet()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicPopularQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicPopularQryExe.java new file mode 100644 index 00000000..79c1d5cd --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicPopularQryExe.java @@ -0,0 +1,274 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicListCO; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicPictureCO; +import com.red.circle.other.app.dto.cmd.dynamic.DynamicLimitCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.infra.database.mongo.entity.dynamic.DynamicPopular; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.entity.dynamic.TopDynamic; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.infra.database.rds.service.dynamic.TopDynamicService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; +import com.red.circle.other.inner.model.dto.user.UserSimpleProfileDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.num.NumUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 热门动态内容列表. + *

+ * + * @author pengshigang + * @since 2022-04-25 + */ +@Component +@RequiredArgsConstructor +public class DynamicPopularQryExe { + + private final UserRegionGateway userRegionGateway; + private final DynamicTagService dynamicTagService; + private final TopDynamicService topDynamicService; + private final UserProfileGateway userProfileGateway; + private final DynamicLikeService dynamicLikeService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicCommentService dynamicCommentService; + private final DynamicPopularService dynamicPopularService; + private final UserSubscriptionService userSubscriptionService; + private final UserProfileAppConvertor userProfileAppConvertor; + + public List execute(DynamicLimitCmd cmd) { + PageReq pageReq = cmd.getPageReq(); + + //热门动态 + List populars = getPopulars(cmd); + + //大于第一页没数据则返回 + if (CollectionUtils.isEmpty(populars) && pageReq.getCursor() > 1) { + return Lists.newArrayList(); + } + + //置顶动态ID + List topDynamicIds = getTopDynamicIds(cmd); + + List popularsIds = getPopularContentIds(populars); + //处理置顶动态,移除与热门动态重复值 + popularsIds.removeAll(topDynamicIds); + + List resultList = Lists.newArrayList(); + //置顶动态,如果当前页码非第一页则无视置顶动态 + if (pageReq.getCursor() <= 1) { + resultList.addAll(getHotDynamic(topDynamicIds)); + } + //处理热门动态列表 + resultList.addAll(getHotDynamic(popularsIds)); + + //没有热门动态时,默认列表处理 + if (CollectionUtils.isEmpty(popularsIds)) { + List tmpContentList = getTmpContentList(cmd); + tmpContentList.removeAll(resultList); + resultList.addAll(tmpContentList); + } + + if (CollectionUtils.isEmpty(resultList)) { + return Lists.newArrayList(); + } + + resultList = resultList.stream().filter(result -> Objects.nonNull(result) && + Objects.nonNull(result.getId())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(resultList)) { + return Lists.newArrayList(); + } + + Set tmpContentIds = resultList.stream().map(DynamicContent::getId) + .collect(Collectors.toSet()); + + Set userIds = getUserIds(resultList); + if (CollectionUtils.isEmpty(userIds)) { + return Lists.newArrayList(); + } + + //自己是否已点赞 + Map likeMap = getLikeMap(cmd, tmpContentIds); + Map contentMap = mapDynamicContent(resultList); + Map subscriptionMap = getSubscriptionMap(cmd, userIds); + Map likeQuantityMap = dynamicLikeService.mapLikeQuantity(tmpContentIds); + Map tagMap = dynamicTagService.mapByIds(getTagIds(resultList)); + Map userProfileMap = userProfileAppConvertor.convertToSimpleProfiles(userProfileGateway.mapByUserIds(userIds)); + Map commentQuantityMap = dynamicCommentService.mapCommentQuantity(tmpContentIds); + Map> pictureMap = dynamicPictureService.mapPreviewGroup( + tmpContentIds); + + return resultList.stream().map(content -> { + + DynamicContent dynamic = contentMap.get(content.getId()); + if (Objects.isNull(dynamic) || Boolean.TRUE.equals(dynamic.getDel())) { + return null; + } + DynamicListCO result = new DynamicListCO(); + UserSimpleProfileDTO userProfile = userProfileMap.get(dynamic.getCreateUser()); + if (Objects.isNull(userProfile)) { + return null; + } + result.setUserProfile(userProfile); + processBaseDetails(dynamic, result, pictureMap); + result.setUserId(userProfile.getId()); + result.setUserAvatar(userProfile.getUserAvatar()); + result.setUserSex(userProfile.getUserSex()); + result.setUserNickname(userProfile.getUserNickname()); + + result.setSubscription(getSubscription(subscriptionMap, dynamic)); + result.setLikeStrQuantity(NumUtils.formatLong(likeQuantityMap.get(dynamic.getId()))); + result.setLike(Optional.ofNullable(likeMap.get(dynamic.getId())).orElse(Boolean.FALSE)); + result.setCommentStrQuantity(NumUtils.formatInt(commentQuantityMap.get(dynamic.getId()))); + result.setTop(topDynamicIds.contains(content.getId())); + + DynamicTag tag = tagMap.get(dynamic.getTagId()); + if (Objects.nonNull(tag)) { + result.setTag(tag.getTag()); + result.setTagId(tag.getId()); + } + + return result; + }).filter(Objects::nonNull).collect(Collectors.toList()); + + } + + private List getTmpContentList(DynamicLimitCmd cmd) { + return dynamicContentService.pageByTimeDesc(cmd.getPageReq(), + userRegionGateway.getRegionId(cmd.getReqUserId()), + cmd.requireReqSysOrigin()).getRecords().stream().toList(); + } + + private List getHotDynamic(List contentIds) { + + if (CollectionUtils.isEmpty(contentIds)) { + return Lists.newArrayList(); + } + + Map tmpContentMap = dynamicContentService.mapByIds(contentIds); + if (CollectionUtils.isEmpty(tmpContentMap)) { + return Lists.newArrayList(); + } + + return contentIds.stream().map(tmpContentMap::get).collect(Collectors.toList()); + + } + + private List getPopularContentIds(List populars) { + if (CollectionUtils.isEmpty(populars)) { + return Lists.newArrayList(); + } + return populars.stream().map(DynamicPopular::getDynamicId).distinct() + .collect(Collectors.toList()); + } + + private List getTopDynamicIds(DynamicLimitCmd cmd) { + + List topCaches = topDynamicService.listBySysOrigin( + SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin())); + + if (CollectionUtils.isEmpty(topCaches)) { + return Lists.newArrayList(); + } + return topCaches.stream().map(TopDynamic::getDynamicId).distinct() + .toList(); + } + + private List getPopulars(DynamicLimitCmd cmd) { + PageReq pageReq = cmd.getPageReq(); + return dynamicPopularService + .pageDynamic(cmd.getReqSysOrigin().getOrigin(), pageReq.getCursor(), pageReq.getLimit(), + userRegionGateway.getRegionId(cmd.getReqUserId())); + } + + private Map getLikeMap(DynamicLimitCmd cmd, Set contentIds) { + return dynamicLikeService.mapByContentIdsByUserId(contentIds, cmd.getReqUserId()); + } + + private Boolean getSubscription(Map subscriptionMap, DynamicContent dynamic) { + return Optional.ofNullable(subscriptionMap.get(dynamic.getCreateUser())).orElse(Boolean.FALSE); + } + + private Map getSubscriptionMap(DynamicLimitCmd cmd, Set userIds) { + return userSubscriptionService.mapIsSubscription( + cmd.requiredReqUserId(), + userIds + ); + } + + private Set getTagIds(List dynamics) { + return dynamics.stream().map(DynamicContent::getTagId).collect(Collectors.toSet()); + } + + private Set getUserIds(List dynamics) { + + if (CollectionUtils.isEmpty(dynamics)) { + return Sets.newHashSet(); + } + + return dynamics.stream().map(DynamicContent::getCreateUser) + .collect(Collectors.toSet()); + } + + + private Map mapDynamicContent(List contents) { + + if (CollectionUtils.isEmpty(contents)) { + return Maps.newHashMap(); + } + return contents.stream().collect(Collectors.toMap(DynamicContent::getId, v -> v)); + + } + + static void processBaseDetails(DynamicContent dynamic, DynamicListCO result, + Map> pictureMap) { + + result.setDynamicId(dynamic.getId()); + result.setContent(dynamic.getContent()); + result.setCreateTime(dynamic.getCreateTime()); + + List pictures = pictureMap.get(dynamic.getId()); + if (CollectionUtils.isEmpty(pictures)) { + return; + } + result.setPictures(pictures.stream().map(picture -> { + DynamicPictureCO co = new DynamicPictureCO(); + co.setId(picture.getId()); + co.setDynamicId(picture.getDynamicId()); + co.setResourceUrl(picture.getResourceUrl()); + co.setHeight(picture.getHeight()); + co.setWidth(picture.getWidth()); + co.setSort(picture.getSort()); + co.setViolation(picture.getViolation()); + co.setMiniResourceUrl(picture.getMiniResourceUrl()); + return co; + }).collect(Collectors.toList())); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicTagQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicTagQryExe.java new file mode 100644 index 00000000..cdc302bb --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/DynamicTagQryExe.java @@ -0,0 +1,46 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicTagCO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + *

+ * 动态标签列表. + *

+ * + * @author pengshigang + * @since 2022-04-14 + */ +@Component +@RequiredArgsConstructor +public class DynamicTagQryExe { + + private final DynamicTagService dynamicTagService; + + public List execute(AppExtCommand cmd) { + + List tags = dynamicTagService + .listTag(SysOriginPlatformEnum.valueOf(cmd.getReqSysOrigin().getOrigin()), + cmd.getReqLanguage()); + + if (CollectionUtils.isEmpty(tags)) { + return Lists.newArrayList(); + } + + return tags.stream().map(tag -> new DynamicTagCO() + .setId(tag.getId()) + .setTag(tag.getTag()) + .setDesc(tag.getDescription()) + .setImageUrl(tag.getImageUrl()) + ).toList(); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/UserRelationThumsUpQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/UserRelationThumsUpQryExe.java new file mode 100644 index 00000000..1314bcfa --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/dynamic/query/UserRelationThumsUpQryExe.java @@ -0,0 +1,29 @@ +package com.red.circle.other.app.command.dynamic.query; + +import com.red.circle.other.app.dto.clientobject.dynamic.UserThumbsUpCO; +import com.red.circle.other.app.dto.cmd.dynamic.UserRelationThumbsUpCmd; +import com.red.circle.other.infra.database.rds.service.dynamic.UserThumbsUpService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 用户关系点赞信息 + * + * @author zongpubin on 2023/04/06 + */ +@Component +@RequiredArgsConstructor +public class UserRelationThumsUpQryExe { + + private final UserThumbsUpService userThumbsUpService; + + public UserThumbsUpCO execute(UserRelationThumbsUpCmd cmd) { + boolean checkExist = userThumbsUpService.checkExist(cmd.requiredReqUserId(), + cmd.getThumbsUpId()); + long count = userThumbsUpService.countThumbsUp(cmd.getThumbsUpId()); + return new UserThumbsUpCO() + .setThumbsUps(count) + .setLike(checkExist); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java index 01e83377..d5bb76f7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/ApplyJoinFamilyExe.java @@ -20,7 +20,7 @@ import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoSe import com.red.circle.other.infra.database.rds.service.family.FamilyMessageService; import com.red.circle.other.infra.enums.family.FamilyMsgTypeEnum; import com.red.circle.other.infra.enums.family.FamilyRoleEnum; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.FamilyErrorCode; import com.red.circle.other.inner.asserts.user.UserRelationErrorCode; import com.red.circle.other.inner.enums.FamilyMessageStatusEnum; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java index 7fd34044..8e96cef1 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyCreateExe.java @@ -26,7 +26,7 @@ import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserSett import com.red.circle.other.infra.database.rds.service.family.*; import com.red.circle.other.infra.enums.family.FamilyRoleEnum; import com.red.circle.other.infra.enums.family.FamilyStatusEnum; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.FamilyErrorCode; import com.red.circle.tool.core.sequence.IdWorkerUtils; import com.red.circle.tool.core.text.StringUtils; @@ -165,7 +165,7 @@ public class FamilyCreateExe { private FamilyLevelConfig initLevel(FamilyCreateCmd cmd) { FamilyLevelConfig levelConfig = familyLevelConfigService .getIntiLevel(cmd.getReqSysOrigin().getOrigin()); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, levelConfig); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, levelConfig); return levelConfig; } @@ -229,8 +229,8 @@ public class FamilyCreateExe { String string = redisService.getString(FamilyKeys.USER_LEAVE.getKey(cmd.getReqUserId())); ResponseAssert.isNull(FamilyErrorCode.USER_RECENT_LEAVE, string); //敏感词 -// ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyName())); -// ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyIntro())); +// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyName())); +// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyIntro())); } } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyInfoEditExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyInfoEditExe.java index 85baef78..feb33583 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyInfoEditExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/family/FamilyInfoEditExe.java @@ -15,7 +15,7 @@ import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserSett import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService; import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService; import com.red.circle.other.infra.enums.family.FamilyNewsTypeEnum; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.FamilyErrorCode; import com.red.circle.tool.core.text.StringUtils; import lombok.RequiredArgsConstructor; @@ -43,8 +43,8 @@ public class FamilyInfoEditExe { public void execute(FamilyInfoEditCmd cmd) { //敏感词 -// ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyName())); -// ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyNotice())); +// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyName())); +// ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getFamilyNotice())); ResponseAssert.isTrue(FamilyErrorCode.NOT_EXIST_FAMILY_INFO_DATA, getExistFamilyByUserId(cmd)); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/trumpet/GameTrumpetSendExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/trumpet/GameTrumpetSendExe.java index 717d6df3..86d4f962 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/trumpet/GameTrumpetSendExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/game/trumpet/GameTrumpetSendExe.java @@ -12,7 +12,7 @@ import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheSe import com.red.circle.other.infra.database.mongo.entity.game.trumpet.GameTrumpetCount; import com.red.circle.other.infra.database.mongo.service.game.GameTrumpetCountService; import com.red.circle.other.infra.database.rds.service.game.GameTrumpetBlacklistService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.GameErrorCode; import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.tool.core.date.TimestampUtils; @@ -46,7 +46,7 @@ public class GameTrumpetSendExe { public void execute(GameTrumpetSendCmd cmd) { //敏感词 - ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getMessage())); + ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getMessage())); //判断是否为喇叭黑名单用户,是则不能发喇叭 ResponseAssert.isFalse(CommonErrorEnum.INSUFFICIENT_PERMISSION, gameTrumpetBlacklistService.exist(cmd.getReqUserId())); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/BlessingsGiftGiveCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/BlessingsGiftGiveCmdExe.java index 62573139..4e17f044 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/BlessingsGiftGiveCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/BlessingsGiftGiveCmdExe.java @@ -136,6 +136,7 @@ public class BlessingsGiftGiveCmdExe { cmd.filterAcceptUserId().size(), receipt.getOpAmount().getDollarAmount(), cmd.getRoomId(), + cmd.getDynamicContentId(), "BLESSINGS_GIFT"); } @@ -147,10 +148,11 @@ public class BlessingsGiftGiveCmdExe { giveAwayGiftBatchEvent.setRequestPlatform(cmd.requireReqSysOrigin()); giveAwayGiftBatchEvent.setSendUserId(cmd.requiredReqUserId()); giveAwayGiftBatchEvent.setAccepts(getAccepts(cmd)); - giveAwayGiftBatchEvent.setQuantity(cmd.getQuantity()); - giveAwayGiftBatchEvent.setGiftConfig(toGiveGiftConfig(giftConfig)); - giveAwayGiftBatchEvent.setRoomId(cmd.getRoomId()); - giveAwayGiftBatchEvent.setTrackId(trackId); + giveAwayGiftBatchEvent.setQuantity(cmd.getQuantity()); + giveAwayGiftBatchEvent.setGiftConfig(toGiveGiftConfig(giftConfig)); + giveAwayGiftBatchEvent.setRoomId(cmd.getRoomId()); + giveAwayGiftBatchEvent.setDynamicContentId(cmd.getDynamicContentId()); + giveAwayGiftBatchEvent.setTrackId(trackId); giveAwayGiftBatchEvent.setSongId(cmd.getSongId()); giveAwayGiftBatchEvent.setCheckBlessingsGift(Boolean.FALSE); giveAwayGiftBatchEvent.setBagGift(Boolean.FALSE); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java index f2f2b2f9..6f7ddeb6 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/GiftGiveAwayBatchCmdExe.java @@ -74,7 +74,10 @@ public class GiftGiveAwayBatchCmdExe { ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR, CollectionUtils.isNotEmpty(cmd.filterAcceptUserId())); - if (giftConfig.getGiftCandy().equals(new BigDecimal("0.00"))) { + // 动态礼物检查区域 + checkDynamicRegion(cmd); + + if (giftConfig.getGiftCandy().equals(new BigDecimal("0.00"))) { BigDecimal dollarAmount = walletGoldClient.getBalance(cmd.requiredReqUserId()).getBody().getDollarAmount(); log.info("赠送普通礼物金额为0,余额为 {}", dollarAmount); return dollarAmount; @@ -100,6 +103,16 @@ public class GiftGiveAwayBatchCmdExe { return receipt.getBalance(); } + private void checkDynamicRegion(GiveAwayGiftBatchCmd cmd) { + if (cmd.getDynamicContentId() == null) { + return; + } + ResponseAssert.isTrue(CommonErrorCode.DATA_ERROR, cmd.getAcceptUserIds() != null && cmd.getAcceptUserIds().size() == 1); + Long acceptUserId = cmd.getAcceptUserIds().get(0); + + ResponseAssert.isTrue(GiftErrorCode.NOT_SAME_REGION, userRegionGateway.checkEqRegion(cmd.getReqUserId(), acceptUserId)); + } + /** * 付钱. */ @@ -169,6 +182,7 @@ public class GiftGiveAwayBatchCmdExe { cmd.filterAcceptUserId().size(), receipt.getProcessAmount(), cmd.getRoomId(), + cmd.getDynamicContentId(), "NORMAL_GIFT"); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java index e5df164d..f9818b0e 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/gift/LuckyGiftGiveCmdExe.java @@ -175,6 +175,7 @@ public class LuckyGiftGiveCmdExe { cmd.filterAcceptUserId().size(), receipt.getOpAmount().getDollarAmount(), cmd.getRoomId(), + cmd.getDynamicContentId(), source); } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/LiveVoiceRoomCreateCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/LiveVoiceRoomCreateCmdExe.java index 2782ef4b..2bc7397a 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/LiveVoiceRoomCreateCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/LiveVoiceRoomCreateCmdExe.java @@ -26,7 +26,7 @@ import com.red.circle.other.infra.database.rds.entity.live.RoomMember; import com.red.circle.other.infra.database.rds.entity.sys.SysCountryCode; import com.red.circle.other.infra.database.rds.service.live.RoomMemberService; import com.red.circle.other.infra.database.rds.service.sys.SysCountryCodeService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.RoomErrorCode; import com.red.circle.other.inner.asserts.user.UserErrorCode; import com.red.circle.other.inner.enums.config.EnumConfigKey; @@ -101,7 +101,7 @@ public class LiveVoiceRoomCreateCmdExe { private RoomProfileManager createRoom(UserProfile userProfile, AppExtCommand cmd) { if (SensitiveWordFilter.checkSensitiveWord(userProfile.getUserNickname())){ - ResponseAssert.isTrue(OtherErrorCode.SENSITIVE_WORD_ERROR, false); + ResponseAssert.isTrue(DynamicErrorCode.SENSITIVE_WORD_ERROR, false); } RoomProfileManager roomProfile = new RoomProfileManager(); roomProfile.setId(IdWorkerUtils.getId()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/UpdateRoomProfileCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/UpdateRoomProfileCmdExe.java index 5d417373..e1d75e00 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/UpdateRoomProfileCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/room/UpdateRoomProfileCmdExe.java @@ -16,7 +16,7 @@ import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile; import com.red.circle.other.infra.database.mongo.entity.sys.ApiOperationLog; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.sys.ApiOperationLogService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.RoomErrorCode; import com.red.circle.other.inner.model.dto.live.RoomProfileDTO; import com.red.circle.tool.core.date.DateUtils; @@ -63,10 +63,10 @@ public class UpdateRoomProfileCmdExe { //违禁词 if(ObjectUtil.isNotEmpty(cmd.getRoomName())){ - ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getRoomName())); + ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getRoomName())); } if(ObjectUtil.isNotEmpty(cmd.getRoomDesc())){ - ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getRoomDesc())); + ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getRoomDesc())); } cmd.setRoomName(KeywordConstant.filter(cmd.getRoomName())); cmd.setRoomDesc(KeywordConstant.filter(cmd.getRoomDesc())); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamHandleUserApplyExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamHandleUserApplyExe.java index 5eb79c7f..05bdaff1 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamHandleUserApplyExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/TeamHandleUserApplyExe.java @@ -22,7 +22,7 @@ import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberTar import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService; import com.red.circle.other.infra.database.rds.service.team.BillDiamondBalanceDetailsService; import com.red.circle.other.infra.database.rds.service.team.BillDiamondBalanceService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.asserts.team.TeamErrorCode; import com.red.circle.other.inner.enums.material.BadgeKeyEnum; import com.red.circle.other.inner.model.cmd.team.TeamApplicationProcessChangeCmd; @@ -70,13 +70,13 @@ public class TeamHandleUserApplyExe { Objects.equals(status, TeamApplicationProcessStatus.WAIT)); TeamApplicationProcess process = teamApplicationProcessService.getById(cmd.getId()); - ResponseAssert.notNull(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, process); + ResponseAssert.notNull(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, process); ResponseAssert.isTrue(CommonErrorCode.MSG_REPEAT_PROCESSING, Objects.equals(process.getStatus(), TeamApplicationProcessStatus.WAIT)); TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId()); ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember); - ResponseAssert.isTrue(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, + ResponseAssert.isTrue(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, Objects.equals(teamMember.getTeamId(), process.getAssociateId())); ResponseAssert.isFalse(TeamErrorCode.PERMISSION_DENIED, Objects.equals(teamMember.getRole(), TeamMemberRole.MEMBER)); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/TeamUserApplyRecordQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/TeamUserApplyRecordQryExe.java index 985866f7..f6ff6ef0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/TeamUserApplyRecordQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/team/query/TeamUserApplyRecordQryExe.java @@ -11,7 +11,7 @@ import com.red.circle.other.infra.database.mongo.entity.team.team.TeamApplicatio import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.service.team.team.TeamApplicationProcessService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.asserts.team.TeamErrorCode; import com.red.circle.other.inner.enums.team.TeamApplicationProcessStatus; @@ -48,7 +48,7 @@ public class TeamUserApplyRecordQryExe { TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId()); ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember); - ResponseAssert.isTrue(OtherErrorCode.NO_RELATED_INFORMATION_FOUND, + ResponseAssert.isTrue(DynamicErrorCode.NO_RELATED_INFORMATION_FOUND, Objects.equals(teamMember.getTeamId(), cmd.getTeamId())); ResponseAssert.isFalse(TeamErrorCode.PERMISSION_DENIED, diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java index 106f2843..11a1d899 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UpdateUserProfileCmdExe.java @@ -21,7 +21,7 @@ import com.red.circle.other.infra.database.rds.entity.sys.SysCountryCode; import com.red.circle.other.infra.database.rds.entity.user.user.BaseInfo; import com.red.circle.other.infra.database.rds.service.sys.SysCountryCodeService; import com.red.circle.other.infra.database.rds.service.user.user.BaseInfoService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.text.StringUtils; import com.red.circle.other.domain.enums.PhotoAuditStatus; @@ -63,7 +63,7 @@ public class UpdateUserProfileCmdExe { public UserProfileDTO execute(UserProfileModifyCmd cmd) { //敏感词 if(ObjectUtil.isNotEmpty(cmd.getUserNickname())){ - ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getUserNickname())); + ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getUserNickname())); } userProfileGateway.removeCacheAll(cmd.requiredReqUserId()); UserProfile userProfile = userProfileGateway.getByUserId(cmd.requiredReqUserId()); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCountMessageQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCountMessageQryExe.java index b5babcfb..d787ec0b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCountMessageQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCountMessageQryExe.java @@ -1,29 +1,34 @@ package com.red.circle.other.app.command.user.query; -import com.red.circle.common.business.dto.cmd.AppExtCommand; -import com.red.circle.other.app.dto.clientobject.user.relation.friendcard.UserFriendCardCountMessageCO; -import com.red.circle.other.infra.database.mongo.service.user.friend.FriendsApplyListService; -import com.red.circle.other.infra.database.rds.service.user.user.GiveFriendshipCardApplyService; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.other.app.dto.clientobject.user.relation.friendcard.UserFriendCardCountMessageCO; +import com.red.circle.other.infra.database.mongo.service.user.friend.FriendsApplyListService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.user.user.GiveFriendshipCardApplyService; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; /** - * 统计未同意友谊关系卡申请、好友申请 + * 统计未同意友谊关系卡申请、好友申请、我的消息列表 * * @author zongpubin on 2023/12/5 */ @Service @AllArgsConstructor -public class UserCountMessageQryExe { - - private final FriendsApplyListService friendsApplyListService; - private final GiveFriendshipCardApplyService giveFriendshipCardApplyService; +public class UserCountMessageQryExe { + + private final DynamicMessageService dynamicMessageService; + + private final FriendsApplyListService friendsApplyListService; + private final GiveFriendshipCardApplyService giveFriendshipCardApplyService; public UserFriendCardCountMessageCO execute(AppExtCommand cmd) { - return new UserFriendCardCountMessageCO() - .setUserFriendCardApplyNum(giveFriendshipCardApplyService.countFriendshipCardApply( - cmd.getReqUserId())) - .setUserFriendApplyNum(friendsApplyListService.countFriendsApply(cmd.getReqUserId())); - } -} + return new UserFriendCardCountMessageCO() + .setUserFriendApplyNum(giveFriendshipCardApplyService.countFriendshipCardApply( + cmd.getReqUserId())) + .setUserFriendApplyNum(friendsApplyListService.countFriendsApply(cmd.getReqUserId())) + .setDynamicMessageNum( + dynamicMessageService.countDynamicMessage(cmd.getReqUserId())); + } +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/DynamicCommon.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/DynamicCommon.java new file mode 100644 index 00000000..3d26b590 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/room/DynamicCommon.java @@ -0,0 +1,196 @@ +package com.red.circle.other.app.common.room; + +import com.google.common.collect.Lists; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.external.inner.endpoint.message.NewsletterClient; +import com.red.circle.external.inner.model.cmd.message.NewsletterResultCmd; +import com.red.circle.external.inner.model.enums.message.NewsletterEvent; +import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.infra.database.rds.entity.user.user.UserSubscription; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.other.infra.database.rds.service.user.user.UserSubscriptionService; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 动态. + * + * @author pengshigang + * @since 2022-4-12 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicCommon { + + private final NewsletterClient newsletterClient; + private final DynamicContentService dynamicContentService; + private final DynamicMessageService dynamicMessageService; + private final DynamicTimelineService dynamicTimelineService; + private final UserSubscriptionService userSubscriptionService; + private final ApprovalDynamicContentService approvalDynamicContentService; + + + /** + * 关注用户业务 + * + * @param userId 操作用户id + * @param followedUserId 被关注用户id + */ + public void follow(Long userId, Long followedUserId) { + + //获得被关注用户的发布内容 + List timelines = dynamicTimelineService.ownListByUserId(followedUserId); + if (CollectionUtils.isEmpty(timelines)) { + return; + } + + //将被关注用户的数据插入到自己的时间轴中 + Lists.partition(timelines, 200).parallelStream() + .forEach(timelineList -> dynamicTimelineService.saveBatch( + timelineList.parallelStream().map(obj -> new DynamicTimeline() + .setDynamicContentId(obj.getDynamicContentId()) + .setCreateTime(obj.getCreateTime()) + .setCreateUser(userId) + .setOwn(Boolean.FALSE) + ) + .collect(Collectors.toList()))); + + } + + /** + * 取消关注用户业务 + * + * @param userId 操作用户id + * @param unfollowedUserId 被取消关注用户id + */ + public void unfollow(Long userId, Long unfollowedUserId) { + + //获得需要取消关注用户的发布内容 + List timelines = dynamicTimelineService.ownListByUserId(unfollowedUserId); + if (CollectionUtils.isEmpty(timelines)) { + return; + } + + //将被关注用户的数据插入到自己的时间轴中 + Lists.partition(timelines, 100).parallelStream() + .forEach(timelineList -> { + + //获得需要取关的内容id + Set contentIds = timelineList.parallelStream() + .map(DynamicTimeline::getDynamicContentId) + .collect(Collectors.toSet()); + + if (CollectionUtils.isEmpty(contentIds)) { + return; + } + + //将自己时间轴中属于被取关的内容删除 + dynamicTimelineService.delete() + .in(DynamicTimeline::getDynamicContentId, contentIds) + .eq(DynamicTimeline::getCreateUser, userId) + .execute(); + + }); + + } + + /** + * 自己发布动态时,给关注自己的用户添加动态 + * + * @param dynamicEvent 参数 + */ + public void toFollowUserAddDynamic(DynamicEvent dynamicEvent) { + + List subscriptions = userSubscriptionService.getAllBySubscriptionUserId( + dynamicEvent.getUserId()); + + if (CollectionUtils.isEmpty(subscriptions)) { + return; + } + + Lists.partition(subscriptions, 200).parallelStream() + .forEach(friendList -> dynamicTimelineService + .saveBatch(friendList.parallelStream().map(subscription -> new DynamicTimeline() + .setOwn(Boolean.FALSE) + .setDynamicContentId(dynamicEvent.getDynamicContentId()) + .setRegion(dynamicEvent.getRegion()) + .setCreateUser(subscription.getUserId()) + .setCreateTime(dynamicEvent.getTimestamp()) + ).toList())); + } + + + /** + * 删除自己动态内容 + * + * @param contentId 动态内容id + */ + public void deleteOwnDynamic(Long contentId) { + + //删除时间轴上的所有contentId关联的动态数据 + dynamicTimelineService.deleteByDynamicContentId(contentId); + + } + + /** + * 发送消息 + * + * @param toUserId 接收用户 + */ + public void sendMsg(Long toUserId) { + + if (Objects.isNull(toUserId)) { + return; + } + + /*Integer count = dynamicMessageService.getCountByToUserId(toUserId); + + log.info("该用户 {} 动态评论或点赞消息总数量发送", toUserId); + newsletterClient.send(new NewsletterResultCmd() + .setUserIds(List.of(toUserId)) + .setEvent(NewsletterEvent.DYNAMIC_MESSAGE_QUANTITY) + .setData(count <= 0 ? 1 : count) + );*/ + } + + /** + * 系统删除违规动态与时间轴动态信息 + */ + public void systemDeleteDynamic(Long dynamicId) { + + Long userId = dynamicContentService.getCreateUserById(dynamicId); + if (Objects.isNull(userId)) { + return; + } + + dynamicContentService.deleteById(dynamicId); + dynamicTimelineService.deleteByDynamicContentId(dynamicId); + approvalDynamicContentService.deleteByDynamicId(dynamicId); + + DynamicMessage dynamicMessage = new DynamicMessage(); + dynamicMessage.setDynamicContentId(dynamicId); + dynamicMessage.setToUserId(userId); + dynamicMessage.setType(DynamicMessageEnum.DYNAMIC_VIOLATION.name()); + dynamicMessage.setCreateTime(TimestampUtils.now()); + dynamicMessageService.save(dynamicMessage); + + sendMsg(userId); + + } + + +} + diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/task/TaskCenterGoClient.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/task/TaskCenterGoClient.java index a81f7e52..93d0f9f8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/task/TaskCenterGoClient.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/common/task/TaskCenterGoClient.java @@ -83,6 +83,7 @@ public class TaskCenterGoClient { Integer acceptUserSize, BigDecimal consumeGold, Long roomId, + Long dynamicContentId, String source) { if (Objects.isNull(userId) || Objects.isNull(trackId) || Objects.isNull(consumeGold) || consumeGold.compareTo(BigDecimal.ZERO) <= 0) { @@ -104,6 +105,7 @@ public class TaskCenterGoClient { payload.put("acceptUserSize", acceptUserSize); payload.put("actualAmount", consumeGold); payload.put("roomId", roomId); + payload.put("dynamicContentId", dynamicContentId); payload.put("source", source); reportEvent(new TaskCenterEventRequest() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/material/GiftAppConvertor.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/material/GiftAppConvertor.java index f3c51b59..f7cbebbd 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/material/GiftAppConvertor.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/convertor/material/GiftAppConvertor.java @@ -46,10 +46,11 @@ public interface GiftAppConvertor { .setRequestPlatform(Objects.toString(cmd.getReqClient())) .setSendUserId(cmd.requiredReqUserId()) .setAccepts(getAccepts(cmd)) - .setQuantity(cmd.getQuantity()) - .setGiftConfig(toGiveGiftConfig(giftConfig)) - .setRoomId(cmd.getRoomId()) - .setTrackId(trackId) + .setQuantity(cmd.getQuantity()) + .setGiftConfig(toGiveGiftConfig(giftConfig)) + .setRoomId(cmd.getRoomId()) + .setDynamicContentId(cmd.getDynamicContentId()) + .setTrackId(trackId) .setSongId(cmd.getSongId()) .setBagGift(Boolean.FALSE) .setCreateTime( diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/enums/violation/ViolationTypeEnum.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/enums/violation/ViolationTypeEnum.java index 789a3396..e0866c8e 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/enums/violation/ViolationTypeEnum.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/enums/violation/ViolationTypeEnum.java @@ -45,7 +45,22 @@ public enum ViolationTypeEnum { */ ROOM_THEME(6, "房间主题", TargetTypeEnum.ROOM), - ; + /** + * 发布动态 + */ + CREATE_CONTENT(7, "发布动态", TargetTypeEnum.USER), + + /** + * 删除动态 + */ + DELETE_CONTENT(8, "删除动态", TargetTypeEnum.USER), + + /** + * 删除评论 + */ + DELETE_COMMENT(9, "删除评论", TargetTypeEnum.USER), + + ; /** * 类型编码 diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/ApprovalListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/ApprovalListener.java index 5f46bd64..3ec7d1d2 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/ApprovalListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/ApprovalListener.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.listener; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; import com.red.circle.component.mq.MessageEventProcess; import com.red.circle.component.mq.MessageEventProcessDescribe; import com.red.circle.component.mq.config.RocketMqMessageListener; @@ -51,7 +52,12 @@ public class ApprovalListener implements MessageListener { // 审批处理 factoryForApprovalStrategy.getStrategy(eventBody.getApprovalType()).doOperation(eventBody); - // 清理用户缓存 + // 类型为举报动态则不继续往下处理 + if (DataApprovalTypeEnum.checkDynamic(eventBody.getApprovalType())) { + return; + } + + // 清理用户缓存 userProfileGateway.removeCacheAll(eventBody.waitApprovalUserIdsSet()); if (eventBody.approvalNotPass()) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java index c39c0525..fb24bfa9 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/CensorProfileListener.java @@ -14,27 +14,33 @@ import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; import com.red.circle.external.inner.endpoint.oss.OssServiceClient; import com.red.circle.external.inner.model.dto.CensorImageResponseDTO; import com.red.circle.external.inner.model.dto.CensorSuggestion; -import com.red.circle.mq.business.model.event.approval.CensorContent; -import com.red.circle.mq.business.model.event.approval.CensorProfileEvent; -import com.red.circle.mq.rocket.business.streams.CensorProfileSink; -import com.red.circle.other.domain.enums.PhotoAuditStatus; -import com.red.circle.other.domain.gateway.user.UserProfileGateway; -import com.red.circle.other.domain.model.user.UserProfile; -import com.red.circle.other.infra.convertor.user.UserProfileInfraConvertor; -import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; -import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; -import com.red.circle.other.infra.database.mongo.service.user.profile.UserRunProfileService; -import com.red.circle.other.infra.database.rds.entity.approval.ApprovalUserViolationHistory; -import com.red.circle.other.infra.database.rds.entity.user.user.BaseInfo; -import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserSettingDataService; -import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserViolationHistoryService; -import com.red.circle.other.infra.database.rds.service.user.user.BaseInfoService; -import com.red.circle.other.inner.enums.config.EnumConfigKey; -import com.red.circle.tool.core.collection.CollectionUtils; -import com.red.circle.tool.core.date.TimestampUtils; -import com.red.circle.tool.core.text.StringUtils; -import java.util.List; -import java.util.Objects; +import com.red.circle.mq.business.model.event.approval.CensorContent; +import com.red.circle.mq.business.model.event.approval.CensorProfileEvent; +import com.red.circle.mq.rocket.business.streams.CensorProfileSink; +import com.red.circle.other.app.common.room.DynamicCommon; +import com.red.circle.other.domain.enums.PhotoAuditStatus; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.convertor.user.UserProfileInfraConvertor; +import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; +import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; +import com.red.circle.other.infra.database.mongo.service.user.profile.UserRunProfileService; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalUserViolationHistory; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.user.user.BaseInfo; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserSettingDataService; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserViolationHistoryService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.user.user.BaseInfoService; +import com.red.circle.other.inner.enums.config.EnumConfigKey; +import com.red.circle.other.inner.enums.other.PhotoCensorStatusEnum; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.text.StringUtils; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -48,12 +54,14 @@ import lombok.extern.slf4j.Slf4j; public class CensorProfileListener implements MessageListener { private final String tag = "资料安全鉴定"; - private final OssServiceClient ossServiceClient; + private final DynamicCommon dynamicCommon; + private final OssServiceClient ossServiceClient; private final CensorImageClient censorImageClient; private final UserProfileGateway userProfileGateway; private final MessageEventProcess messageEventProcess; private final OfficialNoticeClient officialNoticeClient; - private final EnumConfigCacheService enumConfigCacheService; + private final DynamicPictureService dynamicPictureService; + private final EnumConfigCacheService enumConfigCacheService; private final RoomProfileManagerService roomProfileManagerService; private final ApprovalUserSettingDataService approvalUserSettingDataService; private final ApprovalUserViolationHistoryService approvalUserViolationHistoryService; @@ -99,7 +107,12 @@ public class CensorProfileListener implements MessageListener { return; } - if (eventBody.checkBackgroundPhoto()) { + if (eventBody.checkDynamicContent()) { + dynamicImageCensor(eventBody); + return; + } + + if (eventBody.checkBackgroundPhoto()) { batchPhotoCensor(eventBody, DataApprovalTypeEnum.BACKGROUND_PHOTO); return; } @@ -109,7 +122,65 @@ public class CensorProfileListener implements MessageListener { } } - String ossFile = "https://dev.file.momooline.com/"; + private void dynamicImageCensor(CensorProfileEvent censorProfileEvent) { + + AtomicReference isViolation = new AtomicReference<>(Boolean.FALSE); + + List pictures = censorProfileEvent.getContents().stream() + .map(violationContent -> { + DynamicPicture picture = new DynamicPicture(); + picture.setId(violationContent.getId()); + picture.setDynamicId(censorProfileEvent.dynamicId()); + picture.setResourceUrl(violationContent.getContent()); + + try { + CensorImageResponseDTO response = censorImageClient.auditing( + violationContent.compression300Content()).getBody(); + + picture.setLabelNames(response.formatLabelString()); + if (response.checkBlock()) { + picture.setViolation(PhotoCensorStatusEnum.VIOLATION.name()); + isViolation.set(Boolean.TRUE); + } else if (response.checkPass()) { + picture.setViolation(PhotoCensorStatusEnum.NORMAL.name()); + } else { + picture.setViolation(PhotoCensorStatusEnum.SUSPECTED.name()); + } + return picture; + } catch (Exception ex) { + // 如果调用失败进入人工审核 + picture.setLabelNames("鉴定服务调用异常"); + picture.setViolation(PhotoCensorStatusEnum.SUSPECTED.name()); + return picture; + } + + + }).collect(Collectors.toList()); + + if (Boolean.TRUE.equals(isViolation.get())) { + + //删除动态与好友动态 +// dynamicCommon.systemDeleteDynamic(censorProfileEvent.dynamicId()); + + // 机器审核违规则删除这条动态全部图片 + for (DynamicPicture picture : pictures) { + if (PhotoCensorStatusEnum.VIOLATION.name().equals(picture.getViolation())) { + ossServiceClient.remove(picture.getResourceUrl()); + } + } + } + + if (CollectionUtils.isEmpty(pictures)) { + log.warn("审核结果 dynamicImageCensor 为空"); + return; + } + + //修改动态图片列表图片状态与机器打分 + dynamicPictureService.updateBatchById(pictures); + } + + + String ossFile = "https://dev.file.momooline.com/"; String ossAccess = "https://media.haiyihy.com/"; private void roomAvatarCensor(CensorProfileEvent param) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/RcDynamicListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/RcDynamicListener.java new file mode 100644 index 00000000..8f5504e3 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/RcDynamicListener.java @@ -0,0 +1,87 @@ +package com.red.circle.other.app.listener; + +import com.red.circle.common.business.core.enums.DynamicEventTypeEnum; +import com.red.circle.component.mq.MessageEventProcess; +import com.red.circle.component.mq.MessageEventProcessDescribe; +import com.red.circle.component.mq.config.RocketMqMessageListener; +import com.red.circle.component.mq.service.Action; +import com.red.circle.component.mq.service.ConsumerMessage; +import com.red.circle.component.mq.service.MessageListener; +import com.red.circle.mq.business.model.event.dynamic.DynamicEvent; +import com.red.circle.mq.rocket.business.streams.DynamicSink; +import com.red.circle.other.app.common.room.DynamicCommon; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 动态. + * + * @author pengshigang on 2022/4/13 + */ +@Slf4j +@RocketMqMessageListener(groupId = DynamicSink.INPUT, tag = DynamicSink.TAG) +@RequiredArgsConstructor +public class RcDynamicListener implements MessageListener { + + private final DynamicCommon dynamicCommon; + private final MessageEventProcess messageEventProcess; + private final DynamicContentService dynamicContentService; + + @Override + public Action consume(ConsumerMessage message) { + return messageEventProcess.consume( + MessageEventProcessDescribe.builder() + .logTag("语音房会话") + .consumeMsgTimeoutMinute(30) + .repeatConsumeMinute(10) + .repeatConsumeTag("Dynamic") + .checkConsumeTag(DynamicSink.TAG) + .message(message) + .build(), + DynamicEvent.class, + this::business); + } + + private void business(DynamicEvent dynamicEvent) { + + DynamicContent content = dynamicContentService.getById(dynamicEvent.getDynamicContentId()); + if (Objects.isNull(content)) { + return; + } + + // 创建动态时给好友时间轴添加动态 + if (DynamicEventTypeEnum.CREATE.eq(dynamicEvent.getType())) { + dynamicCommon.toFollowUserAddDynamic(dynamicEvent); + return; + } + + // 取消关注时,删除自己时间轴中对方的动态数据 + if (DynamicEventTypeEnum.UNFOLLOW.eq(dynamicEvent.getType())) { + dynamicCommon.unfollow(dynamicEvent.getUserId(), dynamicEvent.getFollowUserId()); + return; + } + + // 关注用户时,将对方时间轴中的动态数据存入自己列表 + if (DynamicEventTypeEnum.FOLLOW.eq(dynamicEvent.getType())) { + dynamicCommon.follow(dynamicEvent.getUserId(), dynamicEvent.getFollowUserId()); + return; + } + + // 删除自己动态内容 + if (DynamicEventTypeEnum.DELETE.eq(dynamicEvent.getType())) { + dynamicCommon.deleteOwnDynamic(dynamicEvent.getDynamicContentId()); + return; + } + + // 系统删除-违规 + if (DynamicEventTypeEnum.SYSTEM_DELETE.eq(dynamicEvent.getType())) { + dynamicCommon.systemDeleteDynamic(dynamicEvent.getDynamicContentId()); + } + + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java index a736bc78..580b2af8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/GiveGiftsListener.java @@ -519,10 +519,11 @@ public class GiveGiftsListener implements MessageListener { .id(IdWorkerUtils.getId()) .songId(event.getSongId()) .refunded(Boolean.FALSE) - .processed(Boolean.FALSE) - .trackId(event.getTrackId().toString()) - .originId(Objects.nonNull(event.getRoomId()) ? event.getRoomId().toString() : "OTHER") - .sysOrigin(event.getSysOrigin().name()) + .processed(Boolean.FALSE) + .trackId(event.getTrackId().toString()) + .originId(Objects.nonNull(event.getRoomId()) ? event.getRoomId().toString() : "OTHER") + .dynamicContentId(Objects.nonNull(event.getDynamicContentId()) ? event.getDynamicContentId().toString() : null) + .sysOrigin(event.getSysOrigin().name()) .requestPlatform(event.getRequestPlatform()) .userId(event.getSendUserId()) .anchor(anchorUserIds.contains(event.getSendUserId())) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java index 981076cf..13f224f0 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/gift/strategy/GiftCountStrategy.java @@ -1,17 +1,19 @@ package com.red.circle.other.app.listener.gift.strategy; -import com.alibaba.fastjson.JSON; -import com.google.common.collect.Lists; -import com.red.circle.common.business.core.enums.GameStateEnum; -import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; -import com.red.circle.component.redis.service.RedisService; -import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; -import com.red.circle.mq.business.model.event.gift.OfflineProcessGiftEvent; -import com.red.circle.mq.rocket.business.producer.TaskMqMessage; -import com.red.circle.mq.rocket.business.producer.UserMqMessageService; -import com.red.circle.other.app.common.game.GameIndoorTeamPkCommon; -import com.red.circle.other.app.common.gift.GameLuckyGiftCommon; -import com.red.circle.other.app.dto.clientobject.game.GameRoomPkUserCO; +import com.alibaba.fastjson.JSON; +import com.google.common.collect.Lists; +import com.red.circle.common.business.core.enums.GameStateEnum; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; +import com.red.circle.mq.business.model.event.gift.OfflineProcessGiftEvent; +import com.red.circle.mq.rocket.business.producer.TaskMqMessage; +import com.red.circle.mq.rocket.business.producer.UserMqMessageService; +import com.red.circle.other.app.common.game.GameIndoorTeamPkCommon; +import com.red.circle.other.app.common.gift.GameLuckyGiftCommon; +import com.red.circle.other.app.dto.clientobject.dynamic.MessageItemCO; +import com.red.circle.other.app.dto.clientobject.game.GameRoomPkUserCO; import com.red.circle.other.app.dto.cmd.SpinsTaskProgressUpdateCmd; import com.red.circle.other.app.dto.cmd.task.RoomDailyTaskProgressUpdateCmd; import com.red.circle.other.app.service.SpinsUserTaskProgressService; @@ -44,7 +46,9 @@ import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManager import com.red.circle.other.infra.database.mongo.service.sys.ActivityConfigService; import com.red.circle.other.infra.database.mongo.service.user.count.UserGuardCountService; import com.red.circle.other.infra.database.mongo.service.user.count.WeekFriendshipCardCountService; -import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkIntegralRecord; import com.red.circle.other.infra.database.rds.entity.game.GameRoomPkRecord; import com.red.circle.other.infra.database.rds.entity.live.RoomMember; import com.red.circle.other.infra.database.rds.entity.user.user.ConfessionChance; @@ -52,7 +56,10 @@ import com.red.circle.other.infra.database.rds.entity.user.user.CpBlessRecord; import com.red.circle.other.infra.database.rds.entity.user.user.CpRelationship; import com.red.circle.other.infra.database.rds.entity.user.user.CpValue; import com.red.circle.other.infra.database.rds.entity.user.user.FriendshipCard; -import com.red.circle.other.infra.database.rds.service.game.GameRoomPkIntegralRecordService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.game.GameRoomPkIntegralRecordService; import com.red.circle.other.infra.database.rds.service.game.GameRoomPkRecordService; import com.red.circle.other.infra.database.rds.service.live.RoomContributionBalanceService; import com.red.circle.other.infra.database.rds.service.live.RoomMemberService; @@ -134,7 +141,10 @@ public class GiftCountStrategy implements GiftStrategy { private final RoomDailyTaskProgressService roomDailyTaskProgressService; private final RedisService redisService; private final RedisTemplate redisTemplate; - private static final List inRegionCodes = List.of("IN", "PK", "BD"); + private final DynamicContentService dynamicContentService; + private final DynamicGiftService dynamicGiftService; + private final DynamicMessageService dynamicMessageService; + private static final List inRegionCodes = List.of("IN", "PK", "BD"); private final UserRegionCacheService userRegionCacheService; private final UserProfileGateway userProfileGateway; @@ -174,6 +184,9 @@ public class GiftCountStrategy implements GiftStrategy { } } + // 动态礼物处理 + processDynamicGift(runningWater); + boolean isHighPriceGift = checkHighPriceGift(runningWater); BigDecimal giftValueCount = BigDecimal.valueOf(getActualAmount(giftValue, giftValue.getGiftValue())); @@ -809,4 +822,71 @@ public class GiftCountStrategy implements GiftStrategy { } } -} + /** + * 处理动态礼物 + */ + private void processDynamicGift(GiftGiveRunningWater runningWater) { + try { + // 检查是否是动态礼物 + if (runningWater.getDynamicContentId() == null || !runningWater.getDynamicContentId().matches(RegexConstant.NUMBER)) { + return; + } + + // 验证动态是否存在 + DynamicContent dynamicContent = + dynamicContentService.getById(runningWater.getDynamicContentId()); + + if (dynamicContent == null || Boolean.TRUE.equals(dynamicContent.getDel())) { + log.warn("动态不存在或已删除, dynamicContentId={}", runningWater.getDynamicContentId()); + return; + } + + // 获取礼物信息 + GiftValue giftValue = runningWater.getGiftValue(); + + // 获取礼物URL + String giftUrl = null; + GiftConfigDTO cache = cacheGiftConfigManagerService.getById(runningWater.getGiftId()); + if (cache != null) { + giftUrl = cache.getGiftPhoto(); + } + + // 保存或更新动态礼物 + dynamicGiftService.save1( + Long.parseLong(runningWater.getDynamicContentId()), + runningWater.getGiftId(), + runningWater.getUserId(), + giftValue.getQuantity(), + giftUrl, + giftValue.getUnitPrice() + ); + + // 保存消息 + DynamicMessage message = new DynamicMessage(); + message.setContent(buildContent(giftUrl, giftValue.getQuantity())); + message.setDynamicContentId(Long.parseLong(runningWater.getDynamicContentId())); + message.setToUserId( dynamicContent.getCreateUser()); + message.setCreateUser(runningWater.getUserId()); + saveDynamicMessage(message, DynamicMessageEnum.DYNAMIC_GIFT); + + } catch (Exception e) { + log.error("处理动态礼物失败", e); + } + } + + private String buildContent(String giftUrl, Integer quantity) { + MessageItemCO messageItemCO = new MessageItemCO(); + messageItemCO.setGiftCount(quantity); + messageItemCO.setMessageContent(giftUrl); + return JSON.toJSONString(messageItemCO); + } + + private void saveDynamicMessage(DynamicMessage message, DynamicMessageEnum type) { + message.setId(IdWorkerUtils.getId()); + message.setType(type.name()); + message.setCreateTime(TimestampUtils.now()); + dynamicMessageService.save(message); + } + + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicContentStrategy.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicContentStrategy.java new file mode 100644 index 00000000..c7218208 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicContentStrategy.java @@ -0,0 +1,111 @@ +package com.red.circle.other.app.listener.strategy; + +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.external.inner.endpoint.message.NewsletterClient; +import com.red.circle.external.inner.model.cmd.message.NewsletterResultCmd; +import com.red.circle.external.inner.model.enums.message.NewsletterEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalContent; +import com.red.circle.mq.business.model.event.approval.ApprovalEvent; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态内容-审核 + * + * @author pengshigang on 2022/4/20 + */ +@Component("DYNAMIC_CONTENT_APPROVAL") +@RequiredArgsConstructor +public class ApprovalDynamicContentStrategy implements ApprovalStrategy { + + private final NewsletterClient newsletterClient; + private final DynamicPopularService dynamicPopularService; + private final DynamicMessageService dynamicMessageService; + private final DynamicContentService dynamicContentService; + + @Override + public void doOperation(ApprovalEvent param) { + if (!param.approvalNotPass()) { + return; + } + + if (CollectionUtils.isEmpty(param.getWaitApprovalUser())) { + return; + } + + List contents = dynamicContentService.listByIds(getDynamicIds(param)); + if (CollectionUtils.isEmpty(contents)) { + return; + } + + Map dynamicMap = getDynamicMap(contents); + if (CollectionUtils.isEmpty(dynamicMap)) { + return; + } + + //保存消息与记录 + process(param, dynamicMap); + + //发送消息标记 +// dynamicMessageService.mapByUserIdsByContentId(getUserIds(contents)) +// .forEach((key, list) -> newsletterClient +// .send(new NewsletterResultCmd() +// .setUserIds(List.of(key)) +// .setEvent(NewsletterEvent.DYNAMIC_MESSAGE_QUANTITY) +// .setData(list.size()) +// ) +// ); + + } + + private Map getDynamicMap(List contents) { + return contents.stream() + .collect(Collectors.toMap(DynamicContent::getId, v -> v)); + } + + private Set getDynamicIds(ApprovalEvent param) { + return param.getWaitApprovalUser().stream().map(ApprovalContent::getContentId) + .collect(Collectors.toSet()); + } + + private Set getUserIds(List contents) { + return contents.parallelStream().map(DynamicContent::getCreateUser) + .collect(Collectors.toSet()); + } + + private void process(ApprovalEvent param, + Map dynamicMap) { + + param.getWaitApprovalUser() + .forEach(approval -> { + + DynamicContent dynamicContent = dynamicMap.get(approval.getContentId()); + if (Objects.isNull(dynamicContent)) { + return; + } + + //删除动态 + dynamicContentService.deleteById(dynamicContent.getId()); + + dynamicPopularService.removeByDynamicId(dynamicContent.getId()); + + //保存数据 + dynamicMessageService.save(dynamicContent.getContent(), + dynamicContent.getId(), + dynamicContent.getCreateUser(), + DynamicMessageEnum.valueOf(approval.getTags())); + }); + + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicReportStrategy.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicReportStrategy.java new file mode 100644 index 00000000..9cb4cc86 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/listener/strategy/ApprovalDynamicReportStrategy.java @@ -0,0 +1,63 @@ +package com.red.circle.other.app.listener.strategy; + +import com.red.circle.external.inner.endpoint.message.NewsletterClient; +import com.red.circle.external.inner.model.cmd.message.NewsletterResultCmd; +import com.red.circle.external.inner.model.enums.message.NewsletterEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalContent; +import com.red.circle.mq.business.model.event.approval.ApprovalEvent; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalUserViolationHistoryService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 动态-举报 + * + * @author pengshigang on 2022/4/18 + */ +@Component("DYNAMIC_REPORT_APPROVAL") +@RequiredArgsConstructor +public class ApprovalDynamicReportStrategy implements ApprovalStrategy { + + private final NewsletterClient newsletterClient; + private final DynamicMessageService dynamicMessageService; + private final ApprovalUserViolationHistoryService approvalUserViolationHistoryService; + + @Override + public void doOperation(ApprovalEvent param) { + + if (Objects.isNull(param) || CollectionUtils.isEmpty(param.getWaitApprovalUser())) { + return; + } + ApprovalContent dto = param.getWaitApprovalUser().get(0); + if (Objects.isNull(dto)) { + return; + } + Set userIds = getUserIds(param); + + //保存数据 +// dynamicMessageService.saveBatch(dto.getContent(), dto.getContentId(), userIds, dto.getTags()); + + //发送消息标记 +// dynamicMessageService.mapByUserIdsByContentId(userIds) +// .forEach((key, list) -> newsletterClient +// .send(new NewsletterResultCmd() +// .setUserIds(List.of(key)) +// .setEvent(NewsletterEvent.DYNAMIC_MESSAGE_QUANTITY) +// .setData(list.size()) +// ) +// ); + + } + + private Set getUserIds(ApprovalEvent param) { + return param.getWaitApprovalUser().parallelStream().map(ApprovalContent::getUserId).collect( + Collectors.toSet()); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DynamicCommentHotScoreTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DynamicCommentHotScoreTask.java new file mode 100644 index 00000000..da0aa5e3 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/DynamicCommentHotScoreTask.java @@ -0,0 +1,254 @@ +package com.red.circle.other.app.scheduler; + +import com.red.circle.component.redis.annotation.TaskCacheLock; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.tool.core.collection.CollectionUtils; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * 评论热度分数更新定时任务(增量更新). + * 每10分钟执行一次,优先更新有变化的评论 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class DynamicCommentHotScoreTask { + + private static final String PENDING_SET_KEY = "comment:hot_score:pending"; + + private final RedisService redisService; + private final DynamicCommentService dynamicCommentService; + private final DynamicCacheService dynamicCacheService; + + /** + * 每10分钟执行一次 + */ + @Scheduled(cron = "0 */10 * * * ?") + @TaskCacheLock(key = "COMMENT_HOT_SCORE_UPDATE", expireSecond = 540) + public void updateHotScore() { + try { + log.info("评论热度分数更新任务 - 开始执行"); + long startTime = System.currentTimeMillis(); + + int incrementalUpdated = 0; + int fallbackUpdated = 0; + + // 1. 优先更新有变化的评论(增量更新) + Set pendingIds = getPendingCommentIds(); + if (CollectionUtils.isNotEmpty(pendingIds)) { + incrementalUpdated = updatePendingComments(pendingIds); + } + + // 2. 兜底更新最近24小时的评论(每小时整点执行) + int currentMinute = LocalDateTime.now().getMinute(); + if (currentMinute == 0) { + fallbackUpdated = updateRecentComments(pendingIds); + } + + long costTime = System.currentTimeMillis() - startTime; + if (fallbackUpdated > 0) { + log.info("评论热度分数更新任务 - 执行完成,增量更新{}条,兜底更新{}条,总计{}条,耗时{}ms", + incrementalUpdated, fallbackUpdated, incrementalUpdated + fallbackUpdated, costTime); + } else { + log.info("评论热度分数更新任务 - 执行完成,增量更新{}条,耗时{}ms", + incrementalUpdated, costTime); + } + + } catch (Exception e) { + log.error("评论热度分数更新任务 - 执行失败", e); + } + } + + /** + * 获取待更新的评论ID集合 + */ + private Set getPendingCommentIds() { + try { + Set pendingStrSet = redisService.setGet(PENDING_SET_KEY).stream().map(String::valueOf).collect(Collectors.toSet()); + if (CollectionUtils.isEmpty(pendingStrSet)) { + return new HashSet<>(); + } + + Set pendingIds = new HashSet<>(); + for (String idStr : pendingStrSet) { + try { + pendingIds.add(Long.parseLong(idStr)); + } catch (NumberFormatException e) { + log.warn("无效的评论ID: {}", idStr); + } + } + return pendingIds; + } catch (Exception e) { + log.error("获取待更新评论ID集合失败", e); + return new HashSet<>(); + } + } + + /** + * 更新待处理的评论 + */ + private int updatePendingComments(Set pendingIds) { + int updated = 0; + List successIds = new ArrayList<>(); + + for (Long commentId : pendingIds) { + try { + DynamicComment comment = dynamicCommentService.getById(commentId); + if (comment == null) { + // 评论已被删除,从待处理集合移除 + successIds.add(commentId.toString()); + continue; + } + + // 只更新根评论 + if (comment.getRootCommentId() == null) { + updateCommentHotScore(comment); + updated++; + } + + // 更新成功,从待处理集合移除 + successIds.add(commentId.toString()); + + } catch (Exception e) { + log.error("更新评论热度失败,commentId={}", commentId, e); + // 失败的不移除,下次继续尝试 + } + } + + // 批量移除已处理的ID + if (CollectionUtils.isNotEmpty(successIds)) { + try { + redisService.setRemove(PENDING_SET_KEY, successIds.toArray(new String[0])); + } catch (Exception e) { + log.error("移除已处理的评论ID失败", e); + } + } + + return updated; + } + + /** + * 兜底更新最近24小时的评论(应对时间衰减) + */ + private int updateRecentComments(Set excludeIds) { + int updated = 0; + + try { + long oneDayAgo = System.currentTimeMillis() - (24 * 60 * 60 * 1000L); + Long lastId = null; + boolean hasMore = true; + int batchSize = 500; + + while (hasMore && updated < 2000) { // 限制最多2000条,避免执行时间过长 + List comments = dynamicCommentService.query() + .isNull(DynamicComment::getRootCommentId) + .ge(DynamicComment::getCreateTime, new java.sql.Timestamp(oneDayAgo)) + .gt(lastId != null, DynamicComment::getId, lastId) + .orderByAsc(DynamicComment::getId) + .last(PageConstant.formatLimit(batchSize)) + .list(); + + if (CollectionUtils.isEmpty(comments)) { + hasMore = false; + break; + } + + for (DynamicComment comment : comments) { + // 跳过已经在增量更新中处理过的 + if (excludeIds != null && excludeIds.contains(comment.getId())) { + continue; + } + + updateCommentHotScore(comment); + updated++; + } + + lastId = comments.get(comments.size() - 1).getId(); + hasMore = comments.size() >= batchSize; + } + + } catch (Exception e) { + log.error("兜底更新最近评论失败", e); + } + + return updated; + } + + /** + * 更新单条根评论的热度分数 + */ + private void updateCommentHotScore(DynamicComment rootComment) { + try { + // 1. 获取根评论自身的点赞数 + Long rootLikeCount = Optional.ofNullable( + dynamicCacheService.getCommentLikeQuantity(rootComment.getDynamicContentId(), rootComment.getId()) + ).orElse(0L); + + // 2. 查询该根评论下的所有子评论 + List childComments = dynamicCommentService.query() + .eq(DynamicComment::getRootCommentId, rootComment.getId()) + .list(); + + // 3. 汇总所有子评论的点赞数 + long totalChildLikes = 0L; + if (CollectionUtils.isNotEmpty(childComments)) { + for (DynamicComment childComment : childComments) { + Long childLikeCount = Optional.ofNullable( + dynamicCacheService.getCommentLikeQuantity(childComment.getDynamicContentId(), childComment.getId()) + ).orElse(0L); + totalChildLikes += childLikeCount; + } + } + + // 4. 总点赞数 = 根评论点赞数 + 所有子评论点赞数 + long totalLikeCount = rootLikeCount + totalChildLikes; + + // 5. 计算热度分数 + double hotScore = calculateHotScore(rootComment, totalLikeCount); + + // 6. 更新到数据库 + dynamicCommentService.update() + .set(DynamicComment::getHotScore, hotScore) + .eq(DynamicComment::getId, rootComment.getId()) + .last(PageConstant.LIMIT_ONE) + .execute(); + + if (totalChildLikes > 0) { + log.debug("更新评论热度 - 根评论ID:{}, 根评论点赞:{}, 子评论点赞:{}, 总点赞:{}, 热度分数:{}", + rootComment.getId(), rootLikeCount, totalChildLikes, totalLikeCount, hotScore); + } + + } catch (Exception e) { + log.error("更新评论热度分数失败,rootCommentId={}", rootComment.getId(), e); + } + } + + /** + * 计算热度分数 + * 公式: 总点赞数 / (时间差小时数 + 2)^1.5 + */ + private double calculateHotScore(DynamicComment comment, Long totalLikeCount) { + long currentTime = System.currentTimeMillis(); + long ageMillis = currentTime - comment.getCreateTime().getTime(); + double ageHours = Math.max(ageMillis / (1000.0 * 60 * 60), 0.1); + + return totalLikeCount / Math.pow(ageHours + 2, 1.5); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/DynamicServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/DynamicServiceImpl.java new file mode 100644 index 00000000..6653bd6a --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/DynamicServiceImpl.java @@ -0,0 +1,237 @@ +package com.red.circle.other.app.service.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.command.dynamic.DynamicBlacklistAddCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicBlacklistDelCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicCheckSendPermissionCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicCommentCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicCommentLikeCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicLikeCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicMessageUpdateReadCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicReportCmdExe; +import com.red.circle.other.app.command.dynamic.DynamicTagCmdExe; +import com.red.circle.other.app.command.dynamic.add.DynamicContentAddCmdExe; +import com.red.circle.other.app.command.dynamic.delete.DynamicCommentDelCmdExe; +import com.red.circle.other.app.command.dynamic.delete.DynamicContentDelCmdExe; +import com.red.circle.other.app.command.dynamic.delete.DynamicMessageAllDelCmdExe; +import com.red.circle.other.app.command.dynamic.delete.DynamicMessageDelCmdExe; +import com.red.circle.other.app.command.dynamic.query.DynamicChildCommentQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicCommentQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicGiftQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicLikeQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicDetailsQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicFollowQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicLatestQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicListQryByTagExe; +import com.red.circle.other.app.command.dynamic.query.DynamicMessageQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicMyQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicPopularQryExe; +import com.red.circle.other.app.command.dynamic.query.DynamicTagQryExe; +import com.red.circle.other.app.dto.clientobject.dynamic.*; +import com.red.circle.other.app.dto.cmd.dynamic.*; + +import java.util.List; + +import com.red.circle.other.app.util.DistributedLockUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态 . + *

+ * + * @author pengshigang + * @since 2022-4-14 + */ +@Service +@RequiredArgsConstructor +public class DynamicServiceImpl implements DynamicService { + + private final DynamicTagCmdExe dynamicTagExe; + private final DynamicLikeCmdExe dynamicLikeExe; + private final DynamicMyQryExe dynamicMyQryExe; + private final DynamicTagQryExe dynamicTagQryExe; + private final DynamicCommentCmdExe dynamicCommentExe; + private final DynamicLatestQryExe dynamicLatestQryExe; + private final DynamicFollowQryExe dynamicFollowQryExe; + private final DynamicReportCmdExe dynamicReportCmdExe; + private final DynamicMessageQryExe dynamicMessageQryExe; + private final DynamicPopularQryExe dynamicPopularQryExe; + private final DynamicDetailsQryExe dynamicDetailsQryExe; + private final DynamicCommentQryExe dynamicCommentQryExe; + private final DynamicChildCommentQryExe dynamicChildCommentQryExe; + private final DynamicLikeQryExe dynamicLikeQryExe; + private final DynamicGiftQryExe dynamicGiftQryExe; + private final DynamicCommentDelCmdExe dynamicCommentDelExe; + private final DynamicCommentLikeCmdExe dynamicCommentLikeExe; + private final DynamicContentDelCmdExe dynamicContentDelExe; + private final DynamicListQryByTagExe dynamicListQryByTagExe; + private final DynamicMessageDelCmdExe dynamicMessageDelCmdExe; + private final DynamicContentAddCmdExe dynamicContentAddCmdExe; + private final DynamicMessageAllDelCmdExe dynamicMessageAllDelCmdExe; + private final DynamicMessageUpdateReadCmdExe dynamicMessageUpdateReadCmdExe; + private final DynamicCheckSendPermissionCmdExe dynamicCheckSendPermissionCmdExe; + private final DynamicBlacklistAddCmdExe dynamicBlacklistAddCmdExe; + private final DynamicBlacklistDelCmdExe dynamicBlacklistDelCmdExe; + private final DistributedLockUtil distributedLockUtil; + + private static final String LIKE_LOCK_PREFIX = "dynamic:like:lock"; + private static final String COMMENT_LIKE_LOCK_PREFIX = "dynamic:comment:like:lock"; + private static final String COMMENT_LOCK_PREFIX = "dynamic:comment:lock"; + private static final String CREATE_LOCK_PREFIX = "dynamic:create:lock"; + private static final String DELETE_LOCK_PREFIX = "dynamic:delete:lock"; + private static final String DELETE_COMMENT_LOCK_PREFIX = "dynamic:comment:delete:lock"; + private static final String REPORT_LOCK_PREFIX = "dynamic:report:lock"; + + @Override + public DynamicListCO createDynamic(DynamicContentAddCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(CREATE_LOCK_PREFIX, cmd.getReqUserId()); + return distributedLockUtil.executeWithLock(lockKey, () -> dynamicContentAddCmdExe.execute(cmd)); + } + + @Override + public void deleteDynamic(IdLongCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(DELETE_LOCK_PREFIX, cmd.getReqUserId(), cmd.getId()); + distributedLockUtil.executeWithLock(lockKey, () -> dynamicContentDelExe.execute(cmd)); + } + + @Override + public PageResult listDynamicComment(DynamicCommentLimitCmd cmd) { + return dynamicCommentQryExe.execute(cmd); + } + + @Override + public PageResult listDynamicChildComment(DynamicChildCommentLimitCmd cmd) { + return dynamicChildCommentQryExe.execute(cmd); + } + + @Override + public PageResult listDynamicLike(DynamicLikeLimitCmd cmd) { + return dynamicLikeQryExe.execute(cmd); + } + + @Override + public PageResult listDynamicGift(DynamicGiftLimitCmd cmd) { + return dynamicGiftQryExe.execute(cmd); + } + + @Override + public DynamicListCO getDynamicDetails(IdLongCmd cmd) { + return dynamicDetailsQryExe.execute(cmd); + } + + @Override + public PageResult listDynamicFollow(DynamicLimitCmd cmd) { + return dynamicFollowQryExe.execute(cmd); + } + + @Override + public PageResult listMyDynamic(DynamicMyLimitCmd cmd) { + return dynamicMyQryExe.execute(cmd); + } + + @Override + public PageResult listDynamicLatest(DynamicLimitCmd cmd) { + return dynamicLatestQryExe.execute(cmd); + } + + @Override + public List listDynamicPopular(DynamicLimitCmd cmd) { + return dynamicPopularQryExe.execute(cmd); + } + + @Override + public List listDynamicByTagId(DynamicByTagLimitCmd cmd) { + return dynamicListQryByTagExe.execute(cmd); + } + + @Override + public List listDynamicTag(AppExtCommand cmd) { + return dynamicTagQryExe.execute(cmd); + } + + @Override + public Long deleteComment(AppIdLongCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(DELETE_COMMENT_LOCK_PREFIX, cmd.getReqUserId(), cmd.getId()); + return distributedLockUtil.executeWithLock(lockKey, () -> dynamicCommentDelExe.execute(cmd)); + } + + @Override + public DynamicCommentListCO comment(DynamicCommentCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(COMMENT_LOCK_PREFIX, cmd.getReqUserId(), cmd.getId()); + return distributedLockUtil.executeWithLock(lockKey, () -> dynamicCommentExe.execute(cmd)); + } + + @Override + public Long likeComment(DynamicLikeCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(COMMENT_LIKE_LOCK_PREFIX, cmd.getReqUserId(), cmd.getCommentId()); + return distributedLockUtil.executeWithLock(lockKey, () -> dynamicCommentLikeExe.execute(cmd)); + } + + @Override + public Long likeDynamic(DynamicLikeCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(LIKE_LOCK_PREFIX, cmd.getReqUserId(), cmd.getDynamicId()); + return distributedLockUtil.executeWithLock(lockKey, () -> dynamicLikeExe.execute(cmd)); + } + + @Override + public PageResult listDynamicMessage(DynamicLimitCmd cmd) { + return dynamicMessageQryExe.execute(cmd); + } + + @Override + public void deleteMessageAll(AppExtCommand cmd) { + dynamicMessageAllDelCmdExe.execute(cmd); + } + + @Override + public void updateReadMessage(AppExtCommand cmd) { + dynamicMessageUpdateReadCmdExe.execute(cmd); + } + + @Override + public void deleteMessage(IdLongCmd cmd) { + dynamicMessageDelCmdExe.execute(cmd); + } + + @Override + public DynamicTagCO getDynamicTag(IdLongCmd cmd) { + return dynamicTagExe.execute(cmd); + } + + @Override + public void report(DynamicReportCmd cmd) { + String lockKey = DistributedLockUtil.buildLockKey(REPORT_LOCK_PREFIX, cmd.getReqUserId(), cmd.getDynamicContentId()); + distributedLockUtil.executeWithLock(lockKey, () -> dynamicReportCmdExe.execute(cmd)); + } + + @Override + public DynamicSendRestrictCO checkSendPermission(AppExtCommand cmd) { + return dynamicCheckSendPermissionCmdExe.execute(cmd); + } + + @Override + public Boolean checkSendPermission2(AppExtCommand cmd) { + return dynamicCheckSendPermissionCmdExe.execute2(cmd); + } + + @Override + public void addBlacklist(DynamicBlacklistAddCmd cmd) { + dynamicBlacklistAddCmdExe.execute(cmd); + } + + @Override + public void deleteBlacklist(DynamicBlacklistDelCmd cmd) { + dynamicBlacklistDelCmdExe.execute(cmd); + } + + @Override + public void addApprovalDynamic(DynamicContentAddCmd cmd) { + dynamicContentAddCmdExe.addApprovalDynamic(cmd); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpServiceImpl.java new file mode 100644 index 00000000..8eccf82b --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpServiceImpl.java @@ -0,0 +1,30 @@ +package com.red.circle.other.app.service.dynamic; + +import com.red.circle.other.app.command.dynamic.UserRelationThumbsUpCmdExe; +import com.red.circle.other.app.command.dynamic.query.UserRelationThumsUpQryExe; +import com.red.circle.other.app.dto.clientobject.dynamic.UserThumbsUpCO; +import com.red.circle.other.app.dto.cmd.dynamic.UserRelationThumbsUpCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * @author zongpubin on 2023/04/06 + */ +@Service +@RequiredArgsConstructor +public class UserRelationThumbsUpServiceImpl implements UserRelationThumbsUpService { + + private final UserRelationThumsUpQryExe userRelationThumsUpQryExe; + private final UserRelationThumbsUpCmdExe userRelationThumbsUpCmdExe; + + @Override + public Boolean thumbsUp(UserRelationThumbsUpCmd cmd) { + return userRelationThumbsUpCmdExe.execute(cmd); + } + + @Override + public UserThumbsUpCO thumbsUpInfo(UserRelationThumbsUpCmd cmd) { + return userRelationThumsUpQryExe.execute(cmd); + } + +} diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/approve/UserProfileApproveServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/approve/UserProfileApproveServiceImpl.java index bbfd043c..9952e7a7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/approve/UserProfileApproveServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/approve/UserProfileApproveServiceImpl.java @@ -3,11 +3,11 @@ package com.red.circle.other.app.service.user.approve; import com.red.circle.common.business.core.AppBusinessUtils; import com.red.circle.common.business.core.enums.ApprovalStatusEnum; import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; -import com.red.circle.common.business.core.enums.OpUserType; -import com.red.circle.component.mq.MessageEvent; -import com.red.circle.framework.core.asserts.ResponseAssert; -import com.red.circle.mq.business.model.event.approval.ApprovalContent; -import com.red.circle.mq.business.model.event.approval.ApprovalEvent; +import com.red.circle.common.business.core.enums.OpUserType; +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.mq.business.model.event.approval.ApprovalContentEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalDynamicEvent; import com.red.circle.mq.rocket.business.service.MessageSenderService; import com.red.circle.mq.rocket.business.streams.ConsoleApprovalSink; import com.red.circle.other.app.command.room.LiveVoicePublicRoomCreateCmdExe; @@ -134,16 +134,18 @@ public class UserProfileApproveServiceImpl implements UserProfileApproveService senderService.sendEventMessage(MessageEvent.builder() .consumeId(IdWorkerUtils.getIdStr()) .tag(ConsoleApprovalSink.TAG) - .body(new ApprovalEvent() - .setOpsUserId(cmd.getReqUserId()) - .setOpUserType(OpUserType.APP) - .setApprovalType(DataApprovalTypeEnum.valueOf(cmd.getApproveType())) - .setApprovalId(IdWorkerUtils.getId()) - .setApprovalStatus(ApprovalStatusEnum.getApprovalVal(cmd.getStatus())) - .setWaitApprovalUser(Collections.singletonList(new ApprovalContent() - .setContent(userProfileDTO.getUserAvatar()) - .setContentId(userProfileDTO.getId()) - .setUserId(userProfileDTO.getId()) + .body(new ApprovalDynamicEvent() + .setOpsUserId(cmd.getReqUserId()) + .setOpUserType(OpUserType.APP) + .setApprovalType(DataApprovalTypeEnum.valueOf(cmd.getApproveType())) + .setOriginType(Boolean.FALSE) + .setApprovalId(IdWorkerUtils.getId()) + .setApprovalUserId(cmd.getReqUserId()) + .setApprovalStatus(ApprovalStatusEnum.getApprovalVal(cmd.getStatus())) + .setWaitApprovalUser(Collections.singletonList(new ApprovalContentEvent() + .setContent(userProfileDTO.getUserAvatar()) + .setContentId(userProfileDTO.getId()) + .setUserId(userProfileDTO.getId()) .setTags("Pass,label=Normal,score=0")))).build()); } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicCommentListCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicCommentListCO.java new file mode 100644 index 00000000..47a3e36d --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicCommentListCO.java @@ -0,0 +1,108 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态评论列表. + *

+ * + * @author pengshigang + * @since 2022-4-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicCommentListCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 评论id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内动id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 用户头像. + */ + private String userAvatar; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 用户性别:0 女,1 男. + */ + private Integer userSex; + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 被评价用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long toUserId; + + /** + * 被评价用户昵称. + */ + private String toUserNickname; + + /** + * 文字内容. + */ + private String content; + + /** + * 点赞数量. + */ + private String likeStrQuantity; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 自己是否已点赞 + */ + private Boolean like; + + /** + * 根评论id + */ + private Long rootCommentId; + + + /** + * 回复评论ID + */ + private Long replyCommentId; + + /** + * 子评论数量(仅根评论有值) + */ + private Integer childCommentCount; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicGiftListCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicGiftListCO.java new file mode 100644 index 00000000..ba7b7579 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicGiftListCO.java @@ -0,0 +1,91 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import java.math.BigDecimal; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 动态礼物列表. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicGiftListCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 礼物记录id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 礼物ID. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long giftId; + + /** + * 礼物数量. + */ + private Integer giftQuantity; + + /** + * 礼物URL. + */ + private String giftUrl; + + /** + * 单个礼物价值. + */ + private BigDecimal giftUnitPrice; + + /** + * 用户头像. + */ + private String userAvatar; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 用户性别:0 女,1 男. + */ + private Integer userSex; + + /** + * 年龄. + */ + private Integer age; + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 更新时间. + */ + private Timestamp updateTime; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicLikeListCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicLikeListCO.java new file mode 100644 index 00000000..542b236b --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicLikeListCO.java @@ -0,0 +1,66 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 动态点赞列表. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicLikeListCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 点赞id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 用户头像. + */ + private String userAvatar; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 用户性别:0 女,1 男. + */ + private Integer userSex; + + private Integer age; + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 创建时间. + */ + private Timestamp createTime; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicListCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicListCO.java new file mode 100644 index 00000000..76b26aa3 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicListCO.java @@ -0,0 +1,118 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import java.sql.Timestamp; +import java.util.List; + +import com.red.circle.other.inner.model.dto.user.UserSimpleProfileDTO; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 最新动态列表. + *

+ * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicListCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 动态内容id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 用户头像. + */ + private String userAvatar; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 用户性别:0 女,1 男. + */ + private Integer userSex; + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 标签. + */ + private String tag; + + /** + * 标签ID. + */ + private Long tagId; + + /** + * 文字内容. + */ + private String content; + + /** + * 图片内容. + */ + private List pictures; + + /** + * 是否已关注(true 已关注). + */ + private Boolean subscription; + + /** + * 是否已点赞(true 已点赞). + */ + private Boolean like; + + /** + * 评论数量. + */ + private String commentStrQuantity; + + /** + * 点赞数量. + */ + private String likeStrQuantity; + + /** + * 礼物数量. + */ + private String giftStrQuantity; + + /** + * 创建时间. + */ + private Timestamp createTime; + + /** + * 房主资料信息(简化版). + */ + private UserSimpleProfileDTO userProfile; + + /** + * 是否为置顶动态(true:置顶, false:未置顶) + */ + private Boolean top; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicMessageListCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicMessageListCO.java new file mode 100644 index 00000000..06e639e9 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicMessageListCO.java @@ -0,0 +1,87 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-我的消息列表. + *

+ * + * @author pengshigang + * @since 2022-04-13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicMessageListCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 消息id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态内动id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + private Long rootCommentId; + + /** + * 消息类型. + */ + private String type; + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + private Integer age; + + private Integer userSex; + + /** + * 用户头像. + */ + private String userAvatar; + + /** + * 用户昵称. + */ + private String userNickname; + + /** + * 消息内容. + */ + private String messageContent; + + /** + * 礼物数量 + */ + private Integer giftCount; + + /** + * 动态内容. + */ + private String dynamicContent; + + /** + * 创建时间 + */ + private Timestamp createTime; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicPictureCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicPictureCO.java new file mode 100644 index 00000000..a9eba292 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicPictureCO.java @@ -0,0 +1,63 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicPictureCO extends ClientObject { + + /** + * 文件id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 动态id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 资源图片地址. + */ + private String resourceUrl; + + /** + * 缩略图-资源图片地址. + */ + private String miniResourceUrl; + + /** + * 图片宽. + */ + private Integer width; + + /** + * 图片高. + */ + private Integer height; + + /** + * 序号. + */ + private Integer sort; + + /** + * 违规状态. + */ + private String violation; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicSendRestrictCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicSendRestrictCO.java new file mode 100644 index 00000000..813ab4ab --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicSendRestrictCO.java @@ -0,0 +1,35 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-限制发送. + *

+ * + * @author pengshigang + * @since 2022-6-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicSendRestrictCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 发送需支付金额. + */ + private Long amount; + + /** + * 是否为超量发送用户(true是则需要支付金币, 反之正常发送). + */ + private Boolean overSend; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicTagCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicTagCO.java new file mode 100644 index 00000000..e28fe4e3 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/DynamicTagCO.java @@ -0,0 +1,48 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态标签列表. + *

+ * + * @author pengshigang + * @since 2022-4-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +public class DynamicTagCO extends ClientObject { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 标签. + */ + private String tag; + + /** + * 描述. + */ + private String desc; + + /** + * 背景图. + */ + private String imageUrl; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/MessageItemCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/MessageItemCO.java new file mode 100644 index 00000000..e46ebc62 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/MessageItemCO.java @@ -0,0 +1,18 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import lombok.Data; + +@Data +public class MessageItemCO { + + /** + * 消息内容. + */ + private String messageContent; + + /** + * 礼物数量 + */ + private Integer giftCount; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/UserThumbsUpCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/UserThumbsUpCO.java new file mode 100644 index 00000000..8fe5841e --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/dynamic/UserThumbsUpCO.java @@ -0,0 +1,31 @@ +package com.red.circle.other.app.dto.clientobject.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.dto.ClientObject; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 用户点赞信息 + * + * @auther zongpubin on 2023/4/6 16:24 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class UserThumbsUpCO extends ClientObject { + + /** + * 用户当前点赞数量. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long thumbsUps; + + /** + * true 已经点赞,false 未点赞 + */ + private Boolean like; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/friendcard/UserFriendCardCountMessageCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/friendcard/UserFriendCardCountMessageCO.java index c6671583..aa0103f8 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/friendcard/UserFriendCardCountMessageCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/friendcard/UserFriendCardCountMessageCO.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * 统计未同意友谊关系卡申请、好友申请. + * 统计未同意友谊关系卡申请、好友申请、我的消息列表. * * @author zongpubin * @since 2023-12-05 @@ -30,4 +30,9 @@ public class UserFriendCardCountMessageCO extends ClientObject { */ private Long userFriendApplyNum; -} + /** + * 我的消息列表数. + */ + private Long dynamicMessageNum; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistAddCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistAddCmd.java new file mode 100644 index 00000000..68ce4b78 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistAddCmd.java @@ -0,0 +1,26 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-添加黑名单. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicBlacklistAddCmd extends AppExtCommand { + + /** + * 用户ID. + * + * @eo.required + */ + @NotNull(message = "用户ID不能为空") + private Long userId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistDelCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistDelCmd.java new file mode 100644 index 00000000..9409bff9 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicBlacklistDelCmd.java @@ -0,0 +1,26 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-删除黑名单. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicBlacklistDelCmd extends AppExtCommand { + + /** + * 用户ID. + * + * @eo.required + */ + @NotNull(message = "用户ID不能为空") + private Long userId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicByTagLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicByTagLimitCmd.java new file mode 100644 index 00000000..e3937635 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicByTagLimitCmd.java @@ -0,0 +1,34 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 根据标签查询动态列表. + * + * @author pengshigang + * @since 2022-4-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicByTagLimitCmd extends AppExtCommand { + + /** + * 页码. + * + * @eo.required + */ + @NotNull + private Integer pageNumber; + + /** + * 标签id. + * + * @eo.required + */ + @NotNull + private Long tagId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicChildCommentLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicChildCommentLimitCmd.java new file mode 100644 index 00000000..80fcc232 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicChildCommentLimitCmd.java @@ -0,0 +1,35 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-子评论列表. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicChildCommentLimitCmd extends AppExtCommand { + + /** + * 页码. + * + * @eo.required + */ + @NotNull + private PageReq pageReq; + + /** + * 根评论id. + * + * @eo.required + */ + @NotNull + private Long rootCommentId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentCmd.java new file mode 100644 index 00000000..1635eb96 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentCmd.java @@ -0,0 +1,52 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-内容创建. + * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicCommentCmd extends AppExtCommand { + + /** + * 文字内容. + * + * @eo.required + */ + @NotBlank + @Size(min = 1, max = 255) + private String content; + + /** + * 动态ID. + * + * @eo.required + */ + @NotNull + private Long id; + + /** + * 被评论用户id,不传则为针对动态的评价. + */ + private Long toUserId; + + /** + * 评论ID + */ + private Long commentId; + + /** + * 根评论ID + */ + private Long rootCommentId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentLimitCmd.java new file mode 100644 index 00000000..6d1577ff --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicCommentLimitCmd.java @@ -0,0 +1,35 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-评论列表. + * + * @author pengshigang + * @since 2022-4-13 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicCommentLimitCmd extends AppExtCommand { + + /** + * 页码. + * + * @eo.required + */ + @NotNull + private PageReq pageReq; + + /** + * 动态内容id. + * + * @eo.required + */ + @NotNull + private Long dynamicId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicContentAddCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicContentAddCmd.java new file mode 100644 index 00000000..03bb63f9 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicContentAddCmd.java @@ -0,0 +1,38 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.other.app.dto.clientobject.dynamic.DynamicPictureCO; +import jakarta.validation.constraints.NotBlank; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-内容创建. + * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicContentAddCmd extends AppExtCommand { + + /** + * 图片集合. + */ + private List pictures; + + /** + * 文字内容. + * + * @eo.required + */ +// @NotBlank(message = "content required.") + private String content; + + /** + * 标签ID. + */ + private Long tagId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicGiftLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicGiftLimitCmd.java new file mode 100644 index 00000000..69f9a741 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicGiftLimitCmd.java @@ -0,0 +1,35 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-礼物列表. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicGiftLimitCmd extends AppExtCommand { + + /** + * 页码. + * + * @eo.required + */ + @NotNull + private PageReq pageReq; + + /** + * 动态内容id. + * + * @eo.required + */ + @NotNull + private Long dynamicId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeCmd.java new file mode 100644 index 00000000..fc2ed2b8 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeCmd.java @@ -0,0 +1,49 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-点赞. + * + * @author pengshigang + * @since 2022-4-14 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicLikeCmd extends AppExtCommand { + + /** + * 动态内容ID. + * + * @eo.required + */ + @NotNull + private Long dynamicId; + + /** + * 被点赞的评论ID. + */ + private Long commentId; + + /** + * 根评论ID + */ + private Long rootCommentId; + + /** + * 被点赞的评论用户ID. + */ + private Long toUserId; + + /** + * 点赞(true 点赞, false取消点赞). + * + * @eo.required + */ + @NotNull + private Boolean like; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeLimitCmd.java new file mode 100644 index 00000000..2ef3b117 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLikeLimitCmd.java @@ -0,0 +1,35 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-点赞列表. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicLikeLimitCmd extends AppExtCommand { + + /** + * 页码. + * + * @eo.required + */ + @NotNull + private PageReq pageReq; + + /** + * 动态内容id. + * + * @eo.required + */ + @NotNull + private Long dynamicId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLimitCmd.java new file mode 100644 index 00000000..dc492884 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicLimitCmd.java @@ -0,0 +1,28 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +/** + * 动态-内容分页. + * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicLimitCmd extends AppExtCommand { + + /** + * 分页参数. + */ + private PageReq pageReq; + + private List dynamicMessageEnums; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicMyLimitCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicMyLimitCmd.java new file mode 100644 index 00000000..9b1dedc1 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicMyLimitCmd.java @@ -0,0 +1,31 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.PageReq; +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.framework.core.dto.PageCommand; +import com.red.circle.framework.dto.PageQuery; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-内容分页. + * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicMyLimitCmd extends AppExtCommand { + + /** + * 用户id. + * + * @eo.required + */ + @NotNull + private Long userId; + + private PageReq pageReq; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicPageCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicPageCmd.java new file mode 100644 index 00000000..97dfa087 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicPageCmd.java @@ -0,0 +1,28 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.framework.core.dto.PageCommand; +import com.red.circle.framework.dto.PageQuery; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-内容分页. + * + * @author pengshigang + * @since 2022-4-11 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicPageCmd extends AppExtCommand { + + /** + * 用户id. + * + * @eo.required + */ + @NotNull + private Long userId; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicReportCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicReportCmd.java new file mode 100644 index 00000000..a4d76344 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/DynamicReportCmd.java @@ -0,0 +1,44 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 动态-举报. + * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DynamicReportCmd extends AppExtCommand { + + /** + * 文字描述. + */ + private String reportedContent; + + /** + * 动态内容ID. + * + * @eo.required + */ + @NotNull + private Long dynamicContentId; + + /** + * 类型: 0.非法信息 1.人生攻击 2.不适当的内容 3.发送垃圾邮件 4.诈骗 5.涉及色情. + * + * @eo.required + */ + @NotNull + private Integer reportType; + + /** + * 图片集合. + */ + private String imageUrls; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/UserRelationThumbsUpCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/UserRelationThumbsUpCmd.java new file mode 100644 index 00000000..b20bbc79 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/dynamic/UserRelationThumbsUpCmd.java @@ -0,0 +1,25 @@ +package com.red.circle.other.app.dto.cmd.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.red.circle.framework.core.dto.CommonCommand; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author zongpubin on 2023/04/06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class UserRelationThumbsUpCmd extends CommonCommand { + + /** + * 被点赞人id. + * + * @eo.required + */ + @JsonSerialize(using = ToStringSerializer.class) + @NotNull(message = "thumbsUpId required.") + private Long thumbsUpId; +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/gift/GiveAwayGiftBatchCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/gift/GiveAwayGiftBatchCmd.java index 9f2b16d9..c3e8ec0c 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/gift/GiveAwayGiftBatchCmd.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/gift/GiveAwayGiftBatchCmd.java @@ -59,8 +59,13 @@ public class GiveAwayGiftBatchCmd extends AppExtCommand { */ private Long roomId; - /** - * 已点歌曲唯一标识ID(不是歌曲配置id而是已点歌曲id). + /** + * 动态id. + */ + private Long dynamicContentId; + + /** + * 已点歌曲唯一标识ID(不是歌曲配置id而是已点歌曲id). */ private Long songId; diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/DynamicService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/DynamicService.java new file mode 100644 index 00000000..df8b75dc --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/DynamicService.java @@ -0,0 +1,166 @@ +package com.red.circle.other.app.service.dynamic; + + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import com.red.circle.common.business.dto.cmd.IdLongCmd; +import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.clientobject.dynamic.*; +import com.red.circle.other.app.dto.cmd.dynamic.*; + +import java.util.List; + +/** + *

+ * 动态 . + *

+ * + * @author pengshigang + * @since 2022-4-14 + */ +public interface DynamicService { + + /** + * 创建动态. + */ + DynamicListCO createDynamic(DynamicContentAddCmd cmd); + + + /** + * 删除动态. + */ + void deleteDynamic(IdLongCmd cmd); + + /** + * 动态评论列表. + */ + PageResult listDynamicComment(DynamicCommentLimitCmd cmd); + + /** + * 动态子评论列表. + */ + PageResult listDynamicChildComment(DynamicChildCommentLimitCmd cmd); + + /** + * 动态点赞列表. + */ + PageResult listDynamicLike(DynamicLikeLimitCmd cmd); + + /** + * 动态礼物列表. + */ + PageResult listDynamicGift(DynamicGiftLimitCmd cmd); + + /** + * 动态内容详情. + */ + DynamicListCO getDynamicDetails(IdLongCmd cmd); + + /** + * 动态关注列表. + */ + PageResult listDynamicFollow(DynamicLimitCmd cmd); + + /** + * 我的动态列表. + */ + PageResult listMyDynamic(DynamicMyLimitCmd cmd); + + /** + * 最新动态列表. + */ + PageResult listDynamicLatest(DynamicLimitCmd cmd); + + /** + * 热门动态列表. + */ + List listDynamicPopular(DynamicLimitCmd cmd); + + /** + * 根据标签id查询动态列表. + */ + List listDynamicByTagId(DynamicByTagLimitCmd cmd); + + /** + * 标签列表. + */ + List listDynamicTag(AppExtCommand cmd); + + /** + * 删除评论. + */ + Long deleteComment(AppIdLongCmd cmd); + + /** + * 评论动态或回复用户. + * + * @return 数量 + */ + DynamicCommentListCO comment(DynamicCommentCmd cmd); + + /** + * 点赞评论. + * + * @return 数量 + */ + Long likeComment(DynamicLikeCmd cmd); + + /** + * 点赞动态 + * + * @return 数量 + */ + Long likeDynamic(DynamicLikeCmd cmd); + + /** + * 我的消息列表. + */ + PageResult listDynamicMessage(DynamicLimitCmd cmd); + + /** + * 删除自己全部消息. + */ + void deleteMessageAll(AppExtCommand cmd); + + /** + * 将我的消息设置为已读. + */ + void updateReadMessage(AppExtCommand cmd); + + /** + * 删除消息. + */ + void deleteMessage(IdLongCmd cmd); + + /** + * 根据标签id获得标签. + */ + DynamicTagCO getDynamicTag(IdLongCmd cmd); + + /** + * 举报. + */ + void report(DynamicReportCmd cmd); + + /** + * 校验发送动态权限. + */ + DynamicSendRestrictCO checkSendPermission(AppExtCommand cmd); + + /** + * 校验发送动态权限. + */ + Boolean checkSendPermission2(AppExtCommand cmd); + + /** + * 添加黑名单. + */ + void addBlacklist(DynamicBlacklistAddCmd cmd); + + /** + * 删除黑名单. + */ + void deleteBlacklist(DynamicBlacklistDelCmd cmd); + + void addApprovalDynamic(DynamicContentAddCmd cmd); +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpService.java new file mode 100644 index 00000000..d3819043 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/dynamic/UserRelationThumbsUpService.java @@ -0,0 +1,15 @@ +package com.red.circle.other.app.service.dynamic; + + +import com.red.circle.other.app.dto.clientobject.dynamic.UserThumbsUpCO; +import com.red.circle.other.app.dto.cmd.dynamic.UserRelationThumbsUpCmd; + +/** + * @author zongpubin on 2023/04/06 + */ +public interface UserRelationThumbsUpService { + + Boolean thumbsUp(UserRelationThumbsUpCmd cmd); + + UserThumbsUpCO thumbsUpInfo(UserRelationThumbsUpCmd cmd); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/annotation/aspect/CreateAccountAspect.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/annotation/aspect/CreateAccountAspect.java index e51e1d6d..c06c080a 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/annotation/aspect/CreateAccountAspect.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/annotation/aspect/CreateAccountAspect.java @@ -15,7 +15,7 @@ import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.rds.entity.user.user.AuthType; import com.red.circle.other.infra.database.rds.service.user.device.ArchiveDeviceService; import com.red.circle.other.infra.database.rds.service.user.user.AuthTypeService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.model.cmd.user.UserProfileCmd; import com.red.circle.tool.core.phone.PhoneNumberUtils; import com.red.circle.tool.core.sequence.IdWorkerUtils; @@ -182,7 +182,7 @@ public class CreateAccountAspect { private void checkRegisterUserProfileNickName(CreateAccountCmd cmd) { if(ObjectUtil.isNotEmpty(cmd.getProfile())&&ObjectUtil.isNotEmpty(cmd.getProfile().getUserNickname())) { //敏感词 - ResponseAssert.isFalse(OtherErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getProfile().getUserNickname())); + ResponseAssert.isFalse(DynamicErrorCode.SENSITIVE_WORD_ERROR, SensitiveWordFilter.checkSensitiveWord(cmd.getProfile().getUserNickname())); } } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/DynamicTagConfigCache.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/DynamicTagConfigCache.java new file mode 100644 index 00000000..bd49866c --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/DynamicTagConfigCache.java @@ -0,0 +1,46 @@ +package com.red.circle.other.infra.database.cache.entity.dynamic; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.io.Serial; +import java.io.Serializable; +import lombok.Data; + +/** + *

+ * 动态-标签信息. + *

+ * + * @author pengshigang + * @since 2022-4-14 + */ +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class DynamicTagConfigCache implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 标签. + */ + private String tag; + + /** + * 描述. + */ + private String description; + + /** + * 背景图. + */ + private String imageUrl; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/TopDynamicCache.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/TopDynamicCache.java new file mode 100644 index 00000000..4cc7d68f --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/entity/dynamic/TopDynamicCache.java @@ -0,0 +1,56 @@ +package com.red.circle.other.infra.database.cache.entity.dynamic; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.io.Serial; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 系统置顶动态. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@JsonIgnoreProperties(ignoreUnknown = true) +public class TopDynamicCache implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 动态id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 归属系统. + */ + private String sysOrigin; + + /** + * 权重. + */ + private Integer weights; + + /** + * 开始时间. + */ + private Timestamp startTime; + + /** + * 过期时间. + */ + private Timestamp expiredTime; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/key/DynamicKeys.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/key/DynamicKeys.java new file mode 100644 index 00000000..f16c5f96 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/key/DynamicKeys.java @@ -0,0 +1,80 @@ +package com.red.circle.other.infra.database.cache.key; + +import com.red.circle.component.redis.RedisKeys; + +/** + * 动态相关key + * + * @author zongpubin on 2023/8/4 + */ +public enum DynamicKeys implements RedisKeys { + + /** + * 动态-标签. + */ + DYNAMIC_TAG, + + /** + * 用户当天发送动态数量达到限制,继续发送则每条动态支付多少金币? + */ + DYNAMIC_SEND_FEES, + + /** + * 动态-评论数量 + */ + DYNAMIC_COMMENT_QUANTITY, + + /** + * 热门动态权重-点赞计分. + */ + DYNAMIC_LIKE_WEIGHTS_SCORE, + + /** + * 热门动态权重-评论计分. + */ + DYNAMIC_COMMENT_WEIGHTS_SCORE, + + /** + * 财富、魅力等级多少级才能发布动态. + */ + DYNAMIC_SEND_LEVEL_LIMIT, + + /** + * 每个用户当天允许发送多少条动态. + */ + DYNAMIC_SEND_QUANTITY_LIMIT, + /** + * 动态-用户今日发送动态输. + */ + DYNAMIC_USER_SEND_COUNT, + + /** + * 动态-置顶. + */ + DYNAMIC_TOP, + + /** + * 动态-点赞数量 + */ + DYNAMIC_LIKE_QUANTITY, + + /** + * 动态-点赞评论数量 + */ + DYNAMIC_LIKE_COMMENT_QUANTITY, + + /** + * 动态-待审核ID列表 + */ + DYNAMIC_PENDING_IDS; + + @Override + public String businessPrefix() { + return ""; + } + + @Override + public String businessKey() { + return this.name(); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java new file mode 100644 index 00000000..63e732d0 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/DynamicCacheService.java @@ -0,0 +1,230 @@ +package com.red.circle.other.infra.database.cache.service.other; + +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.other.infra.database.cache.entity.dynamic.DynamicTagConfigCache; +import com.red.circle.other.infra.database.cache.entity.dynamic.TopDynamicCache; +import com.red.circle.tool.core.func.VoidCallable; +import java.util.List; + +/** + *

+ * 动态. + *

+ * + * @author pengshigang + * @since 2022-4-12 + */ +public interface DynamicCacheService { + + /** + * 获取标签缓存 + * + * @param sysOrigin 归属系统 + * @param language 语言 + * @param orElse 否者执行 + * @return cache + */ + List getCaches(SysOriginPlatformEnum sysOrigin, String language, + VoidCallable> orElse); + + void remove(); + + //////////////////////////// 评论 ///////////////////////////////////// + + /** + * 修改动态评论数量. + * + * @param dynamicContentId 动态内容ID + * @param quantity 数量(正数为加,负数为减) + * @return 剩余数量 + */ + Long updateCommentQuantity(Long dynamicContentId, Integer quantity); + + /** + * 初始化. + * + * @param dynamicContentId 动态内容ID + */ + Integer initCommentQuantity(Long dynamicContentId, Integer quantity); + + /** + * 获得评论总数量 + * + * @param dynamicContentId 动态内容ID + * @return 数量 + */ + Integer getCommentQuantity(Long dynamicContentId); + + //////////////////////////// 点赞动态数 ///////////////////////////////////// + + /** + * 累加动态点赞数量. + * + * @param dynamicContentId 动态内容ID + */ + Long incrLikeQuantity(Long dynamicContentId); + + /** + * 累减动态点赞数量. + * + * @param dynamicContentId 动态内容ID + */ + Long decrLikeQuantity(Long dynamicContentId); + + /** + * 初始化. + * + * @param dynamicContentId 动态内容ID + */ + void initLikeQuantity(Long dynamicContentId, Long quantity); + + /** + * 获得动态点赞数量. + * + * @param dynamicContentId 动态内容ID + * @return 数量 + */ + Long getLikeQuantity(Long dynamicContentId); + + //////////////////////////// 评论点赞数 ///////////////////////////////////// + + /** + * 累加评论点赞数量. + * + * @param dynamicContentId 动态内容ID + */ + Long incrCommentLikeQuantity(Long dynamicContentId, Long commentId); + + /** + * 累减评论点赞数量. + * + * @param dynamicContentId 动态内容ID + */ + Long decrCommentLikeQuantity(Long dynamicContentId, Long commentId); + + /** + * 初始化. + * + * @param dynamicContentId 动态内容ID + */ + void initCommentLikeQuantity(Long dynamicContentId, Long commentId, Long quantity); + + /** + * 获得评论点赞数量. + * + * @param dynamicContentId 动态内容ID + * @return 数量 + */ + Long getCommentLikeQuantity(Long dynamicContentId, Long commentId); + + ////////////////////////////// 热门动态权重计分 ////////////////////////////////////// + + /** + * 设置点赞热门动态权重分 + * + * @param score 计分 + */ + void pushLikeScore(Integer score); + + /** + * 获得点赞热门动态权重分 + */ + Integer getLikeScore(); + + /** + * 设置评论热门动态权重分 + * + * @param score 计分 + */ + void pushCommentScore(Integer score); + + /** + * 获得评论热门动态权重分 + */ + Integer getCommentScore(); + + /** + * 移除置顶动态 + */ + void removeTopDynamic(); + + /** + * 获得置顶动态缓存 + * + * @param sysOrigin 归属系统 + * @param orElse 否者执行 + * @return cache + */ + List getTopDynamicCache(SysOriginPlatformEnum sysOrigin, + VoidCallable> orElse); + + ///////////////////////////// 动态-发布限制 ////////////////////////////////////////////////////// + + /** + * 财富、魅力等级多少级才能发布动态. + */ + void pushSendLevelLimit(Long levelLimit); + + /** + * 财富、魅力等级多少级才能发布动态. + */ + Long getSendLevelLimit(); + + /** + * 每个用户当天允许发送多少条动态. + */ + void pushSendQuantityLimit(Long quantityLimit); + + /** + * 每个用户当天允许发送多少条动态. + */ + Long getSendQuantityLimit(); + + /** + * 用户当天发送动态数量达到限制,继续发送则每条动态支付多少金币?. + */ + void pushSendDynamicFees(Long dynamicFees); + + /** + * 用户当天发送动态数量达到限制,继续发送则每条动态支付多少金币?. + */ + Long getSendDynamicFees(); + + /** + * 今天用户发布的动态数量. + * + * @param userId 用户ID + * @return 今天用户发布的动态数量 + */ + Long getUserTodayDynamicCount(Long userId); + + /** + * 今天用户发布的动态数量. + * + * @param userId 用户ID + * @return 今天用户发布的动态数量 + */ + Long incrUserTodayDynamicCount(Long userId); + + ///////////////////////////// 动态-待审核 ////////////////////////////////////////////////////// + + /** + * 缓存待审核动态ID列表. + * + * @param dynamicIds 待审核动态ID列表 + */ + void cachePendingDynamicIds(List dynamicIds); + + /** + * 获取待审核动态ID列表. + * + * @return 待审核动态ID列表 + */ + List getPendingDynamicIds(); + + /** + * 清除待审核动态缓存. + */ + void clearPendingDynamicIds(); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java new file mode 100644 index 00000000..c360aa17 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/DynamicCacheServiceImpl.java @@ -0,0 +1,294 @@ +package com.red.circle.other.infra.database.cache.service.other.impl; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.component.redis.service.RedisService; +import com.red.circle.other.infra.database.cache.entity.dynamic.DynamicTagConfigCache; +import com.red.circle.other.infra.database.cache.entity.dynamic.TopDynamicCache; +import com.red.circle.other.infra.database.cache.key.DynamicKeys; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.DateFormatConstant; +import com.red.circle.tool.core.date.LocalDateTimeUtils; +import com.red.circle.tool.core.func.VoidCallable; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 动态 + * + * @author pengliang + * @since 2022/4/12 + */ +@Service +@RequiredArgsConstructor +public class DynamicCacheServiceImpl implements DynamicCacheService { + + private final RedisService redisService; + + @Override + public List getCaches(SysOriginPlatformEnum sysOrigin, String language, + VoidCallable> orElse) { + + List tagConfigCaches = redisService.hashGet( + DynamicKeys.DYNAMIC_TAG.name(), getDynamicTagKey(sysOrigin, language), + new TypeReference<>() { + }); + + if (CollectionUtils.isNotEmpty(tagConfigCaches)) { + return tagConfigCaches; + } + List newTagConfigCaches = orElse.apply(); + if (CollectionUtils.isNotEmpty(newTagConfigCaches)) { + redisService.hashPut(DynamicKeys.DYNAMIC_TAG.name(), + getDynamicTagKey(sysOrigin, language), newTagConfigCaches); + } + return newTagConfigCaches; + } + + private String getDynamicTagKey(SysOriginPlatformEnum sysOrigin, String language) { + return sysOrigin.concatUnderscoreJoin(DynamicKeys.DYNAMIC_TAG.name() + "_" + language); + } + + @Override + public void remove() { + redisService.delete(DynamicKeys.DYNAMIC_TAG.name()); + } + + /** + * 评论数量key + */ + private String getCommentQuantityKey(Long dynamicContentId) { + return DynamicKeys.DYNAMIC_COMMENT_QUANTITY.getKey(dynamicContentId); + } + + @Override + public Long updateCommentQuantity(Long dynamicContentId, Integer quantity) { + + return redisService.increment(getCommentQuantityKey(dynamicContentId), quantity, 30, + TimeUnit.DAYS); + + } + + @Override + public Integer initCommentQuantity(Long dynamicContentId, Integer quantity) { + redisService + .setString(getCommentQuantityKey(dynamicContentId), quantity, 30, TimeUnit.DAYS); + return quantity; + } + + @Override + public Integer getCommentQuantity(Long dynamicContentId) { + return redisService.getStringToInteger(getCommentQuantityKey(dynamicContentId)); + } + + /** + * 动态点赞数量key + */ + private String getLikeQuantityKey(Long dynamicContentId) { + return DynamicKeys.DYNAMIC_LIKE_QUANTITY.getKey(dynamicContentId); + } + + @Override + public Long incrLikeQuantity(Long dynamicContentId) { + return redisService + .increment(getLikeQuantityKey(dynamicContentId), 1, 30, TimeUnit.DAYS); + } + + @Override + public Long decrLikeQuantity(Long dynamicContentId) { + Long quantity = getLikeQuantity(dynamicContentId); + if (Objects.isNull(quantity) || quantity <= 0) { + redisService.delete(getLikeQuantityKey(dynamicContentId)); + return 0L; + } + return redisService.decrement(getLikeQuantityKey(dynamicContentId), 1); + } + + @Override + public void initLikeQuantity(Long dynamicContentId, Long quantity) { + redisService + .setString(getLikeQuantityKey(dynamicContentId), quantity, 30, TimeUnit.DAYS); + } + + @Override + public Long getLikeQuantity(Long dynamicContentId) { + return redisService.getStringToLong(getLikeQuantityKey(dynamicContentId)); + } + + /** + * 动态点赞数量key + */ + private String getCommentLikeQuantityKey(Long dynamicContentId, Long commentId) { + return DynamicKeys.DYNAMIC_LIKE_COMMENT_QUANTITY + .getKey(dynamicContentId + "_" + commentId); + } + + @Override + public Long incrCommentLikeQuantity(Long dynamicContentId, Long commentId) { + return redisService.increment(getCommentLikeQuantityKey(dynamicContentId, commentId), 1, 30, + TimeUnit.DAYS); + } + + @Override + public Long decrCommentLikeQuantity(Long dynamicContentId, Long commentId) { + + Long quantity = getCommentLikeQuantity(dynamicContentId, commentId); + if (Objects.isNull(quantity) || quantity <= 0) { + redisService.delete(getCommentLikeQuantityKey(dynamicContentId, commentId)); + return 0L; + } + + return redisService.decrement(getCommentLikeQuantityKey(dynamicContentId, commentId), 1); + } + + @Override + public void initCommentLikeQuantity(Long dynamicContentId, Long commentId, Long quantity) { + redisService + .setString(getCommentLikeQuantityKey(dynamicContentId, commentId), quantity, 30, + TimeUnit.DAYS); + } + + @Override + public Long getCommentLikeQuantity(Long dynamicContentId, Long commentId) { + return Optional.ofNullable(redisService + .getStringToLong(getCommentLikeQuantityKey(dynamicContentId, commentId))).orElse(0L); + } + + @Override + public void pushLikeScore(Integer score) { + if (Objects.isNull(score) || score <= 0) { + score = 0; + } + redisService.setString(DynamicKeys.DYNAMIC_LIKE_WEIGHTS_SCORE.name(), score); + } + + @Override + public Integer getLikeScore() { + return Optional.ofNullable( + redisService.getStringToInteger(DynamicKeys.DYNAMIC_LIKE_WEIGHTS_SCORE.name())) + .orElse(0); + } + + @Override + public void pushCommentScore(Integer score) { + if (Objects.isNull(score) || score <= 0) { + score = 0; + } + redisService.setString(DynamicKeys.DYNAMIC_COMMENT_WEIGHTS_SCORE.name(), score); + } + + @Override + public Integer getCommentScore() { + return Optional.ofNullable( + redisService.getStringToInteger(DynamicKeys.DYNAMIC_COMMENT_WEIGHTS_SCORE.name())) + .orElse(0); + } + + @Override + public void pushSendLevelLimit(Long levelLimit) { + redisService.setString(DynamicKeys.DYNAMIC_SEND_LEVEL_LIMIT.name(), levelLimit); + } + + @Override + public Long getSendLevelLimit() { + return Optional.ofNullable(redisService + .getStringToLong(DynamicKeys.DYNAMIC_SEND_LEVEL_LIMIT.name())).orElse(0L); + } + + @Override + public void pushSendQuantityLimit(Long quantityLimit) { + redisService + .setString(DynamicKeys.DYNAMIC_SEND_QUANTITY_LIMIT.name(), quantityLimit); + } + + @Override + public Long getSendQuantityLimit() { + return Optional.ofNullable(redisService + .getStringToLong(DynamicKeys.DYNAMIC_SEND_QUANTITY_LIMIT.name())).orElse(0L); + } + + @Override + public void pushSendDynamicFees(Long dynamicFees) { + redisService.setString(DynamicKeys.DYNAMIC_SEND_FEES.name(), dynamicFees); + } + + @Override + public Long getSendDynamicFees() { + return Optional.ofNullable(redisService + .getStringToLong(DynamicKeys.DYNAMIC_SEND_FEES.name())).orElse(0L); + } + + @Override + public Long getUserTodayDynamicCount(Long userId) { + return Optional + .ofNullable( + redisService.getStringToLong(getUserTodayDynamicCountAppendKey(userId))) + .orElse(0L); + } + + @Override + public Long incrUserTodayDynamicCount(Long userId) { + return redisService + .increment(getUserTodayDynamicCountAppendKey(userId), 1, TimeUnit.DAYS); + } + + private String getUserTodayDynamicCountAppendKey(Long userId) { + return DynamicKeys.DYNAMIC_USER_SEND_COUNT.getKey( + LocalDateTimeUtils.nowFormat(DateFormatConstant.yyyyMMdd) + "_" + userId); + } + + @Override + public void removeTopDynamic() { + redisService.delete(DynamicKeys.DYNAMIC_TOP.name()); + } + + @Override + public List getTopDynamicCache(SysOriginPlatformEnum sysOrigin, + VoidCallable> orElse) { + + List caches = redisService.hashGet(DynamicKeys.DYNAMIC_TOP.name(), + getTopDynamicKey(sysOrigin), new TypeReference<>() { + }); + + if (CollectionUtils.isNotEmpty(caches)) { + return caches; + } + List newCaches = orElse.apply(); + if (CollectionUtils.isNotEmpty(newCaches)) { + redisService.hashPut(DynamicKeys.DYNAMIC_TOP.name(), + getTopDynamicKey(sysOrigin), newCaches); + } + return newCaches; + } + + private String getTopDynamicKey(SysOriginPlatformEnum sysOrigin) { + return sysOrigin.concatUnderscoreJoin(DynamicKeys.DYNAMIC_TOP.name()); + } + + @Override + public void cachePendingDynamicIds(List dynamicIds) { + if (CollectionUtils.isEmpty(dynamicIds)) { + redisService.delete(DynamicKeys.DYNAMIC_PENDING_IDS.name()); + return; + } + redisService.setString(DynamicKeys.DYNAMIC_PENDING_IDS.name(), dynamicIds, 1, TimeUnit.HOURS); + } + + @Override + public List getPendingDynamicIds() { + return Optional.ofNullable( + redisService.getStringToObject(DynamicKeys.DYNAMIC_PENDING_IDS.name(), new TypeReference>() {}) + ).orElse(CollectionUtils.newArrayList()); + } + + @Override + public void clearPendingDynamicIds() { + redisService.delete(DynamicKeys.DYNAMIC_PENDING_IDS.name()); + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/dynamic/DynamicPopular.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/dynamic/DynamicPopular.java new file mode 100644 index 00000000..bd9c5019 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/dynamic/DynamicPopular.java @@ -0,0 +1,76 @@ +package com.red.circle.other.infra.database.mongo.entity.dynamic; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +/** + *

+ * 热门动态列表. + *

+ * + * @author pengshigang + * @since 2022-04-25 + */ +@Data +@Accessors(chain = true) +@Document("dynamic_popular") +public class DynamicPopular implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 创建时间. + */ + Timestamp createTime; + + /** + * 过期时间. + */ + Timestamp expiredTime; + + /** + * 主键标识. + */ + @Id + private String id; + + /** + * 来源系统. + */ + private String sysOrigin; + + /** + * 动态id. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long dynamicId; + + /** + * 年月日. + */ + private Integer dateNumber; + + /** + * 评分. + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long score; + + /** + * 是否在使用(true在) + */ + private Boolean use; + + /** + * 语言. + */ + private String region; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/gift/GiftGiveRunningWater.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/gift/GiftGiveRunningWater.java index 5137e40b..deca8308 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/gift/GiftGiveRunningWater.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/entity/gift/GiftGiveRunningWater.java @@ -47,8 +47,13 @@ public class GiftGiveRunningWater implements Serializable { */ private String originId; - /** - * 来源系统. + /** + * 动态id + */ + private String dynamicContentId; + + /** + * 来源系统. */ private String sysOrigin; diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/DynamicPopularService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/DynamicPopularService.java new file mode 100644 index 00000000..02e78d80 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/DynamicPopularService.java @@ -0,0 +1,37 @@ +package com.red.circle.other.infra.database.mongo.service.dynamic; + +import com.red.circle.other.infra.database.mongo.entity.dynamic.DynamicPopular; +import java.util.List; + +/** + *

+ * 热门权重分. + *

+ * + * @author pengshigang + * @since 2022-04-25 + */ +public interface DynamicPopularService { + + /** + * 分页热门动态记录. + * + * @param sysOrigin 系统 + * @param pageNumber 页码 + * @param pageSize 每页大小 + * @return ignore + */ + List pageDynamic(String sysOrigin, Integer pageNumber, Integer pageSize, + String region); + + /** + * 修改热门动态评分. + */ + void updateScore(Long dynamicId, Integer score, String sysOrigin, String region); + + /** + * 删除该热门动态记录. + */ + void removeByDynamicId(Long dynamicId); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/impl/DynamicPopularServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/impl/DynamicPopularServiceImpl.java new file mode 100644 index 00000000..04f347cc --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/dynamic/impl/DynamicPopularServiceImpl.java @@ -0,0 +1,155 @@ +package com.red.circle.other.infra.database.mongo.service.dynamic.impl; + +import com.red.circle.other.infra.database.mongo.entity.dynamic.DynamicPopular; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.tool.core.date.DateFormatConstant; +import com.red.circle.tool.core.date.LocalDateTimeUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import java.util.List; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Service; + +/** + *

+ * 热门权重分. + *

+ * + * @author pengshigang + * @since 2022-04-25 + */ +@Service +@RequiredArgsConstructor +public class DynamicPopularServiceImpl implements DynamicPopularService { + + private final MongoTemplate mongoTemplate; + + @Override + public List pageDynamic(String sysOrigin, Integer pageNumber, Integer pageSize, + String region) { + + Query query = new Query(); + Criteria criteria = Criteria.where("sysOrigin").is(sysOrigin); + criteria.and("score").gt(0); + criteria.and("use").is(Boolean.TRUE); + criteria.and("region").in(region, null); + query.addCriteria(criteria); + query.skip((long) (pageNumber - 1) * pageSize); + query.limit(pageSize); + query.with(Sort.by(Sort.Order.desc("dateNumber"), Sort.Order.desc("score"))); + return mongoTemplate.find(query, DynamicPopular.class); + } + + @Override + public void updateScore(Long dynamicId, Integer score, String sysOrigin, String region) { + + DynamicPopular popular = getOne(dynamicId); + + if (Objects.nonNull(popular)) { + + update(dynamicId, score, popular); + return; + } + + create(dynamicId, score, sysOrigin, region); + + } + + /** + * 修改数据 + */ + private void update(Long dynamicId, Integer score, DynamicPopular popular) { + + if (popular.getScore() + score <= 0) { + + removeById(popular.getId()); + useYesterdayData(dynamicId); + return; + } + + mongoTemplate.updateFirst(Query.query(getUniquenessCriteria(dynamicId)), + new Update().set("score", popular.getScore() + score), DynamicPopular.class); + } + + private DynamicPopular getOne(Long dynamicId) { + return mongoTemplate + .findOne(Query.query(getUniquenessCriteria(dynamicId)), DynamicPopular.class); + } + + /** + * 创建热度记录 + */ + private void create(Long dynamicId, Integer score, String sysOrigin, String region) { + + if (score <= 0) { + return; + } + + //现将以往数据修改成‘不再使用’,再创建今天的新数据 + mongoTemplate.updateFirst(Query.query(Criteria.where("dynamicId").is(dynamicId)), + new Update().set("use", Boolean.FALSE), DynamicPopular.class); + + mongoTemplate.save(new DynamicPopular() + .setId(getId(dynamicId)) + .setSysOrigin(sysOrigin) + .setDynamicId(dynamicId) + .setRegion(region) + .setUse(Boolean.TRUE) + .setDateNumber(Integer.parseInt(LocalDateTimeUtils.nowFormat("yyyyMMdd"))) + .setScore(score.longValue()) + .setCreateTime(TimestampUtils.now()) + .setExpiredTime(TimestampUtils.nowPlusDays(2)) + ); + } + + + /** + * 将昨天记录修改成‘使用中’ + */ + private void useYesterdayData(Long dynamicId) { + + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(getYesterdayId(dynamicId))), + new Update().set("use", Boolean.TRUE), DynamicPopular.class); + } + + @Override + public void removeByDynamicId(Long dynamicId) { + mongoTemplate + .remove(Query.query(Criteria.where("dynamicId").is(dynamicId)), DynamicPopular.class); + } + + /** + * 获得昨天id + * + * @param dynamicId 动态id + */ + private String getYesterdayId(Long dynamicId) { + + return LocalDateTimeUtils.format(TimestampUtils.nowMinusDays(1) + .toLocalDateTime(), DateFormatConstant.yyyyMMdd) + "_" + dynamicId; + } + + /** + * 移除今天的记录 + * + * @param id 完整id + */ + private void removeById(String id) { + mongoTemplate + .remove(Query.query(Criteria.where("id").is(id)), DynamicPopular.class); + } + + private Criteria getUniquenessCriteria(Long dynamicId) { + return Criteria.where("id").is(getId(dynamicId)); + } + + private String getId(Long dynamicId) { + return LocalDateTimeUtils.nowFormat("yyyyMMdd") + "_" + dynamicId; + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/gift/impl/GiftGiveRunningWaterServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/gift/impl/GiftGiveRunningWaterServiceImpl.java index 5b64e7dd..171abf1c 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/gift/impl/GiftGiveRunningWaterServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/gift/impl/GiftGiveRunningWaterServiceImpl.java @@ -89,7 +89,8 @@ public class GiftGiveRunningWaterServiceImpl implements GiftGiveRunningWaterServ .songId(document.getLong("songId")) .trackId(document.getString("trackId")) .originId(document.getString("originId")) - .sysOrigin(document.getString("sysOrigin")) + .dynamicContentId(document.getString("dynamicContentId")) + .sysOrigin(document.getString("sysOrigin")) .requestPlatform(document.getString("requestPlatform")) .userId(document.getLong("userId")) .anchor(document.getBoolean("anchor")) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/RoomProfileManagerServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/RoomProfileManagerServiceImpl.java index a131ad59..9fdde82d 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/RoomProfileManagerServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/mongo/service/live/impl/RoomProfileManagerServiceImpl.java @@ -13,7 +13,7 @@ import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager; import com.red.circle.other.infra.database.mongo.entity.live.RoomSetting; import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; -import com.red.circle.other.inner.asserts.OtherErrorCode; +import com.red.circle.other.inner.asserts.DynamicErrorCode; import com.red.circle.other.inner.enums.room.RoomEventEnum; import com.red.circle.other.inner.model.cmd.room.RoomProfileOpsQryCmd; import com.red.circle.other.inner.model.dto.material.UseBadgeDTO; @@ -562,7 +562,7 @@ public class RoomProfileManagerServiceImpl implements RoomProfileManagerService return; } if (SensitiveWordFilter.checkSensitiveWord(roomDesc)){ - ResponseAssert.isTrue(OtherErrorCode.SENSITIVE_WORD_ERROR, false); + ResponseAssert.isTrue(DynamicErrorCode.SENSITIVE_WORD_ERROR, false); } mongoTemplate.updateMulti(Query.query(Criteria.where("id").in(ids)), new Update().set("updateTime", TimestampUtils.now()) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/approval/ApprovalDynamicContentDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/approval/ApprovalDynamicContentDAO.java new file mode 100644 index 00000000..dd1529fa --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/approval/ApprovalDynamicContentDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.approval; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; + +/** + *

+ * 审核动态内容 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-24 + */ +public interface ApprovalDynamicContentDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicBlacklistDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicBlacklistDAO.java new file mode 100644 index 00000000..bf8089d8 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicBlacklistDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicBlacklist; + +/** + *

+ * 动态-黑名单 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicBlacklistDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentDAO.java new file mode 100644 index 00000000..9c9de894 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentDAO.java @@ -0,0 +1,26 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 动态-朋友圈评论 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicCommentDAO extends BaseDAO { + + /** + * 根据内容id获得评论数量 + * + * @param dynamicContentId 内容id + * @return 数量 + */ + Long getCommentQuantity(@Param("dynamicContentId") Long dynamicContentId); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentLikeDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentLikeDAO.java new file mode 100644 index 00000000..8f9c1520 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicCommentLikeDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike; + +/** + *

+ * 动态-朋友圈评论点赞 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicCommentLikeDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicContentDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicContentDAO.java new file mode 100644 index 00000000..fdff7dab --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicContentDAO.java @@ -0,0 +1,23 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 动态-朋友圈内容表 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicContentDAO extends BaseDAO { + + IPage pageDynamic(IPage pageQuery, + @Param("query") DynamicContentQryCmd query); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicGiftDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicGiftDAO.java new file mode 100644 index 00000000..5ef17384 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicGiftDAO.java @@ -0,0 +1,14 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicGift; + +/** + * 动态-礼物 DAO. + * + * @author pengshigang + * @since 2025-01-29 + */ +public interface DynamicGiftDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicLikeDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicLikeDAO.java new file mode 100644 index 00000000..b8b85b6d --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicLikeDAO.java @@ -0,0 +1,26 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike; +import org.apache.ibatis.annotations.Param; + +/** + *

+ * 动态-朋友圈点赞 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicLikeDAO extends BaseDAO { + + /** + * 根据内容id获得点赞数量 + * + * @param dynamicContentId 内容id + * @return 数量 + */ + Long getLikeQuantity(@Param("dynamicContentId") Long dynamicContentId); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicMessageDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicMessageDAO.java new file mode 100644 index 00000000..f4b0a8a4 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicMessageDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; + +/** + *

+ * 动态-我的消息 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicMessageDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicPictureDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicPictureDAO.java new file mode 100644 index 00000000..33a18c74 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicPictureDAO.java @@ -0,0 +1,24 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import java.util.List; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +public interface DynamicPictureDAO extends BaseDAO { + + /** + * 批量修改图片信息 + * + * @param pictures 图片信息 + */ + void updateApprovalBySelective(List pictures); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicReportDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicReportDAO.java new file mode 100644 index 00000000..b62dc81d --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicReportDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; + +/** + *

+ * 投诉动态 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +public interface DynamicReportDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTagDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTagDAO.java new file mode 100644 index 00000000..c65d3dea --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTagDAO.java @@ -0,0 +1,16 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; + +/** + *

+ * 动态-朋友圈标签 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicTagDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTimelineDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTimelineDAO.java new file mode 100644 index 00000000..5f1a2b61 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/DynamicTimelineDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; + +/** + *

+ * 动态-时间轴表 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicTimelineDAO extends BaseDAO { + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/TopDynamicDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/TopDynamicDAO.java new file mode 100644 index 00000000..2dc72132 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/TopDynamicDAO.java @@ -0,0 +1,17 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.TopDynamic; + +/** + *

+ * 系统置顶动态 Mapper 接口. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +public interface TopDynamicDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/UserThumbsUpDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/UserThumbsUpDAO.java new file mode 100644 index 00000000..aa1dfffa --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/dynamic/UserThumbsUpDAO.java @@ -0,0 +1,16 @@ +package com.red.circle.other.infra.database.rds.dao.dynamic; + + +import com.red.circle.framework.mybatis.dao.BaseDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.UserThumbsUp; + +/** + *

+ * 用户点赞列表 DAO 接口. + *

+ * + * @author zongpubin on 2023-04-06 11:41 + */ +public interface UserThumbsUpDAO extends BaseDAO { + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/approval/ApprovalDynamicContent.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/approval/ApprovalDynamicContent.java new file mode 100644 index 00000000..ac771c9e --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/approval/ApprovalDynamicContent.java @@ -0,0 +1,66 @@ +package com.red.circle.other.infra.database.rds.entity.approval; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 审核动态内容. + *

+ * + * @author pengshigang + * @since 2022-04-24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("approval_dynamic_content") +public class ApprovalDynamicContent extends TimestampBaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 来源系统. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 被审批用户id. + */ + @TableField("user_id") + private Long userId; + + /** + * 被审批动态id. + */ + @TableField("dynamic_id") + private Long dynamicId; + + /** + * 审核状态. + */ + @TableField("approve_status") + private String approveStatus; + + /** + * 审批来源:1.App 0.后台. + */ + @TableField("origin_type") + private Boolean originType; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicBlacklist.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicBlacklist.java new file mode 100644 index 00000000..6eede84f --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicBlacklist.java @@ -0,0 +1,72 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-黑名单. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_blacklist") +public class DynamicBlacklist implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 归属平台. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 用户ID. + */ + @TableField("user_id") + private Long userId; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicComment.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicComment.java new file mode 100644 index 00000000..7d3ce090 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicComment.java @@ -0,0 +1,69 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈评论. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_comment") +public class DynamicComment extends TimestampBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId("id") + private Long id; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 被回复用户ID(空则是针对帖子的评论). + */ + @TableField("to_user_id") + private Long toUserId; + + /** + * 内容 + */ + @TableField("content") + private String content; + + /** + * 根评论id + */ + @TableField("root_comment_id") + private Long rootCommentId; + + /** + * 回复评论ID + */ + @TableField("reply_comment_id") + private Long replyCommentId; + + /** + * 热度分数 + */ + @TableField("hot_score") + private Double hotScore; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicCommentLike.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicCommentLike.java new file mode 100644 index 00000000..4a5a3de1 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicCommentLike.java @@ -0,0 +1,78 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈评论点赞. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_comment_like") +public class DynamicCommentLike implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 被点赞评论ID. + */ + @TableField("dynamic_comment_id") + private Long dynamicCommentId; + + /** + * 根评论ID. + */ + @TableField("root_comment_id") + private Long rootCommentId; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicContent.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicContent.java new file mode 100644 index 00000000..889c47e6 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicContent.java @@ -0,0 +1,107 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈内容表. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_content") +public class DynamicContent implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 归属平台. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 内容. + */ + @TableField("content") + private String content; + + /** + * 动态区域 + */ + @TableField("region") + private String region; + + /** + * 类型 + */ + @TableField("type") + private Integer type; + + /** + * 位置. + */ + @TableField("location") + private String location; + + /** + * 标签ID. + */ + @TableField("tag_id") + private Long tagId; + + /** + * 是否已删除(0.否 1.是). + */ + @TableField("is_del") + private Boolean del; + + /** + * 语言类型 + */ + @TableField("language_type") + private String languageType; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间 + */ + @TableField(value = "update_time", update = "now()") + private Timestamp updateTime; + + /** + * 修改用户 + */ + @TableField("update_user") + private Long updateUser; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicGift.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicGift.java new file mode 100644 index 00000000..b5139cd4 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicGift.java @@ -0,0 +1,88 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 动态-礼物. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_gift") +public class DynamicGift implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 动态内容ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 礼物ID. + */ + @TableField("gift_id") + private Long giftId; + + /** + * 礼物数量. + */ + @TableField("gift_quantity") + private Integer giftQuantity; + + /** + * 礼物URL. + */ + @TableField("gift_url") + private String giftUrl; + + /** + * 单个礼物价值. + */ + @TableField("gift_unit_price") + private BigDecimal giftUnitPrice; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicLike.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicLike.java new file mode 100644 index 00000000..972439a4 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicLike.java @@ -0,0 +1,66 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈点赞. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_like") +public class DynamicLike implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicMessage.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicMessage.java new file mode 100644 index 00000000..17703cd8 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicMessage.java @@ -0,0 +1,78 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import java.io.Serial; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-我的消息. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_message") +public class DynamicMessage extends TimestampBaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 动态评论ID + */ + @TableField("dynamic_comment_id") + private Long dynamicCommentId; + + /** + * 内容. + */ + @TableField("content") + private String content; + + /** + * 类型 DynamicMessageEnum. + */ + @TableField("type") + private String type; + + /** + * 被评论或点赞的用户. + */ + @TableField("to_user_id") + private Long toUserId; + + /** + * 是否删除(1.已删除 0.否). + */ + @TableField("is_del") + private Boolean del; + + /** + * 是否已读(1.已读 0.未读). + */ + @TableField("is_reading") + private Boolean reading; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicPicture.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicPicture.java new file mode 100644 index 00000000..dc6cb4ce --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicPicture.java @@ -0,0 +1,81 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_picture") +public class DynamicPicture extends TimestampBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId("id") + private Long id; + + /** + * 动态ID + */ + @TableField("dynamic_id") + private Long dynamicId; + + /** + * 资源图片地址 + */ + @TableField("resource_url") + private String resourceUrl; + + /** + * 缩略图-资源图片地址 + */ + @TableField("mini_resource_url") + private String miniResourceUrl; + + /** + * 图片宽 + */ + @TableField("width") + private Integer width; + + /** + * 图片高 + */ + @TableField("height") + private Integer height; + + /** + * 序号 + */ + @TableField("sort") + private Integer sort; + + /** + * 违规状态 + */ + @TableField("violation") + private String violation; + + /** + * 机器审核标签 + */ + @TableField("label_names") + private String labelNames; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicReport.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicReport.java new file mode 100644 index 00000000..42f0c635 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicReport.java @@ -0,0 +1,108 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 投诉动态. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_report") +public class DynamicReport implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 归属平台. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 举报人用户ID. + */ + @TableField("report_user_id") + private Long reportUserId; + + /** + * 被举报人用户ID. + */ + @TableField("reported_user_id") + private Long reportedUserId; + + /** + * 举报类型. + */ + @TableField("report_type") + private Integer reportType; + + /** + * 举报内容 + */ + @TableField("reported_content") + private String reportedContent; + + /** + * 举报图片 + */ + @TableField("reported_urls") + private String reportedUrls; + + /** + * 状态(0.待处理 1.违规 2.未违规). + */ + @TableField("approval_status") + private Integer approvalStatus; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTag.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTag.java new file mode 100644 index 00000000..05107e9b --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTag.java @@ -0,0 +1,101 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-朋友圈标签. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_tag") +public class DynamicTag implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId("id") + private Long id; + + /** + * 归属平台. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 标签. + */ + @TableField("tag") + private String tag; + + /** + * 描述. + */ + @TableField("description") + private String description; + + /** + * 背景图. + */ + @TableField("image_url") + private String imageUrl; + + /** + * 0.上架 1.下架. + */ + @TableField("is_del") + private Boolean del; + + /** + * 排序. + */ + @TableField("sort") + private Integer sort; + + /** + * 语言类型 + */ + @TableField("language_type") + private String languageType; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间. + */ + @TableField("update_time") + private Timestamp updateTime; + + /** + * 修改用户. + */ + @TableField("update_user") + private Long updateUser; + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTimeline.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTimeline.java new file mode 100644 index 00000000..1e0801b1 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/DynamicTimeline.java @@ -0,0 +1,77 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 动态-时间轴表. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("dynamic_timeline") +public class DynamicTimeline implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID. + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 朋友圈信息ID. + */ + @TableField("dynamic_content_id") + private Long dynamicContentId; + + /** + * 是否为自己发的朋友圈(1.是 0.否). + */ + @TableField("is_own") + private Boolean own; + + /** + * 动态区域 + */ + @TableField("region") + private String region; + + /** + * 创建时间. + */ + @TableField("create_time") + private Timestamp createTime; + + /** + * 创建用户. + */ + @TableField("create_user") + private Long createUser; + + /** + * 修改时间 + */ + @TableField(value = "update_time", update = "now()") + private Timestamp updateTime; + + /** + * 修改用户 + */ + @TableField("update_user") + private Long updateUser; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/TopDynamic.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/TopDynamic.java new file mode 100644 index 00000000..f9d655ae --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/TopDynamic.java @@ -0,0 +1,58 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import java.sql.Timestamp; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 系统置顶动态. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("sys_top_dynamic") +public class TopDynamic extends TimestampBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 动态id. + */ + @TableId("dynamic_id") + private Long dynamicId; + + /** + * 归属系统. + */ + @TableField("sys_origin") + private String sysOrigin; + + /** + * 权重. + */ + @TableField("weights") + private Integer weights; + + /** + * 开始时间. + */ + @TableField("start_time") + private Timestamp startTime; + + /** + * 过期时间. + */ + @TableField("expired_time") + private Timestamp expiredTime; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/UserThumbsUp.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/UserThumbsUp.java new file mode 100644 index 00000000..6e3dd344 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/entity/dynamic/UserThumbsUp.java @@ -0,0 +1,46 @@ +package com.red.circle.other.infra.database.rds.entity.dynamic; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 用户点赞列表 + *

+ * + * @author zongpubin + * @since 2023-04-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("relation_user_thumbs_up") +public class UserThumbsUp extends TimestampBaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Long id; + + /** + * 用户id + */ + @TableField("user_id") + private Long userId; + + /** + * 被点赞用户id + */ + @TableField("thumbs_up_user_id") + private Long thumbsUpUserId; + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/enums/CacheKeysEnum.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/enums/CacheKeysEnum.java index 2555193c..10ea2424 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/enums/CacheKeysEnum.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/enums/CacheKeysEnum.java @@ -397,8 +397,23 @@ public enum CacheKeysEnum { */ SET_TOP_ROOM("SET_TOP_ROOM"), - /** - * 热门房间. + /** + * 动态-评论数量 + */ + DYNAMIC_COMMENT_QUANTITY("DYNAMIC_COMMENT_QUANTITY"), + + /** + * 动态-点赞数量 + */ + DYNAMIC_LIKE_QUANTITY("DYNAMIC_LIKE_QUANTITY"), + + /** + * 动态-点赞评论数量 + */ + DYNAMIC_LIKE_COMMENT_QUANTITY("DYNAMIC_LIKE_COMMENT_QUANTITY"), + + /** + * 热门房间. */ SET_HOT_ROOM("SET_HOT_ROOM"), @@ -411,9 +426,24 @@ public enum CacheKeysEnum { */ LOTTERY_NUMBERS("LOTTERY_NUMBERS"), - /** - * 生成到新运数字号码. - */ + /** + * 动态-标签. + */ + DYNAMIC_TAG("DYNAMIC_TAG"), + + /** + * 动态-置顶. + */ + DYNAMIC_TOP("DYNAMIC_TOP"), + + /** + * 动态-用户今日发送动态输. + */ + DYNAMIC_USER_SEND_COUNT("DYNAMIC_USER_SEND_COUNT"), + + /** + * 生成到新运数字号码. + */ LOTTERY_NUMBERS_GEN("LOTTERY_NUMBERS_GEN"), /** @@ -441,8 +471,33 @@ public enum CacheKeysEnum { */ LOTTERY_NUMBERS_BET_COUNT_DOWN("LOTTERY_NUMBERS_BET_COUNT_DOWN"), - /** - * LuckyBox 收入. + /** + * 热门动态权重-点赞计分. + */ + DYNAMIC_LIKE_WEIGHTS_SCORE("DYNAMIC_LIKE_WEIGHTS_SCORE"), + + /** + * 热门动态权重-评论计分. + */ + DYNAMIC_COMMENT_WEIGHTS_SCORE("DYNAMIC_COMMENT_WEIGHTS_SCORE"), + + /** + * 财富、魅力等级多少级才能发布动态. + */ + DYNAMIC_SEND_LEVEL_LIMIT("DYNAMIC_SEND_LEVEL_LIMIT"), + + /** + * 每个用户当天允许发送多少条动态. + */ + DYNAMIC_SEND_QUANTITY_LIMIT("DYNAMIC_SEND_QUANTITY_LIMIT"), + + /** + * 用户当天发送动态数量达到限制,继续发送则每条动态支付多少金币?. + */ + DYNAMIC_SEND_FEES("DYNAMIC_SEND_FEES"), + + /** + * LuckyBox 收入. */ @Deprecated LUCKY_BOX_INCOME("LUCKY_BOX_INCOME"), diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/ApprovalDynamicContentService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/ApprovalDynamicContentService.java new file mode 100644 index 00000000..d275e6a4 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/ApprovalDynamicContentService.java @@ -0,0 +1,40 @@ +package com.red.circle.other.infra.database.rds.service.approval; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import java.util.List; +import java.util.Set; + +/** + *

+ * 审核动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-24 + */ +public interface ApprovalDynamicContentService extends BaseService { + + PageResult pageApprovalDynamic(ApprovalDynamicQryCmd query); + + void approvalPass(Set ids); + + void approvalNotPass(Set ids); + + void deleteByDynamicId(Long dynamicId); + + /** + * 获取所有待审核的动态ID列表. + * + * @return 待审核动态ID列表 + */ + List listPendingDynamicIds(); + + /** + * 根据动态id获取审核数据 + */ + ApprovalDynamicContent getByDynamicId(Long dynamicId); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalDynamicContentServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalDynamicContentServiceImpl.java new file mode 100644 index 00000000..7ce94ca6 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalDynamicContentServiceImpl.java @@ -0,0 +1,107 @@ +package com.red.circle.other.infra.database.rds.service.approval.impl; + + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.approval.ApprovalDynamicContentDAO; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.tool.core.date.LocalDateTimeUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.text.StringUtils; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import org.springframework.stereotype.Service; + +/** + *

+ * 审核动态内容 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-24 + */ +@Service +public class ApprovalDynamicContentServiceImpl extends + BaseServiceImpl implements + ApprovalDynamicContentService { + + @Override + public PageResult pageApprovalDynamic(ApprovalDynamicQryCmd query) { + if (query.getStartTime() != null && query.getEndTime() != null){ + query.setStartCreateDate(LocalDateTimeUtils.convert(query.getStartTime())); + query.setEndCreateDate(LocalDateTimeUtils.convert(query.getEndTime())); + } + return query() + .eq(Objects.nonNull(query.getUserId()), ApprovalDynamicContent::getUserId, + query.getUserId()) + .eq(StringUtils.isNotBlank(query.getSysOrigin()), ApprovalDynamicContent::getSysOrigin, + query.getSysOrigin()) + .eq(StringUtils.isNotBlank(query.getApproveStatus()), + ApprovalDynamicContent::getApproveStatus, query.getApproveStatus()) + .gt(Objects.nonNull(query.getStartCreateDate()), ApprovalDynamicContent::getCreateTime, + query.getStartCreateDate()) + .lt(Objects.nonNull(query.getEndCreateDate()), ApprovalDynamicContent::getCreateTime, + query.getEndCreateDate()) + .orderByDesc(ApprovalDynamicContent::getCreateTime) + .page(query.getPageQuery()); + } + + @Override + public void approvalPass(Set ids) { + update() + .set(ApprovalDynamicContent::getApproveStatus, ApprovalStatusEnum.PASS.name()) + .set(ApprovalDynamicContent::getUpdateTime, TimestampUtils.now()) + .in(ApprovalDynamicContent::getDynamicId, ids) + .execute(); + } + + @Override + public void approvalNotPass(Set ids) { + update() + .set(ApprovalDynamicContent::getApproveStatus, ApprovalStatusEnum.NOT_PASS.name()) + .set(ApprovalDynamicContent::getUpdateTime, TimestampUtils.now()) + .in(ApprovalDynamicContent::getDynamicId, ids) + .execute(); + } + + @Override + public void deleteByDynamicId(Long dynamicId) { + if (Objects.isNull(dynamicId)) { + return; + } + update().set(ApprovalDynamicContent::getApproveStatus, ApprovalStatusEnum.NOT_PASS.name()) + .eq(ApprovalDynamicContent::getDynamicId, dynamicId) + .last(PageConstant.LIMIT_ONE).execute(); + } + + @Override + public List listPendingDynamicIds() { + return query() + .select(ApprovalDynamicContent::getDynamicId) + .eq(ApprovalDynamicContent::getApproveStatus, ApprovalStatusEnum.PENDING.name()) + .list() + .stream() + .map(ApprovalDynamicContent::getDynamicId) + .filter(Objects::nonNull) + .toList(); + } + + @Override + public ApprovalDynamicContent getByDynamicId(Long dynamicId) { + if (Objects.isNull(dynamicId)) { + return null; + } + return query() + .eq(ApprovalDynamicContent::getDynamicId, dynamicId) + .orderByDesc(ApprovalDynamicContent::getCreateTime) + .last(PageConstant.LIMIT_ONE) + .getOne(); + + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalUserSettingDataServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalUserSettingDataServiceImpl.java index ce80a4a0..fdbaf95d 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalUserSettingDataServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/approval/impl/ApprovalUserSettingDataServiceImpl.java @@ -196,7 +196,7 @@ public class ApprovalUserSettingDataServiceImpl extends return switch (approveType) { case NICKNAME, AVATAR, PHOTO_WALL, ROOM_NICKNAME, ROOM_AVATAR, ROOM_NOTICE, - PROFILE_DESC, FAMILY_AVATAR, FAMILY_NICKNAME, FAMILY_NOTICE, + PROFILE_DESC, FAMILY_AVATAR, FAMILY_NICKNAME, FAMILY_NOTICE, DYNAMIC_CONTENT, TEAM_AVATAR, TEAM_NICKNAME, BACKGROUND_PHOTO, PERSONAL_PHOTO -> ApprovalStatusEnum.PASS; default -> ApprovalStatusEnum.PENDING; diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicBlacklistService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicBlacklistService.java new file mode 100644 index 00000000..27909823 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicBlacklistService.java @@ -0,0 +1,33 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicBlacklist; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; + +/** + *

+ * 动态-黑名单 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicBlacklistService extends BaseService { + + /** + * 用户是否存在黑名单中 + * + * @param userId 用户 + * @return true存在 + */ + boolean exist(Long userId); + + void deleteByUserId(Long userId); + + void add(DynamicBlacklistCmd cmd); + + PageResult pageDynamicBlacklist(DynamicBlacklistQryCmd query); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentLikeService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentLikeService.java new file mode 100644 index 00000000..d005bb36 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentLikeService.java @@ -0,0 +1,64 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike; +import java.util.Collection; +import java.util.Map; + +/** + *

+ * 动态-朋友圈评论点赞 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicCommentLikeService extends BaseService { + + /** + * 根据评论ids与用户ID获得点赞信息 + * + * @param commentIds 评论id + * @param userId 用户id + * @return true 已点赞 + */ + Map mapByCommentIdsByUserId(Collection commentIds, Long userId); + + /** + * 是否存在数据 + * + * @param contentId 内容ID + * @param commentId 评论ID + * @param createUser 创建人 + * @return true存在 + */ + Boolean exist(Long contentId, Long commentId, Long createUser); + + /** + * 删除点赞记录 + * + * @param contentId 内容ID + * @param commentId 评论ID + * @param createUser 创建人 + */ + void delete(Long contentId, Long commentId, Long createUser); + + /** + * 根据根评论id删除评论 + * + * @param rootCommentId 根评论id + */ + void deleteByRootCommentId(Long rootCommentId); + + /** + * 根据根评论id查询子评论点赞数量 + * + * @param rootCommentId 根评论id + * @param notUserId 过滤该id + * @return 子评论点赞数量 + */ + Integer getNumberByRootCommentIdByNotUserId(Long rootCommentId, Long notUserId); + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentService.java new file mode 100644 index 00000000..5973d904 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicCommentService.java @@ -0,0 +1,132 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 动态-朋友圈评论 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicCommentService extends BaseService { + + + /** + * 获得分页数据 + * + * @param pageNumber 第几页 + * @param contentId 动态内容ID + */ + PageResult pageByTimeDesc(PageQuery pageQuery, Long contentId); + + /** + * 分页查询根评论(按时间倒序) + * + * @param pageQuery 分页参数 + * @param contentId 动态内容ID + */ + PageResult pageRootCommentsByTimeDesc(PageQuery pageQuery, Long contentId); + + /** + * 分页查询子评论(按时间倒序) + * + * @param pageQuery 分页参数 + * @param rootCommentId 根评论ID + */ + PageResult pageChildCommentsByTimeDesc(PageQuery pageQuery, Long rootCommentId); + + /** + * 获得子评论数 + * + * @param rootCommentId 根评论id + * @param notUserId 过滤该用户id + * @return 数量 + */ + Integer getNumberByRootIdByNotUserId(Long rootCommentId, Long notUserId); + + /** + * 获得子评论 + * + * @param rootCommentId 根评论id + * @param notUserId 过滤该用户id + * @return list + */ + List listNumberByRootIdByNotUserId(Long rootCommentId, Long notUserId); + + /** + * 获得子评论数 + * + * @param rootCommentId 根评论id + * @return 数量 + */ + Integer getNumberByRootId(Long rootCommentId); + + /** + * 动态评论数量 + * + * @param dynamicId 动态id + * @return 数量 + */ + Integer getNumberByDynamicId(Long dynamicId); + + /** + * 根据根评论id删除评论 + * + * @param rootCommentId 根评论id + */ + void deleteByRootCommentId(Long rootCommentId); + + /** + * 根据回复评论id删除 + * + */ + void deleteByReplyCommentId(Long rootCommentId); + + /** + * 根据评论id删除评论 + * + * @param id 评论id + */ + void deleteById(Long id); + + /** + * 分页查询根评论(按热度排序) + * + * @param pageQuery 分页参数 + * @param contentId 动态内容ID + */ + PageResult pageRootCommentsByHotScore(PageQuery pageQuery, Long contentId); + + /** + * 根据动态ID获得动态评论数量 + * + * @param contentIds 动态内容ID + */ + Map mapCommentQuantity(Collection contentIds); + + /** + * 批量获取根评论的子评论数量 + * + * @param rootCommentIds 根评论ID集合 + * @return Map<根评论ID, 子评论数量> + */ + Map mapChildCommentCount(Collection rootCommentIds); + + /** + * 根据评论ID集合批量查询评论 + * + * @param commentIds 评论ID集合 + * @return Map<评论ID, 评论对象> + */ + Map mapByIds(Collection commentIds); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicContentService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicContentService.java new file mode 100644 index 00000000..b7aae985 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicContentService.java @@ -0,0 +1,118 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + *

+ * 动态-朋友圈内容表 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicContentService extends BaseService { + + /** + * 根据id集合返回动态内容数据 + * + * @param ids id集合 + * @return 动态内容数据 + */ + Map mapByIds(Collection ids); + + /** + * 获得分页数据 + */ + PageResult pageByTimeDesc(PageQuery pageQuery, String region, String sysOrigin); + + /** + * 获得分页数据(排除黑名单用户和待审核动态) + * + * @param pageQuery 分页参数 + * @param region 地区 + * @param sysOrigin 系统来源 + * @param blackUserIds 黑名单用户ID列表 + * @param pendingDynamicIds 待审核动态ID列表 + */ + PageResult pageByTimeDesc(PageQuery pageQuery, String region, String sysOrigin, + List blackUserIds, List pendingDynamicIds); + + /** + * 获得分页数据 + * + * @param pageNumber 第几页 + * @param userId 创建人 + */ + PageResult pageByTimeDesc(Long userId, PageQuery pageQuery, List pendingDynamicIds); + + /** + * 获得分页数据 + * + * @param pageNumber 第几页 + */ + List pageByTimeDesc(Long tagId, Integer pageNumber); + + /** + * 动态内容 + * + * @param ids id集合 + */ + List listByIds(Set ids); + + /** + * 获取用户最新发布的一条动态id + * + * @param userId 用户id + * @return 动态ID + */ + Long getLatestIdByUserId(Long userId); + + /** + * 获取用户最新发布的一条动态 + * + * @param userId 用户id + * @return 动态ID + */ + DynamicContent getLatestByUserId(Long userId); + + DynamicContent getById(Long id); + + /** + * 删除 + */ + void deleteById(Long id); + + /** + * 批量删除 + */ + void deleteByIds(DelDynamicContentCmd cmd); + + /** + * 根据id获得创建人id + * + * @param id 动态id + * @return 创建人 + */ + Long getCreateUserById(Long id); + + /** + * 是否存在未被删除的动态 + * + * @param id 动态id + * @return true存在 + */ + Boolean isExist(Long id); + + PageResult page(DynamicContentQryCmd query); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicGiftService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicGiftService.java new file mode 100644 index 00000000..17f7e6b0 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicGiftService.java @@ -0,0 +1,60 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicGift; +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Map; + +/** + * 动态-礼物 服务类. + * + * @author pengshigang + * @since 2025-01-29 + */ +public interface DynamicGiftService extends BaseService { + + /** + * 保存或更新动态礼物(累加数量). + * + * @param dynamicContentId 动态内容ID + * @param giftId 礼物ID + * @param createUser 送礼用户 + * @param quantity 数量 + * @param giftUrl 礼物URL + * @param unitPrice 单价 + */ + void saveOrUpdate(Long dynamicContentId, Long giftId, Long createUser, + Integer quantity, String giftUrl, BigDecimal unitPrice); + + /** + * 保存动态礼物. + * @param dynamicContentId 动态内容ID + * @param giftId 礼物ID + * @param createUser 送礼用户 + * @param quantity 数量 + * @param giftUrl 礼物URL + * @param unitPrice 单价 + */ + void save1(Long dynamicContentId, Long giftId, Long createUser, + Integer quantity, String giftUrl, BigDecimal unitPrice); + + /** + * 分页查询动态礼物列表(按更新时间倒序). + * + * @param pageQuery 分页参数 + * @param contentId 动态内容ID + */ + PageResult pageByUpdateTimeDesc(PageQuery pageQuery, Long contentId); + + /** + * 统计动态礼物数量(所有用户送的总数). + * + * @param contentIds 动态内容ID集合 + * @return key: contentId, value: 礼物总数 + */ + Map mapGiftQuantity(Collection contentIds); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicLikeService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicLikeService.java new file mode 100644 index 00000000..7f8f8a42 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicLikeService.java @@ -0,0 +1,61 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike; +import java.util.Collection; +import java.util.Map; + +/** + *

+ * 动态-朋友圈点赞 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicLikeService extends BaseService { + + /** + * 根据动态ID与用户ID获得点赞情况 + * + * @param contentIds 动态内容ID + * @param userId 用户id + * @return true 已点赞 + */ + Map mapByContentIdsByUserId(Collection contentIds, Long userId); + + /** + * 是否存在数据 + * + * @param contentId 内容ID + * @param createUser 创建人 + * @return true存在 + */ + Boolean exist(Long contentId, Long createUser); + + + /** + * 删除点赞记录 + * + * @param contentId 内容ID + * @param createUser 创建人 + */ + void delete(Long contentId, Long createUser); + + /** + * 根据动态ID获得动态点赞数量 + * + * @param contentIds 动态内容ID + */ + Map mapLikeQuantity(Collection contentIds); + + /** + * 分页查询动态点赞列表(按时间倒序) + * + * @param pageQuery 分页参数 + * @param contentId 动态内容ID + */ + PageResult pageByTimeDesc(PageQuery pageQuery, Long contentId); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicMessageService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicMessageService.java new file mode 100644 index 00000000..5fdfeed7 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicMessageService.java @@ -0,0 +1,59 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + *

+ * 动态-我的消息 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicMessageService extends BaseService { + + void saveBatch(String content, Long contentId, Set toUserIds, String type); + + void save(String content, Long contentId, Long toUserId, DynamicMessageEnum type); + + /** + * 根据id集合返回 + * + * @return 消息数量 + */ + Map> mapByUserIdsByContentId(Collection toUserIds); + + /** + * 接收人消息数量 + * + * @param toUserId 接收人id + * @return 数量 + */ + Integer getCountByToUserId(Long toUserId); + + /** + * 获得分页数据 + * + * @param pageNumber 第几页 + * @param toUserId 被评价人或点赞ID + */ + PageResult pageByTimeDesc(PageQuery pageQuery, Long toUserId, List dynamicMessageEnums); + + /** + * 我的消息列表统计 + * + * @param toUserId 被评价人或点赞ID + * @return 数量 + */ + Long countDynamicMessage(Long toUserId); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicPictureService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicPictureService.java new file mode 100644 index 00000000..dca4e078 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicPictureService.java @@ -0,0 +1,129 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.common.business.enums.PhotoApprovalStatusEnum; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + *

+ * 动态图片 + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +public interface DynamicPictureService extends BaseService { + + /** + * 根据动态id 获取资源图片地址 + * + * @param dynamicId 动态id + * @return ignore + */ + String displayableFirstCover(Long dynamicId); + + /** + * 查询照片墙映射 + */ + Map> mapByDynamicIds(Set dynamicIds); + + /** + * 批量修改照片审核状态信息 + * + * @param dynamicPictures 照片墙信息 + */ + void updateApprovalBySelective(List dynamicPictures); + + /** + * 移除图片 + * + * @param dynamicId 动态id + */ + void deleteByUserId(Long dynamicId); + + /** + * 修改违规状态 + * + * @param ids 资源id集合 + * @param violationEnum 违规状态 + * @return 是否修改成功 + */ + boolean updateViolationStatus(List ids, PhotoApprovalStatusEnum violationEnum); + + /** + * 是否存在照片墙 + * + * @param dynamicId 动态id + * @return true 存在 false 不存在 + */ + boolean existsPicture(Long dynamicId); + + /** + * 获取违规图片 + * + * @param dynamicId 动态id + * @return ignore + */ + List listViolationPicture(Long dynamicId); + + /** + * 获取可预览图片 + * + * @param dynamicId 动态id + * @return ignore + */ + List listPreviewPicture(Long dynamicId); + + + /** + * 获取动态所有正在使用图片,走缓存 + * + * @param dynamicId 动态id + * @return ignore + */ + List listPicture(Long dynamicId); + + /** + * 获取照片墙疑似违规图片并且是今日上传的 + * + * @param dynamicId 动态 + * @return ignore + */ + List listNotPassAndGtToday(Long dynamicId); + + /** + * 获取一组指定图片,可预览的 + * + * @param dynamicIds 动态id + * @return list + */ + Map> mapPreviewGroup(Set dynamicIds); + + /** + * 是否存在可预览图片 + * + * @param dynamicId ignore + * @return ignore + */ + boolean existsPreview(Long dynamicId); + + /** + * 图片不存在或者存在违规 + * + * @param dynamicId 动态id + * @return ignore + */ + boolean existsEmptyOrViolation(Long dynamicId); + + /** + * 获取第一张正常图片URL(按sort从小到大,violation=NORMAL) + * + * @param dynamicId 动态id + * @return 图片URL,如果没有正常图片则返回null + */ + String getFirstNormalPic(Long dynamicId); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicReportService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicReportService.java new file mode 100644 index 00000000..65077703 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicReportService.java @@ -0,0 +1,28 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import java.util.List; + +/** + *

+ * 投诉动态 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +public interface DynamicReportService extends BaseService { + + Boolean exist(Long dynamicContentId, Long userId); + + PageResult pageData(ApprovalDynamicReportQryCmd query); + + List getByContentId(Long contentId); + + void updateDynamicReport(ApprovalDynamicReportCmd cmd, List complaints); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTagService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTagService.java new file mode 100644 index 00000000..f56fc874 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTagService.java @@ -0,0 +1,41 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + *

+ * 动态-朋友圈标签 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicTagService extends BaseService { + + /** + * 根据ids获得map集合 + * + * @param ids 主键id + */ + Map mapByIds(Collection ids); + + /** + * 获得标签列表 + * + * @param sysOrigin 系统 + * @param language 语言 + */ + List listTag(SysOriginPlatformEnum sysOrigin, String language); + + void addOrUpdate(DynamicTag dynamicTag); + + PageResult pageData(PageDynamicTagQryCmd query); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTimelineService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTimelineService.java new file mode 100644 index 00000000..3c5b4474 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/DynamicTimelineService.java @@ -0,0 +1,72 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import java.util.List; +import java.util.Set; + +/** + *

+ * 动态-时间轴表 服务类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +public interface DynamicTimelineService extends BaseService { + + /** + * 根据动态内容id删除时间轴数据 + */ + void deleteByDynamicContentId(Long dynamicContentId); + + /** + * 根据动态内容id集合删除时间轴数据 + */ + void deleteByDynamicContentIds(Set dynamicIds); + + /** + * 获得分页数据 + * + * @param pageNumber 第几页 + * @param createUser 用户id + * @param isOwn 是否为自己发布的动态 + */ + List pageByTimeDesc(String region, Integer pageNumber, Long createUser, + Boolean isOwn); + + /** + * 获得分页数据 (使用PageQuery) + * + * @param ids 用户id列表 + * @param region 地区 + * @param pageQuery 分页参数 + * @param isOwn 是否为自己发布的动态 + */ + PageResult pageByTimeDesc(List ids, String region, PageQuery pageQuery, + Boolean isOwn); + + /** + * 获得分页数据 (排除待审核动态) + * + * @param ids 用户id列表 + * @param region 地区 + * @param pageQuery 分页参数 + * @param isOwn 是否为自己发布的动态 + * @param pendingDynamicIds 待审核动态ID列表 + */ + PageResult pageByTimeDesc(List ids, String region, PageQuery pageQuery, + Boolean isOwn, List pendingDynamicIds); + + /** + * 获得自己发布过的动态 + * + * @param userId 用户id + * @return 动态时间轴 + */ + List ownListByUserId(Long userId); + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/TopDynamicService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/TopDynamicService.java new file mode 100644 index 00000000..adf5d778 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/TopDynamicService.java @@ -0,0 +1,27 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.TopDynamic; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import java.util.List; +import java.util.Set; + +/** + *

+ * 系统置顶动态 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +public interface TopDynamicService extends BaseService { + + List listBySysOrigin(SysOriginPlatformEnum sysOrigin); + + void setUpTop(TopDynamicCmd param); + + void closeTop(Long dynamicId); + + void deleteByDynamicIds(Set ids); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/UserThumbsUpService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/UserThumbsUpService.java new file mode 100644 index 00000000..6ae53ae1 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/UserThumbsUpService.java @@ -0,0 +1,21 @@ +package com.red.circle.other.infra.database.rds.service.dynamic; + + +import com.red.circle.framework.mybatis.service.BaseService; +import com.red.circle.other.infra.database.rds.entity.dynamic.UserThumbsUp; + +/** + *

+ * 用户点赞列表 服务类. + *

+ * + * @author zongpubin on 2023-04-06 11:41 + */ +public interface UserThumbsUpService extends BaseService { + + boolean checkExist(Long cmdOriginUserId, Long thumbsUpId); + + boolean notExistsAdd(Long cmdOriginUserId, Long thumbsUpId); + + long countThumbsUp(Long thumbsUpId); +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicBlacklistServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicBlacklistServiceImpl.java new file mode 100644 index 00000000..7fac71f5 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicBlacklistServiceImpl.java @@ -0,0 +1,75 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicBlacklistDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicBlacklist; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.text.StringUtils; +import com.red.circle.other.inner.asserts.user.UserErrorCode; +import java.util.Objects; +import java.util.Optional; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-黑名单 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +public class DynamicBlacklistServiceImpl extends + BaseServiceImpl implements DynamicBlacklistService { + + @Override + public boolean exist(Long userId) { + return Optional.ofNullable(query() + .eq(DynamicBlacklist::getUserId, userId) + .last(PageConstant.LIMIT_ONE) + .getOne()) + .map(blacklist -> Objects.nonNull(blacklist.getId())) + .orElse(Boolean.FALSE); + } + + @Override + public void deleteByUserId(Long userId) { + + delete().eq(DynamicBlacklist::getUserId, userId).last(PageConstant.LIMIT_ONE).execute(); + } + + @Override + public void add(DynamicBlacklistCmd cmd) { + + ResponseAssert.isFalse(UserErrorCode.USER_REGISTERED, exist(cmd.getUserId())); + + save(new DynamicBlacklist() + .setUserId(cmd.getUserId()) + .setSysOrigin(cmd.getSysOrigin()) + .setCreateUser(cmd.getReqUserId()) + .setCreateTime(TimestampUtils.now()) + .setUpdateTime(TimestampUtils.now()) + ); + } + + @Override + public PageResult pageDynamicBlacklist(DynamicBlacklistQryCmd query) { + + return query() + .eq(Objects.nonNull(query.getUserId()), DynamicBlacklist::getUserId, + query.getUserId()) + .eq(StringUtils.isNotBlank(query.getSysOrigin()), DynamicBlacklist::getSysOrigin, + query.getSysOrigin()) + .orderByDesc(DynamicBlacklist::getCreateTime) + .page(query.getPageQuery()); + } + +} + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentLikeServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentLikeServiceImpl.java new file mode 100644 index 00000000..7d8213e7 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentLikeServiceImpl.java @@ -0,0 +1,107 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicCommentLikeDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicCommentLike; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentLikeService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-朋友圈评论点赞 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +public class DynamicCommentLikeServiceImpl extends + BaseServiceImpl implements + DynamicCommentLikeService { + + @Override + public Map mapByCommentIdsByUserId(Collection commentIds, Long userId) { + + if (CollectionUtils.isEmpty(commentIds)) { + return CollectionUtils.newHashMap(); + } + + return Optional.ofNullable( + query() + .eq(DynamicCommentLike::getCreateUser, userId) + .in(DynamicCommentLike::getDynamicCommentId, commentIds) + .last(PageConstant.formatLimit(commentIds.size())) + .list() + ).map( + likes -> likes.stream() + .collect(Collectors + .toMap(DynamicCommentLike::getDynamicCommentId, + Function.identity(), + (v0, v1) -> v0)).values().stream() + .collect(Collectors.toMap(DynamicCommentLike::getDynamicCommentId, + v -> Objects.nonNull(v.getId()))) + ) + .orElse(CollectionUtils.newHashMap()); + } + + @Override + public Boolean exist(Long contentId, Long commentId, Long createUser) { + + return Optional.ofNullable( + query() + .eq(DynamicCommentLike::getDynamicContentId, contentId) + .eq(DynamicCommentLike::getCreateUser, createUser) + .eq(DynamicCommentLike::getDynamicCommentId, commentId) + .last(PageConstant.LIMIT_ONE) + .getOne() + ).map(obj -> Boolean.TRUE).orElse(Boolean.FALSE); + } + + @Override + public void delete(Long contentId, Long commentId, Long createUser) { + + delete() + .eq(DynamicCommentLike::getDynamicContentId, contentId) + .eq(DynamicCommentLike::getCreateUser, createUser) + .eq(DynamicCommentLike::getDynamicCommentId, commentId) + .last(PageConstant.LIMIT_ONE) + .execute(); + + } + + @Override + public void deleteByRootCommentId(Long rootCommentId) { + if (Objects.isNull(rootCommentId)) { + return; + } + + delete().in(DynamicCommentLike::getRootCommentId, rootCommentId).execute(); + + delete().eq(DynamicCommentLike::getDynamicCommentId, rootCommentId).last(PageConstant.LIMIT_ONE) + .execute(); + } + + @Override + public Integer getNumberByRootCommentIdByNotUserId(Long rootCommentId, Long notUserId) { + + if (Objects.isNull(rootCommentId)) { + return 0; + } + + return Optional.ofNullable(query() + .in(DynamicCommentLike::getRootCommentId, rootCommentId) + .ne(DynamicCommentLike::getCreateUser, notUserId) + .count()) + .map(Long::intValue) + .orElse(0); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentServiceImpl.java new file mode 100644 index 00000000..34a846e4 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicCommentServiceImpl.java @@ -0,0 +1,234 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.google.common.collect.Maps; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicCommentDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicComment; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicCommentService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-评论 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +@RequiredArgsConstructor +public class DynamicCommentServiceImpl extends + BaseServiceImpl implements DynamicCommentService { + + private final DynamicCommentDAO dynamicCommentDAO; + private final DynamicCacheService dynamicCacheService; + + + private Integer getCommentQuantity(Long contentId) { + return Optional.ofNullable(dynamicCommentDAO.getCommentQuantity(contentId)) + .map(Long::intValue) + .orElse(0); + } + + @Override + public PageResult pageByTimeDesc(PageQuery pageQuery, Long contentId) { + + return query() + .eq(DynamicComment::getDynamicContentId, contentId) + .orderByDesc(DynamicComment::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageRootCommentsByTimeDesc(PageQuery pageQuery, Long contentId) { + return query() + .eq(DynamicComment::getDynamicContentId, contentId) + .isNull(DynamicComment::getRootCommentId) + .orderByDesc(DynamicComment::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageChildCommentsByTimeDesc(PageQuery pageQuery, Long rootCommentId) { + return query() + .eq(DynamicComment::getRootCommentId, rootCommentId) + .orderByDesc(DynamicComment::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageRootCommentsByHotScore(PageQuery pageQuery, Long contentId) { + return query() + .eq(DynamicComment::getDynamicContentId, contentId) + .isNull(DynamicComment::getRootCommentId) + .orderByDesc(DynamicComment::getHotScore) + .orderByDesc(DynamicComment::getCreateTime) + .page(pageQuery); + } + + @Override + public Integer getNumberByRootIdByNotUserId(Long rootCommentId, Long notUserId) { + + if (Objects.isNull(rootCommentId) || Objects.isNull(notUserId)) { + return 0; + } + + return Optional.of(query() + .eq(DynamicComment::getRootCommentId, rootCommentId) + .ne(DynamicComment::getCreateUser, notUserId) + .count()) + .map(Long::intValue) + .orElse(0); + + } + + @Override + public List listNumberByRootIdByNotUserId(Long rootCommentId, Long notUserId) { + if (Objects.isNull(rootCommentId) || Objects.isNull(notUserId)) { + return null; + } + + return query() + .eq(DynamicComment::getRootCommentId, rootCommentId) + .ne(DynamicComment::getCreateUser, notUserId) + .list(); + } + + @Override + public Integer getNumberByRootId(Long rootCommentId) { + + if (Objects.isNull(rootCommentId)) { + return 0; + } + + return Optional.ofNullable(query() + .eq(DynamicComment::getRootCommentId, rootCommentId) + .count()) + .map(Long::intValue) + .orElse(0); + + } + + private String getPageSql(Integer pageNumber) { + + return String.format("LIMIT %s, %s", (pageNumber - 1) * PageConstant.DEFAULT_LIMIT_SIZE, + PageConstant.DEFAULT_LIMIT_SIZE); + } + + @Override + public Integer getNumberByDynamicId(Long dynamicId) { + if (Objects.isNull(dynamicId)) { + return 0; + } + + return Optional.ofNullable(query() + .eq(DynamicComment::getDynamicContentId, dynamicId) + .count()) + .map(Long::intValue) + .orElse(0); + } + + @Override + public void deleteByRootCommentId(Long rootCommentId) { + if (Objects.isNull(rootCommentId)) { + return; + } + delete().in(DynamicComment::getRootCommentId, rootCommentId).execute(); + delete().eq(DynamicComment::getId, rootCommentId).last(PageConstant.LIMIT_ONE).execute(); + } + + @Override + public void deleteByReplyCommentId(Long replyCommentId) { + if (Objects.isNull(replyCommentId)) { + return; + } + delete().eq(DynamicComment::getReplyCommentId, replyCommentId).execute(); + } + + @Override + public void deleteById(Long id) { + if (Objects.isNull(id)) { + return; + } + delete().eq(DynamicComment::getId, id).last(PageConstant.LIMIT_ONE).execute(); + } + + @Override + public Map mapCommentQuantity(Collection contentIds) { + + if (CollectionUtils.isEmpty(contentIds)) { + return Maps.newHashMap(); + } + + Map result = Maps.newHashMap(); + + for (Long contentId : contentIds) { + Integer quantity = dynamicCacheService.getCommentQuantity(contentId); + if (Objects.isNull(quantity)) { + quantity = getCommentQuantity(contentId); + dynamicCacheService.initCommentQuantity(contentId, quantity); + } + result.put(contentId, quantity); + } + + return result; + } + + @Override + public Map mapChildCommentCount(Collection rootCommentIds) { + if (CollectionUtils.isEmpty(rootCommentIds)) { + return Maps.newHashMap(); + } + + // 查询所有子评论 + List childComments = query() + .select(DynamicComment::getRootCommentId) + .in(DynamicComment::getRootCommentId, rootCommentIds) + .list(); + + Map result = Maps.newHashMap(); + + // 初始化所有根评论ID,默认0 + for (Long rootCommentId : rootCommentIds) { + result.put(rootCommentId, 0); + } + + // 统计每个根评论的子评论数量 + for (DynamicComment comment : childComments) { + Long rootCommentId = comment.getRootCommentId(); + result.put(rootCommentId, result.getOrDefault(rootCommentId, 0) + 1); + } + + return result; + } + + @Override + public Map mapByIds(Collection commentIds) { + if (CollectionUtils.isEmpty(commentIds)) { + return Maps.newHashMap(); + } + + List comments = query() + .in(DynamicComment::getId, commentIds) + .list(); + + Map result = Maps.newHashMap(); + for (DynamicComment comment : comments) { + result.put(comment.getId(), comment); + } + + return result; + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicContentServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicContentServiceImpl.java new file mode 100644 index 00000000..eb74c568 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicContentServiceImpl.java @@ -0,0 +1,214 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.convertor.MybatisConvertor; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicContentDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; + +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-朋友圈内容表 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +@RequiredArgsConstructor +public class DynamicContentServiceImpl extends + BaseServiceImpl implements DynamicContentService { + + private final DynamicContentDAO dynamicContentDAO; + + @Override + public Map mapByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Maps.newHashMap(); + } + return Optional.ofNullable( + query().in(DynamicContent::getId, ids) + .eq(DynamicContent::getDel, Boolean.FALSE) + .last(PageConstant.formatLimit(ids.size())) + .list() + ).map(contents -> contents.stream().collect(Collectors.toMap(DynamicContent::getId, v -> v))) + .orElse(Maps.newHashMap()); + } + + @Override + public PageResult pageByTimeDesc(PageQuery pageQuery, String region, String sysOrigin) { + + return query() + .eq(DynamicContent::getDel, Boolean.FALSE) + .eq(DynamicContent::getSysOrigin, sysOrigin) + .eq(region != null, DynamicContent::getRegion, region) + .orderByDesc(DynamicContent::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageByTimeDesc(PageQuery pageQuery, String region, String sysOrigin, + List blackUserIds, List pendingDynamicIds) { + + return query() + .eq(DynamicContent::getDel, Boolean.FALSE) + .eq(DynamicContent::getSysOrigin, sysOrigin) + .eq(region != null, DynamicContent::getRegion, region) + .notIn(CollectionUtils.isNotEmpty(blackUserIds), DynamicContent::getCreateUser, blackUserIds) + .notIn(CollectionUtils.isNotEmpty(pendingDynamicIds), DynamicContent::getId, pendingDynamicIds) + .orderByDesc(DynamicContent::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageByTimeDesc(Long userId, PageQuery pageQuery, List pendingDynamicIds) { + + return query() + .eq(DynamicContent::getDel, Boolean.FALSE) + .eq(DynamicContent::getCreateUser, userId) + .notIn(CollectionUtils.isNotEmpty(pendingDynamicIds), DynamicContent::getId, pendingDynamicIds) + .orderByDesc(DynamicContent::getCreateTime) + .page(pageQuery); + } + + @Override + public List pageByTimeDesc(Long tagId, Integer pageNumber) { + + if (Objects.isNull(pageNumber) || pageNumber < 1) { + pageNumber = 1; + } + + return query() + .eq(DynamicContent::getTagId, tagId) + .eq(DynamicContent::getDel, Boolean.FALSE) + .orderByDesc(DynamicContent::getCreateTime) + .last(getPageSql(pageNumber)) + .list(); + } + + private String getPageSql(Integer pageNumber) { + + return String.format("LIMIT %s, %s", (pageNumber - 1) * PageConstant.DEFAULT_LIMIT_SIZE, + PageConstant.DEFAULT_LIMIT_SIZE); + } + + @Override + public List listByIds(Set ids) { + + if (CollectionUtils.isEmpty(ids)) { + return Lists.newArrayList(); + } + + return Optional.ofNullable( + query() + .in(DynamicContent::getId, ids) + .eq(DynamicContent::getDel, Boolean.FALSE) + .last(PageConstant.formatLimit(ids.size())).list()) + .orElse(Lists.newArrayList()); + } + + @Override + public Long getLatestIdByUserId(Long userId) { + return Optional.ofNullable( + query().select(DynamicContent::getId) + .eq(DynamicContent::getCreateUser, userId) + .orderByDesc(DynamicContent::getCreateTime) + .last(PageConstant.LIMIT_ONE) + .getOne()) + .map(DynamicContent::getId) + .orElse(null); + } + + @Override + public DynamicContent getLatestByUserId(Long userId) { + return query() + .eq(DynamicContent::getCreateUser, userId) + .orderByDesc(DynamicContent::getCreateTime) + .getOne(); + } + + + @Override + public DynamicContent getById(Long id) { + + return query() + .eq(DynamicContent::getId, id) + .getOne(); + } + + @Override + public void deleteById(Long id) { + + update() + .set(DynamicContent::getDel, Boolean.TRUE) + .eq(DynamicContent::getId, id) + .last(PageConstant.LIMIT_ONE) + .execute(); + + } + + + @Override + public void deleteByIds(DelDynamicContentCmd cmd) { + + update() + .set(DynamicContent::getDel, Boolean.TRUE) + .set(DynamicContent::getUpdateUser, cmd.getReqUserId()) + .set(DynamicContent::getUpdateTime, TimestampUtils.now()) + .in(DynamicContent::getId, cmd.getIds()) + .last(PageConstant.formatLimit(cmd.getIds().size())) + .execute(); + + } + + @Override + public Long getCreateUserById(Long id) { + + return Optional.ofNullable(query().select(DynamicContent::getCreateUser) + .eq(DynamicContent::getId, id) + .last(PageConstant.LIMIT_ONE) + .getOne()) + .map(DynamicContent::getCreateUser) + .orElse(null); + } + + @Override + public Boolean isExist(Long id) { + + return Objects.nonNull(query() + .eq(DynamicContent::getId, id) + .eq(DynamicContent::getDel, Boolean.FALSE) + .last(PageConstant.LIMIT_ONE) + .getOne()); + } + + + @Override + public PageResult page(DynamicContentQryCmd query) { + + return MybatisConvertor.toPageResult( + dynamicContentDAO.pageDynamic(MybatisConvertor.toPage(query.getPageQuery()), query)); + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicGiftServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicGiftServiceImpl.java new file mode 100644 index 00000000..28bcd903 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicGiftServiceImpl.java @@ -0,0 +1,128 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicGiftDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicGift; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicGiftService; +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.List; +import java.util.Map; + +import com.red.circle.tool.core.date.TimestampUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +/** + * 动态-礼物 服务实现类. + * + * @author pengshigang + * @since 2025-01-29 + */ +@Service +@RequiredArgsConstructor +public class DynamicGiftServiceImpl extends BaseServiceImpl + implements DynamicGiftService { + + @Override + @Transactional(rollbackFor = Exception.class) + public void saveOrUpdate(Long dynamicContentId, Long giftId, Long createUser, + Integer quantity, String giftUrl, BigDecimal unitPrice) { + + // 查询是否已存在 + DynamicGift existing = query() + .eq(DynamicGift::getDynamicContentId, dynamicContentId) + .eq(DynamicGift::getGiftId, giftId) + .eq(DynamicGift::getCreateUser, createUser) + .getOne(); + + Timestamp now = new Timestamp(System.currentTimeMillis()); + + if (existing != null) { + // 累加数量 + existing.setGiftQuantity(existing.getGiftQuantity() + quantity); + existing.setGiftUrl(giftUrl); + existing.setUpdateTime(now); + existing.setUpdateUser(createUser); + updateSelectiveById(existing); + } else { + // 新增记录 + DynamicGift newGift = new DynamicGift(); + newGift.setDynamicContentId(dynamicContentId); + newGift.setGiftId(giftId); + newGift.setCreateUser(createUser); + newGift.setGiftQuantity(quantity); + newGift.setGiftUrl(giftUrl); + newGift.setGiftUnitPrice(unitPrice); + newGift.setCreateTime(now); + newGift.setUpdateTime(now); + save(newGift); + } + } + + @Override + public void save1(Long dynamicContentId, Long giftId, Long createUser, + Integer quantity, String giftUrl, BigDecimal unitPrice) { + + // 新增记录 + DynamicGift newGift = new DynamicGift(); + newGift.setDynamicContentId(dynamicContentId); + newGift.setGiftId(giftId); + newGift.setCreateUser(createUser); + newGift.setGiftQuantity(quantity); + newGift.setGiftUrl(giftUrl); + newGift.setGiftUnitPrice(unitPrice); + newGift.setCreateTime(TimestampUtils.now()); + newGift.setUpdateTime(TimestampUtils.now()); + save(newGift); + } + + @Override + public PageResult pageByUpdateTimeDesc(PageQuery pageQuery, Long contentId) { + return query() + .eq(DynamicGift::getDynamicContentId, contentId) + .orderByDesc(DynamicGift::getUpdateTime) + .page(pageQuery); + } + + @Override + public Map mapGiftQuantity(java.util.Collection contentIds) { + if (CollectionUtils.isEmpty(contentIds)) { + return java.util.Collections.emptyMap(); + } + + // 查询所有礼物记录 + List gifts = query() + .select(DynamicGift::getDynamicContentId, DynamicGift::getGiftQuantity) + .in(DynamicGift::getDynamicContentId, contentIds) + .list(); + + if (CollectionUtils.isEmpty(gifts)) { + return contentIds.stream() + .collect(java.util.stream.Collectors.toMap( + java.util.function.Function.identity(), + id -> 0L + )); + } + + // 按 contentId 分组统计总数 + Map result = new java.util.HashMap<>(); + for (DynamicGift gift : gifts) { + Long contentId = gift.getDynamicContentId(); + Long quantity = gift.getGiftQuantity().longValue(); + result.put(contentId, result.getOrDefault(contentId, 0L) + quantity); + } + + // 为所有 contentId 设置默认值 + for (Long contentId : contentIds) { + result.putIfAbsent(contentId, 0L); + } + + return result; + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicLikeServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicLikeServiceImpl.java new file mode 100644 index 00000000..36026e67 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicLikeServiceImpl.java @@ -0,0 +1,124 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.google.common.collect.Maps; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicLikeDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicLike; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicLikeService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-朋友圈点赞 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +@RequiredArgsConstructor +public class DynamicLikeServiceImpl extends BaseServiceImpl implements + DynamicLikeService { + + private final DynamicLikeDAO dynamicLikeDAO; + private final DynamicCacheService dynamicCacheService; + + @Override + public Map mapByContentIdsByUserId(Collection contentIds, Long userId) { + + if (CollectionUtils.isEmpty(contentIds)) { + return CollectionUtils.newHashMap(); + } + + List likes = query() + .eq(DynamicLike::getCreateUser, userId) + .in(DynamicLike::getDynamicContentId, contentIds) + .last(PageConstant.formatLimit(contentIds.size())) + .list(); + + if (CollectionUtils.isEmpty(likes)) { + return CollectionUtils.newHashMap(); + } + + return likes.stream() + .collect(Collectors.toMap( + DynamicLike::getDynamicContentId, + Function.identity(), + (v0, v1) -> v0 + ) + ).values().stream().collect(Collectors.toMap( + DynamicLike::getDynamicContentId, + v -> Objects.nonNull(v.getId()) + )); + } + + private Long getLikeQuantity(Long contentId) { + return Optional.ofNullable(dynamicLikeDAO.getLikeQuantity(contentId)) + .orElse(0L); + } + + @Override + public Boolean exist(Long contentId, Long createUser) { + + return Optional.ofNullable( + query() + .eq(DynamicLike::getDynamicContentId, contentId) + .eq(DynamicLike::getCreateUser, createUser) + .last(PageConstant.LIMIT_ONE) + .getOne() + ).map(obj -> Boolean.TRUE).orElse(Boolean.FALSE); + } + + @Override + public void delete(Long contentId, Long createUser) { + + delete() + .eq(DynamicLike::getDynamicContentId, contentId) + .eq(DynamicLike::getCreateUser, createUser) + .last(PageConstant.LIMIT_ONE) + .execute(); + + } + + @Override + public Map mapLikeQuantity(Collection contentIds) { + if (CollectionUtils.isEmpty(contentIds)) { + return Maps.newHashMap(); + } + + Map result = Maps.newHashMap(); + + for (Long contentId : contentIds) { + Long quantity = dynamicCacheService.getLikeQuantity(contentId); + if (Objects.isNull(quantity)) { + quantity = getLikeQuantity(contentId); + dynamicCacheService.initLikeQuantity(contentId, quantity); + } + result.put(contentId, quantity); + } + + return result; + } + + @Override + public PageResult pageByTimeDesc(PageQuery pageQuery, Long contentId) { + return query() + .eq(DynamicLike::getDynamicContentId, contentId) + .orderByDesc(DynamicLike::getCreateTime) + .page(pageQuery); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicMessageServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicMessageServiceImpl.java new file mode 100644 index 00000000..35bfc7bc --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicMessageServiceImpl.java @@ -0,0 +1,120 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicMessageDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicMessage; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; + +import java.util.*; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-我的消息 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +public class DynamicMessageServiceImpl extends + BaseServiceImpl implements DynamicMessageService { + + @Override + public void saveBatch(String content, Long contentId, Set toUserIds, String type) { + + if (CollectionUtils.isEmpty(toUserIds)) { + return; + } + + saveBatch(toUserIds.stream().map(toUserId -> { + DynamicMessage dynamicMessage = new DynamicMessage(); + dynamicMessage.setContent(content); + dynamicMessage.setDynamicContentId(contentId); + dynamicMessage.setToUserId(toUserId); + dynamicMessage.setType(type); + dynamicMessage.setCreateTime(TimestampUtils.now()); + dynamicMessage.setId(IdWorkerUtils.getId()); + return dynamicMessage; + }).collect(Collectors.toList())); + + } + + @Override + public void save(String content, Long contentId, Long toUserId, DynamicMessageEnum type) { + DynamicMessage dynamicMessage = new DynamicMessage(); + dynamicMessage.setContent(content); + dynamicMessage.setDynamicContentId(contentId); + dynamicMessage.setToUserId(toUserId); + dynamicMessage.setType(type.name()); + dynamicMessage.setCreateTime(TimestampUtils.now()); + dynamicMessage.setId(IdWorkerUtils.getId()); + super.save(dynamicMessage); + } + + @Override + public Map> mapByUserIdsByContentId(Collection toUserIds) { + + if (CollectionUtils.isEmpty(toUserIds)) { + return CollectionUtils.newHashMap(); + } + return Optional.ofNullable( + query() + .in(DynamicMessage::getToUserId, toUserIds) + .eq(DynamicMessage::getDel, Boolean.FALSE) + .eq(DynamicMessage::getReading, Boolean.FALSE) + .last(PageConstant.formatLimit(toUserIds.size())) + .list() + ).map(contents -> contents.stream() + .collect(Collectors.groupingBy(DynamicMessage::getToUserId))) + .orElseGet(CollectionUtils::newHashMap); + } + + @Override + public Integer getCountByToUserId(Long toUserId) { + + return Optional.ofNullable(query() + .eq(DynamicMessage::getReading, Boolean.FALSE) + .eq(DynamicMessage::getDel, Boolean.FALSE) + .eq(DynamicMessage::getToUserId, toUserId) + .count()).map(Long::intValue).orElse(0); + } + + @Override + public PageResult pageByTimeDesc(PageQuery pageQuery, Long toUserId, List dynamicMessageEnums) { + + return query() + .eq(DynamicMessage::getToUserId, toUserId) + .eq(DynamicMessage::getDel, Boolean.FALSE) + .in(dynamicMessageEnums != null, DynamicMessage::getType, + dynamicMessageEnums != null ? dynamicMessageEnums.stream().map(Enum::name).toList() : Collections.emptyList()) + .orderByDesc(DynamicMessage::getCreateTime) + .page(pageQuery); + } + + @Override + public Long countDynamicMessage(Long toUserId) { + + return query() + .eq(DynamicMessage::getToUserId, toUserId) + .eq(DynamicMessage::getDel, Boolean.FALSE) + .eq(DynamicMessage::getReading, Boolean.FALSE) + .count(); + } + + private String getPageSql(Integer pageNumber) { + + return String.format("LIMIT %s, %s", (pageNumber - 1) * PageConstant.DEFAULT_LIMIT_SIZE, + PageConstant.DEFAULT_LIMIT_SIZE); + } + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicPictureServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicPictureServiceImpl.java new file mode 100644 index 00000000..d016aac6 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicPictureServiceImpl.java @@ -0,0 +1,190 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.google.common.collect.Maps; +import com.red.circle.common.business.enums.PhotoApprovalStatusEnum; +import com.red.circle.common.business.enums.ViolationEnum; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicPictureDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.LocalDateUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态图片. + *

+ * + * @author pengshigang + * @since 2022-4-19 + */ +@RequiredArgsConstructor +@Service +public class DynamicPictureServiceImpl extends + BaseServiceImpl implements + DynamicPictureService { + + private final DynamicPictureDAO dynamicPictureDAO; + + @Override + public String displayableFirstCover(Long dynamicId) { + return Optional.ofNullable( + query() + .select(DynamicPicture::getResourceUrl) + .eq(DynamicPicture::getDynamicId, dynamicId) + .in(DynamicPicture::getViolation, PhotoApprovalStatusEnum.NORMAL, + PhotoApprovalStatusEnum.SUSPECTED) + .orderByAsc(DynamicPicture::getSort) + .last(PageConstant.LIMIT_ONE) + .getOne() + ).map(DynamicPicture::getResourceUrl).orElse(null); + } + + @Override + public Map> mapByDynamicIds(Set dynamicIds) { + + if (CollectionUtils.isEmpty(dynamicIds)) { + return Maps.newHashMap(); + } + + List pictures = query() + .in(DynamicPicture::getDynamicId, dynamicIds) + .list(); + if (CollectionUtils.isEmpty(pictures)) { + return Maps.newHashMap(); + } + + return pictures.stream().collect(Collectors.groupingBy(DynamicPicture::getDynamicId)); + } + + @Override + public void updateApprovalBySelective(List pictures) { + dynamicPictureDAO.updateApprovalBySelective(pictures); + } + + @Override + public void deleteByUserId(Long dynamicId) { + delete().eq(DynamicPicture::getDynamicId, dynamicId).execute(); + } + + @Override + public boolean updateViolationStatus(List ids, PhotoApprovalStatusEnum violationEnum) { + return update() + .set(DynamicPicture::getViolation, violationEnum.name()) + .in(DynamicPicture::getId, ids) + .execute(); + } + + @Override + public boolean existsPicture(Long dynamicId) { + return Objects.nonNull( + query().eq(DynamicPicture::getDynamicId, dynamicId) + .eq(DynamicPicture::getViolation, PhotoApprovalStatusEnum.NORMAL) + .last(PageConstant.LIMIT_ONE) + .getOne() + ); + } + + @Override + public List listViolationPicture(Long dynamicId) { + return query().eq(DynamicPicture::getDynamicId, dynamicId) + .eq(DynamicPicture::getViolation, PhotoApprovalStatusEnum.VIOLATION) + .list(); + } + + @Override + public List listPreviewPicture(Long dynamicId) { + return query().eq(DynamicPicture::getDynamicId, dynamicId) + .in(DynamicPicture::getViolation, PhotoApprovalStatusEnum.NORMAL, + PhotoApprovalStatusEnum.SUSPECTED) + .list(); + } + + @Override + public List listPicture(Long dynamicId) { + return query() + .eq(DynamicPicture::getDynamicId, dynamicId) + .orderByAsc(DynamicPicture::getSort) + .last("LIMIT 9").list(); + } + + @Override + public List listNotPassAndGtToday(Long dynamicId) { + return query() + .eq(DynamicPicture::getDynamicId, dynamicId) + .in(DynamicPicture::getViolation, PhotoApprovalStatusEnum.SUSPECTED, + PhotoApprovalStatusEnum.NORMAL) + .gt(DynamicPicture::getCreateTime, LocalDateUtils.nowTimestamp()) + .orderByAsc(DynamicPicture::getSort) + .last("LIMIT 9").list(); + } + + @Override + public Map> mapPreviewGroup(Set dynamicIds) { + return Optional.ofNullable( + query() + .in(DynamicPicture::getViolation, PhotoApprovalStatusEnum.SUSPECTED, + PhotoApprovalStatusEnum.NORMAL) + .in(DynamicPicture::getDynamicId, dynamicIds) + .orderByAsc(DynamicPicture::getSort) + .last(String.format("LIMIT %s", 9 * dynamicIds.size())) + .list() + ).map( + photoWalls -> photoWalls.stream() + .collect(Collectors.groupingBy(DynamicPicture::getDynamicId))) + .orElse(CollectionUtils.newHashMap()); + } + + @Override + public boolean existsPreview(Long dynamicId) { + return Optional.ofNullable( + query().select(DynamicPicture::getId) + .in(DynamicPicture::getViolation, PhotoApprovalStatusEnum.NORMAL, + PhotoApprovalStatusEnum.SUSPECTED) + .eq(DynamicPicture::getDynamicId, dynamicId) + .last(PageConstant.LIMIT_ONE) + .getOne() + ).map(photoWall -> Objects.nonNull(photoWall.getId())).orElse(Boolean.FALSE); + } + + @Override + public boolean existsEmptyOrViolation(Long dynamicId) { + List pictures = query() + .select(DynamicPicture::getId, DynamicPicture::getViolation) + .eq(DynamicPicture::getDynamicId, dynamicId) + .last("LIMIT 9") + .list(); + + if (CollectionUtils.isEmpty(pictures)) { + return Boolean.TRUE; + } + + return pictures.stream().filter(picture -> + Objects.equals(picture.getViolation(), PhotoApprovalStatusEnum.VIOLATION.name())) + .findFirst().map(photoWall -> Boolean.TRUE).orElse(Boolean.FALSE); + } + + @Override + public String getFirstNormalPic(Long dynamicId) { + DynamicPicture picture = query() + .select(DynamicPicture::getResourceUrl) + .eq(DynamicPicture::getDynamicId, dynamicId) + .eq(DynamicPicture::getViolation, ViolationEnum.NORMAL.name()) + .orderByAsc(DynamicPicture::getSort) + .last(PageConstant.LIMIT_ONE) + .getOne(); + + return picture != null ? picture.getResourceUrl() : null; + } + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicReportServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicReportServiceImpl.java new file mode 100644 index 00000000..61508a52 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicReportServiceImpl.java @@ -0,0 +1,82 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicReportDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicReportService; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.tool.core.date.TimestampUtils; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import org.springframework.stereotype.Service; + +/** + *

+ * 投诉动态 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-18 + */ +@Service +public class DynamicReportServiceImpl extends + BaseServiceImpl implements DynamicReportService { + + @Override + public Boolean exist(Long dynamicContentId, Long userId) { + + return Optional.ofNullable(query() + .eq(DynamicReport::getReportUserId, userId) + .eq(DynamicReport::getApprovalStatus, 0) + .eq(DynamicReport::getDynamicContentId, dynamicContentId) + .last(PageConstant.LIMIT_ONE) + .getOne()).map(obj -> Boolean.TRUE) + .orElse(Boolean.FALSE); + + } + + @Override + public PageResult pageData(ApprovalDynamicReportQryCmd query) { + return query() + .eq(Objects.nonNull(query.getSysOrigin()), DynamicReport::getSysOrigin, + query.getSysOrigin()) + .eq(Objects.nonNull(query.getReportUserId()), DynamicReport::getReportUserId, + query.getReportUserId()) + .eq(Objects.nonNull(query.getReportedUserId()), DynamicReport::getReportedUserId, + query.getReportedUserId()) + .eq(Objects.nonNull(query.getApprovalStatus()), DynamicReport::getApprovalStatus, + query.getApprovalStatus()) + .eq(Objects.nonNull(query.getReportType()), DynamicReport::getReportType, + query.getReportType()) + .ge(Objects.nonNull(query.getStartTime()), DynamicReport::getCreateTime, + query.getStartTime()) + .le(Objects.nonNull(query.getEndTime()), DynamicReport::getCreateTime, + query.getEndTime()) + .orderByDesc(DynamicReport::getCreateTime) + .page(query.getPageQuery()); + } + + @Override + public List getByContentId(Long contentId) { + return query() + .eq(DynamicReport::getDynamicContentId, contentId) + .eq(DynamicReport::getApprovalStatus, 0) + .list(); + } + + @Override + public void updateDynamicReport(ApprovalDynamicReportCmd cmd, List complaints) { + update() + .set(DynamicReport::getApprovalStatus, cmd.getApprovalStatus()) + .set(DynamicReport::getUpdateTime, TimestampUtils.now()) + .in(DynamicReport::getId, complaints.stream().map(DynamicReport::getId) + .collect(Collectors.toSet())) + .execute(); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTagServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTagServiceImpl.java new file mode 100644 index 00000000..c7da30d5 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTagServiceImpl.java @@ -0,0 +1,91 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.google.common.collect.Maps; +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicTagDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import com.red.circle.tool.core.text.StringUtils; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-朋友圈标签 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +@RequiredArgsConstructor +public class DynamicTagServiceImpl extends BaseServiceImpl implements + DynamicTagService { + + @Override + public Map mapByIds(Collection ids) { + if (CollectionUtils.isEmpty(ids)) { + return Maps.newHashMap(); + } + return Optional.ofNullable( + query().in(DynamicTag::getId, ids) + .last(PageConstant.formatLimit(ids.size())) + .list() + ).map(tags -> tags.stream().collect(Collectors.toMap(DynamicTag::getId, v -> v))) + .orElse(Maps.newHashMap()); + } + + @Override + public List listTag(SysOriginPlatformEnum sysOrigin, String language) { + return query() + .eq(DynamicTag::getSysOrigin, sysOrigin.name()) + .eq(DynamicTag::getLanguageType, language) + .eq(DynamicTag::getDel, Boolean.FALSE) + .orderByDesc(DynamicTag::getSort, DynamicTag::getCreateTime) + .list(); + + } + + @Override + public void addOrUpdate(DynamicTag dynamicTag) { + + if (Objects.isNull(dynamicTag.getId())) { + + dynamicTag.setCreateTime(TimestampUtils.now()); + save(dynamicTag); + + } else { + + updateSelectiveById(dynamicTag); + } + } + + + @Override + public PageResult pageData(PageDynamicTagQryCmd query) { + + return query() + .eq(StringUtils.isNotBlank(query.getSysOrigin()), DynamicTag::getSysOrigin, + query.getSysOrigin()) + .eq(StringUtils.isNotBlank(query.getLanguageType()), DynamicTag::getLanguageType, + query.getLanguageType()) + .eq(Objects.nonNull(query.getDel()), DynamicTag::getDel, query.getDel()) + .orderByDesc(DynamicTag::getSort, DynamicTag::getCreateTime) + .page(query.getPageQuery()); + + } + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTimelineServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTimelineServiceImpl.java new file mode 100644 index 00000000..e5be726f --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/DynamicTimelineServiceImpl.java @@ -0,0 +1,109 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.google.common.collect.Lists; +import com.red.circle.framework.dto.PageQuery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.DynamicTimelineDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-时间轴表 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-04-11 + */ +@Service +public class DynamicTimelineServiceImpl extends + BaseServiceImpl implements DynamicTimelineService { + + + @Override + public void deleteByDynamicContentId(Long dynamicContentId) { + + if (Objects.isNull(dynamicContentId)) { + return; + } + delete().eq(DynamicTimeline::getDynamicContentId, dynamicContentId).execute(); + } + + @Override + public void deleteByDynamicContentIds(Set dynamicIds) { + + if (CollectionUtils.isEmpty(dynamicIds)) { + return; + } + + delete() + .in(DynamicTimeline::getDynamicContentId, dynamicIds) + .last(PageConstant.formatLimit(dynamicIds.size())) + .execute(); + + } + + @Override + public List pageByTimeDesc(String region, Integer pageNumber, Long createUser, + Boolean isOwn) { + + if (Objects.isNull(pageNumber) || pageNumber < 1) { + pageNumber = 1; + } + + return query() + .eq(DynamicTimeline::getCreateUser, createUser) + .eq(DynamicTimeline::getOwn, isOwn) + .in(DynamicTimeline::getRegion, region, "") + .orderByDesc(DynamicTimeline::getCreateTime) + .last(getPageSql(pageNumber)) + .list(); + } + + + private String getPageSql(Integer pageNumber) { + + return String.format("LIMIT %s, %s", (pageNumber - 1) * PageConstant.DEFAULT_LIMIT_SIZE, + PageConstant.DEFAULT_LIMIT_SIZE); + } + + @Override + public PageResult pageByTimeDesc(List ids, String region, PageQuery pageQuery, + Boolean isOwn) { + return query() + .in(DynamicTimeline::getCreateUser, ids) + .eq(DynamicTimeline::getOwn, isOwn) + .in(region != null, DynamicTimeline::getRegion, region, "") + .orderByDesc(DynamicTimeline::getCreateTime) + .page(pageQuery); + } + + @Override + public PageResult pageByTimeDesc(List ids, String region, PageQuery pageQuery, + Boolean isOwn, List pendingDynamicIds) { + return query() + .in(DynamicTimeline::getCreateUser, ids) + .eq(DynamicTimeline::getOwn, isOwn) + .in(region != null, DynamicTimeline::getRegion, region, "") + .notIn(CollectionUtils.isNotEmpty(pendingDynamicIds), DynamicTimeline::getDynamicContentId, pendingDynamicIds) + .orderByDesc(DynamicTimeline::getCreateTime) + .page(pageQuery); + } + + @Override + public List ownListByUserId(Long userId) { + + return Optional.ofNullable(query() + .eq(DynamicTimeline::getOwn, Boolean.TRUE) + .eq(DynamicTimeline::getCreateUser, userId) + .list()).orElse(Lists.newArrayList()); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/TopDynamicServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/TopDynamicServiceImpl.java new file mode 100644 index 00000000..00b608b2 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/TopDynamicServiceImpl.java @@ -0,0 +1,80 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + +import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.TopDynamicDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.TopDynamic; +import com.red.circle.other.infra.database.rds.service.dynamic.TopDynamicService; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.TimestampUtils; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 系统置顶动态 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-17 + */ +@Service +@RequiredArgsConstructor +public class TopDynamicServiceImpl extends BaseServiceImpl implements + TopDynamicService { + + + @Override + public List listBySysOrigin(SysOriginPlatformEnum sysOrigin) { + return query().eq(TopDynamic::getSysOrigin, sysOrigin.name()) + .orderByDesc(TopDynamic::getWeights) + .last(PageConstant.formatLimit(300)) + .list(); + } + + + @Override + public void setUpTop(TopDynamicCmd param) { + + delete().eq(TopDynamic::getDynamicId, param.getDynamicId()).last(PageConstant.LIMIT_ONE) + .execute(); + + TopDynamic topDynamic = new TopDynamic(); + topDynamic.setDynamicId(param.getDynamicId()); + topDynamic.setSysOrigin(param.getSysOrigin()); + topDynamic.setWeights(param.getWeights()); + topDynamic.setCreateTime(TimestampUtils.now()); + topDynamic.setCreateUser(param.getOperatorId()); + topDynamic.setUpdateTime(TimestampUtils.now()); + save(topDynamic); + + } + + @Override + public void closeTop(Long dynamicId) { + + if (Objects.isNull(dynamicId)) { + return; + } + delete().eq(TopDynamic::getDynamicId, dynamicId).last(PageConstant.LIMIT_ONE).execute(); + } + + @Override + public void deleteByDynamicIds(Set ids) { + + if (CollectionUtils.isEmpty(ids)) { + return; + } + + delete().in(TopDynamic::getDynamicId, ids).execute(); + + + } + + +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/UserThumbsUpServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/UserThumbsUpServiceImpl.java new file mode 100644 index 00000000..8e351b40 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/dynamic/impl/UserThumbsUpServiceImpl.java @@ -0,0 +1,58 @@ +package com.red.circle.other.infra.database.rds.service.dynamic.impl; + + +import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; +import com.red.circle.other.infra.database.rds.dao.dynamic.UserThumbsUpDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.UserThumbsUp; +import com.red.circle.other.infra.database.rds.service.dynamic.UserThumbsUpService; +import java.util.Objects; +import java.util.Optional; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; + +/** + *

+ * 用户点赞列表 服务实现类. + *

+ * + * @author zongpubin on 2023-04-06 11:41 + */ +@Service +public class UserThumbsUpServiceImpl extends + BaseServiceImpl implements + UserThumbsUpService { + + @Override + public boolean checkExist(Long userId, Long thumbsUpId) { + return Optional.ofNullable(query() + .select(UserThumbsUp::getId) + .eq(UserThumbsUp::getUserId, userId) + .eq(UserThumbsUp::getThumbsUpUserId, thumbsUpId) + .last(PageConstant.LIMIT_ONE) + .getOne()).map(thumbsUp -> Objects.nonNull(thumbsUp.getId())) + .orElse(Boolean.FALSE); + } + + @Override + public boolean notExistsAdd(Long userId, Long thumbsUpId) { + try { + save(new UserThumbsUp() + .setThumbsUpUserId(thumbsUpId) + .setUserId(userId) + ); + return true; + } catch (DuplicateKeyException ignore) { + // ignore + } + return false; + } + + @Override + public long countThumbsUp(Long thumbsUpId) { + if (Objects.isNull(thumbsUpId)) { + return 0L; + } + return query().eq(UserThumbsUp::getThumbsUpUserId, thumbsUpId).count(); + } +} diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/BaseInfoServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/BaseInfoServiceImpl.java index 674457f5..5c1aa5bb 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/BaseInfoServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/user/user/impl/BaseInfoServiceImpl.java @@ -10,9 +10,10 @@ import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.mybatis.constant.PageConstant; import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; -import com.red.circle.other.infra.convertor.user.SysUserBaseInfoConvertor; -import com.red.circle.other.infra.database.rds.dao.user.user.BaseInfoDAO; -import com.red.circle.other.infra.database.rds.entity.user.user.BaseInfo; +import com.red.circle.other.infra.convertor.user.SysUserBaseInfoConvertor; +import com.red.circle.other.infra.database.rds.dao.user.user.BaseInfoDAO; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.infra.database.rds.entity.user.user.BaseInfo; import com.red.circle.other.infra.database.rds.service.user.user.BaseInfoService; import com.red.circle.other.inner.model.cmd.count.SysOriginUserQryCmd; import com.red.circle.other.inner.model.cmd.user.UserBaseInfoPageQryCmd; diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/approval/ApprovalDynamicContentDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/approval/ApprovalDynamicContentDAO.xml new file mode 100644 index 00000000..c380364b --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/approval/ApprovalDynamicContentDAO.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicBlacklistDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicBlacklistDAO.xml new file mode 100644 index 00000000..30707939 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicBlacklistDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentDAO.xml new file mode 100644 index 00000000..bdf5ae8a --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentDAO.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentLikeDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentLikeDAO.xml new file mode 100644 index 00000000..32e940c9 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicCommentLikeDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicContentDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicContentDAO.xml new file mode 100644 index 00000000..845a64ff --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicContentDAO.xml @@ -0,0 +1,41 @@ + + + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicLikeDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicLikeDAO.xml new file mode 100644 index 00000000..2f9abf24 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicLikeDAO.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicMessageDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicMessageDAO.xml new file mode 100644 index 00000000..ef101356 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicMessageDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicPictureDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicPictureDAO.xml new file mode 100644 index 00000000..babe4ac1 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicPictureDAO.xml @@ -0,0 +1,21 @@ + + + + + + + + UPDATE `dynamic_picture` SET update_time = CURRENT_TIMESTAMP + + ,`violation` = #{item.violation} + + + ,`label_names` = #{item.labelNames} + + WHERE id = #{item.id} AND `violation` IN('NORMAL','SUSPECTED') + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicReportDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicReportDAO.xml new file mode 100644 index 00000000..b340e6e6 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicReportDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTagDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTagDAO.xml new file mode 100644 index 00000000..72a1f578 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTagDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTimelineDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTimelineDAO.xml new file mode 100644 index 00000000..9f6df575 --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/DynamicTimelineDAO.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/TopDynamicDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/TopDynamicDAO.xml new file mode 100644 index 00000000..82bf0b8d --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/TopDynamicDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/UserThumbsUpDAO.xml b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/UserThumbsUpDAO.xml new file mode 100644 index 00000000..ea04427e --- /dev/null +++ b/rc-service/rc-service-other/other-infrastructure/src/main/resources/dao/dynamic/UserThumbsUpDAO.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicConvertor.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicConvertor.java new file mode 100644 index 00000000..3c6aaa53 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicConvertor.java @@ -0,0 +1,18 @@ +package com.red.circle.other.app.inner.convertor.approval; + +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import org.mapstruct.Mapper; + +/** + * @author zongpubin on 2024/1/19 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface ApprovalDynamicConvertor { + + ApprovalDynamicDTO toApprovalDynamicDTO(ApprovalDynamicContent approvalDynamicContent); + + ApprovalDynamicContent toApprovalDynamicContent(ApprovalDynamicContentCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicReportConvertor.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicReportConvertor.java new file mode 100644 index 00000000..57355f46 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/approval/ApprovalDynamicReportConvertor.java @@ -0,0 +1,15 @@ +package com.red.circle.other.app.inner.convertor.approval; + +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import org.mapstruct.Mapper; + +/** + * @author zongpubin on 2024/1/19 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface ApprovalDynamicReportConvertor { + + ApprovalDynamicReportedDTO toApprovalDynamicReportedDTO(DynamicReport dynamicReport); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/dynamic/DynamicInnerConvertor.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/dynamic/DynamicInnerConvertor.java new file mode 100644 index 00000000..008f920f --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/convertor/dynamic/DynamicInnerConvertor.java @@ -0,0 +1,37 @@ +package com.red.circle.other.app.inner.convertor.dynamic; + +import com.red.circle.framework.core.convertor.ConvertorModel; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicBlacklist; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPictureDTO; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; +import org.mapstruct.Mapper; + +/** + * @author pengliang on 2023/6/5 + */ +@Mapper(componentModel = ConvertorModel.SPRING) +public interface DynamicInnerConvertor { + + PageDynamicBlacklistDTO toDynamicBlacklistDTO(DynamicBlacklist dynamicBlacklist); + + DynamicPictureDTO toDynamicPictureDTO(DynamicPicture dynamicPicture); + + DynamicTag toDynamicTag(DynamicTagCmd cmd); + + DynamicTagDTO toDynamicTagDTO(DynamicTag dynamicTag); + + DynamicContent toDynamicContent(DynamicContentCmd cmd); + + DynamicPicture toDynamicPicture(DynamicPictureCmd cmd); + + DynamicTimeline toDynamicTimeline(DynamicTimelineCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDataInfoClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDataInfoClientEndpoint.java index 145c9260..852c4402 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDataInfoClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDataInfoClientEndpoint.java @@ -2,7 +2,7 @@ package com.red.circle.other.app.inner.endpoint.approval; import com.red.circle.framework.dto.ResultResponse; import com.red.circle.other.app.inner.service.approval.ApprovalDataInfoClientService; -import com.red.circle.other.inner.endpoint.approval.api.ApprovalDataInfoClientApi; +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDataInfoClientApi; import com.red.circle.other.inner.model.cmd.approval.ApprovalDateInfoCmd; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicClientEndpoint.java new file mode 100644 index 00000000..10b5a261 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicClientEndpoint.java @@ -0,0 +1,52 @@ +package com.red.circle.other.app.inner.endpoint.approval; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.approval.ApprovalDynamicClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDynamicClientApi; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 审批动态 + * @author zongpubin on 2024/1/19 + */ +@Validated +@RestController +@RequestMapping(value = ApprovalDynamicClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class ApprovalDynamicClientEndpoint implements ApprovalDynamicClientApi { + + private final ApprovalDynamicClientService approvalDynamicClientService; + + @Override + public ResultResponse> pageApprovalDynamic(ApprovalDynamicQryCmd query) { + return ResultResponse.success(approvalDynamicClientService.pageApprovalDynamic(query)); + } + + @Override + public ResultResponse approvalPass(Set ids) { + approvalDynamicClientService.approvalPass(ids); + return ResultResponse.success(); + } + + @Override + public ResultResponse approvalNotPass(ApprovalDynamicCmd approvalDynamicCmd) { + approvalDynamicClientService.approvalNotPass(approvalDynamicCmd); + return ResultResponse.success(); + } + + @Override + public ResultResponse save(ApprovalDynamicContentCmd cmd) { + approvalDynamicClientService.save(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicReportClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicReportClientEndpoint.java new file mode 100644 index 00000000..4df278d0 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalDynamicReportClientEndpoint.java @@ -0,0 +1,40 @@ +package com.red.circle.other.app.inner.endpoint.approval; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.approval.ApprovalDynamicReportClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalDynamicReportClientApi; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/20 + */ +@Validated +@RestController +@RequestMapping(value = ApprovalDynamicReportClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class ApprovalDynamicReportClientEndpoint implements ApprovalDynamicReportClientApi { + + private final ApprovalDynamicReportClientService approvalDynamicReportClientService; + + @Override + public ResultResponse> pageData( + ApprovalDynamicReportQryCmd query) { + return ResultResponse.success(approvalDynamicReportClientService.pageData(query)); + } + + @Override + public ResultResponse report(ApprovalDynamicReportCmd cmd) { + approvalDynamicReportClientService.report(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalFamilySettingDataClientEndPoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalFamilySettingDataClientEndPoint.java index 78ffabb0..fc25330c 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalFamilySettingDataClientEndPoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalFamilySettingDataClientEndPoint.java @@ -4,7 +4,7 @@ import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.ResultResponse; import com.red.circle.other.app.inner.service.approval.ApprovalFamilySettingDataClientService; -import com.red.circle.other.inner.endpoint.approval.api.ApprovalFamilySettingDataClientApi; +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalFamilySettingDataClientApi; import com.red.circle.other.inner.model.cmd.approval.ApprovalFamilyCmd; import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; import com.red.circle.other.inner.model.dto.approval.ApprovalFamilyDTO; diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalUserSettingInfoClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalUserSettingInfoClientEndpoint.java index 7fb2b68a..7a5f8c49 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalUserSettingInfoClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/approval/ApprovalUserSettingInfoClientEndpoint.java @@ -4,7 +4,7 @@ import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.dto.ResultResponse; import com.red.circle.other.app.inner.service.approval.ApprovalUserSettingInfoClientService; -import com.red.circle.other.inner.endpoint.approval.api.ApprovalUserSettingInfoClientApi; +import com.red.circle.other.inner.endpoint.dynamic.api.ApprovalUserSettingInfoClientApi; import com.red.circle.other.inner.model.cmd.approval.ApprovalProfileDescQryCmd; import com.red.circle.other.inner.model.cmd.approval.ApprovalUserProfileQryCmd; import com.red.circle.other.inner.model.dto.approval.ApprovalProfileDescDTO; diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicBlacklistClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicBlacklistClientEndpoint.java new file mode 100644 index 00000000..adbab21e --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicBlacklistClientEndpoint.java @@ -0,0 +1,47 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicBlacklistClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicBlacklistClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-黑名单服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicBlacklistClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicBlacklistClientEndpoint implements DynamicBlacklistClientApi { + + private final DynamicBlacklistClientService dynamicBlacklistClientService; + + + @Override + public ResultResponse deleteByUserId(Long userId) { + dynamicBlacklistClientService.deleteByUserId(userId); + return ResultResponse.success(); + } + + @Override + public ResultResponse add(DynamicBlacklistCmd cmd) { + dynamicBlacklistClientService.add(cmd); + return ResultResponse.success(); + } + + @Override + public ResultResponse> pageDynamicBlacklist( + DynamicBlacklistQryCmd cmd) { + return ResultResponse.success(dynamicBlacklistClientService.pageDynamicBlacklist(cmd)); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicCacheClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicCacheClientEndpoint.java new file mode 100644 index 00000000..3c038ae5 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicCacheClientEndpoint.java @@ -0,0 +1,38 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicCacheClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicCacheClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-缓存. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicCacheClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicCacheClientEndpoint implements DynamicCacheClientApi { + + private final DynamicCacheClientService dynamicCacheClientService; + + + @Override + public ResultResponse getDynamicPopularConfig() { + return ResultResponse.success(dynamicCacheClientService.getDynamicPopularConfig()); + } + + @Override + public ResultResponse updateDynamicPopularConfig(DynamicPopularConfigCmd param) { + dynamicCacheClientService.updateDynamicPopularConfig(param); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicContentClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicContentClientEndpoint.java new file mode 100644 index 00000000..40529608 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicContentClientEndpoint.java @@ -0,0 +1,53 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicContentClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicContentClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicContentDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-内容服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicContentClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicContentClientEndpoint implements DynamicContentClientApi { + + private final DynamicContentClientService dynamicContentClientService; + + @Override + public ResultResponse deleteByIds(DelDynamicContentCmd cmd) { + dynamicContentClientService.deleteByIds(cmd); + return ResultResponse.success(); + } + + @Override + public ResultResponse> pageDynamicContent( + DynamicContentQryCmd cmd) { + return ResultResponse.success(dynamicContentClientService.page(cmd)); + } + + @Override + public ResultResponse countDynamicMessage(Long userId) { + return ResultResponse.success(dynamicContentClientService.countDynamicMessage(userId)); + } + + @Override + public ResultResponse save(DynamicContentCmd cmd) { + dynamicContentClientService.save(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicPictureClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicPictureClientEndpoint.java new file mode 100644 index 00000000..d86c19c1 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicPictureClientEndpoint.java @@ -0,0 +1,31 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicPictureClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicPictureClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-内容服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicPictureClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicPictureClientEndpoint implements DynamicPictureClientApi { + + private final DynamicPictureClientService dynamicPictureClientService; + + @Override + public ResultResponse save(DynamicPictureCmd cmd) { + dynamicPictureClientService.save(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTagClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTagClientEndpoint.java new file mode 100644 index 00000000..da6ce072 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTagClientEndpoint.java @@ -0,0 +1,46 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicTagClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicTagClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-内容服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicTagClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicTagClientEndpoint implements DynamicTagClientApi { + + private final DynamicTagClientService dynamicTagClientService; + + @Override + public ResultResponse addOrUpdate(DynamicTagCmd dynamicTag) { + dynamicTagClientService.addOrUpdate(dynamicTag); + return ResultResponse.success(); + } + + + @Override + public ResultResponse> pageData(PageDynamicTagQryCmd query) { + return ResultResponse.success(dynamicTagClientService.pageData(query)); + } + + @Override + public ResultResponse> getAllDynamicTag() { + return ResultResponse.success(dynamicTagClientService.getAllDynamicTag()); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTimelineClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTimelineClientEndpoint.java new file mode 100644 index 00000000..8d86f0b9 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/DynamicTimelineClientEndpoint.java @@ -0,0 +1,31 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.DynamicTimelineClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.DynamicTimelineClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-内容服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = DynamicTimelineClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class DynamicTimelineClientEndpoint implements DynamicTimelineClientApi { + + private final DynamicTimelineClientService dynamicTimelineClientService; + + @Override + public ResultResponse save(DynamicTimelineCmd cmd) { + dynamicTimelineClientService.save(cmd); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/TopDynamicClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/TopDynamicClientEndpoint.java new file mode 100644 index 00000000..61eed842 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/dynamic/TopDynamicClientEndpoint.java @@ -0,0 +1,38 @@ +package com.red.circle.other.app.inner.endpoint.dynamic; + +import com.red.circle.framework.dto.ResultResponse; +import com.red.circle.other.app.inner.service.dynamic.TopDynamicClientService; +import com.red.circle.other.inner.endpoint.dynamic.api.TopDynamicClientApi; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 动态-内容服务. + * + * @author pengliang on 2023/6/5 + */ +@Validated +@RestController +@RequestMapping(value = TopDynamicClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE) +@RequiredArgsConstructor +public class TopDynamicClientEndpoint implements TopDynamicClientApi { + + private final TopDynamicClientService topDynamicClientService; + + + @Override + public ResultResponse setUpTop(TopDynamicCmd param) { + topDynamicClientService.setUpTop(param); + return ResultResponse.success(); + } + + @Override + public ResultResponse closeTop(Long dynamicId) { + topDynamicClientService.closeTop(dynamicId); + return ResultResponse.success(); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicClientService.java new file mode 100644 index 00000000..408bdeb7 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicClientService.java @@ -0,0 +1,23 @@ +package com.red.circle.other.app.inner.service.approval; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import java.util.Set; + +/** + * 审批动态 + * @author zongpubin on 2024/1/19 + */ +public interface ApprovalDynamicClientService { + + PageResult pageApprovalDynamic(ApprovalDynamicQryCmd query); + + void approvalPass(Set ids); + + void approvalNotPass(ApprovalDynamicCmd approvalDynamicCmd); + + void save(ApprovalDynamicContentCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicReportClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicReportClientService.java new file mode 100644 index 00000000..e7a7ab95 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/ApprovalDynamicReportClientService.java @@ -0,0 +1,18 @@ +package com.red.circle.other.app.inner.service.approval; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/20 + */ +public interface ApprovalDynamicReportClientService { + + PageResult pageData(ApprovalDynamicReportQryCmd query); + + void report(ApprovalDynamicReportCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDataInfoClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDataInfoClientServiceImpl.java index 87435566..47c885a0 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDataInfoClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDataInfoClientServiceImpl.java @@ -1,11 +1,10 @@ package com.red.circle.other.app.inner.service.approval.impl; -import com.red.circle.common.business.core.enums.ApprovalStatusEnum; -import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; -import com.red.circle.common.business.core.enums.OpUserType; -import com.red.circle.component.mq.MessageEvent; -import com.red.circle.mq.business.model.event.approval.ApprovalContent; -import com.red.circle.mq.business.model.event.approval.ApprovalEvent; +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalContentEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalDynamicEvent; import com.red.circle.mq.rocket.business.service.MessageSenderService; import com.red.circle.mq.rocket.business.streams.ConsoleApprovalSink; import com.red.circle.other.app.inner.service.approval.ApprovalDataInfoClientService; @@ -46,18 +45,18 @@ public class ApprovalDataInfoClientServiceImpl implements ApprovalDataInfoClient senderService.sendEventMessage(MessageEvent.builder() .consumeId(IdWorkerUtils.getIdStr()) .tag(ConsoleApprovalSink.TAG) - .body(new ApprovalEvent() - .setApprovalType(DataApprovalTypeEnum.valueOf(cmd.getApprovalType())) - .setApprovalId(IdWorkerUtils.getId()) - .setOpsUserId(cmd.getApprovalUserId()) - .setOpUserType(OpUserType.BACK) - .setApprovalStatus(ApprovalStatusEnum.valueOf(cmd.getApprovalStatus())) - .setWaitApprovalUser( - cmd.getWaitApprovalUser().parallelStream() - .map(approvalContent -> new ApprovalContent() - .setContent(approvalContent.getContent()) - .setContentId(approvalContent.getContentId()) - .setUserId(approvalContent.getUserId()) + .body(new ApprovalDynamicEvent() + .setApprovalType(DataApprovalTypeEnum.valueOf(cmd.getApprovalType())) + .setOriginType(Boolean.FALSE) + .setApprovalId(IdWorkerUtils.getId()) + .setApprovalUserId(cmd.getApprovalUserId()) + .setApprovalStatus(ApprovalStatusEnum.valueOf(cmd.getApprovalStatus())) + .setWaitApprovalUser( + cmd.getWaitApprovalUser().parallelStream() + .map(approvalContent -> new ApprovalContentEvent() + .setContent(approvalContent.getContent()) + .setContentId(approvalContent.getContentId()) + .setUserId(approvalContent.getUserId()) .setTags(approvalContent.getTags())).filter(Objects::nonNull).collect( Collectors.toList()))).build()); diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicClientServiceImpl.java new file mode 100644 index 00000000..802f86be --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicClientServiceImpl.java @@ -0,0 +1,125 @@ +package com.red.circle.other.app.inner.service.approval.impl; + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.mq.business.model.event.approval.ApprovalContentEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalDynamicEvent; +import com.red.circle.mq.rocket.business.service.MessageSenderService; +import com.red.circle.mq.rocket.business.streams.ConsoleApprovalSink; +import com.red.circle.other.app.inner.convertor.approval.ApprovalDynamicConvertor; +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.approval.ApprovalDynamicClientService; +import com.red.circle.other.infra.database.rds.entity.approval.ApprovalDynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.service.approval.ApprovalDynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 审批动态 + * + * @author zongpubin on 2024/1/19 + */ +@Service +@RequiredArgsConstructor +public class ApprovalDynamicClientServiceImpl implements ApprovalDynamicClientService { + + private final MessageSenderService senderService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicInnerConvertor dynamicInnerConvertor; + private final ApprovalDynamicConvertor approvalDynamicConvertor; + private final ApprovalDynamicContentService approvalDynamicContentService; + + @Override + public PageResult pageApprovalDynamic(ApprovalDynamicQryCmd query) { + PageResult pageResult = approvalDynamicContentService.pageApprovalDynamic( + query); + if (CollectionUtils.isEmpty(pageResult.getRecords())) { + return pageResult.convert(approvalDynamicConvertor::toApprovalDynamicDTO); + } + + Set dynamicIds = getDynamicIds(pageResult); + Map contentMap = dynamicContentService.mapByIds(dynamicIds); + Map> pictureMap = dynamicPictureService.mapByDynamicIds(dynamicIds); + + return pageResult.convert(approvalDynamicContent -> { + DynamicContent content = contentMap.get(approvalDynamicContent.getDynamicId()); + List pictures = pictureMap.get(approvalDynamicContent.getDynamicId()); + ApprovalDynamicDTO approvalDynamicDTO = approvalDynamicConvertor.toApprovalDynamicDTO( + approvalDynamicContent); + + if (Objects.nonNull(content)) { + approvalDynamicDTO.setDynamicContent(content.getContent()); + } + + if (CollectionUtils.isNotEmpty(pictures)) { + approvalDynamicDTO.setPictures( + pictures.stream().map(dynamicInnerConvertor::toDynamicPictureDTO) + .collect(Collectors.toList())); + } + + return approvalDynamicDTO; + }); + } + + @Override + public void approvalPass(Set ids) { + ResponseAssert.notEmpty(CommonErrorCode.NOT_FOUND_RECORD_INFO, ids); + approvalDynamicContentService.approvalPass(ids); + + } + + @Override + public void approvalNotPass(ApprovalDynamicCmd approvalDynamicCmd) { + ResponseAssert.notEmpty(CommonErrorCode.NOT_FOUND_RECORD_INFO, approvalDynamicCmd.getIds()); + approvalDynamicContentService.approvalNotPass(approvalDynamicCmd.getIds()); + + senderService.sendEventMessage(MessageEvent.builder() + .consumeId(IdWorkerUtils.getIdStr()) + .tag(ConsoleApprovalSink.TAG) + .body(new ApprovalDynamicEvent() + .setApprovalType(DataApprovalTypeEnum.DYNAMIC_CONTENT) + .setOriginType(Boolean.FALSE) + .setApprovalId(IdWorkerUtils.getId()) + .setApprovalUserId(approvalDynamicCmd.getUserId()) + .setApprovalStatus(ApprovalStatusEnum.NOT_PASS) + .setWaitApprovalUser( + approvalDynamicCmd.getIds().parallelStream().map(id -> new ApprovalContentEvent() + .setContentId(id) + .setTags(DynamicMessageEnum.DYNAMIC_VIOLATION.name())) + .filter(Objects::nonNull).collect(Collectors.toList()))).build()); + } + + private Set getDynamicIds(PageResult pageResult) { + return pageResult.getRecords().stream().map(ApprovalDynamicContent::getDynamicId) + .collect(Collectors.toSet()); + } + + @Override + public void save(ApprovalDynamicContentCmd cmd) { + ApprovalDynamicContent approvalDynamicContent = approvalDynamicConvertor.toApprovalDynamicContent(cmd); + if (Objects.nonNull(approvalDynamicContent)) { + approvalDynamicContentService.save(approvalDynamicContent); + } + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicReportClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicReportClientServiceImpl.java new file mode 100644 index 00000000..377fb3fe --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/approval/impl/ApprovalDynamicReportClientServiceImpl.java @@ -0,0 +1,178 @@ +package com.red.circle.other.app.inner.service.approval.impl; + +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.common.business.enums.DynamicMessageEnum; +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.external.inner.endpoint.message.NewsletterClient; +import com.red.circle.external.inner.model.cmd.message.NewsletterResultCmd; +import com.red.circle.external.inner.model.enums.message.NewsletterEvent; +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.mq.business.model.event.approval.ApprovalContentEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalDynamicEvent; +import com.red.circle.mq.rocket.business.service.MessageSenderService; +import com.red.circle.mq.rocket.business.streams.ConsoleApprovalSink; +import com.red.circle.other.app.inner.convertor.approval.ApprovalDynamicReportConvertor; +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.approval.ApprovalDynamicReportClientService; +import com.red.circle.other.infra.database.mongo.service.dynamic.DynamicPopularService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicReport; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicReportService; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportCmd; +import com.red.circle.other.inner.model.cmd.approval.ApprovalDynamicReportQryCmd; +import com.red.circle.other.inner.model.dto.approval.ApprovalDynamicReportedDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.sequence.IdWorkerUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 动态投诉 + * + * @author zongpubin on 2024/1/20 + */ +@Service +@RequiredArgsConstructor +public class ApprovalDynamicReportClientServiceImpl implements ApprovalDynamicReportClientService { + + private final MessageSenderService senderService; + private final NewsletterClient newsletterClient; + private final DynamicReportService dynamicReportService; + private final DynamicPopularService dynamicPopularService; + private final DynamicMessageService dynamicMessageService; + private final DynamicContentService dynamicContentService; + private final DynamicPictureService dynamicPictureService; + private final DynamicInnerConvertor dynamicInnerConvertor; + private final ApprovalDynamicReportConvertor approvalDynamicReportConvertor; + + @Override + public PageResult pageData(ApprovalDynamicReportQryCmd query) { + PageResult pageResult = dynamicReportService.pageData(query); + + if (CollectionUtils.isEmpty(pageResult.getRecords())) { + return pageResult.convert(approvalDynamicReportConvertor::toApprovalDynamicReportedDTO); + } + + Set dynamicIds = getDynamicIds(pageResult); + Map contentMap = dynamicContentService.mapByIds(dynamicIds); + Map> pictureMap = dynamicPictureService.mapByDynamicIds(dynamicIds); + + var result = pageResult.convert(dynamicReport -> { + + DynamicContent content = contentMap.get(dynamicReport.getDynamicContentId()); + if (Objects.isNull(content)) { + return null; + } + List pictures = pictureMap.get(content.getId()); + ApprovalDynamicReportedDTO approvalDynamicReportedDTO = approvalDynamicReportConvertor.toApprovalDynamicReportedDTO( + dynamicReport); + + approvalDynamicReportedDTO.setDynamicContent(content.getContent()); + + if (CollectionUtils.isNotEmpty(pictures)) { + approvalDynamicReportedDTO.setDynamicPictures( + pictures.stream().map(dynamicInnerConvertor::toDynamicPictureDTO) + .collect(Collectors.toList())); + } + + return approvalDynamicReportedDTO; + }); + result.setRecords(result.getRecords().stream().filter(Objects::nonNull).collect( + Collectors.toList())); + return result; + } + + @Override + public void report(ApprovalDynamicReportCmd cmd) { + ResponseAssert.isFalse(CommonErrorCode.UPDATE_FAILURE, cmd.getApprovalStatus() == 0); + + for (Long contentId : cmd.getContentIds()) { + + DynamicContent content = dynamicContentService.getById(contentId); + if (Objects.isNull(content)) { + continue; + } + + List complaints = dynamicReportService.getByContentId(contentId); + if (CollectionUtils.isEmpty(complaints)) { + continue; + } + + updateDynamicReport(cmd, complaints); + + if (content.getDel()) { + //如果是已被删除的动态则修改下状态,不做发消息等处理。 + continue; + } + + //举报成功 + if (Objects.equals(cmd.getApprovalStatus(), 1)) { + + dynamicPopularService.removeByDynamicId(content.getId()); + + dynamicContentService.deleteById(content.getId()); + + dynamicMessageService.save(content.getContent(), content.getId(), content.getCreateUser(), + DynamicMessageEnum.DYNAMIC_VIOLATION); + + //发送消息给被举报人 +// newsletterClient.send( +// new NewsletterResultCmd() +// .setUserIds(List.of(content.getCreateUser())) +// .setEvent(NewsletterEvent.DYNAMIC_MESSAGE_QUANTITY) +// .setData(1)); + + //发送消息给举报人 + sendMq(cmd.getApprovalUserId(), content, complaints, DynamicMessageEnum.REPORT_SUCCESS, + ApprovalStatusEnum.PASS); + return; + } + + //举报驳回 + sendMq(cmd.getApprovalUserId(), content, complaints, DynamicMessageEnum.REPORT_FAIL, + ApprovalStatusEnum.NOT_PASS); + } + } + + private void updateDynamicReport(ApprovalDynamicReportCmd cmd, List complaints) { + dynamicReportService.updateDynamicReport(cmd, complaints); + } + + private Set getDynamicIds(PageResult pageResult) { + return pageResult.getRecords().stream().map(DynamicReport::getDynamicContentId) + .collect(Collectors.toSet()); + } + + private void sendMq(Long approvalUserId, DynamicContent content, List complaints, + DynamicMessageEnum type, ApprovalStatusEnum status) { + + senderService.sendEventMessage(MessageEvent.builder() + .consumeId(IdWorkerUtils.getIdStr()) + .tag(ConsoleApprovalSink.TAG) + .body(new ApprovalDynamicEvent() + .setApprovalType(DataApprovalTypeEnum.DYNAMIC_REPORT) + .setOriginType(Boolean.FALSE) + .setApprovalId(IdWorkerUtils.getId()) + .setApprovalUserId(approvalUserId) + .setApprovalStatus(status) + .setWaitApprovalUser( + complaints.parallelStream().map(complaint -> new ApprovalContentEvent() + .setContent(content.getContent()) + .setContentId(content.getId()) + .setUserId(complaint.getCreateUser()) + .setTags(type.name())).filter(Objects::nonNull).collect(Collectors.toList()))) + .build()); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicBlacklistClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicBlacklistClientService.java new file mode 100644 index 00000000..031758d9 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicBlacklistClientService.java @@ -0,0 +1,23 @@ +package com.red.circle.other.app.inner.service.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; + +/** + *

+ * 动态-黑名单 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicBlacklistClientService { + + void deleteByUserId(Long userId); + + void add(DynamicBlacklistCmd cmd); + + PageResult pageDynamicBlacklist(DynamicBlacklistQryCmd query); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicCacheClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicCacheClientService.java new file mode 100644 index 00000000..f9328fd8 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicCacheClientService.java @@ -0,0 +1,20 @@ +package com.red.circle.other.app.inner.service.dynamic; + + +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; + +/** + *

+ * 动态-热门权重分设置 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicCacheClientService { + + DynamicPopularConfigDTO getDynamicPopularConfig(); + + void updateDynamicPopularConfig(DynamicPopularConfigCmd param); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicContentClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicContentClientService.java new file mode 100644 index 00000000..a68f9f37 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicContentClientService.java @@ -0,0 +1,27 @@ +package com.red.circle.other.app.inner.service.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicContentDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicContentClientService { + + PageResult page(DynamicContentQryCmd query); + + void deleteByIds(DelDynamicContentCmd cmd); + + Long countDynamicMessage(Long userId); + + void save(DynamicContentCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicPictureClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicPictureClientService.java new file mode 100644 index 00000000..e6ea67a7 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicPictureClientService.java @@ -0,0 +1,21 @@ +package com.red.circle.other.app.inner.service.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicPictureClientService { + + void save(DynamicPictureCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTagClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTagClientService.java new file mode 100644 index 00000000..606158b7 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTagClientService.java @@ -0,0 +1,25 @@ +package com.red.circle.other.app.inner.service.dynamic; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import java.util.Map; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicTagClientService { + + void addOrUpdate(DynamicTagCmd dynamicTag); + + PageResult pageData(PageDynamicTagQryCmd query); + + Map getAllDynamicTag(); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTimelineClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTimelineClientService.java new file mode 100644 index 00000000..f058a65f --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/DynamicTimelineClientService.java @@ -0,0 +1,22 @@ +package com.red.circle.other.app.inner.service.dynamic; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; + +/** + *

+ * 动态内容 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface DynamicTimelineClientService { + + void save(DynamicTimelineCmd cmd); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/TopDynamicClientService.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/TopDynamicClientService.java new file mode 100644 index 00000000..7a350620 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/TopDynamicClientService.java @@ -0,0 +1,19 @@ +package com.red.circle.other.app.inner.service.dynamic; + + +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; + +/** + *

+ * 排行榜 服务类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +public interface TopDynamicClientService { + + void setUpTop(TopDynamicCmd param); + + void closeTop(Long dynamicId); +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicBlacklistClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicBlacklistClientServiceImpl.java new file mode 100644 index 00000000..c6f25418 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicBlacklistClientServiceImpl.java @@ -0,0 +1,47 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.DynamicBlacklistClientService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicBlacklistService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicBlacklistQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicBlacklistDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-黑名单 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicBlacklistClientServiceImpl implements DynamicBlacklistClientService { + + private final DynamicInnerConvertor dynamicInnerConvertor; + private final DynamicBlacklistService dynamicBlacklistService; + + + @Override + public void deleteByUserId(Long userId) { + dynamicBlacklistService.deleteByUserId(userId); + } + + @Override + public void add(DynamicBlacklistCmd cmd) { + dynamicBlacklistService.add(cmd); + } + + @Override + public PageResult pageDynamicBlacklist(DynamicBlacklistQryCmd query) { + return dynamicBlacklistService.pageDynamicBlacklist(query) + .convert(dynamicInnerConvertor::toDynamicBlacklistDTO); + } + +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicCacheClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicCacheClientServiceImpl.java new file mode 100644 index 00000000..ebaf29fe --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicCacheClientServiceImpl.java @@ -0,0 +1,43 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + +import com.red.circle.other.app.inner.service.dynamic.DynamicCacheClientService; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPopularConfigCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicPopularConfigDTO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + * 动态-缓存 + * + * @author pengliang + * @since 2022/4/12 + */ +@Service +@RequiredArgsConstructor +public class DynamicCacheClientServiceImpl implements DynamicCacheClientService { + + private final DynamicCacheService dynamicCacheService; + + + @Override + public DynamicPopularConfigDTO getDynamicPopularConfig() { + + DynamicPopularConfigDTO vo = new DynamicPopularConfigDTO(); + vo.setLikeScore(dynamicCacheService.getLikeScore()); + vo.setCommentScore(dynamicCacheService.getCommentScore()); + vo.setLevelLimit(dynamicCacheService.getSendLevelLimit()); + vo.setDynamicFees(dynamicCacheService.getSendDynamicFees()); + vo.setQuantityLimit(dynamicCacheService.getSendQuantityLimit()); + return vo; + } + + @Override + public void updateDynamicPopularConfig(DynamicPopularConfigCmd param) { + dynamicCacheService.pushLikeScore(param.getLikeScore()); + dynamicCacheService.pushCommentScore(param.getCommentScore()); + dynamicCacheService.pushSendDynamicFees(param.getDynamicFees()); + dynamicCacheService.pushSendLevelLimit(param.getLevelLimit()); + dynamicCacheService.pushSendQuantityLimit(param.getQuantityLimit()); + } +} diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicContentClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicContentClientServiceImpl.java new file mode 100644 index 00000000..6210d3d8 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicContentClientServiceImpl.java @@ -0,0 +1,107 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.framework.core.response.CommonErrorCode; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.DynamicContentClientService; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicContent; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicContentService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicMessageService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.other.infra.database.rds.service.dynamic.TopDynamicService; +import com.red.circle.other.inner.model.cmd.dynamic.DelDynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicContentQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicContentDTO; +import com.red.circle.other.inner.model.dto.dynamic.PageDynamicContentDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import com.red.circle.tool.core.date.LocalDateTimeUtils; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态内容 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicContentClientServiceImpl implements DynamicContentClientService { + + private final TopDynamicService topDynamicService; + private final DynamicCacheService dynamicCacheService; + private final DynamicContentService dynamicContentService; + private final DynamicInnerConvertor dynamicInnerConvertor; + private final DynamicPictureService dynamicPictureService; + private final DynamicMessageService dynamicMessageService; + private final DynamicTimelineService dynamicTimelineService; + + @Override + public PageResult page(DynamicContentQryCmd query) { + if (query.getStartTime() != null && query.getEndTime() != null){ + query.setStartCreateDate(LocalDateTimeUtils.convert(query.getStartTime())); + query.setEndCreateDate(LocalDateTimeUtils.convert(query.getEndTime())); + } + PageResult pageResult = dynamicContentService.page(query); + Set dynamicIds = getDynamicIds(pageResult); + Map> pictureMap = dynamicPictureService.mapByDynamicIds(dynamicIds); + + return pageResult.convert(vo -> { + List pictures = pictureMap.get(vo.getId()); + if (CollectionUtils.isNotEmpty(pictures)) { + vo.setPictures(pictures.stream().map(dynamicInnerConvertor::toDynamicPictureDTO) + .collect(Collectors.toList())); + } + return vo; + }); + } + + @Override + public void deleteByIds(DelDynamicContentCmd cmd) { + + ResponseAssert.notEmpty(CommonErrorCode.NOT_FOUND_RECORD_INFO, cmd.getIds()); + + dynamicContentService.deleteByIds(cmd); + + dynamicTimelineService.deleteByDynamicContentIds(cmd.getIds()); + + topDynamicService.deleteByDynamicIds(cmd.getIds()); + //移除置顶缓存 + dynamicCacheService.removeTopDynamic(); + + } + + @Override + public Long countDynamicMessage(Long userId) { + return Optional.ofNullable(dynamicMessageService.countDynamicMessage(userId)).orElse(0L); + } + + + private Set getDynamicIds(PageResult iPage) { + return iPage.getRecords().stream().map(PageDynamicContentDTO::getId) + .collect(Collectors.toSet()); + } + + @Override + public void save(DynamicContentCmd cmd) { + DynamicContent dynamicContent = dynamicInnerConvertor.toDynamicContent(cmd); + if (Objects.nonNull(dynamicContent)) { + dynamicContentService.save(dynamicContent); + } + } +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicPictureClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicPictureClientServiceImpl.java new file mode 100644 index 00000000..ca3d9670 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicPictureClientServiceImpl.java @@ -0,0 +1,36 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + + +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.DynamicPictureClientService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态内容 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicPictureClientServiceImpl implements DynamicPictureClientService { + + private final DynamicInnerConvertor dynamicInnerConvertor; + private final DynamicPictureService dynamicPictureService; + + @Override + public void save(DynamicPictureCmd cmd) { + DynamicPicture dynamicPicture= dynamicInnerConvertor.toDynamicPicture(cmd); + if(Objects.nonNull(dynamicPicture)){ + dynamicPictureService.save(dynamicPicture); + } + } +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTagClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTagClientServiceImpl.java new file mode 100644 index 00000000..fdb91d0e --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTagClientServiceImpl.java @@ -0,0 +1,61 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.DynamicTagClientService; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTag; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTagService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTagCmd; +import com.red.circle.other.inner.model.cmd.dynamic.PageDynamicTagQryCmd; +import com.red.circle.other.inner.model.dto.dynamic.DynamicTagDTO; +import com.red.circle.tool.core.collection.CollectionUtils; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态-标签 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicTagClientServiceImpl implements DynamicTagClientService { + + private final DynamicTagService dynamicTagService; + private final DynamicCacheService dynamicCacheService; + private final DynamicInnerConvertor dynamicInnerConvertor; + + @Override + public void addOrUpdate(DynamicTagCmd dynamicTag) { + dynamicTagService.addOrUpdate(dynamicInnerConvertor.toDynamicTag(dynamicTag)); + dynamicCacheService.remove(); + } + + + @Override + public PageResult pageData(PageDynamicTagQryCmd query) { + return dynamicTagService.pageData(query).convert(dynamicInnerConvertor::toDynamicTagDTO); + } + + @Override + public Map getAllDynamicTag() { + LambdaQueryWrapper queryWrapper=new LambdaQueryWrapper<>(); + queryWrapper.eq(DynamicTag::getDel,Boolean.FALSE); + List dynamicTagList = dynamicTagService.list(queryWrapper); + if(CollectionUtils.isEmpty(dynamicTagList)){ + return Collections.emptyMap(); + } + return dynamicTagList.stream().collect(Collectors.toMap(DynamicTag::getTag, dynamicInnerConvertor::toDynamicTagDTO)); + } +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTimelineClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTimelineClientServiceImpl.java new file mode 100644 index 00000000..35f2ea9d --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/DynamicTimelineClientServiceImpl.java @@ -0,0 +1,40 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + + +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.DynamicPictureClientService; +import com.red.circle.other.app.inner.service.dynamic.DynamicTimelineClientService; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicPicture; +import com.red.circle.other.infra.database.rds.entity.dynamic.DynamicTimeline; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicPictureService; +import com.red.circle.other.infra.database.rds.service.dynamic.DynamicTimelineService; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicPictureCmd; +import com.red.circle.other.inner.model.cmd.dynamic.DynamicTimelineCmd; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 动态内容 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class DynamicTimelineClientServiceImpl implements DynamicTimelineClientService { + + private final DynamicInnerConvertor dynamicInnerConvertor; + private final DynamicTimelineService dynamicTimelineService; + + @Override + public void save(DynamicTimelineCmd cmd) { + DynamicTimeline dynamicTimeline= dynamicInnerConvertor.toDynamicTimeline(cmd); + if(Objects.nonNull(dynamicTimeline)){ + dynamicTimelineService.save(dynamicTimeline); + } + } +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/TopDynamicClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/TopDynamicClientServiceImpl.java new file mode 100644 index 00000000..e539ee58 --- /dev/null +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/dynamic/impl/TopDynamicClientServiceImpl.java @@ -0,0 +1,43 @@ +package com.red.circle.other.app.inner.service.dynamic.impl; + +import com.red.circle.other.app.inner.convertor.dynamic.DynamicInnerConvertor; +import com.red.circle.other.app.inner.service.dynamic.TopDynamicClientService; +import com.red.circle.other.infra.database.cache.service.other.DynamicCacheService; +import com.red.circle.other.infra.database.rds.service.dynamic.TopDynamicService; +import com.red.circle.other.inner.model.cmd.dynamic.TopDynamicCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +/** + *

+ * 排行榜 服务实现类. + *

+ * + * @author pengshigang + * @since 2022-06-30 + */ +@Service +@RequiredArgsConstructor +public class TopDynamicClientServiceImpl implements TopDynamicClientService { + + private final TopDynamicService topDynamicService; + private final DynamicCacheService dynamicCacheService; + private final DynamicInnerConvertor dynamicInnerConvertor; + + + @Override + public void setUpTop(TopDynamicCmd param) { + topDynamicService.setUpTop(param); + //移除置顶缓存 + dynamicCacheService.removeTopDynamic(); + + } + + @Override + public void closeTop(Long dynamicId) { + topDynamicService.closeTop(dynamicId); + //移除置顶缓存 + dynamicCacheService.removeTopDynamic(); + } +} + diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/ApprovalPhotoWallClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/ApprovalPhotoWallClientServiceImpl.java index 6564a61c..f1ed9eda 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/ApprovalPhotoWallClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/user/user/impl/ApprovalPhotoWallClientServiceImpl.java @@ -1,12 +1,11 @@ package com.red.circle.other.app.inner.service.user.user.impl; -import com.red.circle.common.business.core.enums.ApprovalStatusEnum; -import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; -import com.red.circle.common.business.core.enums.OpUserType; -import com.red.circle.common.business.enums.ViolationEnum; -import com.red.circle.component.mq.MessageEvent; -import com.red.circle.mq.business.model.event.approval.ApprovalContent; -import com.red.circle.mq.business.model.event.approval.ApprovalEvent; +import com.red.circle.common.business.core.enums.ApprovalStatusEnum; +import com.red.circle.common.business.core.enums.DataApprovalTypeEnum; +import com.red.circle.common.business.enums.ViolationEnum; +import com.red.circle.component.mq.MessageEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalContentEvent; +import com.red.circle.mq.business.model.event.approval.ApprovalDynamicEvent; import com.red.circle.mq.rocket.business.service.MessageSenderService; import com.red.circle.mq.rocket.business.streams.ConsoleApprovalSink; import com.red.circle.other.app.inner.service.user.user.ApprovalPhotoWallClientService; @@ -58,17 +57,17 @@ public class ApprovalPhotoWallClientServiceImpl implements ApprovalPhotoWallClie senderService.sendEventMessage(MessageEvent.builder() .consumeId(IdWorkerUtils.getIdStr()) .tag(ConsoleApprovalSink.TAG) - .body(new ApprovalEvent() - .setApprovalType(DataApprovalTypeEnum.PHOTO_WALL) - .setApprovalId(IdWorkerUtils.getId()) - .setOpsUserId(cmd.getApprovalUserId()) - .setOpUserType(OpUserType.BACK) - .setApprovalStatus(ApprovalStatusEnum.valueOf(cmd.getApprovalStatus())) - .setWaitApprovalUser( - cmd.getParams().parallelStream().map(approvalContent -> new ApprovalContent() - .setContent(approvalContent.getContent()) - .setContentId(approvalContent.getContentId()) - .setUserId(approvalContent.getUserId()) + .body(new ApprovalDynamicEvent() + .setApprovalType(DataApprovalTypeEnum.PHOTO_WALL) + .setOriginType(Boolean.FALSE) + .setApprovalId(IdWorkerUtils.getId()) + .setApprovalUserId(cmd.getApprovalUserId()) + .setApprovalStatus(ApprovalStatusEnum.valueOf(cmd.getApprovalStatus())) + .setWaitApprovalUser( + cmd.getParams().parallelStream().map(approvalContent -> new ApprovalContentEvent() + .setContent(approvalContent.getContent()) + .setContentId(approvalContent.getContentId()) + .setUserId(approvalContent.getUserId()) .setTags(approvalContent.getTags())).filter(Objects::nonNull) .collect(Collectors.toList()))).build());