修改删除掉自己的逻辑

This commit is contained in:
hy001 2026-04-28 23:01:46 +08:00
parent 9427b7e41b
commit 9878d6bf81
26 changed files with 376 additions and 217 deletions

View File

@ -39,7 +39,7 @@ public class ActivityAgentAnchorCountRewardCmdExe {
public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO, public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) { List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) {
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
if (Objects.isNull(teamProfile)) { if (Objects.isNull(teamProfile)) {
return ImmutableTriple.of(0L, Lists.newArrayList(), null); return ImmutableTriple.of(0L, Lists.newArrayList(), null);
} }

View File

@ -137,8 +137,8 @@ public class ActivityAgentAnchorReceiveCmdExe {
} }
private TeamProfile getTeamProfile(AppIdLongCmd cmd) { private TeamProfile getTeamProfile(AppIdLongCmd cmd) {
TeamProfile teamProfile = TeamProfile teamProfile =
teamProfileService.getByOwnUserId(cmd.getReqUserId()); teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
return teamProfile; return teamProfile;
} }

View File

@ -41,7 +41,7 @@ public class ActivityAgentMonthTargetRewardCmdExe {
public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO, public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) { List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) {
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
if (Objects.isNull(teamProfile)) { if (Objects.isNull(teamProfile)) {
return ImmutableTriple.of(0L, Lists.newArrayList(), null); return ImmutableTriple.of(0L, Lists.newArrayList(), null);
} }

View File

@ -33,7 +33,7 @@ public class AgentActivityOwnQueryExe {
public AgentActivityOwnCO execute(AppTypeCmd cmd) { public AgentActivityOwnCO execute(AppTypeCmd cmd) {
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
if (Objects.isNull(teamProfile)) { if (Objects.isNull(teamProfile)) {
return null; return null;
} }

View File

@ -91,7 +91,7 @@ public class BdTeamMemberDetailQryExe {
*/ */
private BdTeamMemberDetailCO queryAgencyDetail(Long userId) { private BdTeamMemberDetailCO queryAgencyDetail(Long userId) {
BdTeamMemberDetailCO detail = new BdTeamMemberDetailCO(); BdTeamMemberDetailCO detail = new BdTeamMemberDetailCO();
TeamProfile teamProfile = teamProfileService.getByOwnUserId(userId); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(userId);
ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamProfile); ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamProfile);
// 查询最近2个账单周期 // 查询最近2个账单周期

View File

@ -59,7 +59,7 @@ public class AgentInviteHostExe {
public void execute(AgentInviteHostCmd cmd) { public void execute(AgentInviteHostCmd cmd) {
// 检查权限 // 检查权限
boolean teamOwn = teamProfileService.existsOwnUserId(cmd.getReqUserId()); boolean teamOwn = teamProfileService.existsAvailableOwnUserId(cmd.getReqUserId());
ResponseAssert.isTrue(TeamErrorCode.USER_AGENT_ROLE_INVALID_ERROR, teamOwn); ResponseAssert.isTrue(TeamErrorCode.USER_AGENT_ROLE_INVALID_ERROR, teamOwn);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
@ -159,7 +159,7 @@ public class AgentInviteHostExe {
Objects.equals(message.getGroup(), MessageInviteGroup.AGENT_INVITE_HOST.name()) || Objects.equals(message.getGroup(), MessageInviteGroup.AGENT_INVITE_HOST.name()) ||
StringUtils.isBlank(message.getGroup())); StringUtils.isBlank(message.getGroup()));
TeamProfile teamProfile = teamProfileService.getByOwnUserId(message.getUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(message.getUserId());
ResponseAssert.notNull(TeamErrorCode.USER_AGENT_ROLE_INVALID_ERROR, teamProfile); ResponseAssert.notNull(TeamErrorCode.USER_AGENT_ROLE_INVALID_ERROR, teamProfile);
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,

View File

@ -76,9 +76,9 @@ public class BdAgentInviteExe {
// 用户已经是主播 // 用户已经是主播
ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR, ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR,
teamMemberService.existsMember(cmd.getInviteUserId())); teamMemberService.existsMember(cmd.getInviteUserId()));
// 历史数据问题 用户是代理但是在其他用户名下做主播 导致倒入数据的错误所有这里加一个验证拦截 // 历史数据问题 用户是代理但是在其他用户名下做主播 导致倒入数据的错误所有这里加一个验证拦截
ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR, ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR,
teamProfileService.existsOwnUserId(cmd.getInviteUserId())); teamProfileService.existsAvailableOwnUserId(cmd.getInviteUserId()));
// 用户正在申请加入其他代理 // 用户正在申请加入其他代理
ResponseAssert.isFalse(TeamErrorCode.USER_APPLY_JOIN_OTHER_AGENT, ResponseAssert.isFalse(TeamErrorCode.USER_APPLY_JOIN_OTHER_AGENT,
teamApplicationProcessService.existWaitByUserId(cmd.getInviteUserId())); teamApplicationProcessService.existWaitByUserId(cmd.getInviteUserId()));

View File

@ -2,10 +2,11 @@ package com.red.circle.other.app.command.team.query;
import com.red.circle.framework.core.dto.CommonCommand; import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.util.Objects; import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -20,16 +21,18 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamBdProfileQryExe { public class TeamBdProfileQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final UserProfileGateway userProfileGateway; private final TeamProfileService teamProfileService;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileGateway userProfileGateway;
private final BusinessDevelopmentTeamService businessDevelopmentTeamService; private final UserProfileAppConvertor userProfileAppConvertor;
private final BusinessDevelopmentTeamService businessDevelopmentTeamService;
public UserProfileDTO execute(CommonCommand cmd) {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId()); public UserProfileDTO execute(CommonCommand cmd) {
if (Objects.isNull(teamMember)) { TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
return null; if (Objects.isNull(teamMember)
} || !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
return null;
}
Long bdUserId = businessDevelopmentTeamService.getBdUserIdByTeamId(teamMember.getTeamId()); Long bdUserId = businessDevelopmentTeamService.getBdUserIdByTeamId(teamMember.getTeamId());

View File

@ -18,9 +18,10 @@ import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberSer
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.infra.database.mongo.service.user.region.SysRegionConfigService; import com.red.circle.other.infra.database.mongo.service.user.region.SysRegionConfigService;
import com.red.circle.other.inner.enums.config.EnumConfigKey; import com.red.circle.other.inner.enums.config.EnumConfigKey;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; 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.asserts.team.TeamErrorCode;
import com.red.circle.other.inner.enums.team.TeamMemberRole; import com.red.circle.other.inner.enums.team.TeamMemberRole;
import com.red.circle.other.inner.model.dto.agency.agency.TeamStatus;
import java.util.*; import java.util.*;
@ -51,10 +52,12 @@ public class TeamEntryTeamQryExe {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId()); TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember); ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember);
TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId()); TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId());
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
ResponseAssert.isTrue(TeamErrorCode.TEAM_NOT_FOUND,
UserProfileDTO teamMemberProfile = userProfileAppConvertor.toUserProfileDTO( TeamStatus.AVAILABLE.equals(teamProfile.getStatus()));
UserProfileDTO teamMemberProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(cmd.getReqUserId())); userProfileGateway.getByUserId(cmd.getReqUserId()));
String reviewUserWhitelist = enumConfigCacheService.getValue(EnumConfigKey.REVIEW_USER_WHITELIST, cmd.getReqSysOrigin().getOrigin()); String reviewUserWhitelist = enumConfigCacheService.getValue(EnumConfigKey.REVIEW_USER_WHITELIST, cmd.getReqSysOrigin().getOrigin());

View File

@ -21,7 +21,7 @@ public class TeamExistsMessageTipsQryExe {
private final TeamApplicationProcessService teamApplicationProcessService; private final TeamApplicationProcessService teamApplicationProcessService;
public Boolean execute(AppExtCommand cmd) { public Boolean execute(AppExtCommand cmd) {
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.requiredReqUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.requiredReqUserId());
if (Objects.isNull(teamProfile)) { if (Objects.isNull(teamProfile)) {
return Boolean.FALSE; return Boolean.FALSE;
} }

View File

@ -1,9 +1,12 @@
package com.red.circle.other.app.command.team.query; package com.red.circle.other.app.command.team.query;
import com.red.circle.framework.core.dto.AppCommand; import com.red.circle.framework.core.dto.AppCommand;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import lombok.RequiredArgsConstructor; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import org.springframework.stereotype.Component; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
/** /**
* 是否存在团队成员. * 是否存在团队成员.
@ -12,12 +15,15 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamMemberExistsQryExe { public class TeamMemberExistsQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService;
public boolean execute(AppCommand cmd) {
return teamMemberService.existsMember(cmd.requiredReqUserId()); public boolean execute(AppCommand cmd) {
} TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId());
return Objects.nonNull(teamMember)
} && teamProfileService.checkStatusAvailable(teamMember.getTeamId());
}
}

View File

@ -1,10 +1,11 @@
package com.red.circle.other.app.command.team.query; package com.red.circle.other.app.command.team.query;
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd; import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import java.util.Objects; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import java.util.Optional; import java.util.Objects;
import java.util.Optional;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -15,14 +16,16 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamMemberRoleQryExe { public class TeamMemberRoleQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService;
public String execute(AppIdLongCmd cmd) {
return Optional.ofNullable(teamMemberService.getMember(cmd.getId(), cmd.getReqUserId())) public String execute(AppIdLongCmd cmd) {
.map(TeamMember::getRole) return Optional.ofNullable(teamMemberService.getMember(cmd.getId(), cmd.getReqUserId()))
.map(Objects::toString) .filter(member -> teamProfileService.checkStatusAvailable(member.getTeamId()))
.orElse(""); .map(TeamMember::getRole)
.map(Objects::toString)
.orElse("");
} }
} }

View File

@ -6,10 +6,11 @@ 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.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.clientobject.team.TeamOwnMemberCO; import com.red.circle.other.app.dto.clientobject.team.TeamOwnMemberCO;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.enums.team.TeamMemberRole; import com.red.circle.other.inner.enums.team.TeamMemberRole;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.collection.CollectionUtils;
import java.util.List; import java.util.List;
@ -28,16 +29,19 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamOwnMemberListQryExe { public class TeamOwnMemberListQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final UserProfileGateway userProfileGateway; private final TeamProfileService teamProfileService;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor;
public List<TeamOwnMemberCO> execute(AppExtCommand cmd) { public List<TeamOwnMemberCO> execute(AppExtCommand cmd) {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId()); TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId());
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole())); Objects.nonNull(teamMember)
&& TeamMemberRole.OWN.eq(teamMember.getRole())
&& teamProfileService.checkStatusAvailable(teamMember.getTeamId()));
List<TeamMember> teamMembers = teamMemberService.listTeamMember(teamMember.getTeamId(), List<TeamMember> teamMembers = teamMemberService.listTeamMember(teamMember.getTeamId(),
3000); 3000);

View File

@ -2,11 +2,12 @@ package com.red.circle.other.app.command.team.query;
import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import java.util.Objects; import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -20,15 +21,17 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamOwnProfileQryExe { public class TeamOwnProfileQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final UserProfileGateway userProfileGateway; private final TeamProfileService teamProfileService;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor;
public UserProfileDTO execute(AppExtCommand cmd) {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId()); public UserProfileDTO execute(AppExtCommand cmd) {
if (Objects.isNull(teamMember)) { TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
return null; if (Objects.isNull(teamMember)
} || !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
return null;
}
TeamMember teamOwn = teamMemberService.getTeamOwn(teamMember.getTeamId()); TeamMember teamOwn = teamMemberService.getTeamOwn(teamMember.getTeamId());
if (Objects.isNull(teamOwn)) { if (Objects.isNull(teamOwn)) {

View File

@ -33,7 +33,7 @@ public class TeamProfileByAccountQryExe {
cmd.getAccount())); cmd.getAccount()));
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, userProfile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, userProfile);
TeamProfile profile = teamProfileService.getByOwnUserId(userProfile.getId()); TeamProfile profile = teamProfileService.getAvailableByOwnUserId(userProfile.getId());
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, profile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, profile);
return new TeamProfileSearchResCO() return new TeamProfileSearchResCO()

View File

@ -1,11 +1,12 @@
package com.red.circle.other.app.command.team.query; package com.red.circle.other.app.command.team.query;
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.inner.enums.team.TeamMemberRole; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.inner.enums.team.TeamUserIdentity; import com.red.circle.other.inner.enums.team.TeamMemberRole;
import java.util.Objects; import com.red.circle.other.inner.enums.team.TeamUserIdentity;
import java.util.Objects;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -16,16 +17,18 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class TeamUserIdentityQryExe { public class TeamUserIdentityQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService;
public TeamUserIdentity execute(AppUserIdCmd cmd) {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId()); public TeamUserIdentity execute(AppUserIdCmd cmd) {
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
if (Objects.isNull(teamMember)) {
return TeamUserIdentity.TOURIST; if (Objects.isNull(teamMember)
} || !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
return TeamUserIdentity.TOURIST;
}
return TeamMemberRole.OWN.eq(teamMember.getRole()) return TeamMemberRole.OWN.eq(teamMember.getRole())
? TeamUserIdentity.AGENT ? TeamUserIdentity.AGENT

View File

@ -14,10 +14,11 @@ import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.common.game.GameKtvCommon; import com.red.circle.other.infra.common.game.GameKtvCommon;
import com.red.circle.other.infra.database.cache.service.cp.CpRelationshipCacheService; import com.red.circle.other.infra.database.cache.service.cp.CpRelationshipCacheService;
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager; import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.infra.database.rds.service.live.RoomMemberService;
import com.red.circle.other.inner.enums.live.RoomUserRolesEnum; import com.red.circle.other.inner.enums.live.RoomUserRolesEnum;
import com.red.circle.other.inner.enums.team.TeamMemberRole; import com.red.circle.other.inner.enums.team.TeamMemberRole;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
@ -43,10 +44,11 @@ public class UserProfileCardQryExe {
private final GameKtvCommon gameKtvCommon; private final GameKtvCommon gameKtvCommon;
private final UserSVipGateway userSVipGateway; private final UserSVipGateway userSVipGateway;
private final RoomMemberService roomMemberService; private final RoomMemberService roomMemberService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileAppConvertor userProfileAppConvertor;
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final RedisService redisService; private final TeamProfileService teamProfileService;
private final RedisService redisService;
private final RoomProfileManagerService roomProfileManagerService; private final RoomProfileManagerService roomProfileManagerService;
private final UserRegionGateway userRegionGateway; private final UserRegionGateway userRegionGateway;
private final CpRelationshipCacheService cpRelationshipCacheService; private final CpRelationshipCacheService cpRelationshipCacheService;
@ -59,8 +61,10 @@ public class UserProfileCardQryExe {
AppBusinessUtils.eqSysOrigin(cmd.requireReqSysOrigin())); AppBusinessUtils.eqSysOrigin(cmd.requireReqSysOrigin()));
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId()); TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
Boolean agent = Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole()); Boolean activeTeamMember = Objects.nonNull(teamMember)
Boolean anchor = Objects.nonNull(teamMember); && teamProfileService.checkStatusAvailable(teamMember.getTeamId());
Boolean agent = activeTeamMember && TeamMemberRole.OWN.eq(teamMember.getRole());
Boolean anchor = activeTeamMember;
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile); UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile);
boolean eqRegion = userRegionGateway.checkEqRegion(userProfile.getId(), cmd.requiredReqUserId()); boolean eqRegion = userRegionGateway.checkEqRegion(userProfile.getId(), cmd.requiredReqUserId());
userProfileDTO.setSameRegion(eqRegion); userProfileDTO.setSameRegion(eqRegion);

View File

@ -6,9 +6,11 @@ import com.red.circle.common.business.dto.cmd.AppExtCommand;
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.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService; import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService;
import com.red.circle.other.infra.database.rds.service.team.RoomBdLeadService; import com.red.circle.other.infra.database.rds.service.team.RoomBdLeadService;
import com.red.circle.other.infra.database.rds.service.user.user.InviteUserRegisterService; import com.red.circle.other.infra.database.rds.service.user.user.InviteUserRegisterService;
@ -29,8 +31,9 @@ import org.springframework.stereotype.Component;
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserVoiceRoomAuthCheckQryExe { public class UserVoiceRoomAuthCheckQryExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final RoomBdLeadService roomBdLeadService; private final TeamProfileService teamProfileService;
private final RoomBdLeadService roomBdLeadService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final FreightSellerClient freightSellerClient; private final FreightSellerClient freightSellerClient;
private final FreightBalanceClient freightBalanceClient; private final FreightBalanceClient freightBalanceClient;
@ -77,11 +80,13 @@ public class UserVoiceRoomAuthCheckQryExe {
return inviteUserRegisterService.getUserIdByInviteUserId(cmd.getReqUserId()); return inviteUserRegisterService.getUserIdByInviteUserId(cmd.getReqUserId());
} }
private Boolean checkAuth(SysOriginPlatformEnum sysOrigin, Long userId) { private Boolean checkAuth(SysOriginPlatformEnum sysOrigin, Long userId) {
if (Boolean.TRUE.equals(teamMemberService.existsMember(userId))) { TeamMember teamMember = teamMemberService.getByMemberId(userId);
return Boolean.TRUE; if (Objects.nonNull(teamMember)
} && Boolean.TRUE.equals(teamProfileService.checkStatusAvailable(teamMember.getTeamId()))) {
return Boolean.TRUE;
}
if (Boolean.TRUE.equals(roomBdLeadService.checkBdLeader(userId))) { if (Boolean.TRUE.equals(roomBdLeadService.checkBdLeader(userId))) {
return Boolean.TRUE; return Boolean.TRUE;

View File

@ -77,10 +77,11 @@ public class MemberActiveServiceImpl implements MemberActiveService {
// ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE, // ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE,
// "Permission denied: Not a guild leader", Objects.isNull(familyBaseInfo)); // "Permission denied: Not a guild leader", Objects.isNull(familyBaseInfo));
//判断是否是 agent //判断是否是 agent
ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE, ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE,
"Permission denied: Not a Agent", !teamProfileService.existsOwnUserId(cmd.getReqUserId())); "Permission denied: Not a Agent",
!teamProfileService.existsAvailableOwnUserId(cmd.getReqUserId()));
// 检查工会是否已参与 // 检查工会是否已参与
LambdaQueryWrapper<FamilyActiveRecord> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FamilyActiveRecord> query = new LambdaQueryWrapper<>();

View File

@ -0,0 +1,54 @@
package com.red.circle.other.app.command.team.query;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.inner.enums.team.TeamMemberRole;
import com.red.circle.other.inner.enums.team.TeamUserIdentity;
import org.junit.jupiter.api.Test;
class TeamUserIdentityQryExeTest {
@Test
void executeShouldReturnTouristWhenOwnerTeamIsClosed() {
TeamMemberService teamMemberService = mock(TeamMemberService.class);
TeamProfileService teamProfileService = mock(TeamProfileService.class);
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService);
AppUserIdCmd cmd = new AppUserIdCmd();
cmd.setUserId(100L);
TeamMember teamMember = new TeamMember()
.setMemberId(100L)
.setTeamId(200L)
.setRole(TeamMemberRole.OWN);
when(teamMemberService.getByMemberId(100L)).thenReturn(teamMember);
when(teamProfileService.checkStatusAvailable(200L)).thenReturn(false);
assertEquals(TeamUserIdentity.TOURIST, exe.execute(cmd));
}
@Test
void executeShouldReturnAgentWhenOwnerTeamIsAvailable() {
TeamMemberService teamMemberService = mock(TeamMemberService.class);
TeamProfileService teamProfileService = mock(TeamProfileService.class);
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService);
AppUserIdCmd cmd = new AppUserIdCmd();
cmd.setUserId(100L);
TeamMember teamMember = new TeamMember()
.setMemberId(100L)
.setTeamId(200L)
.setRole(TeamMemberRole.OWN);
when(teamMemberService.getByMemberId(100L)).thenReturn(teamMember);
when(teamProfileService.checkStatusAvailable(200L)).thenReturn(true);
assertEquals(TeamUserIdentity.AGENT, exe.execute(cmd));
}
}

View File

@ -49,7 +49,7 @@ public class TeamMemberAddDecay {
* 添加成员. * 添加成员.
*/ */
public TeamProfile execute(TeamMemberAddCmd param) { public TeamProfile execute(TeamMemberAddCmd param) {
TeamProfile teamProfile = teamProfileService.getByOwnUserId(param.getOwnUserId()); TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(param.getOwnUserId());
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
ResponseAssert.isTrue(TeamErrorCode.TEAM_MEMBER_FULL_ERROR, teamProfile.checkAllowJoinTeam()); ResponseAssert.isTrue(TeamErrorCode.TEAM_MEMBER_FULL_ERROR, teamProfile.checkAllowJoinTeam());
ResponseAssert.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER, ResponseAssert.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER,

View File

@ -81,7 +81,7 @@ public class UpdateMemberTeamDecay {
TeamMember teamMember = teamMemberService.getByMemberId(param.getMemberUserId()); TeamMember teamMember = teamMemberService.getByMemberId(param.getMemberUserId());
ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember); ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember);
TeamProfile newTmpTeamProfile = teamProfileService.getByOwnUserId(param.getOwnUserId()); TeamProfile newTmpTeamProfile = teamProfileService.getAvailableByOwnUserId(param.getOwnUserId());
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, newTmpTeamProfile); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, newTmpTeamProfile);
ResponseAssert.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER, ResponseAssert.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER,

View File

@ -28,10 +28,15 @@ public interface TeamProfileService {
*/ */
void create(TeamProfile teamProfile); void create(TeamProfile teamProfile);
/** /**
* 是否存在团长. * 是否存在团长.
*/ */
boolean existsOwnUserId(Long ownUserId); boolean existsOwnUserId(Long ownUserId);
/**
* 是否存在可用团队团长.
*/
boolean existsAvailableOwnUserId(Long ownUserId);
/** /**
* 修改团队资料. * 修改团队资料.
@ -98,10 +103,15 @@ public interface TeamProfileService {
*/ */
Set<Long> listIdByRegion(String regionId); Set<Long> listIdByRegion(String regionId);
/** /**
* 获取团队资料. * 获取团队资料.
*/ */
TeamProfile getByOwnUserId(Long ownUserId); TeamProfile getByOwnUserId(Long ownUserId);
/**
* 获取可用团队资料.
*/
TeamProfile getAvailableByOwnUserId(Long ownUserId);
/** /**
* 获取团队资料. * 获取团队资料.

View File

@ -53,11 +53,18 @@ public class TeamProfileServiceImpl implements TeamProfileService {
mongoTemplate.save(teamProfile); mongoTemplate.save(teamProfile);
} }
@Override @Override
public boolean existsOwnUserId(Long ownUserId) { public boolean existsOwnUserId(Long ownUserId) {
return mongoTemplate.exists(Query.query(Criteria.where("ownUserId").is(ownUserId)), return mongoTemplate.exists(Query.query(Criteria.where("ownUserId").is(ownUserId)),
TeamProfile.class); TeamProfile.class);
} }
@Override
public boolean existsAvailableOwnUserId(Long ownUserId) {
return mongoTemplate.exists(Query.query(Criteria.where("ownUserId").is(ownUserId)
.and("status").is(TeamStatus.AVAILABLE)),
TeamProfile.class);
}
@Override @Override
public void updateByIdSelective(TeamProfile teamProfile) { public void updateByIdSelective(TeamProfile teamProfile) {
@ -271,13 +278,20 @@ public class TeamProfileServiceImpl implements TeamProfileService {
@Override @Override
public TeamProfile getByOwnUserId(Long ownUserId) { public TeamProfile getByOwnUserId(Long ownUserId) {
return mongoTemplate return mongoTemplate
.findOne(Query.query(Criteria.where("ownUserId").is(ownUserId)), TeamProfile.class); .findOne(Query.query(Criteria.where("ownUserId").is(ownUserId)), TeamProfile.class);
} }
@Override @Override
public List<TeamProfile> getByOwnUserIds(Set<Long> ownUserIds) { public TeamProfile getAvailableByOwnUserId(Long ownUserId) {
return mongoTemplate.findOne(Query.query(Criteria.where("ownUserId").is(ownUserId)
.and("status").is(TeamStatus.AVAILABLE)),
TeamProfile.class);
}
@Override
public List<TeamProfile> getByOwnUserIds(Set<Long> ownUserIds) {
return mongoTemplate.find(Query.query(Criteria.where("ownUserId").in(ownUserIds)), TeamProfile.class); return mongoTemplate.find(Query.query(Criteria.where("ownUserId").in(ownUserIds)), TeamProfile.class);
} }

View File

@ -5,16 +5,18 @@ import com.red.circle.other.infra.database.mongo.entity.team.team.TeamProfile;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamExchangeSurplusTargetService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamExchangeSurplusTargetService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService; import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
import com.red.circle.other.app.inner.convertor.team.AgencyTeamInnerConvertor; import com.red.circle.other.app.inner.convertor.team.AgencyTeamInnerConvertor;
import com.red.circle.other.app.inner.service.team.AgentTeamClientService; import com.red.circle.other.app.inner.service.team.AgentTeamClientService;
import com.red.circle.other.inner.model.dto.agency.agency.TeamExchangeSurplusTargetDTO; import com.red.circle.other.inner.enums.team.TeamMemberRole;
import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO; import com.red.circle.other.inner.model.dto.agency.agency.TeamExchangeSurplusTargetDTO;
import com.red.circle.other.inner.model.dto.agency.agency.TeamProfileDTO; import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO;
import com.red.circle.other.inner.model.dto.agency.agency.UserTeamRegionDTO; import com.red.circle.other.inner.model.dto.agency.agency.TeamProfileDTO;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.other.inner.model.dto.agency.agency.TeamStatus;
import java.util.Collection; import com.red.circle.other.inner.model.dto.agency.agency.UserTeamRegionDTO;
import java.util.List; import com.red.circle.tool.core.collection.CollectionUtils;
import java.util.Map; import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -33,43 +35,50 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
private final AgencyTeamInnerConvertor agencyTeamInnerConvertor; private final AgencyTeamInnerConvertor agencyTeamInnerConvertor;
private final TeamExchangeSurplusTargetService exchangeSurplusTargetService; private final TeamExchangeSurplusTargetService exchangeSurplusTargetService;
@Override @Override
public boolean existsTeamMember(Long userId) { public boolean existsTeamMember(Long userId) {
return teamMemberService.existsMember(userId); return Objects.nonNull(getAvailableProfile(teamMemberService.getByMemberId(userId)));
} }
@Override @Override
public boolean existsTeamOwn(Long userId) { public boolean existsTeamOwn(Long userId) {
return teamMemberService.existsTeamOwn(userId); TeamMember teamMember = teamMemberService.getByMemberId(userId);
} return Objects.nonNull(getAvailableProfile(teamMember))
&& TeamMemberRole.OWN.eq(teamMember.getRole());
}
@Override @Override
public void refreshActiveTime(Long userId) { public void refreshActiveTime(Long userId) {
teamMemberService.updateActiveTimeNow(userId); teamMemberService.updateActiveTimeNow(userId);
} }
@Override @Override
public TeamMemberDTO getByMemberId(Long memberId) { public TeamMemberDTO getByMemberId(Long memberId) {
return agencyTeamInnerConvertor.toTeamMemberDTO(teamMemberService.getByMemberId(memberId)); TeamMember teamMember = teamMemberService.getByMemberId(memberId);
} if (Objects.isNull(getAvailableProfile(teamMember))) {
return null;
@Override }
public TeamProfileDTO getProfileByOwnUserId(Long ownUserId) { return agencyTeamInnerConvertor.toTeamMemberDTO(teamMember);
return agencyTeamInnerConvertor.toTeamProfileDTO(teamProfileService.getByOwnUserId(ownUserId)); }
}
@Override
@Override public TeamProfileDTO getProfileByOwnUserId(Long ownUserId) {
public TeamProfileDTO getProfileByMemberId(Long memberId) { return agencyTeamInnerConvertor.toTeamProfileDTO(
TeamMember teamMember = teamMemberService.getByMemberId(memberId); teamProfileService.getAvailableByOwnUserId(ownUserId));
if (Objects.isNull(teamMember)) { }
return null;
} @Override
return agencyTeamInnerConvertor.toTeamProfileDTO( public TeamProfileDTO getProfileByMemberId(Long memberId) {
teamProfileService.getById(teamMember.getTeamId())); TeamMember teamMember = teamMemberService.getByMemberId(memberId);
TeamProfile teamProfile = getAvailableProfile(teamMember);
} if (Objects.isNull(teamProfile)) {
return null;
}
return agencyTeamInnerConvertor.toTeamProfileDTO(teamProfile);
}
@Override @Override
public List<UserTeamRegionDTO> listUserTeamRegion(Set<Long> userIds) { public List<UserTeamRegionDTO> listUserTeamRegion(Set<Long> userIds) {
@ -79,19 +88,23 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
return CollectionUtils.newArrayList(); return CollectionUtils.newArrayList();
} }
Map<Long, TeamProfile> teamProfilesMap = teamProfileService.mapProfileByIds( Map<Long, TeamProfile> teamProfilesMap = teamProfileService.listStatusAvailable(
teamMembers.stream().map(TeamMember::getTeamId).collect(Collectors.toSet())); teamMembers.stream().map(TeamMember::getTeamId).collect(Collectors.toSet()))
.stream()
if (CollectionUtils.isEmpty(teamProfilesMap)) { .collect(Collectors.toMap(TeamProfile::getId, v -> v));
return CollectionUtils.newArrayList();
} if (CollectionUtils.isEmpty(teamProfilesMap)) {
return CollectionUtils.newArrayList();
return teamMembers.stream().map(member -> new UserTeamRegionDTO() }
.setUserId(member.getMemberId())
.setSysOrigin(member.getSysOrigin()) return teamMembers.stream()
.setTeamId(member.getTeamId()) .filter(member -> teamProfilesMap.containsKey(member.getTeamId()))
.setRegionId(teamProfilesMap.get(member.getTeamId()).getRegion()) .map(member -> new UserTeamRegionDTO()
).toList(); .setUserId(member.getMemberId())
.setSysOrigin(member.getSysOrigin())
.setTeamId(member.getTeamId())
.setRegionId(teamProfilesMap.get(member.getTeamId()).getRegion())
).toList();
} }
@Override @Override
@ -104,10 +117,27 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
return agencyTeamInnerConvertor.toMapTeamMemberDTO(teamMemberService.mapByMemberIds(memberIds)); return agencyTeamInnerConvertor.toMapTeamMemberDTO(teamMemberService.mapByMemberIds(memberIds));
} }
@Override @Override
public List<Long> listMemberIds(Set<Long> userIds) { public List<Long> listMemberIds(Set<Long> userIds) {
return teamMemberService.listMemberIds(userIds); List<TeamMember> teamMembers = teamMemberService.listByMemberIds(userIds);
} if (CollectionUtils.isEmpty(teamMembers)) {
return CollectionUtils.newArrayList();
}
Set<Long> availableTeamIds = teamProfileService.listStatusAvailable(
teamMembers.stream().map(TeamMember::getTeamId).collect(Collectors.toSet()))
.stream()
.map(TeamProfile::getId)
.collect(Collectors.toSet());
if (CollectionUtils.isEmpty(availableTeamIds)) {
return CollectionUtils.newArrayList();
}
return teamMembers.stream()
.filter(member -> availableTeamIds.contains(member.getTeamId()))
.map(TeamMember::getMemberId)
.toList();
}
@Override @Override
public TeamProfileDTO getProfileById(Long id) { public TeamProfileDTO getProfileById(Long id) {
@ -125,10 +155,21 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
@Override @Override
public String getTotalAmountUsd(Long userId, String sysOrigin, Integer dateNumber) { public String getTotalAmountUsd(Long userId, String sysOrigin, Integer dateNumber) {
return exchangeSurplusTargetService.getTotalAmountUsd(userId, sysOrigin, dateNumber); return exchangeSurplusTargetService.getTotalAmountUsd(userId, sysOrigin, dateNumber);
} }
private TeamProfile getAvailableProfile(TeamMember teamMember) {
} if (Objects.isNull(teamMember)) {
return null;
}
TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId());
if (Objects.isNull(teamProfile) || !TeamStatus.AVAILABLE.equals(teamProfile.getStatus())) {
return null;
}
return teamProfile;
}
}

View File

@ -135,10 +135,15 @@ public class TeamProfileClientServiceImpl implements TeamProfileClientService {
return teamInfraConvertor.toListTeamMemberDTO(teamMemberService.listByMemberIds(memberIds)); return teamInfraConvertor.toListTeamMemberDTO(teamMemberService.listByMemberIds(memberIds));
} }
@Override @Override
public TeamMemberDTO getByMemberId(Long userId) { public TeamMemberDTO getByMemberId(Long userId) {
return teamInfraConvertor.toTeamMemberDTO(teamMemberService.getByMemberId(userId)); TeamMember teamMember = teamMemberService.getByMemberId(userId);
} if (Objects.isNull(teamMember)
|| !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
return null;
}
return teamInfraConvertor.toTeamMemberDTO(teamMember);
}
@Override @Override
public List<TeamApplicationProcessApprovalDTO> listProcessApprovalByCondition( public List<TeamApplicationProcessApprovalDTO> listProcessApprovalByCondition(