| | |
| | | package com.hx.mp.util; |
| | | |
| | | import com.hx.util.corp.entity.AppLetInfo; |
| | | import com.hx.exception.TipsException; |
| | | import com.hx.util.HttpMethodUtil; |
| | | import com.hx.util.StringUtils; |
| | | import net.sf.json.JSONException; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.poi.util.SystemOutLogger; |
| | | |
| | | import java.io.OutputStream; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.text.MessageFormat; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 企业微信工具类 |
| | |
| | | public static final String URL_INFO_USER = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={0}&userid={1}"; |
| | | /**发送消息*/ |
| | | public static final String URL_MESSAGE_SEND = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="; |
| | | |
| | | |
| | | /** |
| | | * 添加工作人员 |
| | |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 添加工作人员 |
| | | * @param at 访问at |
| | | * @param userId 用户id |
| | | * @param name 名称 |
| | | * @param depId 部门id |
| | | * @param position 职位 |
| | | * @param tel 电话 |
| | | * @param email 邮箱 |
| | | * @return 返回 |
| | | */ |
| | | public static JSONObject addUserObj(String at, String userId, String name, int depId |
| | | , String position,String tel,String email) { |
| | | |
| | | if(StringUtils.isEmpty(tel)&&StringUtils.isEmpty(email)){ |
| | | throw new TipsException("添加企业微信手机号和邮箱不能都为空!"); |
| | | } |
| | | |
| | | JSONObject obj = new JSONObject(); |
| | | obj.put("userid", userId); |
| | | obj.put("name", name); |
| | | obj.put("department", depId); |
| | | obj.put("position", position); |
| | | obj.put("mobile", tel); |
| | | obj.put("email", email); |
| | | obj = HttpURLUtil(MessageFormat.format(URL_ADD_USER, at), obj.toString()); |
| | | |
| | | if(obj == null){ |
| | | obj = new JSONObject(); |
| | | } |
| | | |
| | | return obj; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 更新工作人员 |
| | | * @param at 访问at |
| | |
| | | } |
| | | return obj; |
| | | } |
| | | |
| | | } |