Commit efed2738 by 刘宇峰

用户组织feign开放接口

1 parent 137b35a2
...@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
/**
* 不需要登录的接口
*/
@FeignClient( @FeignClient(
name = "${feign.usercenter.name}", name = "${feign.usercenter.name}",
path = "${feign.usercenter.path}" + "/api/user", path = "${feign.usercenter.path}" + "/api/user",
...@@ -19,9 +22,21 @@ import java.util.List; ...@@ -19,9 +22,21 @@ import java.util.List;
) )
public interface ApiUserService { public interface ApiUserService {
/**
* 根据账号名获取用户列表
*
* @param account
* @return
*/
@GetMapping(value = "/findByAccount", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findByAccount", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findByAccount(@RequestParam("account") String account); R<List<User>> findByAccount(@RequestParam("account") String account);
/**
* 根据用户名获取用户列表
*
* @param username
* @return
*/
@GetMapping(value = "/findByUsername", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findByUsername", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findByUsername(@RequestParam("username") String username); R<List<User>> findByUsername(@RequestParam("username") String username);
......
...@@ -13,7 +13,7 @@ import java.util.List; ...@@ -13,7 +13,7 @@ import java.util.List;
@FeignClient( @FeignClient(
name = "${feign.usercenter.name}", name = "${feign.usercenter.name}",
path = "${feign.usercenter.path}" + "/org", path = "${feign.usercenter.path}" + "/forg",
contextId = "feignorgz", contextId = "feignorgz",
fallbackFactory = OrganizationServiceFallbackFactory.class, fallbackFactory = OrganizationServiceFallbackFactory.class,
decode404 = true decode404 = true
...@@ -30,13 +30,13 @@ public interface OrganizationService { ...@@ -30,13 +30,13 @@ public interface OrganizationService {
R<List<Organization>> getTenantPathsByUserId(@RequestParam("userId") Long userId); R<List<Organization>> getTenantPathsByUserId(@RequestParam("userId") Long userId);
/** /**
* 根据userIds获取租户机构 * 根据userIds获取租户及(下级)机构
* *
* @param userIds * @param userIds
* @return * @return
*/ */
@GetMapping(value = "/getTenantByUserIds", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/getTenantPathsByUserId", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<Organization>> getTenantByUserIds(@RequestParam("userIds") List<Long> userIds); R<List<Organization>> getTenantPathsByUserId(@RequestParam("userIds") List<Long> userIds);
/** /**
......
...@@ -20,18 +20,47 @@ import java.util.List; ...@@ -20,18 +20,47 @@ import java.util.List;
) )
public interface UserService { public interface UserService {
/**
* 获取所有(特定租户)用户
*
* @return
*/
@GetMapping(value = "/findAll", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findAll", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findAll(); R<List<User>> findAll();
/**
* 根据id获取用户信息
*
* @param id
* @return
*/
@GetMapping(value = "/getById", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/getById", consumes = MediaType.APPLICATION_JSON_VALUE)
R<User> getById(@RequestParam("id") Long id); R<User> getById(@RequestParam("id") Long id);
/**
* 根据用户信息查询用户
*
* @param request
* @return
*/
@GetMapping(value = "/findByUser", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findByUser", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findByUser(FindUserRequest request); R<List<User>> findByUser(FindUserRequest request);
/**
* 根据组织信息查询当前组织下面的用户
*
* @param request
* @return
*/
@GetMapping(value = "/findByOrg", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findByOrg", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findByOrg(FindUserRequest request); R<List<User>> findByOrg(FindUserRequest request);
/**
* 根据组织信息查询整个组织层级下的用户
*
* @param request
* @return
*/
@GetMapping(value = "/findAllByOrg", consumes = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/findAllByOrg", consumes = MediaType.APPLICATION_JSON_VALUE)
R<List<User>> findAllByOrg(FindUserRequest request); R<List<User>> findAllByOrg(FindUserRequest request);
......
...@@ -24,7 +24,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService { ...@@ -24,7 +24,7 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
} }
@Override @Override
public R<List<Organization>> getTenantByUserIds(List<Long> userIds) { public R<List<Organization>> getTenantPathsByUserId(List<Long> userIds) {
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!