主服务增加fegin接口调用
This commit is contained in:
parent
045214ae80
commit
7475f9d75d
@ -57,7 +57,7 @@ public interface LauncherConstant {
|
|||||||
/**
|
/**
|
||||||
* nacos test 地址
|
* nacos test 地址
|
||||||
*/
|
*/
|
||||||
String NACOS_TEST_ADDR = "172.30.0.48:8848";
|
String NACOS_TEST_ADDR = "172.19.2.126:30848";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sentinel dev 地址
|
* sentinel dev 地址
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>blade-service-api</artifactId>
|
<artifactId>blade-service-api</artifactId>
|
||||||
<groupId>org.springblade</groupId>
|
<groupId>org.springblade</groupId>
|
||||||
|
|||||||
@ -53,6 +53,8 @@ public interface ISysClient {
|
|||||||
String DEPT_NAME = API_PREFIX + "/dept-name";
|
String DEPT_NAME = API_PREFIX + "/dept-name";
|
||||||
String DEPT_NAMES = API_PREFIX + "/dept-names";
|
String DEPT_NAMES = API_PREFIX + "/dept-names";
|
||||||
String DEPT_CHILD = API_PREFIX + "/dept-child";
|
String DEPT_CHILD = API_PREFIX + "/dept-child";
|
||||||
|
String CURRENT_USER_COMPANY = API_PREFIX + "/current-user-company";
|
||||||
|
String CURRENT_USER_DEPT = API_PREFIX + "/current-user-dept";
|
||||||
String POST = API_PREFIX + "/post";
|
String POST = API_PREFIX + "/post";
|
||||||
String POST_IDS = API_PREFIX + "/post-ids";
|
String POST_IDS = API_PREFIX + "/post-ids";
|
||||||
String POST_IDS_FUZZY = API_PREFIX + "/post-ids-fuzzy";
|
String POST_IDS_FUZZY = API_PREFIX + "/post-ids-fuzzy";
|
||||||
@ -136,6 +138,22 @@ public interface ISysClient {
|
|||||||
@GetMapping(DEPT_CHILD)
|
@GetMapping(DEPT_CHILD)
|
||||||
R<List<Dept>> getDeptChild(@RequestParam("deptId") Long deptId);
|
R<List<Dept>> getDeptChild(@RequestParam("deptId") Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户所属公司
|
||||||
|
*
|
||||||
|
* @return Dept
|
||||||
|
*/
|
||||||
|
@GetMapping(CURRENT_USER_COMPANY)
|
||||||
|
R<Dept> getCurrentUserCompany();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录用户所属部门
|
||||||
|
*
|
||||||
|
* @return Dept
|
||||||
|
*/
|
||||||
|
@GetMapping(CURRENT_USER_DEPT)
|
||||||
|
R<Dept> getCurrentUserDept();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取岗位
|
* 获取岗位
|
||||||
*
|
*
|
||||||
|
|||||||
@ -74,6 +74,16 @@ public class ISysClientFallback implements ISysClient {
|
|||||||
return R.fail("获取数据失败");
|
return R.fail("获取数据失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<Dept> getCurrentUserCompany() {
|
||||||
|
return R.fail("获取数据失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<Dept> getCurrentUserDept() {
|
||||||
|
return R.fail("获取数据失败");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<Post> getPost(Long id) {
|
public R<Post> getPost(Long id) {
|
||||||
return R.fail("获取数据失败");
|
return R.fail("获取数据失败");
|
||||||
|
|||||||
@ -26,8 +26,10 @@
|
|||||||
package org.springblade.system.feign;
|
package org.springblade.system.feign;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tenant.annotation.NonDS;
|
import org.springblade.core.tenant.annotation.NonDS;
|
||||||
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.api.R;
|
||||||
|
import org.springblade.core.tool.utils.Func;
|
||||||
import org.springblade.system.pojo.entity.*;
|
import org.springblade.system.pojo.entity.*;
|
||||||
import org.springblade.system.service.*;
|
import org.springblade.system.service.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -103,6 +105,52 @@ public class SysClient implements ISysClient {
|
|||||||
return R.data(deptService.getDeptChild(deptId));
|
return R.data(deptService.getDeptChild(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping(CURRENT_USER_COMPANY)
|
||||||
|
public R<Dept> getCurrentUserCompany() {
|
||||||
|
Long deptId = Func.firstLong(AuthUtil.getDeptId());
|
||||||
|
if (Func.isEmpty(deptId)) {
|
||||||
|
return R.data(null);
|
||||||
|
}
|
||||||
|
Dept company = findCompanyByDeptId(deptId);
|
||||||
|
return R.data(company);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GetMapping(CURRENT_USER_DEPT)
|
||||||
|
public R<Dept> getCurrentUserDept() {
|
||||||
|
Long deptId = Func.firstLong(AuthUtil.getDeptId());
|
||||||
|
if (Func.isEmpty(deptId)) {
|
||||||
|
return R.data(null);
|
||||||
|
}
|
||||||
|
Dept dept = deptService.getById(deptId);
|
||||||
|
if (dept != null && Integer.valueOf(2).equals(dept.getDeptCategory())) {
|
||||||
|
return R.data(dept);
|
||||||
|
}
|
||||||
|
return R.data(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ID向上查找所属公司(dept_category = 1)
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
|
* @return 公司信息
|
||||||
|
*/
|
||||||
|
private Dept findCompanyByDeptId(Long deptId) {
|
||||||
|
Dept current = deptService.getById(deptId);
|
||||||
|
while (current != null) {
|
||||||
|
if (Integer.valueOf(1).equals(current.getDeptCategory())) {
|
||||||
|
return current;
|
||||||
|
}
|
||||||
|
Long parentId = current.getParentId();
|
||||||
|
if (Func.isEmpty(parentId) || parentId <= 0L) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
current = deptService.getById(parentId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<Post> getPost(Long id) {
|
public R<Post> getPost(Long id) {
|
||||||
return R.data(postService.getById(id));
|
return R.data(postService.getById(id));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user