修改删除掉自己的逻辑
This commit is contained in:
parent
9427b7e41b
commit
9878d6bf81
@ -39,7 +39,7 @@ public class ActivityAgentAnchorCountRewardCmdExe {
|
||||
public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
|
||||
List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) {
|
||||
|
||||
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId());
|
||||
TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamProfile)) {
|
||||
return ImmutableTriple.of(0L, Lists.newArrayList(), null);
|
||||
}
|
||||
|
||||
@ -137,8 +137,8 @@ public class ActivityAgentAnchorReceiveCmdExe {
|
||||
}
|
||||
|
||||
private TeamProfile getTeamProfile(AppIdLongCmd cmd) {
|
||||
TeamProfile teamProfile =
|
||||
teamProfileService.getByOwnUserId(cmd.getReqUserId());
|
||||
TeamProfile teamProfile =
|
||||
teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
|
||||
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
|
||||
return teamProfile;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class ActivityAgentMonthTargetRewardCmdExe {
|
||||
public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
|
||||
List<ActivityRewardProps>>>, Long> execute(AppExtCommand cmd) {
|
||||
|
||||
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId());
|
||||
TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamProfile)) {
|
||||
return ImmutableTriple.of(0L, Lists.newArrayList(), null);
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public class AgentActivityOwnQueryExe {
|
||||
|
||||
public AgentActivityOwnCO execute(AppTypeCmd cmd) {
|
||||
|
||||
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.getReqUserId());
|
||||
TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamProfile)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class BdTeamMemberDetailQryExe {
|
||||
*/
|
||||
private BdTeamMemberDetailCO queryAgencyDetail(Long userId) {
|
||||
BdTeamMemberDetailCO detail = new BdTeamMemberDetailCO();
|
||||
TeamProfile teamProfile = teamProfileService.getByOwnUserId(userId);
|
||||
TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(userId);
|
||||
ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamProfile);
|
||||
|
||||
// 查询最近2个账单周期
|
||||
|
||||
@ -59,7 +59,7 @@ public class AgentInviteHostExe {
|
||||
|
||||
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);
|
||||
|
||||
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
|
||||
@ -159,7 +159,7 @@ public class AgentInviteHostExe {
|
||||
Objects.equals(message.getGroup(), MessageInviteGroup.AGENT_INVITE_HOST.name()) ||
|
||||
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.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
|
||||
@ -76,9 +76,9 @@ public class BdAgentInviteExe {
|
||||
// 用户已经是主播
|
||||
ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR,
|
||||
teamMemberService.existsMember(cmd.getInviteUserId()));
|
||||
// 历史数据问题: 用户是代理但是在其他用户名下做主播, 导致倒入数据的错误;所有这里加一个验证拦截
|
||||
ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR,
|
||||
teamProfileService.existsOwnUserId(cmd.getInviteUserId()));
|
||||
// 历史数据问题: 用户是代理但是在其他用户名下做主播, 导致倒入数据的错误;所有这里加一个验证拦截
|
||||
ResponseAssert.isFalse(TeamErrorCode.USER_IS_ALREADY_A_ANCHOR,
|
||||
teamProfileService.existsAvailableOwnUserId(cmd.getInviteUserId()));
|
||||
// 用户正在申请加入其他代理
|
||||
ResponseAssert.isFalse(TeamErrorCode.USER_APPLY_JOIN_OTHER_AGENT,
|
||||
teamApplicationProcessService.existWaitByUserId(cmd.getInviteUserId()));
|
||||
|
||||
@ -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.other.app.convertor.user.UserProfileAppConvertor;
|
||||
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.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService;
|
||||
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.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.BusinessDevelopmentTeamService;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -20,16 +21,18 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class TeamBdProfileQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final BusinessDevelopmentTeamService businessDevelopmentTeamService;
|
||||
|
||||
public UserProfileDTO execute(CommonCommand cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamMember)) {
|
||||
return null;
|
||||
}
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final BusinessDevelopmentTeamService businessDevelopmentTeamService;
|
||||
|
||||
public UserProfileDTO execute(CommonCommand cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamMember)
|
||||
|| !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Long bdUserId = businessDevelopmentTeamService.getBdUserIdByTeamId(teamMember.getTeamId());
|
||||
|
||||
|
||||
@ -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.user.region.SysRegionConfigService;
|
||||
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.asserts.team.TeamErrorCode;
|
||||
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.asserts.team.TeamErrorCode;
|
||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamStatus;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -51,10 +52,12 @@ public class TeamEntryTeamQryExe {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
|
||||
ResponseAssert.notNull(TeamErrorCode.NOT_TEAM_MEMBER, teamMember);
|
||||
|
||||
TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId());
|
||||
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
|
||||
|
||||
UserProfileDTO teamMemberProfile = userProfileAppConvertor.toUserProfileDTO(
|
||||
TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId());
|
||||
ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile);
|
||||
ResponseAssert.isTrue(TeamErrorCode.TEAM_NOT_FOUND,
|
||||
TeamStatus.AVAILABLE.equals(teamProfile.getStatus()));
|
||||
|
||||
UserProfileDTO teamMemberProfile = userProfileAppConvertor.toUserProfileDTO(
|
||||
userProfileGateway.getByUserId(cmd.getReqUserId()));
|
||||
|
||||
String reviewUserWhitelist = enumConfigCacheService.getValue(EnumConfigKey.REVIEW_USER_WHITELIST, cmd.getReqSysOrigin().getOrigin());
|
||||
|
||||
@ -21,7 +21,7 @@ public class TeamExistsMessageTipsQryExe {
|
||||
private final TeamApplicationProcessService teamApplicationProcessService;
|
||||
|
||||
public Boolean execute(AppExtCommand cmd) {
|
||||
TeamProfile teamProfile = teamProfileService.getByOwnUserId(cmd.requiredReqUserId());
|
||||
TeamProfile teamProfile = teamProfileService.getAvailableByOwnUserId(cmd.requiredReqUserId());
|
||||
if (Objects.isNull(teamProfile)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
package com.red.circle.other.app.command.team.query;
|
||||
|
||||
import com.red.circle.framework.core.dto.AppCommand;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.red.circle.framework.core.dto.AppCommand;
|
||||
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 java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 是否存在团队成员.
|
||||
@ -12,12 +15,15 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class TeamMemberExistsQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
|
||||
public boolean execute(AppCommand cmd) {
|
||||
return teamMemberService.existsMember(cmd.requiredReqUserId());
|
||||
}
|
||||
|
||||
}
|
||||
public class TeamMemberExistsQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
|
||||
public boolean execute(AppCommand cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId());
|
||||
return Objects.nonNull(teamMember)
|
||||
&& teamProfileService.checkStatusAvailable(teamMember.getTeamId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package com.red.circle.other.app.command.team.query;
|
||||
|
||||
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.service.team.team.TeamMemberService;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
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.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -15,14 +16,16 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class TeamMemberRoleQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
|
||||
public String execute(AppIdLongCmd cmd) {
|
||||
return Optional.ofNullable(teamMemberService.getMember(cmd.getId(), cmd.getReqUserId()))
|
||||
.map(TeamMember::getRole)
|
||||
.map(Objects::toString)
|
||||
.orElse("");
|
||||
public class TeamMemberRoleQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
|
||||
public String execute(AppIdLongCmd cmd) {
|
||||
return Optional.ofNullable(teamMemberService.getMember(cmd.getId(), cmd.getReqUserId()))
|
||||
.filter(member -> teamProfileService.checkStatusAvailable(member.getTeamId()))
|
||||
.map(TeamMember::getRole)
|
||||
.map(Objects::toString)
|
||||
.orElse("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,10 +6,11 @@ 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.team.TeamOwnMemberCO;
|
||||
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.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
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.service.team.team.TeamMemberService;
|
||||
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.tool.core.collection.CollectionUtils;
|
||||
import java.util.List;
|
||||
@ -28,16 +29,19 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class TeamOwnMemberListQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public List<TeamOwnMemberCO> execute(AppExtCommand cmd) {
|
||||
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId());
|
||||
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole()));
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.requiredReqUserId());
|
||||
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
Objects.nonNull(teamMember)
|
||||
&& TeamMemberRole.OWN.eq(teamMember.getRole())
|
||||
&& teamProfileService.checkStatusAvailable(teamMember.getTeamId()));
|
||||
|
||||
List<TeamMember> teamMembers = teamMemberService.listTeamMember(teamMember.getTeamId(),
|
||||
3000);
|
||||
|
||||
@ -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.other.app.convertor.user.UserProfileAppConvertor;
|
||||
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.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||
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.service.team.team.TeamMemberService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,15 +21,17 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class TeamOwnProfileQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public UserProfileDTO execute(AppExtCommand cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamMember)) {
|
||||
return null;
|
||||
}
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
|
||||
public UserProfileDTO execute(AppExtCommand cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getReqUserId());
|
||||
if (Objects.isNull(teamMember)
|
||||
|| !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
|
||||
return null;
|
||||
}
|
||||
TeamMember teamOwn = teamMemberService.getTeamOwn(teamMember.getTeamId());
|
||||
|
||||
if (Objects.isNull(teamOwn)) {
|
||||
|
||||
@ -33,7 +33,7 @@ public class TeamProfileByAccountQryExe {
|
||||
cmd.getAccount()));
|
||||
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);
|
||||
|
||||
return new TeamProfileSearchResCO()
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.red.circle.other.app.command.team.query;
|
||||
|
||||
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.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.enums.team.TeamUserIdentity;
|
||||
import java.util.Objects;
|
||||
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 java.util.Objects;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -16,16 +17,18 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class TeamUserIdentityQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
|
||||
public TeamUserIdentity execute(AppUserIdCmd cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
|
||||
|
||||
if (Objects.isNull(teamMember)) {
|
||||
return TeamUserIdentity.TOURIST;
|
||||
}
|
||||
public class TeamUserIdentityQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
|
||||
public TeamUserIdentity execute(AppUserIdCmd cmd) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
|
||||
|
||||
if (Objects.isNull(teamMember)
|
||||
|| !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
|
||||
return TeamUserIdentity.TOURIST;
|
||||
}
|
||||
|
||||
return TeamMemberRole.OWN.eq(teamMember.getRole())
|
||||
? TeamUserIdentity.AGENT
|
||||
|
||||
@ -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.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.team.team.TeamMember;
|
||||
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.rds.service.live.RoomMemberService;
|
||||
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.team.team.TeamMemberService;
|
||||
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.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
@ -43,10 +44,11 @@ public class UserProfileCardQryExe {
|
||||
private final GameKtvCommon gameKtvCommon;
|
||||
private final UserSVipGateway userSVipGateway;
|
||||
private final RoomMemberService roomMemberService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final RedisService redisService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final RedisService redisService;
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
private final UserRegionGateway userRegionGateway;
|
||||
private final CpRelationshipCacheService cpRelationshipCacheService;
|
||||
@ -59,8 +61,10 @@ public class UserProfileCardQryExe {
|
||||
AppBusinessUtils.eqSysOrigin(cmd.requireReqSysOrigin()));
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
|
||||
|
||||
Boolean agent = Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole());
|
||||
Boolean anchor = Objects.nonNull(teamMember);
|
||||
Boolean activeTeamMember = Objects.nonNull(teamMember)
|
||||
&& teamProfileService.checkStatusAvailable(teamMember.getTeamId());
|
||||
Boolean agent = activeTeamMember && TeamMemberRole.OWN.eq(teamMember.getRole());
|
||||
Boolean anchor = activeTeamMember;
|
||||
UserProfileDTO userProfileDTO = userProfileAppConvertor.toUserProfileDTO(userProfile);
|
||||
boolean eqRegion = userRegionGateway.checkEqRegion(userProfile.getId(), cmd.requiredReqUserId());
|
||||
userProfileDTO.setSameRegion(eqRegion);
|
||||
|
||||
@ -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.response.CommonErrorCode;
|
||||
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.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
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.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.RoomBdLeadService;
|
||||
import com.red.circle.other.infra.database.rds.service.user.user.InviteUserRegisterService;
|
||||
@ -29,8 +31,9 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class UserVoiceRoomAuthCheckQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final RoomBdLeadService roomBdLeadService;
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final RoomBdLeadService roomBdLeadService;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final FreightSellerClient freightSellerClient;
|
||||
private final FreightBalanceClient freightBalanceClient;
|
||||
@ -77,11 +80,13 @@ public class UserVoiceRoomAuthCheckQryExe {
|
||||
return inviteUserRegisterService.getUserIdByInviteUserId(cmd.getReqUserId());
|
||||
}
|
||||
|
||||
private Boolean checkAuth(SysOriginPlatformEnum sysOrigin, Long userId) {
|
||||
|
||||
if (Boolean.TRUE.equals(teamMemberService.existsMember(userId))) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
private Boolean checkAuth(SysOriginPlatformEnum sysOrigin, Long userId) {
|
||||
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(userId);
|
||||
if (Objects.nonNull(teamMember)
|
||||
&& Boolean.TRUE.equals(teamProfileService.checkStatusAvailable(teamMember.getTeamId()))) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(roomBdLeadService.checkBdLeader(userId))) {
|
||||
return Boolean.TRUE;
|
||||
|
||||
@ -77,10 +77,11 @@ public class MemberActiveServiceImpl implements MemberActiveService {
|
||||
// ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE,
|
||||
// "Permission denied: Not a guild leader", Objects.isNull(familyBaseInfo));
|
||||
|
||||
//判断是否是 agent
|
||||
|
||||
ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE,
|
||||
"Permission denied: Not a Agent", !teamProfileService.existsOwnUserId(cmd.getReqUserId()));
|
||||
//判断是否是 agent
|
||||
|
||||
ResponseAssert.isFalse(CommonErrorCode.SAVE_FAILURE,
|
||||
"Permission denied: Not a Agent",
|
||||
!teamProfileService.existsAvailableOwnUserId(cmd.getReqUserId()));
|
||||
|
||||
// 检查工会是否已参与
|
||||
LambdaQueryWrapper<FamilyActiveRecord> query = new LambdaQueryWrapper<>();
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class TeamMemberAddDecay {
|
||||
* 添加成员.
|
||||
*/
|
||||
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.isTrue(TeamErrorCode.TEAM_MEMBER_FULL_ERROR, teamProfile.checkAllowJoinTeam());
|
||||
ResponseAssert.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER,
|
||||
|
||||
@ -81,7 +81,7 @@ public class UpdateMemberTeamDecay {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(param.getMemberUserId());
|
||||
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.isFalse(TeamErrorCode.USER_ALREADY_TEAM_MEMBER,
|
||||
|
||||
@ -28,10 +28,15 @@ public interface TeamProfileService {
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 获取团队资料.
|
||||
*/
|
||||
TeamProfile getByOwnUserId(Long ownUserId);
|
||||
/**
|
||||
* 获取团队资料.
|
||||
*/
|
||||
TeamProfile getByOwnUserId(Long ownUserId);
|
||||
|
||||
/**
|
||||
* 获取可用团队资料.
|
||||
*/
|
||||
TeamProfile getAvailableByOwnUserId(Long ownUserId);
|
||||
|
||||
/**
|
||||
* 获取团队资料.
|
||||
|
||||
@ -53,11 +53,18 @@ public class TeamProfileServiceImpl implements TeamProfileService {
|
||||
mongoTemplate.save(teamProfile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsOwnUserId(Long ownUserId) {
|
||||
return mongoTemplate.exists(Query.query(Criteria.where("ownUserId").is(ownUserId)),
|
||||
TeamProfile.class);
|
||||
}
|
||||
@Override
|
||||
public boolean existsOwnUserId(Long ownUserId) {
|
||||
return mongoTemplate.exists(Query.query(Criteria.where("ownUserId").is(ownUserId)),
|
||||
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
|
||||
public void updateByIdSelective(TeamProfile teamProfile) {
|
||||
@ -271,13 +278,20 @@ public class TeamProfileServiceImpl implements TeamProfileService {
|
||||
|
||||
|
||||
@Override
|
||||
public TeamProfile getByOwnUserId(Long ownUserId) {
|
||||
return mongoTemplate
|
||||
.findOne(Query.query(Criteria.where("ownUserId").is(ownUserId)), TeamProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeamProfile> getByOwnUserIds(Set<Long> ownUserIds) {
|
||||
public TeamProfile getByOwnUserId(Long ownUserId) {
|
||||
return mongoTemplate
|
||||
.findOne(Query.query(Criteria.where("ownUserId").is(ownUserId)), TeamProfile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@ -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.TeamMemberService;
|
||||
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.service.team.AgentTeamClientService;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamExchangeSurplusTargetDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.UserTeamRegionDTO;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamExchangeSurplusTargetDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.TeamStatus;
|
||||
import com.red.circle.other.inner.model.dto.agency.agency.UserTeamRegionDTO;
|
||||
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.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@ -33,43 +35,50 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final AgencyTeamInnerConvertor agencyTeamInnerConvertor;
|
||||
private final TeamExchangeSurplusTargetService exchangeSurplusTargetService;
|
||||
|
||||
@Override
|
||||
public boolean existsTeamMember(Long userId) {
|
||||
return teamMemberService.existsMember(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsTeamOwn(Long userId) {
|
||||
return teamMemberService.existsTeamOwn(userId);
|
||||
}
|
||||
private final TeamExchangeSurplusTargetService exchangeSurplusTargetService;
|
||||
|
||||
@Override
|
||||
public boolean existsTeamMember(Long userId) {
|
||||
return Objects.nonNull(getAvailableProfile(teamMemberService.getByMemberId(userId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean existsTeamOwn(Long userId) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(userId);
|
||||
return Objects.nonNull(getAvailableProfile(teamMember))
|
||||
&& TeamMemberRole.OWN.eq(teamMember.getRole());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshActiveTime(Long userId) {
|
||||
teamMemberService.updateActiveTimeNow(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamMemberDTO getByMemberId(Long memberId) {
|
||||
return agencyTeamInnerConvertor.toTeamMemberDTO(teamMemberService.getByMemberId(memberId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProfileDTO getProfileByOwnUserId(Long ownUserId) {
|
||||
return agencyTeamInnerConvertor.toTeamProfileDTO(teamProfileService.getByOwnUserId(ownUserId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProfileDTO getProfileByMemberId(Long memberId) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(memberId);
|
||||
if (Objects.isNull(teamMember)) {
|
||||
return null;
|
||||
}
|
||||
return agencyTeamInnerConvertor.toTeamProfileDTO(
|
||||
teamProfileService.getById(teamMember.getTeamId()));
|
||||
|
||||
}
|
||||
@Override
|
||||
public TeamMemberDTO getByMemberId(Long memberId) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(memberId);
|
||||
if (Objects.isNull(getAvailableProfile(teamMember))) {
|
||||
return null;
|
||||
}
|
||||
return agencyTeamInnerConvertor.toTeamMemberDTO(teamMember);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProfileDTO getProfileByOwnUserId(Long ownUserId) {
|
||||
return agencyTeamInnerConvertor.toTeamProfileDTO(
|
||||
teamProfileService.getAvailableByOwnUserId(ownUserId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamProfileDTO getProfileByMemberId(Long memberId) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(memberId);
|
||||
TeamProfile teamProfile = getAvailableProfile(teamMember);
|
||||
if (Objects.isNull(teamProfile)) {
|
||||
return null;
|
||||
}
|
||||
return agencyTeamInnerConvertor.toTeamProfileDTO(teamProfile);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserTeamRegionDTO> listUserTeamRegion(Set<Long> userIds) {
|
||||
@ -79,19 +88,23 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
|
||||
return CollectionUtils.newArrayList();
|
||||
}
|
||||
|
||||
Map<Long, TeamProfile> teamProfilesMap = teamProfileService.mapProfileByIds(
|
||||
teamMembers.stream().map(TeamMember::getTeamId).collect(Collectors.toSet()));
|
||||
|
||||
if (CollectionUtils.isEmpty(teamProfilesMap)) {
|
||||
return CollectionUtils.newArrayList();
|
||||
}
|
||||
|
||||
return teamMembers.stream().map(member -> new UserTeamRegionDTO()
|
||||
.setUserId(member.getMemberId())
|
||||
.setSysOrigin(member.getSysOrigin())
|
||||
.setTeamId(member.getTeamId())
|
||||
.setRegionId(teamProfilesMap.get(member.getTeamId()).getRegion())
|
||||
).toList();
|
||||
Map<Long, TeamProfile> teamProfilesMap = teamProfileService.listStatusAvailable(
|
||||
teamMembers.stream().map(TeamMember::getTeamId).collect(Collectors.toSet()))
|
||||
.stream()
|
||||
.collect(Collectors.toMap(TeamProfile::getId, v -> v));
|
||||
|
||||
if (CollectionUtils.isEmpty(teamProfilesMap)) {
|
||||
return CollectionUtils.newArrayList();
|
||||
}
|
||||
|
||||
return teamMembers.stream()
|
||||
.filter(member -> teamProfilesMap.containsKey(member.getTeamId()))
|
||||
.map(member -> new UserTeamRegionDTO()
|
||||
.setUserId(member.getMemberId())
|
||||
.setSysOrigin(member.getSysOrigin())
|
||||
.setTeamId(member.getTeamId())
|
||||
.setRegionId(teamProfilesMap.get(member.getTeamId()).getRegion())
|
||||
).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,10 +117,27 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
|
||||
return agencyTeamInnerConvertor.toMapTeamMemberDTO(teamMemberService.mapByMemberIds(memberIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> listMemberIds(Set<Long> userIds) {
|
||||
return teamMemberService.listMemberIds(userIds);
|
||||
}
|
||||
@Override
|
||||
public List<Long> listMemberIds(Set<Long> 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
|
||||
public TeamProfileDTO getProfileById(Long id) {
|
||||
@ -125,10 +155,21 @@ public class AgentTeamClientServiceImpl implements AgentTeamClientService {
|
||||
|
||||
|
||||
@Override
|
||||
public String getTotalAmountUsd(Long userId, String sysOrigin, Integer dateNumber) {
|
||||
|
||||
return exchangeSurplusTargetService.getTotalAmountUsd(userId, sysOrigin, dateNumber);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public String getTotalAmountUsd(Long userId, String sysOrigin, Integer 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -135,10 +135,15 @@ public class TeamProfileClientServiceImpl implements TeamProfileClientService {
|
||||
return teamInfraConvertor.toListTeamMemberDTO(teamMemberService.listByMemberIds(memberIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamMemberDTO getByMemberId(Long userId) {
|
||||
return teamInfraConvertor.toTeamMemberDTO(teamMemberService.getByMemberId(userId));
|
||||
}
|
||||
@Override
|
||||
public TeamMemberDTO getByMemberId(Long userId) {
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(userId);
|
||||
if (Objects.isNull(teamMember)
|
||||
|| !teamProfileService.checkStatusAvailable(teamMember.getTeamId())) {
|
||||
return null;
|
||||
}
|
||||
return teamInfraConvertor.toTeamMemberDTO(teamMember);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeamApplicationProcessApprovalDTO> listProcessApprovalByCondition(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user