From eba0a1e93d4562c6cdad4b8c0224eb9fe88ca649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=BA=E6=98=8E=20=E6=B2=88?= <2431685932@qq.com> Date: Sat, 20 Jul 2024 20:49:13 +0800 Subject: [PATCH] feat: address rpc --- .../share/infra/rpc/AddressRpc.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 schisandra-cloud-storage-share/schisandra-cloud-storage-share-infra/src/main/java/com/schisandra/share/infra/rpc/AddressRpc.java diff --git a/schisandra-cloud-storage-share/schisandra-cloud-storage-share-infra/src/main/java/com/schisandra/share/infra/rpc/AddressRpc.java b/schisandra-cloud-storage-share/schisandra-cloud-storage-share-infra/src/main/java/com/schisandra/share/infra/rpc/AddressRpc.java new file mode 100644 index 0000000..bc2c68e --- /dev/null +++ b/schisandra-cloud-storage-share/schisandra-cloud-storage-share-infra/src/main/java/com/schisandra/share/infra/rpc/AddressRpc.java @@ -0,0 +1,40 @@ +package com.schisandra.share.infra.rpc;; + +import com.schisandra.auth.api.SchisandraAuthFeignService; +import com.schisandra.auth.entity.Result; +import com.schisandra.auth.entity.SchisandraAuthAddressDTO; +import com.schisandra.share.infra.entity.AuthUserAddressEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.annotation.Resource; + + +/** + * @Classname UserRpc + * @BelongsProject: schisandra-cloud-storage + * @BelongsPackage: com.schisandra.share.infra.rpc + * @Author: landaiqing + * @CreateTime: 2024-07-15 09:48 + * @Description: TODO + * @Version: 1.0 + */ +@Component +public class AddressRpc { + @Resource + private SchisandraAuthFeignService schisandraAuthFeignService; + + public AuthUserAddressEntity getUserAddress(@RequestParam("userId") String userId){ + Result result = schisandraAuthFeignService.getUserAddress(userId); + AuthUserAddressEntity authUserAddressEntity = new AuthUserAddressEntity(); + if (!result.getSuccess()) { + return authUserAddressEntity; + } + SchisandraAuthAddressDTO data = result.getData(); + authUserAddressEntity.setId(data.getId()); + authUserAddressEntity.setUserId(data.getUserId()); + authUserAddressEntity.setLocation(data.getLocation()); + authUserAddressEntity.setBrowser(data.getBrowser()); + return authUserAddressEntity; + } +} \ No newline at end of file