|
|
@ -127,7 +127,6 @@ public class OrgPerson {
|
|
|
|
//云平台
|
|
|
|
//云平台
|
|
|
|
List<Record> list = Model.getOrgList(bureau_id);
|
|
|
|
List<Record> list = Model.getOrgList(bureau_id);
|
|
|
|
|
|
|
|
|
|
|
|
//在B不在A
|
|
|
|
|
|
|
|
for (Record record : list) {
|
|
|
|
for (Record record : list) {
|
|
|
|
// 增加
|
|
|
|
// 增加
|
|
|
|
String org_name = record.getStr("org_name");
|
|
|
|
String org_name = record.getStr("org_name");
|
|
|
@ -138,6 +137,7 @@ public class OrgPerson {
|
|
|
|
long dingTalkParentDeptId = 1;
|
|
|
|
long dingTalkParentDeptId = 1;
|
|
|
|
if (parentId > 0) dingTalkParentDeptId = Model.getDtDeptId(parentId);
|
|
|
|
if (parentId > 0) dingTalkParentDeptId = Model.getDtDeptId(parentId);
|
|
|
|
long dt_dept_id = createDept(accessToken, org_name, dingTalkParentDeptId, sId, parentId == -1);
|
|
|
|
long dt_dept_id = createDept(accessToken, org_name, dingTalkParentDeptId, sId, parentId == -1);
|
|
|
|
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
Model.writeDtDeptId(org_id, String.valueOf(dt_dept_id));
|
|
|
|
Model.writeDtDeptId(org_id, String.valueOf(dt_dept_id));
|
|
|
|
CommonUtil.Print("成功创建部门:" + org_name);
|
|
|
|
CommonUtil.Print("成功创建部门:" + org_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -205,7 +205,7 @@ public class OrgPerson {
|
|
|
|
req.setLanguage("zh_CN");
|
|
|
|
req.setLanguage("zh_CN");
|
|
|
|
OapiUserListsimpleResponse rsp = client.execute(req, access_token);
|
|
|
|
OapiUserListsimpleResponse rsp = client.execute(req, access_token);
|
|
|
|
JSONObject jo = JSONObject.parseObject(rsp.getBody());
|
|
|
|
JSONObject jo = JSONObject.parseObject(rsp.getBody());
|
|
|
|
|
|
|
|
if(jo==null) return;
|
|
|
|
JSONArray ja = jo.getJSONObject("result").getJSONArray("list");
|
|
|
|
JSONArray ja = jo.getJSONObject("result").getJSONArray("list");
|
|
|
|
if (ja == null) return;
|
|
|
|
if (ja == null) return;
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
@ -255,19 +255,23 @@ public class OrgPerson {
|
|
|
|
tel = DingTalkCommon.getLawfulTel(tel);
|
|
|
|
tel = DingTalkCommon.getLawfulTel(tel);
|
|
|
|
long deptId = record.getLong("dingtalk_dept_id");
|
|
|
|
long deptId = record.getLong("dingtalk_dept_id");
|
|
|
|
createPerson(accessToken, deptId, person_id, person_name, tel, "教师");
|
|
|
|
createPerson(accessToken, deptId, person_id, person_name, tel, "教师");
|
|
|
|
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
//回写标识
|
|
|
|
//回写标识
|
|
|
|
Model.writePersonDingTalkId(person_id);
|
|
|
|
Model.writePersonDingTalkId(person_id);
|
|
|
|
|
|
|
|
|
|
|
|
CommonUtil.Print("成功加入人员:" + person_name);
|
|
|
|
CommonUtil.Print("成功加入人员:" + person_name);
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void delAllDept(String access_token) throws ApiException {
|
|
|
|
public static void delAllDept(String access_token,Record rOrg) throws ApiException {
|
|
|
|
|
|
|
|
getDeptList(access_token,rOrg.getInt("dingtalk_dept_id"));
|
|
|
|
for (int i = 0; i < deptList.size(); i++) {
|
|
|
|
for (int i = 0; i < deptList.size(); i++) {
|
|
|
|
delDept(access_token, deptList.get(i).getLong("dept_id"));
|
|
|
|
delDept(access_token, deptList.get(i).getLong("dept_id"));
|
|
|
|
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
CommonUtil.Print("成功删除部门:" + deptList.get(i).getStr("name"));
|
|
|
|
CommonUtil.Print("成功删除部门:" + deptList.get(i).getStr("name"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delDept(access_token, rOrg.getInt("dingtalk_dept_id"));
|
|
|
|
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void delBureauPerson(String accessToken, Record rOrg) throws ApiException {
|
|
|
|
public static void delBureauPerson(String accessToken, Record rOrg) throws ApiException {
|
|
|
@ -277,6 +281,7 @@ public class OrgPerson {
|
|
|
|
String userid = personList.get(i).getStr("userid");
|
|
|
|
String userid = personList.get(i).getStr("userid");
|
|
|
|
String person_name = personList.get(i).getStr("name");
|
|
|
|
String person_name = personList.get(i).getStr("name");
|
|
|
|
delPerson(accessToken, Integer.parseInt(userid));
|
|
|
|
delPerson(accessToken, Integer.parseInt(userid));
|
|
|
|
|
|
|
|
DingTalkCommon.WriteActionTimes();
|
|
|
|
CommonUtil.Print("成功删除:" + person_name);
|
|
|
|
CommonUtil.Print("成功删除:" + person_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|