|
|
@@ -1,15 +1,21 @@
|
|
|
package com.usoftchina.uas.office.dingtalk.manage.controller;
|
|
|
|
|
|
+import com.dingtalk.api.response.OapiDepartmentListResponse;
|
|
|
+import com.dingtalk.api.response.OapiUserListbypageResponse;
|
|
|
+import com.usoftchina.dingtalk.sdk.AddrBookSdk;
|
|
|
import com.usoftchina.uas.office.dingtalk.service.UasEmployeeService;
|
|
|
import com.usoftchina.uas.office.dingtalk.service.UasOrgService;
|
|
|
import com.usoftchina.uas.office.dto.Result;
|
|
|
import com.usoftchina.uas.office.entity.DataCenter;
|
|
|
import com.usoftchina.uas.office.jdbc.DataSourceHolder;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @author yingp
|
|
|
* @date 2020/2/16
|
|
|
@@ -24,6 +30,9 @@ public class DingTalkAddrBookController {
|
|
|
@Autowired
|
|
|
private UasEmployeeService employeeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AddrBookSdk addrBookSdk;
|
|
|
+
|
|
|
@PostMapping(path = "/addrbook/sync")
|
|
|
public Result syncAll() {
|
|
|
DataCenter dataCenter = DataCenter.INSTANCE;
|
|
|
@@ -41,4 +50,16 @@ public class DingTalkAddrBookController {
|
|
|
DataSourceHolder.clear();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping(path = "/addrbook/user")
|
|
|
+ public Result getUserList() {
|
|
|
+ List<OapiUserListbypageResponse.Userlist> userList = addrBookSdk.getUserList("Uas", 1, true);
|
|
|
+ return Result.success(userList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(path = "/addrbook/org")
|
|
|
+ public Result getDepartmentList() {
|
|
|
+ List<OapiDepartmentListResponse.Department> departmentList = addrBookSdk.getDepartmentList("Uas");
|
|
|
+ return Result.success(departmentList);
|
|
|
+ }
|
|
|
}
|