@EnableConfigurationProperties(value=WXWorkProperties.class) @Service public class WXWorkServiceImpl extends Object implements WXWorkService, org.springframework.beans.factory.InitializingBean
| 限定符和类型 | 类和说明 |
|---|---|
static class |
WXWorkServiceImpl.NodeName
自定义节点名称对象
|
static class |
WXWorkServiceImpl.UploadTypeEnum
媒体文件类型
|
| 限定符和类型 | 字段和说明 |
|---|---|
static com.google.gson.Gson |
GSON |
static String |
WXWORK_ALIAS |
| 构造器和说明 |
|---|
WXWorkServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
afterPropertiesSet() |
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
|
byte[] |
downloadTemp(Integer appIndex,
String mediaId)
获取临时素材
|
byte[] |
downloadVoice(Integer appIndex,
String mediaId)
获取高清语音素材
|
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 简单信息
|
static void |
getFullyQualifiedNodeName(org.dom4j.Element node,
WXWorkServiceImpl.NodeName nodeName)
递归获取完全限定节点名称,以英文点“.”分隔(例如:grandparentNodeName.parentNodeName.nodeName)
|
String |
getJsapiTicket(Integer appIndex)
获取 jsapi_ticket
|
String |
getJsapiTicketAgent(Integer appIndex)
获取 jsapi_ticket
|
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 获取)
|
String |
getToken(Integer appIndex)
获取 token
|
String |
getTokenCache(Integer appIndex)
获取 token 缓存
|
UserIdResponseDTO |
getUserId(Integer appIndex,
String code)
获取工号
|
UserInfoResponseDTO |
getUserInfo(Integer appIndex,
String userId)
获取 user 信息
|
static void |
listNodes(org.dom4j.Element node,
com.google.common.collect.Multimap<String,String> map)
递归遍历 xml 节点
|
AppMsgResponseDTO |
sendAppTextMsgToDepartment(Integer appIndex,
List<String> departmentIdList,
String content)
发送应用文本消息
|
AppMsgResponseDTO |
sendAppTextMsgToDepartment(Integer appIndex,
String departmentId,
String content)
发送应用文本消息
|
AppMsgResponseDTO |
sendAppTextMsgToTag(Integer appIndex,
List<String> tagIdList,
String content)
发送应用文本消息
|
AppMsgResponseDTO |
sendAppTextMsgToTag(Integer appIndex,
String tagId,
String content)
发送应用文本消息
|
AppMsgResponseDTO |
sendAppTextMsgToUser(Integer appIndex,
List<String> userIdList,
String content)
发送应用文本消息
|
AppMsgResponseDTO |
sendAppTextMsgToUser(Integer appIndex,
String userId,
String content)
发送应用文本消息
|
BotMsgResponseDTO |
sendBotTextMsg(Integer appIndex,
String content)
发送机器人文本消息
|
BotMsgResponseDTO |
sendBotTextMsgAtMobileNo(Integer appIndex,
List<String> mobileNoList,
String content)
发送机器人文本消息
|
BotMsgResponseDTO |
sendBotTextMsgAtUserId(Integer appIndex,
List<String> userIdList,
String content)
发送机器人文本消息
|
AppUploadImageResponseDTO |
uploadImage(Integer appIndex,
String filePath)
上传图片
|
AppUploadTempResponseDTO |
uploadTemp(Integer appIndex,
WXWorkServiceImpl.UploadTypeEnum typeEnum,
String filePath)
上传临时素材
|
boolean |
verifyUrl(Integer appIndex,
String msg_signature,
String timestamp,
String nonce,
String echostr,
javax.servlet.http.HttpServletResponse response)
验证 url
|
static com.google.common.collect.Multimap<String,String> |
xmlToMultimap(String xmlStr)
xml 转 map
|
public void afterPropertiesSet()
afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBeanpublic 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 TagDataResponseDTO getTagData()
WXWorkServicegetTagData 在接口中 WXWorkServicepublic TagUserResponseDTO getTagUser(Integer tagId)
WXWorkServicegetTagUser 在接口中 WXWorkServicetagId - 标签 idpublic AppMsgResponseDTO sendAppTextMsgToUser(Integer appIndex, String userId, String content)
WXWorkServicesendAppTextMsgToUser 在接口中 WXWorkServiceappIndex - 索引userId - 工号(多个工号之间用“|”隔开,不允许加空格,最多支持 1000 个)content - 文本内容public AppMsgResponseDTO sendAppTextMsgToUser(Integer appIndex, List<String> userIdList, String content)
WXWorkServicesendAppTextMsgToUser 在接口中 WXWorkServiceappIndex - 索引userIdList - 工号集合(最多支持 1000 个)content - 文本内容public AppMsgResponseDTO sendAppTextMsgToDepartment(Integer appIndex, String departmentId, String content)
WXWorkServicesendAppTextMsgToDepartment 在接口中 WXWorkServiceappIndex - 索引departmentId - 部门 id(多个部门 id 之间用“|”隔开,不允许加空格,最多支持 100 个)content - 文本内容public AppMsgResponseDTO sendAppTextMsgToDepartment(Integer appIndex, List<String> departmentIdList, String content)
WXWorkServicesendAppTextMsgToDepartment 在接口中 WXWorkServiceappIndex - 索引departmentIdList - 部门 id 集合(最多支持 100 个)content - 文本内容public AppMsgResponseDTO sendAppTextMsgToTag(Integer appIndex, String tagId, String content)
WXWorkServicesendAppTextMsgToTag 在接口中 WXWorkServiceappIndex - 索引tagId - 标签 id(多个标签 id 之间用“|”隔开,不允许加空格,最多支持 100 个)content - 文本内容public AppMsgResponseDTO sendAppTextMsgToTag(Integer appIndex, List<String> tagIdList, String content)
WXWorkServicesendAppTextMsgToTag 在接口中 WXWorkServiceappIndex - 索引tagIdList - 标签 id 集合(最多支持 100 个)content - 文本内容public AppUploadTempResponseDTO uploadTemp(Integer appIndex, WXWorkServiceImpl.UploadTypeEnum typeEnum, String filePath) throws IOException
WXWorkServiceuploadTemp 在接口中 WXWorkServiceappIndex - 索引typeEnum - 临时素材类型filePath - 临时素材绝对路径IOException - 异常public AppUploadImageResponseDTO uploadImage(Integer appIndex, String filePath) throws IOException
WXWorkServiceuploadImage 在接口中 WXWorkServiceappIndex - 索引filePath - 图片绝对路径IOException - 异常public byte[] downloadTemp(Integer appIndex, String mediaId)
WXWorkServicedownloadTemp 在接口中 WXWorkServiceappIndex - 索引mediaId - 媒体文件 idpublic byte[] downloadVoice(Integer appIndex, String mediaId)
WXWorkServicedownloadVoice 在接口中 WXWorkServiceappIndex - 索引mediaId - 媒体文件 idpublic 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 String getTokenCache(Integer appIndex)
WXWorkServicegetTokenCache 在接口中 WXWorkServiceappIndex - 索引public String getJsapiTicketCache(Integer appIndex)
WXWorkServicegetJsapiTicketCache 在接口中 WXWorkServiceappIndex - 索引public String getJsapiTicket(Integer appIndex)
appIndex - 索引public String getJsapiTicketAgentCache(Integer appIndex)
WXWorkServicegetJsapiTicketAgentCache 在接口中 WXWorkServiceappIndex - 索引public String getJsapiTicketAgent(Integer appIndex)
appIndex - 索引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 static com.google.common.collect.Multimap<String,String> xmlToMultimap(String xmlStr)
xmlStr - xml 字符串public static void listNodes(org.dom4j.Element node,
com.google.common.collect.Multimap<String,String> map)
node - xml 节点map - 载体public static void getFullyQualifiedNodeName(org.dom4j.Element node,
WXWorkServiceImpl.NodeName nodeName)
node - 节点nodeName - 自定义节点名称对象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 BotMsgResponseDTO sendBotTextMsg(Integer appIndex, String content)
WXWorkServicesendBotTextMsg 在接口中 WXWorkServiceappIndex - 索引content - 文本内容public BotMsgResponseDTO sendBotTextMsgAtUserId(Integer appIndex, List<String> userIdList, String content)
WXWorkServicesendBotTextMsgAtUserId 在接口中 WXWorkServiceappIndex - 索引userIdList - 工号集合,提醒群中的指定成员(@某个成员),@all表示提醒所有人content - 文本内容public BotMsgResponseDTO sendBotTextMsgAtMobileNo(Integer appIndex, List<String> mobileNoList, String content)
WXWorkServicesendBotTextMsgAtMobileNo 在接口中 WXWorkServiceappIndex - 索引mobileNoList - 手机号码集合,提醒手机号对应的群成员(@某个成员),@all表示提醒所有人content - 文本内容Copyright © 2021. All rights reserved.