|
@@ -0,0 +1,35 @@
|
|
|
+package org.fouram.core.plugin.weixin.cp.util;
|
|
|
+
|
|
|
+import org.fouram.core.plugin.weixin.cp.core.WXCpMessage;
|
|
|
+import org.fouram.core.util.ConfConfig;
|
|
|
+import org.fouram.core.util.LoggerUtil;
|
|
|
+
|
|
|
+import me.chanjar.weixin.common.api.WxConsts.XmlMsgType;
|
|
|
+import me.chanjar.weixin.common.error.WxErrorException;
|
|
|
+import me.chanjar.weixin.cp.bean.WxCpMessage;
|
|
|
+import me.chanjar.weixin.cp.bean.WxCpMessageSendResult;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 企业微信用户工具类
|
|
|
+ *
|
|
|
+ * @author Liup
|
|
|
+ */
|
|
|
+public class WXCpMessageUtil {
|
|
|
+
|
|
|
+ public static void sendQuitUserMsg(String content) throws WxErrorException {
|
|
|
+ try {
|
|
|
+ WxCpMessage message = new WxCpMessage();
|
|
|
+ message.setToUser(ConfConfig.getConfigString("wxCp.massage.toUser"));
|
|
|
+ message.setMsgType(XmlMsgType.TEXT);
|
|
|
+ message.setContent(content);
|
|
|
+ WxCpMessageSendResult sendResult = WXCpMessage.service.messageSend(message);
|
|
|
+ LoggerUtil.info(sendResult.toString());
|
|
|
+ } catch (WxErrorException e) {
|
|
|
+ LoggerUtil.error(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws WxErrorException {
|
|
|
+ sendQuitUserMsg("1111111111222");
|
|
|
+ }
|
|
|
+}
|