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