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); + +}