|
@@ -1,19 +1,22 @@
|
|
package com.wtkj.controller;
|
|
package com.wtkj.controller;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.wtkj.entity.DeptToDept;
|
|
import com.wtkj.entity.DeptToDept;
|
|
|
|
+import com.wtkj.service.IContactsService;
|
|
import com.wtkj.service.IDeptToDeptService;
|
|
import com.wtkj.service.IDeptToDeptService;
|
|
import com.wtkj.vo.AuthUserInfo;
|
|
import com.wtkj.vo.AuthUserInfo;
|
|
import com.wtkj.wrapper.UserListWrapper;
|
|
import com.wtkj.wrapper.UserListWrapper;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.entity.Dept;
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.feign.ISysClient;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.entity.User;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
import org.springblade.system.user.feign.IUserClient;
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
+import org.springblade.system.vo.DeptVO;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
@@ -34,6 +37,7 @@ public class CommonController {
|
|
private final IDeptToDeptService deptToDeptService;
|
|
private final IDeptToDeptService deptToDeptService;
|
|
private final ISysClient sysClient;
|
|
private final ISysClient sysClient;
|
|
private final IUserClient userClient;
|
|
private final IUserClient userClient;
|
|
|
|
+ private final IContactsService contactsService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 当前登录用户信息
|
|
* 当前登录用户信息
|
|
@@ -69,24 +73,36 @@ public class CommonController {
|
|
* 本机构下的机构
|
|
* 本机构下的机构
|
|
*/
|
|
*/
|
|
@GetMapping("/dept-by-parentId")
|
|
@GetMapping("/dept-by-parentId")
|
|
- @ApiOperation(value = "机构下的子机构", notes = "传入上级机构id")
|
|
|
|
|
|
+ @ApiOperation(value = "内部通讯录or懒加载树形结构", notes = "传入上级机构id")
|
|
@ApiOperationSupport(order = 4)
|
|
@ApiOperationSupport(order = 4)
|
|
- public R<List<Dept>> deptList(@RequestParam Long parentId) {
|
|
|
|
- List<Dept> result = new ArrayList<>();
|
|
|
|
- R<List<Dept>> rpc = sysClient.getDeptChildByParentId(parentId);
|
|
|
|
- if (rpc.isSuccess() && !CollectionUtils.isEmpty(rpc.getData())) {
|
|
|
|
- result.addAll(rpc.getData());
|
|
|
|
|
|
+ public R<List<DeptVO>> deptList(@RequestParam Long parentId) {
|
|
|
|
+ List<DeptVO> res = new ArrayList<>();
|
|
|
|
+ R<List<DeptVO>> rpc = sysClient.getDeptLazyList(parentId);
|
|
|
|
+ if (rpc.isSuccess()) {
|
|
|
|
+ res = rpc.getData();
|
|
}
|
|
}
|
|
- return R.data(result);
|
|
|
|
|
|
+ return R.data(res);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 机构下的人
|
|
|
|
|
|
+ * 外部联系人
|
|
*/
|
|
*/
|
|
- @GetMapping("/get-user-list")
|
|
|
|
|
|
+ @GetMapping("/outer-dept")
|
|
|
|
+ @ApiOperation(value = "外部联系人", notes = "传入登录用户的topDept,分页参数")
|
|
@ApiOperationSupport(order = 5)
|
|
@ApiOperationSupport(order = 5)
|
|
- @ApiOperation(value = "机构下用户列表", notes = "")
|
|
|
|
- public R getUserList(@RequestParam Long deptId, String name) {
|
|
|
|
|
|
+ public R address(@RequestParam Long topDept, Query query) {
|
|
|
|
+ IPage<DeptVO> page = contactsService.deptPage(topDept, query);
|
|
|
|
+ return R.data(page);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 搜索用户
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("/get-user-list")
|
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
|
+ @ApiOperation(value = "搜索用户", notes = "")
|
|
|
|
+ public R getUserList(@RequestParam Long deptId, @RequestParam String name) {
|
|
List<User> list = new ArrayList<>();
|
|
List<User> list = new ArrayList<>();
|
|
R<List<User>> rpc = userClient.getDeptUserList(deptId, name);
|
|
R<List<User>> rpc = userClient.getDeptUserList(deptId, name);
|
|
if (rpc.isSuccess()) {
|
|
if (rpc.isSuccess()) {
|