资源简介

完整的阿里钉钉集成API(Java)项目,包括了src和demo用例等

资源截图

代码片段和文件信息

package com.alibaba.dingtalk.openapi.demo;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.dingtalk.openapi.demo.auth.AuthHelper;
import com.alibaba.dingtalk.openapi.demo.department.DepartmentHelper;
import com.alibaba.dingtalk.openapi.demo.media.MediaHelper;
import com.alibaba.dingtalk.openapi.demo.message.ConversationMessageDelivery;
import com.alibaba.dingtalk.openapi.demo.message.LightAppMessageDelivery;
import com.alibaba.dingtalk.openapi.demo.message.MessageHelper;
import com.alibaba.dingtalk.openapi.demo.user.User;
import com.alibaba.dingtalk.openapi.demo.user.UserHelper;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONobject;
import com.dingtalk.open.client.api.model.corp.CorpUserDetail;
import com.dingtalk.open.client.api.model.corp.CorpUserDetailList;
import com.dingtalk.open.client.api.model.corp.CorpUserList;
import com.dingtalk.open.client.api.model.corp.Department;
import com.dingtalk.open.client.api.model.corp.MessageBody;
import com.dingtalk.open.client.api.model.corp.MessageBody.OABody.Body;
import com.dingtalk.open.client.api.model.corp.MessageBody.OABody.Body.Form;
import com.dingtalk.open.client.api.model.corp.MessageBody.OABody.Body.Rich;
import com.dingtalk.open.client.api.model.corp.MessageBody.OABody.Head;
import com.dingtalk.open.client.api.model.corp.MessageType;
import com.dingtalk.open.client.api.model.corp.UploadResult;

public class Demo {

public static void main(String[] args) throws Exception {

try {

List departments = new ArrayList();
departments = DepartmentHelper.listDepartments(AuthHelper.getAccessToken() “1“);
JSONobject usersJSON = new JSONobject();

System.out.println(“depart num:“+departments.size());
for(int i = 0;i JSONobject userDepJSON = new JSONobject();
System.out.println(“dep:“+departments.get(i).toString());

            long offset = 0;
            int size = 5;
            CorpUserList corpUserList = new CorpUserList();            
            while (true) {
                corpUserList = UserHelper.getDepartmentUser(AuthHelper.getAccessToken() Long.valueOf(departments.get(i).getId())
                  offset size null);
                System.out.println(JSON.toJSONString(corpUserList));
                if (Boolean.TRUE.equals(corpUserList.isHasMore())) {
                    offset += size;
                } else {
                    break;
                }
            }
if(corpUserList.getUserlist().size()==0){
continue;
}
for(int j = 0;j String user = JSON.toJSONString(corpUserList.getUserlist().get(j));
userDepJSON.put(j+““ JSONobject.parseobject(user CorpUserDetail.class));

}


usersJSON.put(departments.get(i).getName() userDepJSON);
System.out.println(“user:“+usersJSON.toString());
}

S

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-19 18:14  dd\
     文件         589  2017-11-03 18:33  dd\.classpath
     文件          61  2017-09-05 11:49  dd\.gitignore
     文件         879  2017-09-05 11:49  dd\.project
     目录           0  2017-12-19 18:14  dd\.settings\
     文件         555  2017-09-05 11:49  dd\.settings\.jsdtscope
     文件          57  2017-11-03 18:45  dd\.settings\org.eclipse.core.resources.prefs
     文件         658  2017-09-05 11:49  dd\.settings\org.eclipse.jdt.core.prefs
     文件         456  2017-09-05 11:49  dd\.settings\org.eclipse.wst.common.component
     文件         296  2017-09-05 11:49  dd\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-09-05 11:49  dd\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-09-05 11:49  dd\.settings\org.eclipse.wst.jsdt.ui.superType.name
     目录           0  2017-12-19 18:14  dd\build\
     目录           0  2017-12-19 18:14  dd\build\classes\
     目录           0  2017-12-19 18:14  dd\build\classes\com\
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\auth\
     文件        8004  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\auth\AuthHelper.class
     文件       12831  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\Demo.class
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\department\
     文件        3847  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\department\DepartmentHelper.class
     文件         879  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\Env.class
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\eventchange\
     文件        3124  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\eventchange\eventChangeHelper.class
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\media\
     文件         558  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\media\MediaHelper$MediaUploadResult.class
     文件        2253  2017-12-19 18:10  dd\build\classes\com\alibaba\dingtalk\openapi\demo\media\MediaHelper.class
     目录           0  2017-12-19 18:14  dd\build\classes\com\alibaba\dingtalk\openapi\demo\message\
............此处省略197个文件信息

评论

共有 条评论