Commit 4d2bef6d by 刘宇峰

用户组织feign开放接口

1 parent 21522612
...@@ -24,4 +24,9 @@ public class User implements Serializable { ...@@ -24,4 +24,9 @@ public class User implements Serializable {
*/ */
private String account; private String account;
/**
* 映射id,可能是用户上级id,也可能是用户下级id
*/
private Long mId;
} }
...@@ -9,6 +9,7 @@ import org.springframework.http.MediaType; ...@@ -9,6 +9,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List; import java.util.List;
@FeignClient( @FeignClient(
...@@ -38,6 +39,24 @@ public interface UserService { ...@@ -38,6 +39,24 @@ public interface UserService {
R<User> getById(@RequestParam("id") Long id); R<User> getById(@RequestParam("id") Long id);
/** /**
* 根据id获取上级用户信息
*
* @param id
* @return
*/
@GetMapping(value = "/getSuperiorUserById", consumes = MediaType.APPLICATION_JSON_VALUE)
R<User> getSuperiorUserById(@RequestParam("id") Long id);
/**
* 根据id获取上级用户信息
*
* @param userIds
* @return
*/
@GetMapping(value = "/getSuperiorUserByIds", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> getSuperiorUserByIds(@RequestParam("userIds") Collection<Long> userIds);
/**
* 根据用户信息查询用户 * 根据用户信息查询用户
* *
* @param request * @param request
......
...@@ -8,6 +8,7 @@ import lombok.Setter; ...@@ -8,6 +8,7 @@ import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
...@@ -30,6 +31,18 @@ public class UserServiceFallbackImpl implements UserService { ...@@ -30,6 +31,18 @@ public class UserServiceFallbackImpl implements UserService {
} }
@Override @Override
public R<User> getSuperiorUserById(Long id) {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
@Override
public R<List<User>> getSuperiorUserByIds(Collection<Long> userIds) {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
@Override
public R<List<User>> findByUser(FindUserRequest request) { public R<List<User>> findByUser(FindUserRequest request) {
log.warn("熔断啦 {}", cause.getMessage()); log.warn("熔断啦 {}", cause.getMessage());
return R.ok(); return R.ok();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!