17 changed files with 151 additions and 4 deletions
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.feign; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.UserDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.fallback.UserFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
|
||||
|
/** |
||||
|
* 用户接口 |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_USER_SERVER, fallback = UserFeignClientFallback.class) |
||||
|
public interface UserFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @param userId |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.UserDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 查询用户基础信息 |
||||
|
* @Date 2019/12/16 9:57 |
||||
|
**/ |
||||
|
@GetMapping("app-user/epdc-app/user/getById/{userId}") |
||||
|
Result<UserDTO> getUserInfoById(@PathVariable("userId") String userId); |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.elink.esua.epdc.modules.feign.fallback; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.constant.ServiceConstant; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.ModuleUtils; |
||||
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
||||
|
import com.elink.esua.epdc.dto.UserDTO; |
||||
|
import com.elink.esua.epdc.modules.feign.UserFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* 用户接口 Fallback |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class UserFeignClientFallback implements UserFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<UserDTO> getUserInfoById(String userId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_USER_SERVER, "getUserInfoById", userId); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue