下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
微信公众账号第三方平台全网发布源码(java)- 实战测试通过
技术交流请加QQ群:Jeewx微信开发④【289709451】
社区论坛:www.jeecg.org
package org.jeecgframework.web.rest.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.jeecgframework.core.util.LogUtil;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.web.system.service.SystemService;
import org.jeewx.api.core.exception.WexinReqException;
import org.jeewx.api.mp.aes.AesException;
import org.jeewx.api.mp.aes.WXBizMsgCrypt;
import org.jeewx.api.third.JwThirdAPI;
import org.jeewx.api.third.model.ApiComponentToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import weixin.open.entity.base.WeixinOpenAccountEntity;
/**
* 微信公众账号第三方平台全网发布源码(java)
* @author: jeewx开源社区
* @网址:www.jeewx.com
* @论坛:www.jeecg.org
* @date 20150801
*/
@Controller
@RequestMapping("/openwx")
public class OpenwxController {
private final String APPID = "???";
/**
* 微信全网测试账号
*/
private final static String COMPONENT_APPID = "???";
private final String COMPONENT_APPSECRET = "???";
private final static String COMPONENT_ENCODINGAESKEY = "?????";
private final static String COMPONENT_TOKEN = "?????";
@Autowired
private SystemService systemService;
/**
* 授权事件接收
*
* @param request
* @param response
* @throws IOException
* @throws AesException
* @throws DocumentException
*/
@RequestMapping(value = "/event/authorize")
public void acceptAuthorizeEvent(HttpServletRequest request,HttpServletResponse response) throws IOException,AesException,DocumentException {
// LogUtil.info("微信第三方平台---------微信推送Ticket消息10分钟一次-----------"+ DataUtils.getDataString(DataUtils.yyyymmddhhmmss));
processAuthorizeEvent(request);
output(response,"success"); // 输出响应的内容。
}
@RequestMapping(value = "/authorCallback")
public void authorCallback(HttpServletRequest request,DocumentException {
String auth_code = request.getParameter("auth_code");
String expires_in = request.getParameter("auth_code");
}
/**
* 一键授权功能
* @param request
* @param response
* @throws IOException
* @throws AesException
* @throws DocumentException
*/
@RequestMapping(value = "/goAuthor")
public void goAuthor(HttpServletRequest request,DocumentException {
ApiComponentToken apiComponentToken =