7 changed files with 149 additions and 2 deletions
@ -0,0 +1,40 @@ |
|||||
|
package com.elink.esua.epdc.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.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.feign.fallback.AdminFeignClientFallback; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
|
||||
|
/** |
||||
|
* @author zhangyong |
||||
|
* @date 18:40 2020-05-19 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPDC_ADMIN_SERVER, fallback = AdminFeignClientFallback.class) |
||||
|
public interface AdminFeignClient { |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据部门ID获取所有上级机构名称和ID拼接 |
||||
|
* |
||||
|
* @param deptId |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.CompleteDeptDTO> |
||||
|
* @author lipengfei |
||||
|
* @date 2019/11/27 09:31 |
||||
|
*/ |
||||
|
@GetMapping("sys/dept/getParentAndAllDept/{deptId}") |
||||
|
Result<ParentAndAllDeptDTO> getParentAndAllDept(@PathVariable("deptId") Long deptId); |
||||
|
|
||||
|
/** |
||||
|
* 根据部门id,获取所有上级部门id,英文逗号隔开拼接字符串 |
||||
|
* |
||||
|
* @param deptId |
||||
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<java.lang.String> |
||||
|
* @author work@yujt.net.cn |
||||
|
* @date 2019/11/27 15:07 |
||||
|
*/ |
||||
|
@GetMapping("sys/dept/getParentDeptIds/{deptId}") |
||||
|
Result<String> getParentDeptIds(@PathVariable("deptId") Long deptId); |
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.elink.esua.epdc.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.ParentAndAllDeptDTO; |
||||
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @author zhangyong |
||||
|
* @date 18:40 2020-05-19 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class AdminFeignClientFallback implements AdminFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<ParentAndAllDeptDTO> getParentAndAllDept(Long deptId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getParentAndAllDept", deptId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<String> getParentDeptIds(Long deptId) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPDC_ADMIN_SERVER, "getParentDeptIds", deptId); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue