用户关注推送消息
This commit is contained in:
parent
03131de124
commit
0d6b5919af
@ -190,7 +190,14 @@ public enum OfficialNoticeTypeEnum {
|
|||||||
/**
|
/**
|
||||||
* 用户告白
|
* 用户告白
|
||||||
*/
|
*/
|
||||||
USER_CONFESSION;
|
USER_CONFESSION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户关注
|
||||||
|
*/
|
||||||
|
USER_FOLLOW
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
public String getTitle(Locale locale) {
|
public String getTitle(Locale locale) {
|
||||||
|
|||||||
@ -221,6 +221,9 @@ public enum UserErrorCode implements IResponseErrorCode {
|
|||||||
// 密码不正确
|
// 密码不正确
|
||||||
,PASSWORD_NOT_MATCH(4074, "password is incorrect")
|
,PASSWORD_NOT_MATCH(4074, "password is incorrect")
|
||||||
|
|
||||||
|
// 用户已关注
|
||||||
|
,USER_FOLLOWED(4075, "This user has followed"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,11 @@ public class UserSupportRelationRestController extends BaseController {
|
|||||||
return userRelationInterviewService.followOrCancel(cmd);
|
return userRelationInterviewService.followOrCancel(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/follow-new")
|
||||||
|
public Boolean follow(@RequestBody @Validated AppUserIdCmd cmd) {
|
||||||
|
return userRelationInterviewService.follow(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 我的关注列表.
|
* 我的关注列表.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,10 +2,15 @@ package com.red.circle.other.app.command.user;
|
|||||||
|
|
||||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||||
import com.red.circle.external.inner.endpoint.message.ImGroupClient;
|
import com.red.circle.external.inner.endpoint.message.ImGroupClient;
|
||||||
|
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
|
||||||
import com.red.circle.external.inner.model.cmd.message.GroupUnbanCmd;
|
import com.red.circle.external.inner.model.cmd.message.GroupUnbanCmd;
|
||||||
|
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd;
|
||||||
|
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||||
import com.red.circle.mq.rocket.business.producer.TaskMqMessage;
|
import com.red.circle.mq.rocket.business.producer.TaskMqMessage;
|
||||||
|
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||||
|
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
import com.red.circle.other.domain.gateway.user.ability.UserRelationsCalculatorGateway;
|
import com.red.circle.other.domain.gateway.user.ability.UserRelationsCalculatorGateway;
|
||||||
import com.red.circle.other.domain.model.user.ability.UserRelationsCalculator;
|
import com.red.circle.other.domain.model.user.ability.UserRelationsCalculator;
|
||||||
@ -19,6 +24,7 @@ import com.red.circle.other.infra.database.rds.service.user.user.RelationshipFri
|
|||||||
import com.red.circle.other.infra.database.rds.service.user.user.ShieldBlackService;
|
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.infra.database.rds.service.user.user.UserSubscriptionService;
|
||||||
import com.red.circle.other.inner.asserts.user.UserRelationErrorCode;
|
import com.red.circle.other.inner.asserts.user.UserRelationErrorCode;
|
||||||
|
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.tool.core.date.TimestampUtils;
|
import com.red.circle.tool.core.date.TimestampUtils;
|
||||||
import com.red.circle.tool.core.text.StringUtils;
|
import com.red.circle.tool.core.text.StringUtils;
|
||||||
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
||||||
@ -45,6 +51,8 @@ public class UserSupportRelationFollowOrCancelCmdExe {
|
|||||||
private final ImGroupClient imGroupClient;
|
private final ImGroupClient imGroupClient;
|
||||||
private final ShieldBlackService shieldBlackService;
|
private final ShieldBlackService shieldBlackService;
|
||||||
private final RoomUserBlacklistService roomUserBlacklistService;
|
private final RoomUserBlacklistService roomUserBlacklistService;
|
||||||
|
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||||
|
private final OfficialNoticeClient officialNoticeClient;
|
||||||
private final RoomProfileManagerService roomProfileManagerService;
|
private final RoomProfileManagerService roomProfileManagerService;
|
||||||
private final RelationshipFriendService relationshipFriendService;
|
private final RelationshipFriendService relationshipFriendService;
|
||||||
|
|
||||||
@ -57,6 +65,15 @@ public class UserSupportRelationFollowOrCancelCmdExe {
|
|||||||
: subscription(cmd);
|
: subscription(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean follow(AppUserIdCmd cmd) {
|
||||||
|
// 不可操作自己
|
||||||
|
ResponseAssert.notEquals(UserErrorCode.NOT_OPERATION_ME, cmd.requiredReqUserId(),cmd.getUserId());
|
||||||
|
boolean checkedSubscription = userSubscriptionService.checkSubscription(cmd.requiredReqUserId(), cmd.getUserId());
|
||||||
|
ResponseAssert.isFalse(UserErrorCode.USER_FOLLOWED, checkedSubscription);
|
||||||
|
|
||||||
|
return subscription(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
private Boolean subscription(AppUserIdCmd cmd) {
|
private Boolean subscription(AppUserIdCmd cmd) {
|
||||||
|
|
||||||
// 无法操作,错误归属
|
// 无法操作,错误归属
|
||||||
@ -111,6 +128,14 @@ public class UserSupportRelationFollowOrCancelCmdExe {
|
|||||||
roomUserBlacklistService.removeBlack(roomProfile.getId(), cmd.requiredReqUserId());
|
roomUserBlacklistService.removeBlack(roomProfile.getId(), cmd.requiredReqUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId()));
|
||||||
|
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
|
||||||
|
.toAccount(cmd.getUserId())
|
||||||
|
.noticeType(OfficialNoticeTypeEnum.USER_FOLLOW)
|
||||||
|
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
|
||||||
|
.build()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
|
|||||||
@ -53,6 +53,11 @@ public class UserSupportRelationServiceImpl implements UserSupportRelationServic
|
|||||||
return userSupportRelationFollowOrCancelCmdExe.execute(cmd);
|
return userSupportRelationFollowOrCancelCmdExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean follow(AppUserIdCmd cmd) {
|
||||||
|
return userSupportRelationFollowOrCancelCmdExe.follow(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserSupportRelationCO> listUserFollow(AppFlowCmd cmd) {
|
public List<UserSupportRelationCO> listUserFollow(AppFlowCmd cmd) {
|
||||||
return userRelationFollowQryExe.execute(cmd);
|
return userRelationFollowQryExe.execute(cmd);
|
||||||
|
|||||||
@ -22,6 +22,8 @@ public interface UserSupportRelationService {
|
|||||||
|
|
||||||
Boolean followOrCancel(AppUserIdCmd cmd);
|
Boolean followOrCancel(AppUserIdCmd cmd);
|
||||||
|
|
||||||
|
Boolean follow(AppUserIdCmd cmd);
|
||||||
|
|
||||||
List<UserSupportRelationCO> listUserFollow(AppFlowCmd cmd);
|
List<UserSupportRelationCO> listUserFollow(AppFlowCmd cmd);
|
||||||
|
|
||||||
Boolean checkFollow(AppUserIdCmd cmd);
|
Boolean checkFollow(AppUserIdCmd cmd);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user