Commit 78ffcc9a authored by wujipeng's avatar wujipeng
Browse files

钉钉-获取在职员工id列表

parent 61a8760c
...@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -39,15 +40,15 @@ public class DingEmployeeController { ...@@ -39,15 +40,15 @@ public class DingEmployeeController {
try { try {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob"); DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/smartwork/hrm/employee/queryonjob");
OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest(); OapiSmartworkHrmEmployeeQueryonjobRequest req = new OapiSmartworkHrmEmployeeQueryonjobRequest();
Map<String, String> textParams = req.getTextParams(); req.setOffset(0L);
textParams.put("access_token", accessToken); req.setSize(50L);
OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, ""); req.setStatusList("3");
System.out.println(rsp.getBody()); req.setHttpMethod("POST");
return null; OapiSmartworkHrmEmployeeQueryonjobResponse rsp = client.execute(req, accessToken);
return rsp.getResult().getDataList();
} catch (ApiException e) { } catch (ApiException e) {
e.printStackTrace(); throw new RuntimeException(e);
} }
return null;
}
}
} }
...@@ -17,11 +17,11 @@ import org.springframework.context.annotation.Configuration; ...@@ -17,11 +17,11 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
public class PermissionConfig { public class PermissionConfig {
@Value("ding.key") // @Value("ding.key")
private String key; private String key = "dingatpypxs4jlryvh85";
@Value("ding.secret") // @Value("ding.secret")
private String secret; private String secret = "_GVhUwb1bX3_tEAuIMxbD9LIsJsTGlzpUvBroG83_NPt3nxbL4jzbBAPkd_dijD6";
public String getAccessToken() { public String getAccessToken() {
try { try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment