|
@ -1,9 +1,6 @@
|
|
package com.yihu.wlyy.service.weixin;
|
|
package com.yihu.wlyy.service.weixin;
|
|
|
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
|
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
|
|
import com.yihu.wlyy.wechat.process.WeiXinEventProcess;
|
|
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
|
|
import org.dom4j.Document;
|
|
import org.dom4j.Document;
|
|
@ -11,8 +8,6 @@ import org.dom4j.DocumentException;
|
|
import org.dom4j.DocumentHelper;
|
|
import org.dom4j.DocumentHelper;
|
|
import org.dom4j.Element;
|
|
import org.dom4j.Element;
|
|
import org.dom4j.io.SAXReader;
|
|
import org.dom4j.io.SAXReader;
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -20,8 +15,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@ -42,13 +35,13 @@ public class WeiXinCoreService extends BaseService {
|
|
* @param accessToken
|
|
* @param accessToken
|
|
*/
|
|
*/
|
|
public String messageProcess(HttpServletRequest request, String accessToken) {
|
|
public String messageProcess(HttpServletRequest request, String accessToken) {
|
|
try {
|
|
|
|
|
|
try (InputStream inputStream = request.getInputStream()){
|
|
String returnStr = "";
|
|
String returnStr = "";
|
|
// 将解析结果存储在HashMap中
|
|
// 将解析结果存储在HashMap中
|
|
Map<String, String> message = new HashMap();
|
|
Map<String, String> message = new HashMap();
|
|
|
|
|
|
// 从request中取得输入流
|
|
// 从request中取得输入流
|
|
InputStream inputStream = request.getInputStream();
|
|
|
|
|
|
|
|
// 读取输入流
|
|
// 读取输入流
|
|
SAXReader reader = new SAXReader();
|
|
SAXReader reader = new SAXReader();
|
|
Document document = reader.read(inputStream);
|
|
Document document = reader.read(inputStream);
|
|
@ -62,9 +55,7 @@ public class WeiXinCoreService extends BaseService {
|
|
Element ele = (Element) e;
|
|
Element ele = (Element) e;
|
|
message.put(ele.getName(), ele.getText());
|
|
message.put(ele.getName(), ele.getText());
|
|
}
|
|
}
|
|
logger.info("weixin event:" + message.toString());
|
|
|
|
// 释放资源
|
|
|
|
inputStream.close();
|
|
|
|
|
|
// logger.info("weixin event:" + message.toString());
|
|
// 添加access_token参数
|
|
// 添加access_token参数
|
|
message.put("token", accessToken);
|
|
message.put("token", accessToken);
|
|
// 消息处理
|
|
// 消息处理
|