public class WXWorkServiceImpl extends Object implements WXWorkService
| 限定符和类型 | 类和说明 |
|---|---|
static class |
WXWorkServiceImpl.NodeName |
| 限定符和类型 | 字段和说明 |
|---|---|
static com.google.gson.Gson |
GSON |
static String |
WXWORK_ALIAS |
| 构造器和说明 |
|---|
WXWorkServiceImpl(EhcacheService ehcacheService,
org.springframework.web.client.RestTemplate restTemplate,
WXWorkProperties wxWorkProperties) |
| 限定符和类型 | 方法和说明 |
|---|---|
com.google.common.collect.Multimap<String,String> |
callback(Integer appIndex,
String msg_signature,
String timestamp,
String nonce,
String xml,
javax.servlet.http.HttpServletResponse response)
处理 callback
|
AgentConfigSignatureResponseDTO |
getAgentConfigSignature(Integer appIndex,
String currentPageUrl)
获取 agentConfig 签名
|
CallbackIpResponseDTO |
getCallbackIp(Integer appIndex)
获取企业微信服务器的 ip 段
|
CheckinDataResponseDTO |
getCheckinData(Integer openCheckinDataType,
Long startTime,
Long endTime,
List<String> userIdList)
获取打卡信息(token 必须由打卡 secret 获取)
|
ConfigSignatureResponseDTO |
getConfigSignature(Integer appIndex,
String currentPageUrl)
获取 config 签名
|
DepartmentDataResponseDTO |
getDepartmentData(Integer appIndex,
Integer departmentId)
获取 department 部门列表
|
DepartmentUserResponseDTO |
getDepartmentUser(Integer appIndex,
Integer departmentId,
Integer fetchChild)
获取 department 部门 user 简单信息
|
String |
getJsapiTicketAgentCache(Integer appIndex)
获取 jsapi_ticket_agent 缓存
|
String |
getJsapiTicketCache(Integer appIndex)
获取 jsapi_ticket 缓存
|
TagDataResponseDTO |
getTagData()
获取 tag 标签列表(token 必须由通讯录 secret 获取)
|
TagUserResponseDTO |
getTagUser(Integer tagId)
获取 tag 标签 user 简单信息(token 必须由通讯录 secret 获取)
|
UserIdResponseDTO |
getUserId(Integer appIndex,
String code)
获取工号
|
UserInfoResponseDTO |
getUserInfo(Integer appIndex,
String userId)
获取 user 信息
|
boolean |
isPC(String userAgent)
是否 PC
|
boolean |
sendTextMsg(Integer appIndex,
List<String> userIdList,
String content)
发送文本信息
|
boolean |
sendTextMsg(Integer appIndex,
String userId,
String content)
发送文本信息
|
boolean |
verifyUrl(Integer appIndex,
String msg_signature,
String timestamp,
String nonce,
String echostr,
javax.servlet.http.HttpServletResponse response)
验证 url
|
com.google.common.collect.Multimap<String,String> |
xmlToMultimap(String xmlStr)
xml 转 map
|
public WXWorkServiceImpl(EhcacheService ehcacheService, org.springframework.web.client.RestTemplate restTemplate, WXWorkProperties wxWorkProperties)
public UserIdResponseDTO getUserId(Integer appIndex, String code)
WXWorkServicegetUserId 在接口中 WXWorkServiceappIndex - 索引code - 企业微信返回一次性 code,5 分钟内有效public UserInfoResponseDTO getUserInfo(Integer appIndex, String userId)
WXWorkServicegetUserInfo 在接口中 WXWorkServiceappIndex - 索引userId - 工号public DepartmentDataResponseDTO getDepartmentData(Integer appIndex, Integer departmentId)
WXWorkServicegetDepartmentData 在接口中 WXWorkServiceappIndex - 索引departmentId - 部门 id,获取指定部门及其下的子部门(以及及子部门的子部门等等,递归),如果不填,默认获取全量组织架构public DepartmentUserResponseDTO getDepartmentUser(Integer appIndex, Integer departmentId, Integer fetchChild)
WXWorkServicegetDepartmentUser 在接口中 WXWorkServiceappIndex - 索引departmentId - 部门 idfetchChild - 是否递归获取子部门下面的成员(1-递归获取,0-只获取本部门)public boolean sendTextMsg(Integer appIndex, String userId, String content)
WXWorkServicesendTextMsg 在接口中 WXWorkServiceappIndex - 索引userId - 工号(多个工号之间用“|”隔开,不允许加空格)content - 文本内容public boolean sendTextMsg(Integer appIndex, List<String> userIdList, String content)
WXWorkServicesendTextMsg 在接口中 WXWorkServiceappIndex - 索引userIdList - 工号集合content - 文本内容public CheckinDataResponseDTO getCheckinData(Integer openCheckinDataType, Long startTime, Long endTime, List<String> userIdList)
WXWorkServicegetCheckinData 在接口中 WXWorkServiceopenCheckinDataType - 打卡类型(1-上下班打卡,2-外出打卡,3-全部打卡)startTime - 获取打卡记录的开始时间(10 位 Unix 时间戳)endTime - 获取打卡记录的结束时间(10 位 Unix 时间戳)userIdList - 工号集合(至多 100 个)public TagDataResponseDTO getTagData()
WXWorkServicegetTagData 在接口中 WXWorkServicepublic TagUserResponseDTO getTagUser(Integer tagId)
WXWorkServicegetTagUser 在接口中 WXWorkServicetagId - 标签 idpublic String getJsapiTicketCache(Integer appIndex)
WXWorkServicegetJsapiTicketCache 在接口中 WXWorkServiceappIndex - 索引public String getJsapiTicketAgentCache(Integer appIndex)
WXWorkServicegetJsapiTicketAgentCache 在接口中 WXWorkServiceappIndex - 索引public boolean verifyUrl(Integer appIndex, String msg_signature, String timestamp, String nonce, String echostr, javax.servlet.http.HttpServletResponse response)
WXWorkServiceverifyUrl 在接口中 WXWorkServiceappIndex - 索引msg_signature - 企业微信加密签名,msg_signature计算结合了企业填写的token、请求中的timestamp、nonce、加密的消息体timestamp - 时间戳(与nonce结合使用,用于防止请求重放攻击)nonce - 随机数(与timestamp结合使用,用于防止请求重放攻击)echostr - 加密的字符串(需要解密得到消息内容明文,解密后有random、msg_len、msg、receiveid四个字段,其中msg即为消息内容明文)response - 响应public com.google.common.collect.Multimap<String,String> callback(Integer appIndex, String msg_signature, String timestamp, String nonce, String xml, javax.servlet.http.HttpServletResponse response)
WXWorkServicecallback 在接口中 WXWorkServiceappIndex - 索引msg_signature - 企业微信加密签名,msg_signature结合了企业填写的token、请求中的timestamp、nonce参数、加密的消息体timestamp - 时间戳(与nonce结合使用,用于防止请求重放攻击)nonce - 随机数(与timestamp结合使用,用于防止请求重放攻击)xml - 回调数据(放在 HTTP 请求体中,使用 @RequestBody 注解接收)response - 响应public com.google.common.collect.Multimap<String,String> xmlToMultimap(String xmlStr)
xmlStr - xml 字符串public ConfigSignatureResponseDTO getConfigSignature(Integer appIndex, String currentPageUrl)
WXWorkServicegetConfigSignature 在接口中 WXWorkServiceappIndex - 索引currentPageUrl - 当前页面 urlpublic AgentConfigSignatureResponseDTO getAgentConfigSignature(Integer appIndex, String currentPageUrl)
WXWorkServicegetAgentConfigSignature 在接口中 WXWorkServiceappIndex - 索引currentPageUrl - 当前页面 urlpublic CallbackIpResponseDTO getCallbackIp(Integer appIndex)
WXWorkServicegetCallbackIp 在接口中 WXWorkServiceappIndex - 索引public boolean isPC(String userAgent)
WXWorkServiceisPC 在接口中 WXWorkServiceuserAgent - 用户代理Copyright © 2020 Pivotal Software, Inc.. All rights reserved.