From 5ff660ad042aeb71b0569639ea668a629c14b556 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 15 Aug 2025 00:25:22 +0800 Subject: [PATCH] =?UTF-8?q?other=20=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/h5/MemberActiveController.java | 18 +++++-- .../user/user/UserIdentityServiceImpl.java | 33 +++++++++++++ .../other/app/dto/h5/UserIdentityVO.java | 47 +++++++++++++++++++ .../user/user/UserIdentityService.java | 12 +++++ 4 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/h5/UserIdentityVO.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java index 76b5ce8c..7685ad32 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/h5/MemberActiveController.java @@ -3,13 +3,13 @@ package com.red.circle.other.adapter.app.h5; import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.framework.web.controller.BaseController; import com.red.circle.other.app.dto.h5.MemberActiveDTO; +import com.red.circle.other.app.dto.h5.UserIdentityVO; import com.red.circle.other.app.service.h5.MemberActiveService; +import com.red.circle.other.app.service.user.user.UserCountService; +import com.red.circle.other.app.service.user.user.UserIdentityService; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RequiredArgsConstructor @RestController @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController; public class MemberActiveController extends BaseController { private final MemberActiveService memberActiveService; + private final UserIdentityService userIdentityService; /** * 工会裂变活动列表、 @@ -36,4 +37,13 @@ public class MemberActiveController extends BaseController { public void joinActive(AppExtCommand cmd) { memberActiveService.joinActive(cmd); } + + /** + * 用户身份信息. + */ + @GetMapping("{userId}/identity") + public UserIdentityVO getUserIdentity(@PathVariable("userId") Long userId) { + return userIdentityService.getUserIdentity(userId); + } + } diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java new file mode 100644 index 00000000..86b3a8a6 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityServiceImpl.java @@ -0,0 +1,33 @@ +package com.red.circle.other.app.service.user.user; + + +import com.red.circle.framework.core.asserts.ResponseAssert; +import com.red.circle.other.app.dto.h5.UserIdentityVO; +import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient; +import com.red.circle.other.inner.enums.team.TeamMemberRole; +import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO; +import com.red.circle.wallet.inner.endpoint.freight.FreightGoldClient; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +@Service +@RequiredArgsConstructor +public class UserIdentityServiceImpl implements UserIdentityService { + + private final TeamProfileClient teamProfileClient; + private final FreightGoldClient freightGoldClient; + + @Override + public UserIdentityVO getUserIdentity(Long userId) { + TeamMemberDTO teamMember = ResponseAssert.requiredSuccess( + teamProfileClient.getByMemberId(userId)); + return new UserIdentityVO() + .setAgent(Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole())) + .setAnchor(Objects.nonNull(teamMember)) + .setFreightAgent( + ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userId))); + } + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/h5/UserIdentityVO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/h5/UserIdentityVO.java new file mode 100644 index 00000000..9e2e067b --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/h5/UserIdentityVO.java @@ -0,0 +1,47 @@ +package com.red.circle.other.app.dto.h5; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +@Data +@Accessors(chain = true) +public class UserIdentityVO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * true:代理,false:不是. + */ + private Boolean agent; + + /** + * true:主播,false:不是. + */ + private Boolean anchor; + + /** + * true:bd,false:不是. + */ + private Boolean bd; + + /** + * true:bd Leader,false:不是. + */ + private Boolean bdLeader; + + /** + * 货运代理: true:是 false:不是. + */ + private Boolean freightAgent; + + /** + * 历史身份. + */ + private List historyIdentity; + +} \ No newline at end of file diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java new file mode 100644 index 00000000..8c0dea40 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/user/user/UserIdentityService.java @@ -0,0 +1,12 @@ +package com.red.circle.other.app.service.user.user; + +import com.red.circle.other.app.dto.h5.UserIdentityVO; + +public interface UserIdentityService { + + /** + * 用户身份信息. + */ + UserIdentityVO getUserIdentity(Long userId); + +}