diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/FriendCheckQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/FriendCheckQryExe.java index 5e1ef799..02ce59c7 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/FriendCheckQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/FriendCheckQryExe.java @@ -1,8 +1,12 @@ package com.red.circle.other.app.command.user.query; import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd; +import com.red.circle.other.infra.database.mongo.entity.sys.CustomerServiceConfig; +import com.red.circle.other.infra.database.mongo.service.sys.CustomerServiceConfigService; import com.red.circle.other.infra.database.rds.service.sys.AdministratorService; import com.red.circle.other.infra.database.rds.service.user.user.RelationshipFriendService; + +import java.util.List; import java.util.Objects; import java.util.Set; import lombok.RequiredArgsConstructor; @@ -19,6 +23,7 @@ public class FriendCheckQryExe { private final AdministratorService administratorService; private final RelationshipFriendService relationshipFriendService; + private final CustomerServiceConfigService customerServiceConfigService; public Boolean execute(AppUserIdCmd cmd) { Boolean isAdmin = administratorService.existsAvailable( @@ -28,6 +33,12 @@ public class FriendCheckQryExe { return Boolean.TRUE; } + List configList = customerServiceConfigService.list(cmd.getReqSysOrigin().getOrigin(), ""); + boolean match = configList.stream().anyMatch(c -> c.getUserId().equals(cmd.getUserId()) || c.getUserId().equals(cmd.getReqUserId())); + if (match) { + return Boolean.TRUE; + } + return relationshipFriendService .checkFriend(cmd.requiredReqUserId(), cmd.getUserId()); }