You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.5 KiB

package com.dsideal.FengHuang.DingTalk;
import com.dsideal.FengHuang.DingTalk.Util.*;
import com.dsideal.FengHuang.Util.CommonUtil;
import com.jfinal.kit.PropKit;
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
import com.jfinal.plugin.activerecord.Record;
import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
import com.jfinal.plugin.druid.DruidPlugin;
import com.jfinal.plugin.redis.RedisPlugin;
public class Full {
public static void main(String[] args_) throws Exception {
PropKit.use("dingtalk.properties");
final String appKey = PropKit.get("appKey");
String appSecret = PropKit.get("appSecret");
DruidPlugin druid = DingTalkCommon.createDruidPlugin(PropKit.get("jdbcUrl"), PropKit.get("user"), PropKit.get("password").trim(), PropKit.get("driverClassName"));
druid.start();
ActiveRecordPlugin arp = new ActiveRecordPlugin(druid);
arp.setDevMode(false);
arp.setDialect(new MysqlDialect());
arp.start();
// 用于缓存模块的redis服务
RedisPlugin redis = new RedisPlugin("myRedis", PropKit.get("redis_ip"), PropKit.getInt("redis_port"), 10 * 1000);
redis.start();
//accessToken
String accessToken = DingTalkCommon.getAccessToken(appKey, appSecret);
//同步钉钉与云平台中部门信息
String orgName = "103中学";
Record rOrg = Model.getOrgByOrgName(orgName);
//开发测试时专用,批量删除人员与组织机构
//Model.fillDeptListByDataBase(rOrg);//从数据库中获取最新的部门列表(已与钉钉匹配完毕)
//OrgPerson.delBureauPerson(accessToken,rOrg);
//OrgPerson.delAllDept(accessToken);
//初始化组织机构【需提前手动删除此学校及下属部门】
//OrgPerson.InitOrg(accessToken, rOrg);
//同步人员
//Model.fillDeptListByDataBase(rOrg);//从数据库中获取最新的部门列表(已与钉钉匹配完毕)
//OrgPerson.initPerson(accessToken, rOrg,10);//这里限定了上限人数为10
//初始化角色组
//long groupId = RolePerson.createRoleGroup(accessToken, "义务教育阶段角色组");
//初始化角色
//RolePerson.initRole(accessToken, groupId);
//同步人员角色信息
//RolePerson.initPersonRole(accessToken, rOrg);
CommonUtil.Print("恭喜,所有操作成功完成!");
// 记录全量同步完成时间
Progress.finishInit();
}
}