Commit ac969509 by 刘宇峰

用户组织feign开放接口

1 parent 02e73f50
......@@ -8,6 +8,11 @@ import lombok.experimental.Accessors;
public class FindUserRequest {
/**
* 组织id
*/
private Long orgId;
/**
* 用户名
*/
private String username;
......
......@@ -8,6 +8,7 @@ import java.io.Serializable;
public class Organization implements Serializable {
private Long id;
private Long parentId;
private String orgName;
}
......@@ -5,19 +5,26 @@ import cn.com.glsx.usercenter.api.feign.factory.OrganizationServiceFallbackFacto
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(
name = "${feign.usercenter.name}",
path = "${feign.usercenter.path}" + "/api/org",
contextId = "apiorgz",
path = "${feign.usercenter.path}" + "/org",
contextId = "feignorgz",
fallbackFactory = OrganizationServiceFallbackFactory.class,
decode404 = true
)
public interface OrganizationService {
@GetMapping(value = "/getAllSuperiorBySubId")
R<List<Organization>> getAllSuperiorBySubId(Long subOrgId);
@GetMapping(value = "/getSuperiorsBySubId")
R<List<Organization>> getSuperiorsBySubId(@RequestParam("subOrgId") Long subOrgId);
@GetMapping(value = "/getRootOrgs")
R<List<Organization>> getRootOrganizations();
@GetMapping(value = "/getSubOrgs")
R<List<Organization>> getSubOrganizations(@RequestParam("orgId") Long orgId);
}
......@@ -12,8 +12,8 @@ import java.util.List;
@FeignClient(
name = "${feign.usercenter.name}",
path = "${feign.usercenter.path}" + "/api/user",
contextId = "apiuser",
path = "${feign.usercenter.path}" + "/user",
contextId = "feignuser",
fallbackFactory = UserServiceFallbackFactory.class,
decode404 = true
)
......@@ -25,4 +25,7 @@ public interface UserService {
@GetMapping(value = "/findByUser")
R<List<User>> findByUser(FindUserRequest request);
@GetMapping(value = "/findByOrg")
R<List<User>> findByOrg(FindUserRequest request);
}
......@@ -17,7 +17,19 @@ public class OrganizationServiceFallbackImpl implements OrganizationService {
private Throwable cause;
@Override
public R<List<Organization>> getAllSuperiorBySubId(Long subOrgId) {
public R<List<Organization>> getSuperiorsBySubId(Long subOrgId) {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
@Override
public R<List<Organization>> getRootOrganizations() {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
@Override
public R<List<Organization>> getSubOrganizations(Long orgId) {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
......
......@@ -29,4 +29,10 @@ public class UserServiceFallbackImpl implements UserService {
return R.ok();
}
@Override
public R<List<User>> findByOrg(FindUserRequest request) {
log.warn("熔断啦 {}", cause.getMessage());
return R.ok();
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!