package org.fouram.core.plugin.weixin.cp.core;

import org.fouram.core.util.ConfConfig;

import me.chanjar.weixin.cp.api.WxCpDepartmentService;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.WxCpUserService;
import me.chanjar.weixin.cp.api.impl.WxCpDepartmentServiceImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.api.impl.WxCpUserServiceImpl;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;

/**
 * 企业微信工具类
 * 
 * @author Liup
 */
public class WXCpBase {
	

	public static final WxCpService service = new WxCpServiceImpl();
	public static final WxCpUserService userService;
	public static final WxCpDepartmentService departService;
	static {
		WxCpDefaultConfigImpl configStorage = new WxCpDefaultConfigImpl();
		configStorage.setCorpId(ConfConfig.getConfigString("wxCp.corpId"));
		configStorage.setCorpSecret(ConfConfig.getConfigString("wxCp.corpSecret"));
		// 初始化基础service
		service.setWxCpConfigStorage(configStorage);
		// 初始化用户service
		userService = new WxCpUserServiceImpl(service);
		// 初始化部门service
		departService = new WxCpDepartmentServiceImpl(service);
	}
}