entry : entries) {
+ httpGet.setHeader(entry.getKey(), entry.getValue());
+ }
+ }
+ CloseableHttpResponse response = httpClient.execute(httpGet);
+ entity = response.getEntity();
+ } catch (ClientProtocolException e) {
+ logger.info(e.getMessage());
+ } catch (IOException e) {
+ logger.info(e.getMessage());
+ }
+
+ return entity;
+ }
+
+ /**
+ * 处理POST请求
+ *
+ * @author https://github.com/yaphone
+ * @date 2017年4月9日 下午7:06:35
+ * @param url
+ * @param params
+ * @return
+ */
+ public HttpEntity doPost(String url, String paramsStr) {
+ HttpEntity entity = null;
+ HttpPost httpPost = new HttpPost();
+ try {
+ StringEntity params = new StringEntity(paramsStr, Consts.UTF_8);
+ httpPost = new HttpPost(url);
+ httpPost.setEntity(params);
+ httpPost.setHeader("Content-type", "application/json; charset=utf-8");
+ httpPost.setHeader("User-Agent", Config.USER_AGENT);
+ httpPost.setHeader("client-version", Config.UOS_PATCH_CLIENT_VERSION);
+ httpPost.setHeader("extspam", Config.UOS_PATCH_EXTSPAM);
+ httpPost.setHeader("referer", Config.REFERER);
+
+ CloseableHttpResponse response = httpClient.execute(httpPost);
+ entity = response.getEntity();
+ } catch (ClientProtocolException e) {
+ logger.info(e.getMessage());
+ } catch (IOException e) {
+ logger.info(e.getMessage());
+ }
+
+ return entity;
+ }
+
+ /**
+ * 上传文件到服务器
+ *
+ * @author https://github.com/yaphone
+ * @date 2017年5月7日 下午9:19:23
+ * @param url
+ * @param reqEntity
+ * @return
+ */
+ public HttpEntity doPostFile(String url, HttpEntity reqEntity) {
+ HttpEntity entity = null;
+ HttpPost httpPost = new HttpPost(url);
+ httpPost.setHeader("User-Agent", Config.USER_AGENT);
+ httpPost.setHeader("client-version", Config.UOS_PATCH_CLIENT_VERSION);
+ httpPost.setHeader("extspam", Config.UOS_PATCH_EXTSPAM);
+ httpPost.setHeader("referer", Config.REFERER);
+
+ httpPost.setEntity(reqEntity);
+ try {
+ CloseableHttpResponse response = httpClient.execute(httpPost);
+ entity = response.getEntity();
+
+ } catch (Exception e) {
+ logger.info(e.getMessage());
+ }
+ return entity;
+ }
+
+ public static CloseableHttpClient getHttpClient() {
+ return httpClient;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/SleepUtils.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/SleepUtils.java
new file mode 100644
index 00000000..b945606d
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/SleepUtils.java
@@ -0,0 +1,20 @@
+package com.xmzs.common.wechat.utils;
+
+/**
+ * Created by xiaoxiaomo on 2017/5/6.
+ */
+public class SleepUtils {
+
+ /**
+ * 毫秒为单位
+ * @param time
+ */
+ public static void sleep( long time ){
+ try {
+ Thread.sleep( time );
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgCodeEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgCodeEnum.java
new file mode 100644
index 00000000..ec136f33
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgCodeEnum.java
@@ -0,0 +1,68 @@
+package com.xmzs.common.wechat.utils.enums;
+
+/**
+ * 消息类型
+ *
+ * @author https://github.com/yaphone
+ * @date 创建时间:2017年4月23日 下午12:15:00
+ * @version 1.0
+ *
+ */
+public enum MsgCodeEnum {
+
+ // public static final int MSGTYPE_TEXT = 1; // 文本消息类型
+ // public static final int MSGTYPE_IMAGE = 3; // 图片消息
+ // public static final int MSGTYPE_VOICE = 34; // 语音消息
+ // public static final int MSGTYPE_VIDEO = 43; // 小视频消息
+ // public static final int MSGTYPE_MICROVIDEO = 62; // 短视频消息
+ // public static final int MSGTYPE_EMOTICON = 47; // 表情消息
+ // public static final int MSGTYPE_APP = 49;
+ // public static final int MSGTYPE_VOIPMSG = 50;
+ // public static final int MSGTYPE_VOIPNOTIFY = 52;
+ // public static final int MSGTYPE_VOIPINVITE = 53;
+ // public static final int MSGTYPE_LOCATION = 48;
+ // public static final int MSGTYPE_STATUSNOTIFY = 51;
+ // public static final int MSGTYPE_SYSNOTICE = 9999;
+ // public static final int MSGTYPE_POSSIBLEFRIEND_MSG = 40;
+ // public static final int MSGTYPE_VERIFYMSG = 37;
+ // public static final int MSGTYPE_SHARECARD = 42;
+ // public static final int MSGTYPE_SYS = 10000;
+ // public static final int MSGTYPE_RECALLED = 10002;
+ MSGTYPE_TEXT(1, "文本消息类型"),
+ MSGTYPE_IMAGE(3, "图片消息"),
+ MSGTYPE_VOICE(34, "语音消息"),
+ MSGTYPE_VIDEO(43, "小视频消息"),
+ MSGTYPE_MICROVIDEO(62, "短视频消息"),
+ MSGTYPE_EMOTICON(47, "表情消息"),
+ MSGTYPE_MEDIA(49, "多媒体消息"),
+ MSGTYPE_VOIPMSG(50, ""),
+ MSGTYPE_VOIPNOTIFY(52, ""),
+ MSGTYPE_VOIPINVITE(53, ""),
+ MSGTYPE_LOCATION(48, ""),
+ MSGTYPE_STATUSNOTIFY(51, ""),
+ MSGTYPE_SYSNOTICE(9999, ""),
+ MSGTYPE_POSSIBLEFRIEND_MSG(40, ""),
+ MSGTYPE_VERIFYMSG(37, "好友请求"),
+ MSGTYPE_SHARECARD(42, ""),
+ MSGTYPE_SYS(10000, "系统消息"),
+ MSGTYPE_RECALLED(10002, "")
+
+ ;
+
+ private int code;
+ private String type;
+
+ MsgCodeEnum(int code, String type) {
+ this.code = code;
+ this.type = type;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgTypeEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgTypeEnum.java
new file mode 100644
index 00000000..63ef4501
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/MsgTypeEnum.java
@@ -0,0 +1,38 @@
+package com.xmzs.common.wechat.utils.enums;
+
+
+/**
+ * 消息类型枚举类
+ *
+ * @author https://github.com/yaphone
+ * @date 创建时间:2017年5月13日 下午11:53:00
+ * @version 1.0
+ *
+ */
+public enum MsgTypeEnum {
+ TEXT("Text", "文本消息"),
+ PIC("Pic", "图片消息"),
+ VOICE("Voice", "语音消息"),
+ VIEDO("Viedo", "小视频消息"),
+ NAMECARD("NameCard", "名片消息"),
+ SYS("Sys", "系统消息"),
+ VERIFYMSG("VerifyMsg", "添加好友"),
+ MEDIA("app", "文件消息");
+
+ private String type;
+ private String code;
+
+ MsgTypeEnum(String type, String code) {
+ this.type = type;
+ this.code = code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/OsNameEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/OsNameEnum.java
new file mode 100644
index 00000000..1a00a43a
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/OsNameEnum.java
@@ -0,0 +1,13 @@
+package com.xmzs.common.wechat.utils.enums;
+
+/**
+ * 系统平台
+ *
+ * @author https://github.com/yaphone
+ * @date 创建时间:2017年4月8日 下午10:36:28
+ * @version 1.0
+ *
+ */
+public enum OsNameEnum {
+ WINDOWS, LINUX, DARWIN, MAC, OTHER
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/ResultEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/ResultEnum.java
new file mode 100644
index 00000000..f21b20ab
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/ResultEnum.java
@@ -0,0 +1,35 @@
+package com.xmzs.common.wechat.utils.enums;
+
+/**
+ * 返回结构枚举类
+ *
+ * Created by xiaoxiaomo on 2017/5/6.
+ */
+public enum ResultEnum {
+
+ SUCCESS("200", "成功"),
+ WAIT_CONFIRM("201", "请在手机上点击确认"),
+ WAIT_SCAN("400", "请扫描二维码");
+
+ private String code;
+ private String msg;
+
+ ResultEnum(String code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+// public static MsgInfoEnum getCode(String code) {
+// switch (code) {
+// case "Text":
+// return MsgInfoEnum.TEXT;
+// default:
+// return MsgInfoEnum.VIDEO;
+// }
+// }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/RetCodeEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/RetCodeEnum.java
new file mode 100644
index 00000000..f8e8082c
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/RetCodeEnum.java
@@ -0,0 +1,30 @@
+package com.xmzs.common.wechat.utils.enums;
+
+public enum RetCodeEnum {
+
+ NORMAL("0", "普通"),
+ LOGIN_OUT("1102", "退出"),
+ LOGIN_OTHERWHERE("1101", "其它地方登陆"),
+ MOBILE_LOGIN_OUT("1102", "移动端退出"),
+ UNKOWN("9999", "未知")
+
+ ;
+
+
+ private String code;
+ private String type;
+
+ RetCodeEnum(String code, String type) {
+ this.code = code;
+ this.type = type;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/StorageLoginInfoEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/StorageLoginInfoEnum.java
new file mode 100644
index 00000000..fa68b3bf
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/StorageLoginInfoEnum.java
@@ -0,0 +1,59 @@
+package com.xmzs.common.wechat.utils.enums;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by xiaoxiaomo on 2017/5/7.
+ */
+public enum StorageLoginInfoEnum {
+
+ //URL
+ url("url",new String()),
+ fileUrl("fileUrl",new String()),
+ syncUrl("syncUrl",new String()),
+
+ deviceid("deviceid",new String()), //生成15位随机数
+
+ //baseRequest
+ skey("skey",new String()),
+ wxsid("wxsid",new String()),
+ wxuin("wxuin",new String()),
+ pass_ticket("pass_ticket",new String()),
+
+
+ InviteStartCount("InviteStartCount",0),
+ User("User",new JSONObject()),
+ SyncKey("SyncKey",new JSONObject()),
+ synckey("synckey",new String()),
+
+
+
+ MemberCount("MemberCount",new String()),
+ MemberList("MemberList",new JSONArray()),
+
+
+
+ ;
+
+ private String key;
+ private Object type;
+
+ StorageLoginInfoEnum(String key, Object type) {
+ this.key = key;
+ this.type = type;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+
+ public Object getType() {
+ return type;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/URLEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/URLEnum.java
new file mode 100644
index 00000000..06348eff
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/URLEnum.java
@@ -0,0 +1,49 @@
+package com.xmzs.common.wechat.utils.enums;
+
+/**
+ * URL
+ * Created by xiaoxiaomo on 2017/5/6.
+ */
+public enum URLEnum {
+
+
+
+ BASE_URL("https://login.weixin.qq.com","基本的URL"),
+ UUID_URL(BASE_URL.url+"/jslogin","UUIDLURL"),
+ QRCODE_URL(BASE_URL.url+"/qrcode/","初始化URL"),
+ STATUS_NOTIFY_URL(BASE_URL.url+"/webwxstatusnotify?lang=zh_CN&pass_ticket=%s","微信状态通知"),
+ LOGIN_URL(BASE_URL.url+"/cgi-bin/mmwebwx-bin/login","登陆URL"),
+ INIT_URL("%s/webwxinit?r=%s&pass_ticket=%s","初始化URL"),
+ SYNC_CHECK_URL("/synccheck","检查心跳URL"),
+ WEB_WX_SYNC_URL("%s/webwxsync?sid=%s&skey=%s&pass_ticket=%s","web微信消息同步URL"),
+ WEB_WX_GET_CONTACT("%s/webwxgetcontact","web微信获取联系人信息URL"),
+ WEB_WX_SEND_MSG("%s/webwxsendmsg","发送消息URL"),
+ WEB_WX_UPLOAD_MEDIA("%s/webwxuploadmedia?f=json", "上传文件到服务器"),
+ WEB_WX_GET_MSG_IMG("%s/webwxgetmsgimg", "下载图片消息"),
+ WEB_WX_GET_VOICE("%s/webwxgetvoice", "下载语音消息"),
+ WEB_WX_GET_VIEDO("%s/webwxgetvideo", "下载语音消息"),
+ WEB_WX_PUSH_LOGIN("%s/webwxpushloginurl", "不扫码登陆"),
+ WEB_WX_LOGOUT("%s/webwxlogout", "退出微信"),
+ WEB_WX_BATCH_GET_CONTACT("%s/webwxbatchgetcontact?type=ex&r=%s&lang=zh_CN&pass_ticket=%s", "查询群信息"),
+ WEB_WX_REMARKNAME("%s/webwxoplog?lang=zh_CN&pass_ticket=%s", "修改好友备注"),
+ WEB_WX_VERIFYUSER("%s/webwxverifyuser?r=%s&lang=zh_CN&pass_ticket=%s", "被动添加好友"),
+ WEB_WX_GET_MEDIA("%s/webwxgetmedia", "下载文件")
+
+
+
+
+ ;
+
+ private String url;
+ private String msg;
+
+ URLEnum(String url, String msg) {
+ this.url = url;
+ this.msg = msg;
+ }
+
+
+ public String getUrl() {
+ return url;
+ }
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/VerifyFriendEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/VerifyFriendEnum.java
new file mode 100644
index 00000000..1ea22139
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/VerifyFriendEnum.java
@@ -0,0 +1,28 @@
+package com.xmzs.common.wechat.utils.enums;
+
+/**
+ * 确认添加好友Enum
+ *
+ * @author https://github.com/yaphone
+ * @date 创建时间:2017年6月29日 下午9:47:14
+ * @version 1.0
+ *
+ */
+public enum VerifyFriendEnum {
+
+ ADD(2, "添加"),
+ ACCEPT(3, "接受");
+
+ private int code;
+ private String desc;
+
+ private VerifyFriendEnum(int code, String desc) {
+ this.code = code;
+ this.desc = desc;
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/BaseParaEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/BaseParaEnum.java
new file mode 100644
index 00000000..9bdd7e7c
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/BaseParaEnum.java
@@ -0,0 +1,36 @@
+package com.xmzs.common.wechat.utils.enums.parameters;
+
+/**
+ *
+ * 基本请求参数
+ * 1. webWxInit 初始化
+ * 2. wxStatusNotify 微信状态通知
+ *
+ *
+ * Created by xiaoxiaomo on 2017/5/7.
+ */
+public enum BaseParaEnum {
+
+ Uin("Uin", "wxuin"),
+ Sid("Sid", "wxsid"),
+ Skey("Skey", "skey"),
+ DeviceID("DeviceID", "pass_ticket");
+
+ private String para;
+ private String value;
+
+ BaseParaEnum(String para, String value) {
+ this.para = para;
+ this.value = value;
+ }
+
+ public String para() {
+ return para;
+ }
+
+
+ public Object value() {
+ return value;
+ }
+
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/LoginParaEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/LoginParaEnum.java
new file mode 100644
index 00000000..da06b325
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/LoginParaEnum.java
@@ -0,0 +1,31 @@
+package com.xmzs.common.wechat.utils.enums.parameters;
+
+/**
+ * 登陆
+ *
+ * Created by xiaoxiaomo on 2017/5/7.
+ */
+public enum LoginParaEnum {
+
+ LOGIN_ICON("loginicon", "true"),
+ UUID("uuid", ""),
+ TIP("tip", "0"),
+ R("r", ""),
+ _1("_", "");
+
+ private String para;
+ private String value;
+
+ LoginParaEnum(String para, String value) {
+ this.para = para;
+ this.value = value;
+ }
+
+ public String para() {
+ return para;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/StatusNotifyParaEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/StatusNotifyParaEnum.java
new file mode 100644
index 00000000..c70a481c
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/StatusNotifyParaEnum.java
@@ -0,0 +1,30 @@
+package com.xmzs.common.wechat.utils.enums.parameters;
+
+/**
+ * 状态通知
+ *
+ * Created by xiaoxiaomo on 2017/5/7.
+ */
+public enum StatusNotifyParaEnum {
+
+ CODE("Code", "3"),
+ FROM_USERNAME("FromUserName", ""),
+ TO_USERNAME("ToUserName", ""),
+ CLIENT_MSG_ID("ClientMsgId", ""); //时间戳
+
+ private String para;
+ private String value;
+
+ StatusNotifyParaEnum(String para, String value) {
+ this.para = para;
+ this.value = value;
+ }
+
+ public String para() {
+ return para;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/UUIDParaEnum.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/UUIDParaEnum.java
new file mode 100644
index 00000000..6805b54d
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/enums/parameters/UUIDParaEnum.java
@@ -0,0 +1,33 @@
+package com.xmzs.common.wechat.utils.enums.parameters;
+
+/**
+ * UUID
+ *
+ * Created by xiaoxiaomo on 2017/5/7.
+ */
+public enum UUIDParaEnum {
+
+ APP_ID("appid", "wx782c26e4c19acffb"),
+ FUN("fun", "new"),
+ LANG("lang", "zh_CN"),
+ REDIRECT_URL("redirect_uri",
+ "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?mod=desktop"),
+ _1("_", "时间戳");
+
+
+ private String para;
+ private String value;
+
+ UUIDParaEnum(String para, String value) {
+ this.para = para;
+ this.value = value;
+ }
+
+ public String para() {
+ return para;
+ }
+
+ public String value() {
+ return value;
+ }
+}
diff --git a/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/tools/CommonTools.java b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/tools/CommonTools.java
new file mode 100644
index 00000000..6bb567df
--- /dev/null
+++ b/ruoyi-common/ruoyi-common-wechat/src/main/java/com/xmzs/common/wechat/utils/tools/CommonTools.java
@@ -0,0 +1,243 @@
+package com.xmzs.common.wechat.utils.tools;
+
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.vdurmont.emoji.EmojiParser;
+
+import com.xmzs.common.wechat.utils.Config;
+import com.xmzs.common.wechat.utils.enums.OsNameEnum;
+
+/**
+ * 常用工具类
+ *
+ * @author https://github.com/yaphone
+ * @date 创建时间:2017年4月8日 下午10:59:55
+ * @version 1.0
+ *
+ */
+public class CommonTools {
+
+ public static boolean printQr(String qrPath) {
+
+ switch (Config.getOsNameEnum()) {
+ case WINDOWS:
+ if (Config.getOsNameEnum().equals(OsNameEnum.WINDOWS)) {
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("cmd /c start " + qrPath);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+ case MAC:
+ if (Config.getOsNameEnum().equals(OsNameEnum.MAC)) {
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("open " + qrPath);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ return true;
+ }
+
+ public static boolean clearScreen() {
+ switch (Config.getOsNameEnum()) {
+ case WINDOWS:
+ if (Config.getOsNameEnum().equals(OsNameEnum.WINDOWS)) {
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("cmd /c " + "cls");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ return true;
+ }
+
+ /**
+ * 正则表达式处理工具
+ *
+ * @author https://github.com/yaphone
+ * @date 2017年4月9日 上午12:27:10
+ * @return
+ */
+ public static Matcher getMatcher(String regEx, String text) {
+ Pattern pattern = Pattern.compile(regEx);
+ Matcher matcher = pattern.matcher(text);
+ return matcher;
+ }
+
+ /**
+ * xml解析器
+ *
+ * @author https://github.com/yaphone
+ * @date 2017年4月9日 下午6:24:25
+ * @param text
+ * @return
+ */
+ public static Document xmlParser(String text) {
+ Document doc = null;
+ StringReader sr = new StringReader(text);
+ InputSource is = new InputSource(sr);
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ try {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ doc = builder.parse(is);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return doc;
+ }
+
+ public static JSONObject structFriendInfo(JSONObject userObj) {
+ Map friendInfoTemplate = new HashMap();
+ friendInfoTemplate.put("UserName", "");
+ friendInfoTemplate.put("City", "");
+ friendInfoTemplate.put("DisplayName", "");
+ friendInfoTemplate.put("PYQuanPin", "");
+ friendInfoTemplate.put("RemarkPYInitial", "");
+ friendInfoTemplate.put("Province", "");
+ friendInfoTemplate.put("KeyWord", "");
+ friendInfoTemplate.put("RemarkName", "");
+ friendInfoTemplate.put("PYInitial", "");
+ friendInfoTemplate.put("EncryChatRoomId", "");
+ friendInfoTemplate.put("Alias", "");
+ friendInfoTemplate.put("Signature", "");
+ friendInfoTemplate.put("NickName", "");
+ friendInfoTemplate.put("RemarkPYQuanPin", "");
+ friendInfoTemplate.put("HeadImgUrl", "");
+
+ friendInfoTemplate.put("UniFriend", 0);
+ friendInfoTemplate.put("Sex", 0);
+ friendInfoTemplate.put("AppAccountFlag", 0);
+ friendInfoTemplate.put("VerifyFlag", 0);
+ friendInfoTemplate.put("ChatRoomId", 0);
+ friendInfoTemplate.put("HideInputBarFlag", 0);
+ friendInfoTemplate.put("AttrStatus", 0);
+ friendInfoTemplate.put("SnsFlag", 0);
+ friendInfoTemplate.put("MemberCount", 0);
+ friendInfoTemplate.put("OwnerUin", 0);
+ friendInfoTemplate.put("ContactFlag", 0);
+ friendInfoTemplate.put("Uin", 0);
+ friendInfoTemplate.put("StarFriend", 0);
+ friendInfoTemplate.put("Statues", 0);
+
+ friendInfoTemplate.put("MemberList", new ArrayList