批量格式化代码

This commit is contained in:
Binary Wang
2017-05-11 17:07:08 +08:00
parent 5f887739a3
commit 8982cf8471
223 changed files with 2425 additions and 2793 deletions

View File

@@ -6,6 +6,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
/**
* 卡券相关接口
*
* @author YuJian(mgcnrx11@hotmail.com) on 01/11/2016
*/
public interface WxMpCardService {
@@ -52,7 +53,7 @@ public interface WxMpCardService {
* @return 卡券Api签名对象
*/
WxCardApiSignature createCardApiSignature(String... optionalSignParam) throws
WxErrorException;
WxErrorException;
/**
* 卡券Code解码
@@ -71,7 +72,7 @@ public interface WxMpCardService {
* @return WxMpCardResult对象
*/
WxMpCardResult queryCardCode(String cardId, String code, boolean checkConsume)
throws WxErrorException;
throws WxErrorException;
/**
* 卡券Code核销。核销失败会抛出异常
@@ -103,7 +104,7 @@ public interface WxMpCardService {
* @param isMark 是否要mark占用这个code填写true或者false表示占用或解除占用
*/
void markCardCode(String code, String cardId, String openId, boolean isMark) throws
WxErrorException;
WxErrorException;
/**
* 查看卡券详情接口

View File

@@ -1,19 +1,15 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeInterfaceResult;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary;
import me.chanjar.weixin.mp.bean.datacube.*;
import java.util.Date;
import java.util.List;
/**
* 统计分析相关接口
* Created by Binary Wang on 2016/8/23.
* Created by Binary Wang on 2016/8/23.
*
* @author binarywang (https://github.com/binarywang)
*/
public interface WxMpDataCubeService {
@@ -192,6 +188,7 @@ public interface WxMpDataCubeService {
List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException;
//*******************接口分析数据接口***********************//
/**
* <pre>
* 获取接口分析数据getinterfacesummary

View File

@@ -20,6 +20,7 @@ public interface WxMpDeviceService {
* 获取一组新的deviceid和设备二维码
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-6
* </pre>
*
* @param productId 产品id
* @return 返回WxDeviceQrCodeResult
*/
@@ -30,6 +31,7 @@ public interface WxMpDeviceService {
* 将device id及其属性信息提交公众平台进行授权
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-6
* </pre>
*
* @param wxDeviceAuthorize 授权请求对象
* @return WxDeviceAuthorizeResult
*/
@@ -41,6 +43,7 @@ public interface WxMpDeviceService {
* 第三方后台绑定成功后,通知公众平台
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html/page=3-4-7
* </pre>
*
* @param wxDeviceBind 绑定请求对象
* @return WxDeviceBindResult
*/
@@ -51,6 +54,7 @@ public interface WxMpDeviceService {
* 强制绑定用户和设备
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
* </pre>
*
* @param wxDeviceBind 强制绑定请求对象
* @return WxDeviceBindResult
*/
@@ -61,6 +65,7 @@ public interface WxMpDeviceService {
* 第三方确认用户和设备的解绑操作
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html/page=3-4-7
* </pre>
*
* @param wxDeviceBind 绑定请求对象
* @return WxDeviceBidResult
*/
@@ -71,6 +76,7 @@ public interface WxMpDeviceService {
* 强制解绑用户和设备
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-7
* </pre>
*
* @param wxDeviceBind 强制解绑请求对象
* @return WxDeviceBindResult
*/
@@ -81,17 +87,19 @@ public interface WxMpDeviceService {
* 通过device type和device id 获取设备主人的openid
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-11
* </pre>
*
* @param deviceType 设备类型,目前为"公众账号原始ID"
* @param deviceId 设备ID
* @param deviceId 设备ID
* @return WxDeviceOpenIdResult
*/
WxDeviceOpenIdResult getOpenId(String deviceType,String deviceId) throws WxErrorException;
WxDeviceOpenIdResult getOpenId(String deviceType, String deviceId) throws WxErrorException;
/**
* <pre>
* 通过openid获取用户在当前devicetype下绑定的deviceid列表`
* 详情请见http://iot.weixin.qq.com/wiki/new/index.html?page=3-4-12
* </pre>
*
* @param openId 要查询的用户的openid
* @return WxDeviceBindDeviceResult
*/

View File

@@ -51,6 +51,10 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
return this.accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
@Override
public Lock getAccessTokenLock() {
return this.accessTokenLock;
@@ -82,6 +86,10 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
return this.jsapiTicket;
}
public void setJsapiTicket(String jsapiTicket) {
this.jsapiTicket = jsapiTicket;
}
@Override
public Lock getJsapiTicketLock() {
return this.jsapiTicketLock;
@@ -112,6 +120,10 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
return this.cardApiTicket;
}
public void setCardApiTicket(String cardApiTicket) {
this.cardApiTicket = cardApiTicket;
}
@Override
public Lock getCardApiTicketLock() {
return this.cardApiTicketLock;
@@ -247,14 +259,6 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
this.apacheHttpClientBuilder = apacheHttpClientBuilder;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public void setJsapiTicket(String jsapiTicket) {
this.jsapiTicket = jsapiTicket;
}
public long getJsapiTicketExpiresTime() {
return this.jsapiTicketExpiresTime;
}
@@ -263,10 +267,6 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
this.jsapiTicketExpiresTime = jsapiTicketExpiresTime;
}
public void setCardApiTicket(String cardApiTicket) {
this.cardApiTicket = cardApiTicket;
}
public long getCardApiTicketExpiresTime() {
return this.cardApiTicketExpiresTime;
}

View File

@@ -25,10 +25,10 @@ public class WxMpInRedisConfigStorage extends WxMpInMemoryConfigStorage {
@Override
public boolean isAccessTokenExpired() {
return getAccessToken() == null ? true : false;
return getAccessToken() == null ? true : false;
}
@Override
@Override
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
jedis.set(ACCESS_TOKEN_KEY.concat(appId), accessToken);
jedis.expire(ACCESS_TOKEN_KEY.concat(appId), expiresInSeconds - 200);
@@ -87,4 +87,4 @@ public class WxMpInRedisConfigStorage extends WxMpInMemoryConfigStorage {
public void setJedis(Jedis jedis) {
this.jedis = jedis;
}
}
}

View File

@@ -13,6 +13,7 @@ import java.util.Date;
* 客服接口
* 注意命名采用kefu拼音的原因是其英文CustomerService如果再加上Service后缀显得有点啰嗦如果不加又显得表意不完整。
* </pre>
*
* @author Binary Wang
*/
public interface WxMpKefuService {

View File

@@ -2,9 +2,6 @@ package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
import me.chanjar.weixin.mp.bean.material.*;
import java.io.File;
@@ -37,12 +34,13 @@ public interface WxMpMaterialService {
* 语音voice2M播放长度不超过60s支持AMR\MP3格式
* 视频video10MB支持MP4格式
* 缩略图thumb64KB支持JPG格式
*媒体文件在后台保存时间为3天即3天后media_id失效。
* 媒体文件在后台保存时间为3天即3天后media_id失效。
* 详情请见: <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">新增临时素材</a>
* 接口url格式https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE
* </pre>
*
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
* @param file 文件对象
* @param file 文件对象
* @throws WxErrorException
* @see #mediaUpload(String, String, InputStream)
*/
@@ -106,12 +104,12 @@ public interface WxMpMaterialService {
* 接口url格式https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE
*
* 除了3天就会失效的临时素材外开发者有时需要永久保存一些素材届时就可以通过本接口新增永久素材。
永久图片素材新增后将带有URL返回给开发者开发者可以在腾讯系域名内使用腾讯系域名外使用图片将被屏蔽
请注意:
1、新增的永久素材也可以在公众平台官网素材管理模块中看到
2、永久素材的数量是有上限的请谨慎新增。图文消息素材和图片素材的上限为5000其他类型为1000
3、素材的格式大小等要求与公众平台官网一致。具体是图片大小不超过2M支持bmp/png/jpeg/jpg/gif格式语音大小不超过5M长度不超过60秒支持mp3/wma/wav/amr格式
4、调用该接口需https协议
* 永久图片素材新增后将带有URL返回给开发者开发者可以在腾讯系域名内使用腾讯系域名外使用图片将被屏蔽
* 请注意:
* 1、新增的永久素材也可以在公众平台官网素材管理模块中看到
* 2、永久素材的数量是有上限的请谨慎新增。图文消息素材和图片素材的上限为5000其他类型为1000
* 3、素材的格式大小等要求与公众平台官网一致。具体是图片大小不超过2M支持bmp/png/jpeg/jpg/gif格式语音大小不超过5M长度不超过60秒支持mp3/wma/wav/amr格式
* 4、调用该接口需https协议
* </pre>
*
* @param mediaType 媒体类型, 请看{@link me.chanjar.weixin.common.api.WxConsts}
@@ -127,12 +125,12 @@ public interface WxMpMaterialService {
* 接口url格式https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=ACCESS_TOKEN
*
* 除了3天就会失效的临时素材外开发者有时需要永久保存一些素材届时就可以通过本接口新增永久素材。
永久图片素材新增后将带有URL返回给开发者开发者可以在腾讯系域名内使用腾讯系域名外使用图片将被屏蔽
请注意:
1、新增的永久素材也可以在公众平台官网素材管理模块中看到
2、永久素材的数量是有上限的请谨慎新增。图文消息素材和图片素材的上限为5000其他类型为1000
3、素材的格式大小等要求与公众平台官网一致。具体是图片大小不超过2M支持bmp/png/jpeg/jpg/gif格式语音大小不超过5M长度不超过60秒支持mp3/wma/wav/amr格式
4、调用该接口需https协议
* 永久图片素材新增后将带有URL返回给开发者开发者可以在腾讯系域名内使用腾讯系域名外使用图片将被屏蔽
* 请注意:
* 1、新增的永久素材也可以在公众平台官网素材管理模块中看到
* 2、永久素材的数量是有上限的请谨慎新增。图文消息素材和图片素材的上限为5000其他类型为1000
* 3、素材的格式大小等要求与公众平台官网一致。具体是图片大小不超过2M支持bmp/png/jpeg/jpg/gif格式语音大小不超过5M长度不超过60秒支持mp3/wma/wav/amr格式
* 4、调用该接口需https协议
* </pre>
*
* @param news 上传的图文消息, 请看{@link WxMpMaterialNews}

View File

@@ -19,6 +19,7 @@ public interface WxMpMenuService {
* 如果要创建个性化菜单请设置matchrule属性
* 详情请见https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN
* </pre>
*
* @return 如果是个性化菜单则返回menuid否则返回null
*/
String menuCreate(WxMenu menu) throws WxErrorException;
@@ -30,6 +31,7 @@ public interface WxMpMenuService {
* 如果要创建个性化菜单请设置matchrule属性
* 详情请见https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN
* </pre>
*
* @return 如果是个性化菜单则返回menuid否则返回null
*/
String menuCreate(String json) throws WxErrorException;
@@ -74,16 +76,16 @@ public interface WxMpMenuService {
* <pre>
* 获取自定义菜单配置接口
* 本接口将会提供公众号当前使用的自定义菜单的配置如果公众号是通过API调用设置的菜单则返回菜单的开发配置而如果公众号是在公众平台官网通过网站功能发布菜单则本接口返回运营者设置的菜单配置。
请注意:
1、第三方平台开发者可以通过本接口在旗下公众号将业务授权给你后立即通过本接口检测公众号的自定义菜单配置并通过接口再次给公众号设置好自动回复规则以提升公众号运营者的业务体验。
2、本接口与自定义菜单查询接口的不同之处在于本接口无论公众号的接口是如何设置的都能查询到接口而自定义菜单查询接口则仅能查询到使用API设置的菜单配置。
3、认证/未认证的服务号/订阅号,以及接口测试号,均拥有该接口权限。
4、从第三方平台的公众号登录授权机制上来说该接口从属于消息与菜单权限集。
5、本接口中返回的图片/语音/视频为临时素材临时素材每次获取都不同3天内有效通过素材管理-获取临时素材接口来获取这些素材),本接口返回的图文消息为永久素材素材(通过素材管理-获取永久素材接口来获取这些素材)。
* 请注意:
* 1、第三方平台开发者可以通过本接口在旗下公众号将业务授权给你后立即通过本接口检测公众号的自定义菜单配置并通过接口再次给公众号设置好自动回复规则以提升公众号运营者的业务体验。
* 2、本接口与自定义菜单查询接口的不同之处在于本接口无论公众号的接口是如何设置的都能查询到接口而自定义菜单查询接口则仅能查询到使用API设置的菜单配置。
* 3、认证/未认证的服务号/订阅号,以及接口测试号,均拥有该接口权限。
* 4、从第三方平台的公众号登录授权机制上来说该接口从属于消息与菜单权限集。
* 5、本接口中返回的图片/语音/视频为临时素材临时素材每次获取都不同3天内有效通过素材管理-获取临时素材接口来获取这些素材),本接口返回的图文消息为永久素材素材(通过素材管理-获取永久素材接口来获取这些素材)。
* 接口调用请求说明:
http请求方式: GET请使用https协议
https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=ACCESS_TOKEN
*</pre>
* http请求方式: GET请使用https协议
* https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=ACCESS_TOKEN
* </pre>
*/
WxMpGetSelfMenuInfoResult getSelfMenuInfo() throws WxErrorException;
}

View File

@@ -9,6 +9,7 @@ public interface WxMpMessageMatcher {
/**
* 消息是否匹配某种模式
*
* @param message
*/
boolean match(WxMpXmlMessage message);

View File

@@ -1,15 +1,5 @@
package me.chanjar.weixin.mp.api;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import me.chanjar.weixin.common.api.WxErrorExceptionHandler;
import me.chanjar.weixin.common.api.WxMessageDuplicateChecker;
import me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker;
@@ -20,6 +10,15 @@ import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.common.util.LogExceptionHandler;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
* <pre>
@@ -46,15 +45,13 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
* router.route(message);
*
* </pre>
* @author Daniel Qian
*
* @author Daniel Qian
*/
public class WxMpMessageRouter {
protected final Logger log = LoggerFactory.getLogger(WxMpMessageRouter.class);
private static final int DEFAULT_THREAD_POOL_SIZE = 100;
protected final Logger log = LoggerFactory.getLogger(WxMpMessageRouter.class);
private final List<WxMpMessageRouterRule> rules = new ArrayList<>();
private final WxMpService wxMpService;
@@ -80,6 +77,7 @@ public class WxMpMessageRouter {
* 设置自定义的 {@link ExecutorService}
* 如果不调用该方法,默认使用 Executors.newFixedThreadPool(100)
* </pre>
*
* @param executorService
*/
public void setExecutorService(ExecutorService executorService) {
@@ -91,6 +89,7 @@ public class WxMpMessageRouter {
* 设置自定义的 {@link me.chanjar.weixin.common.api.WxMessageDuplicateChecker}
* 如果不调用该方法,默认使用 {@link me.chanjar.weixin.common.api.WxMessageInMemoryDuplicateChecker}
* </pre>
*
* @param messageDuplicateChecker
*/
public void setMessageDuplicateChecker(WxMessageDuplicateChecker messageDuplicateChecker) {
@@ -102,6 +101,7 @@ public class WxMpMessageRouter {
* 设置自定义的{@link me.chanjar.weixin.common.session.WxSessionManager}
* 如果不调用该方法,默认使用 {@link me.chanjar.weixin.common.session.StandardSessionManager}
* </pre>
*
* @param sessionManager
*/
public void setSessionManager(WxSessionManager sessionManager) {
@@ -113,6 +113,7 @@ public class WxMpMessageRouter {
* 设置自定义的{@link me.chanjar.weixin.common.api.WxErrorExceptionHandler}
* 如果不调用该方法,默认使用 {@link me.chanjar.weixin.common.util.LogExceptionHandler}
* </pre>
*
* @param exceptionHandler
*/
public void setExceptionHandler(WxErrorExceptionHandler exceptionHandler) {
@@ -132,6 +133,7 @@ public class WxMpMessageRouter {
/**
* 处理微信消息
*
* @param wxMessage
*/
public WxMpXmlOutMessage route(final WxMpXmlMessage wxMessage) {
@@ -145,7 +147,7 @@ public class WxMpMessageRouter {
for (final WxMpMessageRouterRule rule : this.rules) {
if (rule.test(wxMessage)) {
matchRules.add(rule);
if(!rule.isReEnter()) {
if (!rule.isReEnter()) {
break;
}
}
@@ -159,14 +161,14 @@ public class WxMpMessageRouter {
final List<Future<?>> futures = new ArrayList<>();
for (final WxMpMessageRouterRule rule : matchRules) {
// 返回最后一个非异步的rule的执行结果
if(rule.isAsync()) {
if (rule.isAsync()) {
futures.add(
this.executorService.submit(new Runnable() {
@Override
public void run() {
rule.service(wxMessage, WxMpMessageRouter.this.wxMpService, WxMpMessageRouter.this.sessionManager, WxMpMessageRouter.this.exceptionHandler);
}
})
this.executorService.submit(new Runnable() {
@Override
public void run() {
rule.service(wxMessage, WxMpMessageRouter.this.wxMpService, WxMpMessageRouter.this.sessionManager, WxMpMessageRouter.this.exceptionHandler);
}
})
);
} else {
res = rule.service(wxMessage, this.wxMpService, this.sessionManager, this.exceptionHandler);
@@ -217,11 +219,12 @@ public class WxMpMessageRouter {
/**
* 对session的访问结束
*
* @param wxMessage
*/
protected void sessionEndAccess(WxMpXmlMessage wxMessage) {
InternalSession session = ((InternalSessionManager)this.sessionManager).findSession(wxMessage.getFromUser());
InternalSession session = ((InternalSessionManager) this.sessionManager).findSession(wxMessage.getFromUser());
if (session != null) {
session.endAccess();
}

View File

@@ -1,8 +1,8 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.api.WxErrorExceptionHandler;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.common.api.WxErrorExceptionHandler;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
@@ -168,22 +168,22 @@ public class WxMpMessageRouterRule {
*/
protected boolean test(WxMpXmlMessage wxMessage) {
return
(this.fromUser == null || this.fromUser.equals(wxMessage.getFromUser()))
&&
(this.msgType == null || this.msgType.toLowerCase().equals((wxMessage.getMsgType()==null?null:wxMessage.getMsgType().toLowerCase())))
&&
(this.event == null || this.event.toLowerCase().equals((wxMessage.getEvent()==null?null:wxMessage.getEvent().toLowerCase())))
&&
(this.eventKey == null || this.eventKey.toLowerCase().equals((wxMessage.getEventKey()==null?null:wxMessage.getEventKey().toLowerCase())))
&&
(this.content == null || this.content
.equals(wxMessage.getContent() == null ? null : wxMessage.getContent().trim()))
&&
(this.rContent == null || Pattern
.matches(this.rContent, wxMessage.getContent() == null ? "" : wxMessage.getContent().trim()))
&&
(this.matcher == null || this.matcher.match(wxMessage))
;
(this.fromUser == null || this.fromUser.equals(wxMessage.getFromUser()))
&&
(this.msgType == null || this.msgType.toLowerCase().equals((wxMessage.getMsgType() == null ? null : wxMessage.getMsgType().toLowerCase())))
&&
(this.event == null || this.event.toLowerCase().equals((wxMessage.getEvent() == null ? null : wxMessage.getEvent().toLowerCase())))
&&
(this.eventKey == null || this.eventKey.toLowerCase().equals((wxMessage.getEventKey() == null ? null : wxMessage.getEventKey().toLowerCase())))
&&
(this.content == null || this.content
.equals(wxMessage.getContent() == null ? null : wxMessage.getContent().trim()))
&&
(this.rContent == null || Pattern
.matches(this.rContent, wxMessage.getContent() == null ? "" : wxMessage.getContent().trim()))
&&
(this.matcher == null || this.matcher.match(wxMessage))
;
}
/**
@@ -193,9 +193,9 @@ public class WxMpMessageRouterRule {
* @return true 代表继续执行别的routerfalse 代表停止执行别的router
*/
protected WxMpXmlOutMessage service(WxMpXmlMessage wxMessage,
WxMpService wxMpService,
WxSessionManager sessionManager,
WxErrorExceptionHandler exceptionHandler) {
WxMpService wxMpService,
WxSessionManager sessionManager,
WxErrorExceptionHandler exceptionHandler) {
try {
@@ -211,7 +211,7 @@ public class WxMpMessageRouterRule {
WxMpXmlOutMessage res = null;
for (WxMpMessageHandler handler : this.handlers) {
// 返回最后handler的结果
if(handler == null){
if (handler == null) {
continue;
}
res = handler.handle(wxMessage, context, wxMpService, sessionManager);

View File

@@ -10,6 +10,7 @@ import java.io.File;
* 二维码相关操作接口
* 文档地址https://mp.weixin.qq.com/wiki?action=doc&id=mp1443433542&t=0.9274944716856435
* </pre>
*
* @author Binary Wang
*/
public interface WxMpQrcodeService {

View File

@@ -297,11 +297,6 @@ public interface WxMpService {
*/
//HttpHost getRequestHttpProxy();
/**
* 注入 {@link WxMpConfigStorage} 的实现
*/
void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider);
/**
* <pre>
* 设置当微信系统响应系统繁忙时,要等待多少 retrySleepMillis(ms) * 2^(重试次数 - 1) 再发起重试
@@ -325,6 +320,11 @@ public interface WxMpService {
*/
WxMpConfigStorage getWxMpConfigStorage();
/**
* 注入 {@link WxMpConfigStorage} 的实现
*/
void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider);
/**
* 返回客服接口方法实现类,以方便调用其各个接口
*
@@ -416,7 +416,6 @@ public interface WxMpService {
void initHttp();
/**
*
* @return
*/
RequestHttp getRequestHttp();

View File

@@ -9,10 +9,11 @@ import java.util.List;
/**
* 门店管理的相关接口代码
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016-09-23.
*/
public interface WxMpStoreService<H,P> {
public interface WxMpStoreService<H, P> {
/**
* <pre>
* 创建门店
@@ -23,7 +24,6 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式: http://api.weixin.qq.com/cgi-bin/poi/addpoi?access_token=TOKEN
* </pre>
*
*/
void add(WxMpStoreBaseInfo request) throws WxErrorException;
@@ -37,7 +37,8 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/getpoi?access_token=TOKEN
* </pre>
* @param poiId 门店Id
*
* @param poiId 门店Id
* @throws WxErrorException
*/
WxMpStoreBaseInfo get(String poiId) throws WxErrorException;
@@ -49,7 +50,8 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/delpoi?access_token=TOKEN
* </pre>
* @param poiId 门店Id
*
* @param poiId 门店Id
* @throws WxErrorException
*/
void delete(String poiId) throws WxErrorException;
@@ -61,6 +63,7 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=TOKEN
* </pre>
*
* @param begin 开始位置0 即为从第一条开始查询
* @param limit 返回数据条数最大允许50默认为20
* @throws WxErrorException
@@ -74,6 +77,7 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=TOKEN
* </pre>
*
* @throws WxErrorException
*/
List<WxMpStoreInfo> listAll() throws WxErrorException;
@@ -85,6 +89,7 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/updatepoi?access_token=TOKEN
* </pre>
*
* @throws WxErrorException
*/
void update(WxMpStoreBaseInfo info) throws WxErrorException;
@@ -96,6 +101,7 @@ public interface WxMpStoreService<H,P> {
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a>
* 接口格式http://api.weixin.qq.com/cgi-bin/poi/getwxcategory?access_token=TOKEN
* </pre>
*
* @throws WxErrorException
*/
List<String> listCategories() throws WxErrorException;

View File

@@ -56,6 +56,7 @@ public interface WxMpTemplateMsgService {
* 详情请见: http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN
* 接口地址格式https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN
* </pre>
*
* @param shortTemplateId 模板库中模板的编号有“TM**”和“OPENTMTM**”等形式
* @return templateId 模板Id
*/

View File

@@ -48,7 +48,7 @@ public interface WxMpUserService {
* </pre>
*
* @param openid 用户openid
* @param lang 语言zh_CN 简体(默认)zh_TW 繁体en 英语
* @param lang 语言zh_CN 简体(默认)zh_TW 繁体en 英语
*/
WxMpUser userInfo(String openid, String lang) throws WxErrorException;

View File

@@ -1,16 +1,16 @@
package me.chanjar.weixin.mp.api;
import java.util.List;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
import java.util.List;
/**
* 用户标签管理相关接口
* Created by Binary Wang on 2016/9/2.
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
*/
public interface WxMpUserTagService {
@@ -32,7 +32,6 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/get?access_token=ACCESS_TOKEN
* </pre>
*
*/
List<WxUserTag> tagGet() throws WxErrorException;
@@ -42,7 +41,6 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/update?access_token=ACCESS_TOKEN
* </pre>
*
*/
Boolean tagUpdate(Long tagId, String name) throws WxErrorException;
@@ -52,7 +50,6 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/delete?access_token=ACCESS_TOKEN
* </pre>
*
*/
Boolean tagDelete(Long tagId) throws WxErrorException;
@@ -62,10 +59,9 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/user/tag/get?access_token=ACCESS_TOKEN
* </pre>
*
*/
WxTagListUser tagListUser(Long tagId, String nextOpenid)
throws WxErrorException;
throws WxErrorException;
/**
* <pre>
@@ -73,7 +69,6 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN
* </pre>
*
*/
boolean batchTagging(Long tagId, String[] openids) throws WxErrorException;
@@ -83,7 +78,6 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging?access_token=ACCESS_TOKEN
* </pre>
*
*/
boolean batchUntagging(Long tagId, String[] openids) throws WxErrorException;
@@ -94,7 +88,8 @@ public interface WxMpUserTagService {
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
* 接口url格式 https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN
* </pre>
* @return 标签Id的列表
*
* @return 标签Id的列表
*/
List<Long> userTagList(String openid) throws WxErrorException;

View File

@@ -35,8 +35,8 @@ public class WxMpCardServiceImpl implements WxMpCardService {
}
@Override
public WxMpService getWxMpService(){
return this.wxMpService;
public WxMpService getWxMpService() {
return this.wxMpService;
}
/**
@@ -98,13 +98,13 @@ public class WxMpCardServiceImpl implements WxMpCardService {
* </pre>
*
* @param optionalSignParam 参与签名的参数数组。
* 可以为下列字段app_id, card_id, card_type, code, openid, location_id
* </br>注意当做wx.chooseCard调用时必须传入app_id参与签名否则会造成签名失败导致拉取卡券列表为空
* 可以为下列字段app_id, card_id, card_type, code, openid, location_id
* </br>注意当做wx.chooseCard调用时必须传入app_id参与签名否则会造成签名失败导致拉取卡券列表为空
* @return 卡券Api签名对象
*/
@Override
public WxCardApiSignature createCardApiSignature(String... optionalSignParam) throws
WxErrorException {
WxErrorException {
long timestamp = System.currentTimeMillis() / 1000;
String nonceStr = RandomUtils.getRandomStr();
String cardApiTicket = getCardApiTicket(false);
@@ -157,8 +157,8 @@ public class WxMpCardServiceImpl implements WxMpCardService {
String responseContent = this.wxMpService.post(url, param.toString());
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement,
new TypeToken<WxMpCardResult>() {
}.getType());
new TypeToken<WxMpCardResult>() {
}.getType());
}
/**
@@ -206,7 +206,7 @@ public class WxMpCardServiceImpl implements WxMpCardService {
*/
@Override
public void markCardCode(String code, String cardId, String openId, boolean isMark) throws
WxErrorException {
WxErrorException {
String url = "https://api.weixin.qq.com/card/code/mark";
JsonObject param = new JsonObject();
param.addProperty("code", code);
@@ -216,7 +216,8 @@ public class WxMpCardServiceImpl implements WxMpCardService {
String responseContent = this.getWxMpService().post(url, param.toString());
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
WxMpCardResult cardResult = WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement,
new TypeToken<WxMpCardResult>() { }.getType());
new TypeToken<WxMpCardResult>() {
}.getType());
if (!cardResult.getErrorCode().equals("0")) {
this.log.warn("朋友的券mark失败{}", cardResult.getErrorMsg());
}

View File

@@ -12,7 +12,8 @@ import java.util.Date;
import java.util.List;
/**
* Created by Binary Wang on 2016/8/23.
* Created by Binary Wang on 2016/8/23.
*
* @author binarywang (https://github.com/binarywang)
*/
public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@@ -108,7 +109,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsg(Date beginDate, Date endDate)
throws WxErrorException {
throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsg";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -119,7 +120,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgHour(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsghour";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -130,7 +131,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsgweek";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -141,7 +142,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsgmonth";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -152,7 +153,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsgdist";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -163,7 +164,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsgdistweek";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -174,7 +175,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getupstreammsgdistmonth";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -185,7 +186,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeInterfaceResult> getInterfaceSummary(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getinterfacesummary";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));
@@ -196,7 +197,7 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
@Override
public List<WxDataCubeInterfaceResult> getInterfaceSummaryHour(Date beginDate,
Date endDate) throws WxErrorException {
Date endDate) throws WxErrorException {
String url = API_URL_PREFIX + "/getinterfacesummaryhour";
JsonObject param = new JsonObject();
param.addProperty("begin_date", this.dateFormat.format(beginDate));

View File

@@ -78,8 +78,8 @@ public class WxMpDeviceServiceImpl implements WxMpDeviceService {
@Override
public WxDeviceBindDeviceResult getBindDevice(String openId) throws WxErrorException {
String url = API_URL_PREFIX+"/get_bind_device";
String response = this.wxMpService.get(url,"openid="+openId);
String url = API_URL_PREFIX + "/get_bind_device";
String response = this.wxMpService.get(url, "openid=" + openId);
return WxDeviceBindDeviceResult.fromJson(response);
}
}

View File

@@ -83,7 +83,7 @@ public class WxMpMaterialServiceImpl implements WxMpMaterialService {
@Override
public InputStream materialImageOrVoiceDownload(String media_id) throws WxErrorException {
String url = MATERIAL_API_URL_PREFIX + "/get_material";
return this.wxMpService.execute(MaterialVoiceAndImageDownloadRequestExecutor.create(this.wxMpService.getRequestHttp(),this.wxMpService.getWxMpConfigStorage().getTmpDirFile()), url, media_id);
return this.wxMpService.execute(MaterialVoiceAndImageDownloadRequestExecutor.create(this.wxMpService.getRequestHttp(), this.wxMpService.getWxMpConfigStorage().getTmpDirFile()), url, media_id);
}
@Override

View File

@@ -16,9 +16,9 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
* Created by Binary Wang on 2016/9/26.
* @author binarywang (https://github.com/binarywang)
* Created by Binary Wang on 2016/9/26.
*
* @author binarywang (https://github.com/binarywang)
*/
public class WxMpStoreServiceImpl implements WxMpStoreService {
private static final String API_BASE_URL = "http://api.weixin.qq.com/cgi-bin/poi";
@@ -45,21 +45,21 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
public WxMpStoreBaseInfo get(String poiId) throws WxErrorException {
String url = API_BASE_URL + "/getpoi";
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id",poiId);
paramObject.addProperty("poi_id", poiId);
String response = this.wxMpService.post(url, paramObject.toString());
WxError wxError = WxError.fromJson(response);
if (wxError.getErrorCode() != 0) {
throw new WxErrorException(wxError);
}
return WxMpStoreBaseInfo.fromJson(new JsonParser().parse(response).getAsJsonObject()
.get("business").getAsJsonObject().get("base_info").toString());
.get("business").getAsJsonObject().get("base_info").toString());
}
@Override
public void delete(String poiId) throws WxErrorException {
String url = API_BASE_URL + "/delpoi";
JsonObject paramObject = new JsonObject();
paramObject.addProperty("poi_id",poiId);
paramObject.addProperty("poi_id", poiId);
String response = this.wxMpService.post(url, paramObject.toString());
WxError wxError = WxError.fromJson(response);
if (wxError.getErrorCode() != 0) {
@@ -69,7 +69,7 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
@Override
public WxMpStoreListResult list(int begin, int limit)
throws WxErrorException {
throws WxErrorException {
String url = API_BASE_URL + "/getpoilist";
JsonObject params = new JsonObject();
params.addProperty("begin", begin);
@@ -125,8 +125,9 @@ public class WxMpStoreServiceImpl implements WxMpStoreService {
}
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(response).getAsJsonObject().get("category_list"),
new TypeToken<List<String>>(){}.getType());
new JsonParser().parse(response).getAsJsonObject().get("category_list"),
new TypeToken<List<String>>() {
}.getType());
}
}

View File

@@ -40,7 +40,7 @@ public class WxMpUserServiceImpl implements WxMpUserService {
String url = API_URL_PREFIX + "/info";
lang = lang == null ? "zh_CN" : lang;
String responseContent = this.wxMpService.get(url,
"openid=" + openid + "&lang=" + lang);
"openid=" + openid + "&lang=" + lang);
return WxMpUser.fromJson(responseContent);
}
@@ -48,13 +48,13 @@ public class WxMpUserServiceImpl implements WxMpUserService {
public WxMpUserList userList(String next_openid) throws WxErrorException {
String url = API_URL_PREFIX + "/get";
String responseContent = this.wxMpService.get(url,
next_openid == null ? null : "next_openid=" + next_openid);
next_openid == null ? null : "next_openid=" + next_openid);
return WxMpUserList.fromJson(responseContent);
}
@Override
public List<WxMpUser> userInfoList(List<String> openids)
throws WxErrorException {
throws WxErrorException {
return this.userInfoList(new WxMpUserQuery(openids));
}
@@ -62,7 +62,7 @@ public class WxMpUserServiceImpl implements WxMpUserService {
public List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException {
String url = API_URL_PREFIX + "/info/batchget";
String responseContent = this.wxMpService.post(url,
userQuery.toJsonString());
userQuery.toJsonString());
return WxMpUser.fromJsonList(responseContent);
}

View File

@@ -16,7 +16,6 @@ import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/9/2.
*/
@@ -88,7 +87,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
@Override
public WxTagListUser tagListUser(Long tagId, String nextOpenid)
throws WxErrorException {
throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/user/tag/get";
JsonObject json = new JsonObject();
@@ -101,7 +100,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
@Override
public boolean batchTagging(Long tagId, String[] openids)
throws WxErrorException {
throws WxErrorException {
String url = API_URL_PREFIX + "/members/batchtagging";
JsonObject json = new JsonObject();
@@ -123,7 +122,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
@Override
public boolean batchUntagging(Long tagId, String[] openids)
throws WxErrorException {
throws WxErrorException {
String url = API_URL_PREFIX + "/members/batchuntagging";
JsonObject json = new JsonObject();
@@ -153,8 +152,8 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
String responseContent = this.wxMpService.post(url, json.toString());
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"),
new TypeToken<List<Long>>() {
}.getType());
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"),
new TypeToken<List<Long>>() {
}.getType());
}
}

View File

@@ -36,6 +36,11 @@ public class WxMpMassNews implements Serializable {
return this.articles == null || this.articles.isEmpty();
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* <pre>
* 群发图文消息article
@@ -141,9 +146,4 @@ public class WxMpMassNews implements Serializable {
return ToStringUtils.toSimpleString(this);
}
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
}

View File

@@ -38,6 +38,7 @@ public class WxMpMassOpenIdsMessage implements Serializable {
* {@link me.chanjar.weixin.common.api.WxConsts#MASS_MSG_VOICE}
* 如果msgtype和media_id不匹配的话会返回系统繁忙的错误
* </pre>
*
* @param msgType
*/
public void setMsgType(String msgType) {
@@ -71,28 +72,29 @@ public class WxMpMassOpenIdsMessage implements Serializable {
return this.toUsers;
}
/**
* 添加openid最多支持10,000个
* @param openid
*/
public void addUser(String openid) {
this.toUsers.add(openid);
}
/**
* 提供set方法方便客户端直接设置所有群发对象的openid列表
*
* @param toUsers
*/
public void setToUsers(List<String> toUsers) {
this.toUsers = toUsers;
}
/**
* 添加openid最多支持10,000个
*
* @param openid
*/
public void addUser(String openid) {
this.toUsers.add(openid);
}
public boolean isSendIgnoreReprint() {
return sendIgnoreReprint;
}
/**
*
* @param sendIgnoreReprint 文章被判定为转载时,是否继续进行群发操作。
*/
public void setSendIgnoreReprint(boolean sendIgnoreReprint) {

View File

@@ -82,7 +82,6 @@ public class WxMpMassTagMessage implements Serializable {
}
/**
*
* @param sendIgnoreReprint 文章被判定为转载时,是否继续进行群发操作。
*/
public void setSendIgnoreReprint(boolean sendIgnoreReprint) {
@@ -97,7 +96,7 @@ public class WxMpMassTagMessage implements Serializable {
}
public void setSendAll(boolean sendAll) {
if(sendAll){
if (sendAll) {
this.tagId = null;
}

View File

@@ -6,13 +6,13 @@ import java.io.Serializable;
/**
* 群发时用到的视频素材
*
*
* @author chanjarster
*/
public class WxMpMassVideo implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = 9153925016061915637L;
private String mediaId;

View File

@@ -6,7 +6,7 @@ import java.io.Serializable;
/**
* 语义理解查询用对象
*
* <p>
* http://mp.weixin.qq.com/wiki/index.php?title=语义理解
*
* @author Daniel Qian
@@ -14,7 +14,7 @@ import java.io.Serializable;
public class WxMpSemanticQuery implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = 7685873048199870690L;
private String query;

View File

@@ -1,189 +1,188 @@
package me.chanjar.weixin.mp.bean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
/**
* 批量查询用户信息查询参数 <br>
* Created by LiuJunGuang on 2016/8/31.
*
* @author LiuJunGuang
*/
public class WxMpUserQuery {
private List<WxMpUserQueryParam> queryParamList = new ArrayList<>();
public WxMpUserQuery() {
super();
}
/**
* 语言使用默认(zh_CN)
*
* @param openids
*/
public WxMpUserQuery(List<String> openids) {
super();
add(openids);
}
/**
* 添加OpenId列表语言使用默认(zh_CN)
*
* @param openids
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(List<String> openids) {
for (String openid : openids) {
this.add(openid);
}
return this;
}
/**
* 添加一个OpenId
*
* @param openid
* @param lang 国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(String openid, String lang) {
this.queryParamList.add(new WxMpUserQueryParam(openid, lang));
return this;
}
/**
* 添加一个OpenId到列表中并返回本对象
*
* <pre>
* 该方法默认lang = zh_CN
* </pre>
*
* @param openid
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(String openid) {
this.queryParamList.add(new WxMpUserQueryParam(openid));
return this;
}
/**
* 删除指定的OpenId语言使用默认(zh_CN)
*
* @param openid
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery remove(String openid) {
this.queryParamList.remove(new WxMpUserQueryParam(openid));
return this;
}
/**
* 删除指定的OpenId
*
* @param openid
* @param lang 国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery remove(String openid, String lang) {
this.queryParamList.remove(new WxMpUserQueryParam(openid, lang));
return this;
}
/**
* 获取查询参数列表
*
*/
public List<WxMpUserQueryParam> getQueryParamList() {
return this.queryParamList;
}
public String toJsonString() {
Map<String, Object> map = new HashMap<>();
map.put("user_list", this.queryParamList);
return new Gson().toJson(map);
}
// 查询参数封装
public class WxMpUserQueryParam implements Serializable {
private static final long serialVersionUID = -6863571795702385319L;
private String openid;
private String lang;
public WxMpUserQueryParam(String openid, String lang) {
super();
this.openid = openid;
this.lang = lang;
}
public WxMpUserQueryParam(String openid) {
super();
this.openid = openid;
this.lang = "zh_CN";
}
public WxMpUserQueryParam() {
super();
}
public String getOpenid() {
return this.openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getLang() {
return this.lang;
}
public void setLang(String lang) {
this.lang = lang;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + ((this.lang == null) ? 0 : this.lang.hashCode());
result = prime * result + ((this.openid == null) ? 0 : this.openid.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WxMpUserQueryParam other = (WxMpUserQueryParam) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (this.lang == null) {
if (other.lang != null)
return false;
} else if (!this.lang.equals(other.lang))
return false;
if (this.openid == null) {
if (other.openid != null)
return false;
} else if (!this.openid.equals(other.openid))
return false;
return true;
}
private WxMpUserQuery getOuterType() {
return WxMpUserQuery.this;
}
}
}
package me.chanjar.weixin.mp.bean;
import com.google.gson.Gson;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 批量查询用户信息查询参数 <br>
* Created by LiuJunGuang on 2016/8/31.
*
* @author LiuJunGuang
*/
public class WxMpUserQuery {
private List<WxMpUserQueryParam> queryParamList = new ArrayList<>();
public WxMpUserQuery() {
super();
}
/**
* 语言使用默认(zh_CN)
*
* @param openids
*/
public WxMpUserQuery(List<String> openids) {
super();
add(openids);
}
/**
* 添加OpenId列表语言使用默认(zh_CN)
*
* @param openids
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(List<String> openids) {
for (String openid : openids) {
this.add(openid);
}
return this;
}
/**
* 添加一个OpenId
*
* @param openid
* @param lang 国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(String openid, String lang) {
this.queryParamList.add(new WxMpUserQueryParam(openid, lang));
return this;
}
/**
* 添加一个OpenId到列表中并返回本对象
* <p>
* <pre>
* 该方法默认lang = zh_CN
* </pre>
*
* @param openid
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery add(String openid) {
this.queryParamList.add(new WxMpUserQueryParam(openid));
return this;
}
/**
* 删除指定的OpenId语言使用默认(zh_CN)
*
* @param openid
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery remove(String openid) {
this.queryParamList.remove(new WxMpUserQueryParam(openid));
return this;
}
/**
* 删除指定的OpenId
*
* @param openid
* @param lang 国家地区语言版本zh_CN 简体zh_TW 繁体en 英语
* @return {@link WxMpUserQuery}
*/
public WxMpUserQuery remove(String openid, String lang) {
this.queryParamList.remove(new WxMpUserQueryParam(openid, lang));
return this;
}
/**
* 获取查询参数列表
*/
public List<WxMpUserQueryParam> getQueryParamList() {
return this.queryParamList;
}
public String toJsonString() {
Map<String, Object> map = new HashMap<>();
map.put("user_list", this.queryParamList);
return new Gson().toJson(map);
}
// 查询参数封装
public class WxMpUserQueryParam implements Serializable {
private static final long serialVersionUID = -6863571795702385319L;
private String openid;
private String lang;
public WxMpUserQueryParam(String openid, String lang) {
super();
this.openid = openid;
this.lang = lang;
}
public WxMpUserQueryParam(String openid) {
super();
this.openid = openid;
this.lang = "zh_CN";
}
public WxMpUserQueryParam() {
super();
}
public String getOpenid() {
return this.openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getLang() {
return this.lang;
}
public void setLang(String lang) {
this.lang = lang;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + ((this.lang == null) ? 0 : this.lang.hashCode());
result = prime * result + ((this.openid == null) ? 0 : this.openid.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WxMpUserQueryParam other = (WxMpUserQueryParam) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (this.lang == null) {
if (other.lang != null)
return false;
} else if (!this.lang.equals(other.lang))
return false;
if (this.openid == null) {
if (other.openid != null)
return false;
} else if (!this.openid.equals(other.openid))
return false;
return true;
}
private WxMpUserQuery getOuterType() {
return WxMpUserQuery.this;
}
}
}

View File

@@ -9,6 +9,7 @@ import java.util.List;
/**
* 图文分析数据接口返回结果对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/24.
*/
@@ -109,6 +110,13 @@ public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
@SerializedName("user_source")
private Integer userSource;
public static List<WxDataCubeArticleResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeArticleResult>>() {
}.getType());
}
public Integer getRefHour() {
return this.refHour;
}
@@ -212,11 +220,4 @@ public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
public void setUserSource(Integer userSource) {
this.userSource = userSource;
}
public static List<WxDataCubeArticleResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeArticleResult>>() {
}.getType());
}
}

View File

@@ -1,15 +1,15 @@
package me.chanjar.weixin.mp.bean.datacube;
import java.util.List;
import com.google.gson.JsonParser;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
* 图文分析数据接口返回结果对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/24.
*/
@@ -38,6 +38,13 @@ public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
@SerializedName("details")
private List<WxDataCubeArticleTotalDetail> details;
public static List<WxDataCubeArticleTotal> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeArticleTotal>>() {
}.getType());
}
public String getMsgId() {
return this.msgId;
}
@@ -61,11 +68,4 @@ public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
public void setDetails(List<WxDataCubeArticleTotalDetail> details) {
this.details = details;
}
public static List<WxDataCubeArticleTotal> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeArticleTotal>>() {
}.getType());
}
}

View File

@@ -4,6 +4,7 @@ import com.google.gson.annotations.SerializedName;
/**
* 获取图文群发总数据接口(getarticletotal)中的详细字段
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/24.
*/
@@ -80,114 +81,114 @@ public class WxDataCubeArticleTotalDetail {
private Integer addToFavCount;
/**
* int_page_from_session_read_user
* 公众号会话阅读人数
*/
* int_page_from_session_read_user
* 公众号会话阅读人数
*/
@SerializedName("int_page_from_session_read_user")
private Integer intPageFromSessionReadUser;
/**
* int_page_from_session_read_count
* 公众号会话阅读次数
*/
* int_page_from_session_read_count
* 公众号会话阅读次数
*/
@SerializedName("int_page_from_session_read_count")
private Integer intPageFromSessionReadCount;
/**
* int_page_from_hist_msg_read_user
* 历史消息页阅读人数
*/
* int_page_from_hist_msg_read_user
* 历史消息页阅读人数
*/
@SerializedName("int_page_from_hist_msg_read_user")
private Integer intPageFromHistMsgReadUser;
/**
* int_page_from_hist_msg_read_count
* 历史消息页阅读次数
*/
* int_page_from_hist_msg_read_count
* 历史消息页阅读次数
*/
@SerializedName("int_page_from_hist_msg_read_count")
private Integer intPageFromHistMsgReadCount;
/**
* int_page_from_feed_read_user
* 朋友圈阅读人数
*/
* int_page_from_feed_read_user
* 朋友圈阅读人数
*/
@SerializedName("int_page_from_feed_read_user")
private Integer intPageFromFeedReadUser;
/**
* int_page_from_feed_read_count
* 朋友圈阅读次数
*/
* int_page_from_feed_read_count
* 朋友圈阅读次数
*/
@SerializedName("int_page_from_feed_read_count")
private Integer intPageFromFeedReadCount;
/**
* int_page_from_friends_read_user
* 好友转发阅读人数
*/
* int_page_from_friends_read_user
* 好友转发阅读人数
*/
@SerializedName("int_page_from_friends_read_user")
private Integer intPageFromFriendsReadUser;
/**
* int_page_from_friends_read_count
* 好友转发阅读次数
*/
* int_page_from_friends_read_count
* 好友转发阅读次数
*/
@SerializedName("int_page_from_friends_read_count")
private Integer intPageFromFriendsReadCount;
/**
* int_page_from_other_read_user
* 其他场景阅读人数
*/
* int_page_from_other_read_user
* 其他场景阅读人数
*/
@SerializedName("int_page_from_other_read_user")
private Integer intPageFromOtherReadUser;
/**
* int_page_from_other_read_count
* 其他场景阅读次数
*/
* int_page_from_other_read_count
* 其他场景阅读次数
*/
@SerializedName("int_page_from_other_read_count")
private Integer intPageFromOtherReadCount;
/**
* feed_share_from_session_user
* 公众号会话转发朋友圈人数
*/
* feed_share_from_session_user
* 公众号会话转发朋友圈人数
*/
@SerializedName("feed_share_from_session_user")
private Integer feedShareFromSessionUser;
/**
* feed_share_from_session_cnt
* 公众号会话转发朋友圈次数
*/
* feed_share_from_session_cnt
* 公众号会话转发朋友圈次数
*/
@SerializedName("feed_share_from_session_cnt")
private Integer feedShareFromSessionCnt;
/**
* feed_share_from_feed_user
* 朋友圈转发朋友圈人数
*/
* feed_share_from_feed_user
* 朋友圈转发朋友圈人数
*/
@SerializedName("feed_share_from_feed_user")
private Integer feedShareFromFeedUser;
/**
* feed_share_from_feed_cnt
* 朋友圈转发朋友圈次数
*/
* feed_share_from_feed_cnt
* 朋友圈转发朋友圈次数
*/
@SerializedName("feed_share_from_feed_cnt")
private Integer feedShareFromFeedCnt;
/**
* feed_share_from_other_user
* 其他场景转发朋友圈人数
*/
* feed_share_from_other_user
* 其他场景转发朋友圈人数
*/
@SerializedName("feed_share_from_other_user")
private Integer feedShareFromOtherUser;
/**
* feed_share_from_other_cnt
* 其他场景转发朋友圈次数
*/
* feed_share_from_other_cnt
* 其他场景转发朋友圈次数
*/
@SerializedName("feed_share_from_other_cnt")
private Integer feedShareFromOtherCnt;
@@ -284,7 +285,7 @@ public class WxDataCubeArticleTotalDetail {
}
public void setIntPageFromSessionReadCount(
Integer intPageFromSessionReadCount) {
Integer intPageFromSessionReadCount) {
this.intPageFromSessionReadCount = intPageFromSessionReadCount;
}
@@ -301,7 +302,7 @@ public class WxDataCubeArticleTotalDetail {
}
public void setIntPageFromHistMsgReadCount(
Integer intPageFromHistMsgReadCount) {
Integer intPageFromHistMsgReadCount) {
this.intPageFromHistMsgReadCount = intPageFromHistMsgReadCount;
}
@@ -334,7 +335,7 @@ public class WxDataCubeArticleTotalDetail {
}
public void setIntPageFromFriendsReadCount(
Integer intPageFromFriendsReadCount) {
Integer intPageFromFriendsReadCount) {
this.intPageFromFriendsReadCount = intPageFromFriendsReadCount;
}

View File

@@ -5,15 +5,11 @@ import me.chanjar.weixin.common.util.ToStringUtils;
/**
* 统计接口的共用属性类
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/25.
*/
public class WxDataCubeBaseResult {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* ref_date
* 数据的日期需在begin_date和end_date之间
@@ -21,6 +17,11 @@ public class WxDataCubeBaseResult {
@SerializedName("ref_date")
private String refDate;
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public String getRefDate() {
return this.refDate;
}

View File

@@ -1,15 +1,15 @@
package me.chanjar.weixin.mp.bean.datacube;
import java.util.List;
import com.google.gson.JsonParser;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
* 接口分析数据接口返回结果对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/30.
*/
@@ -52,6 +52,13 @@ public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
@SerializedName("max_time_cost")
private Integer maxTimeCost;
public static List<WxDataCubeInterfaceResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeInterfaceResult>>() {
}.getType());
}
public Integer getRefHour() {
return this.refHour;
}
@@ -92,11 +99,4 @@ public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
this.maxTimeCost = maxTimeCost;
}
public static List<WxDataCubeInterfaceResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeInterfaceResult>>() {
}.getType());
}
}

View File

@@ -1,15 +1,15 @@
package me.chanjar.weixin.mp.bean.datacube;
import java.util.List;
import com.google.gson.JsonParser;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
* 消息分析数据接口返回结果对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/8/29.
*/
@@ -66,6 +66,13 @@ public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
@SerializedName("ori_page_read_user")
private Integer oriPageReadUser;
public static List<WxDataCubeMsgResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeMsgResult>>() {
}.getType());
}
public Integer getRefHour() {
return this.refHour;
}
@@ -122,11 +129,4 @@ public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
this.oriPageReadUser = oriPageReadUser;
}
public static List<WxDataCubeMsgResult> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeMsgResult>>() {
}.getType());
}
}

View File

@@ -25,6 +25,13 @@ public class WxDataCubeUserCumulate implements Serializable {
private Integer cumulateUser;
public static List<WxDataCubeUserCumulate> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeUserCumulate>>() {
}.getType());
}
public Date getRefDate() {
return this.refDate;
}
@@ -45,11 +52,4 @@ public class WxDataCubeUserCumulate implements Serializable {
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static List<WxDataCubeUserCumulate> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeUserCumulate>>() {
}.getType());
}
}

View File

@@ -28,6 +28,13 @@ public class WxDataCubeUserSummary implements Serializable {
private Integer cancelUser;
public static List<WxDataCubeUserSummary> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeUserSummary>>() {
}.getType());
}
public Date getRefDate() {
return this.refDate;
}
@@ -64,11 +71,4 @@ public class WxDataCubeUserSummary implements Serializable {
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static List<WxDataCubeUserSummary> fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(
JSON_PARSER.parse(json).getAsJsonObject().get("list"),
new TypeToken<List<WxDataCubeUserSummary>>() {
}.getType());
}
}

View File

@@ -5,7 +5,7 @@ import com.google.gson.annotations.SerializedName;
/**
* Created by keungtung on 10/12/2016.
*/
public class BaseResp extends AbstractDeviceBean{
public class BaseResp extends AbstractDeviceBean {
@SerializedName("base_info")
private BaseInfo baseInfo;
@SerializedName("errcode")

View File

@@ -6,7 +6,7 @@ import com.google.gson.annotations.SerializedName;
* Created by keungtung on 10/12/2016.
*/
public class RespMsg extends AbstractDeviceBean{
public class RespMsg extends AbstractDeviceBean {
@SerializedName("ret_code")
private Integer retCode;
@SerializedName("error_info")

View File

@@ -6,7 +6,7 @@ import me.chanjar.weixin.common.util.json.WxGsonBuilder;
/**
* Created by keungtung on 14/12/2016.
*/
public class TransMsgResp extends AbstractDeviceBean{
public class TransMsgResp extends AbstractDeviceBean {
private Integer ret;
@SerializedName("ret_info")
private String retInfo;

View File

@@ -7,7 +7,7 @@ import java.util.List;
/**
* Created by keungtung on 10/12/2016.
*/
public class WxDeviceAuthorizeResult extends AbstractDeviceBean{
public class WxDeviceAuthorizeResult extends AbstractDeviceBean {
private List<BaseResp> resp;
public static WxDeviceAuthorizeResult fromJson(String response) {

View File

@@ -5,7 +5,7 @@ import com.google.gson.annotations.SerializedName;
/**
* Created by keungtung on 10/12/2016.
*/
public class WxDeviceBind extends AbstractDeviceBean{
public class WxDeviceBind extends AbstractDeviceBean {
private String ticket;
@SerializedName("device_id")
private String deviceId;

View File

@@ -6,7 +6,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* Created by keungtung on 10/12/2016.
*/
public class WxDeviceBindResult extends AbstractDeviceBean{
public class WxDeviceBindResult extends AbstractDeviceBean {
@SerializedName("base_resp")
private BaseResp baseResp;

View File

@@ -6,7 +6,7 @@ import me.chanjar.weixin.common.util.ToStringUtils;
/**
* Created by keungtung on 10/12/2016.
*/
public class WxDeviceMsg extends AbstractDeviceBean{
public class WxDeviceMsg extends AbstractDeviceBean {
@SerializedName("device_type")
private String deviceType;
@SerializedName("device_id")

View File

@@ -1,19 +1,12 @@
package me.chanjar.weixin.mp.bean.kefu;
import me.chanjar.weixin.mp.builder.kefu.*;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import me.chanjar.weixin.mp.builder.kefu.ImageBuilder;
import me.chanjar.weixin.mp.builder.kefu.MpNewsBuilder;
import me.chanjar.weixin.mp.builder.kefu.MusicBuilder;
import me.chanjar.weixin.mp.builder.kefu.NewsBuilder;
import me.chanjar.weixin.mp.builder.kefu.TextBuilder;
import me.chanjar.weixin.mp.builder.kefu.VideoBuilder;
import me.chanjar.weixin.mp.builder.kefu.VoiceBuilder;
import me.chanjar.weixin.mp.builder.kefu.WxCardBuilder;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 客服消息
*
@@ -104,14 +97,6 @@ public class WxMpKefuMessage implements Serializable {
return this.msgType;
}
public String getMpNewsMediaId() {
return this.mpNewsMediaId;
}
public void setMpNewsMediaId(String mpNewsMediaId) {
this.mpNewsMediaId = mpNewsMediaId;
}
/**
* <pre>
* 请使用
@@ -131,6 +116,14 @@ public class WxMpKefuMessage implements Serializable {
this.msgType = msgType;
}
public String getMpNewsMediaId() {
return this.mpNewsMediaId;
}
public void setMpNewsMediaId(String mpNewsMediaId) {
this.mpNewsMediaId = mpNewsMediaId;
}
public String getContent() {
return this.content;
}

View File

@@ -8,8 +8,8 @@ import java.io.Serializable;
/**
* 客服基本信息以及客服在线状态信息
* @author Binary Wang
*
* @author Binary Wang
*/
public class WxMpKfInfo implements Serializable {
private static final long serialVersionUID = -5877300750666022290L;
@@ -63,7 +63,7 @@ public class WxMpKfInfo implements Serializable {
private String inviteStatus;
/**
* status 客服在线状态目前为1、web 在线
* status 客服在线状态目前为1、web 在线
*/
@SerializedName("status")
private Integer status;

View File

@@ -5,15 +5,18 @@ import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfList {
@SerializedName("kf_list")
private List<WxMpKfInfo> kfList;
public static WxMpKfList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfList.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
@@ -26,8 +29,4 @@ public class WxMpKfList {
public void setKfList(List<WxMpKfInfo> kfList) {
this.kfList = kfList;
}
public static WxMpKfList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfList.class);
}
}

View File

@@ -19,6 +19,10 @@ public class WxMpKfMsgList {
@SerializedName("msgid")
private Long msgId;
public static WxMpKfMsgList fromJson(String responseContent) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(responseContent, WxMpKfMsgList.class);
}
public List<WxMpKfMsgRecord> getRecords() {
return this.records;
}
@@ -47,8 +51,4 @@ public class WxMpKfMsgList {
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpKfMsgList fromJson(String responseContent) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(responseContent, WxMpKfMsgList.class);
}
}

View File

@@ -31,7 +31,7 @@ public class WxMpKfMsgRecord {
@SerializedName("text")
private String text;
/**
/**
* time 操作时间unix时间戳
*/
@SerializedName("time")

View File

@@ -5,15 +5,18 @@ import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfOnlineList {
@SerializedName("kf_online_list")
private List<WxMpKfInfo> kfOnlineList;
public static WxMpKfOnlineList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfOnlineList.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
@@ -26,8 +29,4 @@ public class WxMpKfOnlineList {
public void setKfOnlineList(List<WxMpKfInfo> kfOnlineList) {
this.kfOnlineList = kfOnlineList;
}
public static WxMpKfOnlineList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfOnlineList.class);
}
}

View File

@@ -4,9 +4,7 @@ import com.google.gson.annotations.SerializedName;
import me.chanjar.weixin.common.util.ToStringUtils;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfSession {
/**

View File

@@ -5,9 +5,7 @@ import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfSessionGetResult {
/**
@@ -22,15 +20,15 @@ public class WxMpKfSessionGetResult {
@SerializedName("createtime")
private long createTime;
public static WxMpKfSessionGetResult fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfSessionGetResult.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpKfSessionGetResult fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfSessionGetResult.class);
}
public String getKfAccount() {
return this.kfAccount;
}

View File

@@ -7,9 +7,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfSessionList {
/**
@@ -18,16 +16,16 @@ public class WxMpKfSessionList {
@SerializedName("sessionlist")
private List<WxMpKfSession> kfSessionList;
public static WxMpKfSessionList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json,
WxMpKfSessionList.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpKfSessionList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json,
WxMpKfSessionList.class);
}
public List<WxMpKfSession> getKfSessionList() {
return this.kfSessionList;
}

View File

@@ -7,9 +7,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.util.List;
/**
*
* @author Binary Wang
*
*/
public class WxMpKfSessionWaitCaseList {
/**
@@ -24,16 +22,16 @@ public class WxMpKfSessionWaitCaseList {
@SerializedName("waitcaselist")
private List<WxMpKfSession> kfSessionWaitCaseList;
public static WxMpKfSessionWaitCaseList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json,
WxMpKfSessionWaitCaseList.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpKfSessionWaitCaseList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json,
WxMpKfSessionWaitCaseList.class);
}
public List<WxMpKfSession> getKfSessionWaitCaseList() {
return this.kfSessionWaitCaseList;
}

View File

@@ -28,6 +28,11 @@ public class WxMpMaterialNews implements Serializable {
return this.articles == null || this.articles.isEmpty();
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* <pre>
* 群发图文消息article
@@ -79,7 +84,7 @@ public class WxMpMaterialNews implements Serializable {
/**
* 点击图文消息跳转链接
*/
*/
private String url;
public String getThumbMediaId() {
@@ -139,11 +144,11 @@ public class WxMpMaterialNews implements Serializable {
}
public String getUrl() {
return this.url;
return this.url;
}
public void setUrl(String url) {
this.url = url;
this.url = url;
}
public String getThumbUrl() {
@@ -159,9 +164,4 @@ public class WxMpMaterialNews implements Serializable {
return ToStringUtils.toSimpleString(this);
}
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
}

View File

@@ -13,6 +13,10 @@ public class WxMpMaterialUploadResult implements Serializable {
private String mediaId;
private String url;
public static WxMpMaterialUploadResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialUploadResult.class);
}
public String getMediaId() {
return this.mediaId;
}
@@ -29,10 +33,6 @@ public class WxMpMaterialUploadResult implements Serializable {
this.url = url;
}
public static WxMpMaterialUploadResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialUploadResult.class);
}
@Override
public String toString() {
return "WxMpMaterialUploadResult [media_id=" + this.mediaId + ", url=" + this.url + "]";

View File

@@ -14,6 +14,10 @@ public class WxMpMaterialVideoInfoResult implements Serializable {
private String description;
private String downUrl;
public static WxMpMaterialVideoInfoResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialVideoInfoResult.class);
}
public String getTitle() {
return this.title;
}
@@ -38,10 +42,6 @@ public class WxMpMaterialVideoInfoResult implements Serializable {
this.downUrl = downUrl;
}
public static WxMpMaterialVideoInfoResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMaterialVideoInfoResult.class);
}
@Override
public String toString() {
return "WxMpMaterialVideoInfoResult [title=" + this.title + ", description=" + this.description + ", downUrl=" + this.downUrl + "]";

View File

@@ -25,11 +25,6 @@ public class WxMpSelfMenuInfo {
}
public static class WxMpSelfMenuButton {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* <pre>
* 菜单的类型公众平台官网上能够设置的菜单类型有view跳转网页、text返回文本下同、img、photo、video、voice。
@@ -38,13 +33,11 @@ public class WxMpSelfMenuInfo {
*/
@SerializedName("type")
private String type;
/**
* 菜单名称
*/
@SerializedName("name")
private String name;
/**
* <pre>
* 对于不同的菜单类型value的值意义不同。
@@ -62,24 +55,31 @@ public class WxMpSelfMenuInfo {
*/
@SerializedName("key")
private String key;
/**
* @see #key
*/
@SerializedName("url")
private String url;
/**
* @see #key
*/
@SerializedName("value")
private String value;
/**
* 子菜单信息
*/
@SerializedName("sub_button")
private SubButtons subButtons;
/**
* 图文消息的信息
*/
@SerializedName("news_info")
private NewsInfo newsInfo;
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public SubButtons getSubButtons() {
return subButtons;
@@ -89,30 +89,6 @@ public class WxMpSelfMenuInfo {
this.subButtons = subButtons;
}
public static class SubButtons {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
@SerializedName("list")
private List<WxMpSelfMenuButton> subButtons = new ArrayList<>();
public List<WxMpSelfMenuButton> getSubButtons() {
return subButtons;
}
public void setSubButtons(List<WxMpSelfMenuButton> subButtons) {
this.subButtons = subButtons;
}
}
/**
* 图文消息的信息
*/
@SerializedName("news_info")
private NewsInfo newsInfo;
public String getType() {
return type;
}
@@ -161,15 +137,33 @@ public class WxMpSelfMenuInfo {
this.newsInfo = newsInfo;
}
public static class NewsInfo {
public static class SubButtons {
@SerializedName("list")
private List<WxMpSelfMenuButton> subButtons = new ArrayList<>();
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public List<WxMpSelfMenuButton> getSubButtons() {
return subButtons;
}
public void setSubButtons(List<WxMpSelfMenuButton> subButtons) {
this.subButtons = subButtons;
}
}
public static class NewsInfo {
@SerializedName("list")
private List<NewsInButton> news = new ArrayList<>();
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public List<NewsInButton> getNews() {
return news;
}
@@ -179,54 +173,48 @@ public class WxMpSelfMenuInfo {
}
public static class NewsInButton {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* 图文消息的标题
*/
@SerializedName("title")
private String title;
/**
* 摘要
*/
@SerializedName("digest")
private String digest;
/**
* 作者
*/
@SerializedName("author")
private String author;
/**
* show_cover
* 是否显示封面0为不显示1为显示
*/
@SerializedName("show_cover")
private Integer showCover;
/**
* 封面图片的URL
*/
@SerializedName("cover_url")
private String coverUrl;
/**
* 正文的URL
*/
@SerializedName("content_url")
private String contentUrl;
/**
* 原文的URL若置空则无查看原文入口
*/
@SerializedName("source_url")
private String sourceUrl;
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public String getTitle() {
return title;
}

View File

@@ -16,6 +16,10 @@ public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
@XStreamConverter(value = XStreamMediaIdConverter.class)
private String mediaId;
public WxMpXmlOutImageMessage() {
this.msgType = WxConsts.XML_MSG_IMAGE;
}
public String getMediaId() {
return this.mediaId;
}
@@ -24,8 +28,4 @@ public class WxMpXmlOutImageMessage extends WxMpXmlOutMessage {
this.mediaId = mediaId;
}
public WxMpXmlOutImageMessage() {
this.msgType = WxConsts.XML_MSG_IMAGE;
}
}

View File

@@ -16,66 +16,20 @@ public abstract class WxMpXmlOutMessage implements Serializable {
private static final long serialVersionUID = -381382011286216263L;
@XStreamAlias("ToUserName")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
protected String toUserName;
@XStreamAlias("FromUserName")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
protected String fromUserName;
@XStreamAlias("CreateTime")
protected Long createTime;
@XStreamAlias("MsgType")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
protected String msgType;
public String getToUserName() {
return this.toUserName;
}
public void setToUserName(String toUserName) {
this.toUserName = toUserName;
}
public String getFromUserName() {
return this.fromUserName;
}
public void setFromUserName(String fromUserName) {
this.fromUserName = fromUserName;
}
public Long getCreateTime() {
return this.createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public String getMsgType() {
return this.msgType;
}
public void setMsgType(String msgType) {
this.msgType = msgType;
}
@SuppressWarnings("unchecked")
public String toXml() {
return XStreamTransformer.toXml((Class<WxMpXmlOutMessage>) this.getClass(), this);
}
/**
* 转换成加密的xml格式
*/
public String toEncryptedXml(WxMpConfigStorage wxMpConfigStorage) {
String plainXml = toXml();
WxMpCryptUtil pc = new WxMpCryptUtil(wxMpConfigStorage);
return pc.encrypt(plainXml);
}
/**
* 获得文本消息builder
*/
@@ -124,4 +78,50 @@ public abstract class WxMpXmlOutMessage implements Serializable {
public static TransferCustomerServiceBuilder TRANSFER_CUSTOMER_SERVICE() {
return new TransferCustomerServiceBuilder();
}
public String getToUserName() {
return this.toUserName;
}
public void setToUserName(String toUserName) {
this.toUserName = toUserName;
}
public String getFromUserName() {
return this.fromUserName;
}
public void setFromUserName(String fromUserName) {
this.fromUserName = fromUserName;
}
public Long getCreateTime() {
return this.createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public String getMsgType() {
return this.msgType;
}
public void setMsgType(String msgType) {
this.msgType = msgType;
}
@SuppressWarnings("unchecked")
public String toXml() {
return XStreamTransformer.toXml((Class<WxMpXmlOutMessage>) this.getClass(), this);
}
/**
* 转换成加密的xml格式
*/
public String toEncryptedXml(WxMpConfigStorage wxMpConfigStorage) {
String plainXml = toXml();
WxMpCryptUtil pc = new WxMpCryptUtil(wxMpConfigStorage);
return pc.encrypt(plainXml);
}
}

View File

@@ -63,23 +63,23 @@ public class WxMpXmlOutMusicMessage extends WxMpXmlOutMessage {
public static class Music {
@XStreamAlias("Title")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String title;
@XStreamAlias("Description")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String description;
@XStreamAlias("ThumbMediaId")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String thumbMediaId;
@XStreamAlias("MusicUrl")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String musicUrl;
@XStreamAlias("HQMusicUrl")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String hqMusicUrl;
public String getTitle() {

View File

@@ -15,12 +15,10 @@ public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
*
*/
private static final long serialVersionUID = -4604402850905714772L;
@XStreamAlias("ArticleCount")
protected int articleCount;
@XStreamAlias("Articles")
protected final List<Item> articles = new ArrayList<>();
@XStreamAlias("ArticleCount")
protected int articleCount;
public WxMpXmlOutNewsMessage() {
this.msgType = WxConsts.XML_MSG_NEWS;
@@ -44,19 +42,19 @@ public class WxMpXmlOutNewsMessage extends WxMpXmlOutMessage {
public static class Item {
@XStreamAlias("Title")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String Title;
@XStreamAlias("Description")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String Description;
@XStreamAlias("PicUrl")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String PicUrl;
@XStreamAlias("Url")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String Url;
public String getTitle() {

View File

@@ -13,7 +13,7 @@ public class WxMpXmlOutTextMessage extends WxMpXmlOutMessage {
*/
private static final long serialVersionUID = -3972786455288763361L;
@XStreamAlias("Content")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String content;
public WxMpXmlOutTextMessage() {

View File

@@ -28,7 +28,7 @@ public class WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage {
public static class TransInfo {
@XStreamAlias("KfAccount")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String kfAccount;
public String getKfAccount() {

View File

@@ -45,18 +45,18 @@ public class WxMpXmlOutVideoMessage extends WxMpXmlOutMessage {
@XStreamAlias("Video")
public static class Video {
public static class Video {
@XStreamAlias("MediaId")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String mediaId;
@XStreamAlias("Title")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String title;
@XStreamAlias("Description")
@XStreamConverter(value=XStreamCDataConverter.class)
@XStreamConverter(value = XStreamCDataConverter.class)
private String description;
public String getMediaId() {

View File

@@ -13,8 +13,8 @@ import java.io.Serializable;
* http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口#.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81.E7.BE.A4.E5.8F.91.E7.BB.93.E6.9E.9C
*
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public class WxMpMassSendResult implements Serializable {
private static final long serialVersionUID = -4816336807575562818L;
@@ -23,6 +23,10 @@ public class WxMpMassSendResult implements Serializable {
private String msgId;
private String msgDataId;
public static WxMpMassSendResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMassSendResult.class);
}
public String getErrorCode() {
return this.errorCode;
}
@@ -55,10 +59,6 @@ public class WxMpMassSendResult implements Serializable {
this.msgDataId = msgDataId;
}
public static WxMpMassSendResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMassSendResult.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);

View File

@@ -9,19 +9,23 @@ import java.io.Serializable;
* 上传群发用的素材的结果
* 视频和图文消息需要在群发前上传素材
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public class WxMpMassUploadResult implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = 6568157943644994029L;
private String type;
private String mediaId;
private long createdAt;
public static WxMpMassUploadResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMassUploadResult.class);
}
public String getType() {
return this.type;
}
@@ -46,10 +50,6 @@ public class WxMpMassUploadResult implements Serializable {
this.createdAt = createdAt;
}
public static WxMpMassUploadResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpMassUploadResult.class);
}
@Override
public String toString() {
return "WxUploadResult [type=" + this.type + ", media_id=" + this.mediaId + ", created_at=" + this.createdAt + "]";

View File

@@ -1,13 +1,13 @@
package me.chanjar.weixin.mp.bean.result;
import java.io.Serializable;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import java.io.Serializable;
public class WxMpOAuth2AccessToken implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = -1345910558078620805L;
@@ -23,6 +23,10 @@ public class WxMpOAuth2AccessToken implements Serializable {
private String unionId;
public static WxMpOAuth2AccessToken fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpOAuth2AccessToken.class);
}
public String getRefreshToken() {
return this.refreshToken;
}
@@ -71,19 +75,15 @@ public class WxMpOAuth2AccessToken implements Serializable {
this.unionId = unionId;
}
public static WxMpOAuth2AccessToken fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpOAuth2AccessToken.class);
}
@Override
public String toString() {
return "WxMpOAuth2AccessToken{" +
"accessToken='" + this.accessToken + '\'' +
", expiresTime=" + this.expiresIn +
", refreshToken='" + this.refreshToken + '\'' +
", openId='" + this.openId + '\'' +
", scope='" + this.scope + '\'' +
", unionId='" + this.unionId + '\'' +
'}';
"accessToken='" + this.accessToken + '\'' +
", expiresTime=" + this.expiresIn +
", refreshToken='" + this.refreshToken + '\'' +
", openId='" + this.openId + '\'' +
", scope='" + this.scope + '\'' +
", unionId='" + this.unionId + '\'' +
'}';
}
}

View File

@@ -6,19 +6,23 @@ import java.io.Serializable;
/**
* 换取二维码的Ticket
*
*
* @author chanjarster
*/
public class WxMpQrCodeTicket implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = 5777119669111011584L;
protected String ticket;
protected int expire_seconds = -1;
protected String url;
public static WxMpQrCodeTicket fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpQrCodeTicket.class);
}
public String getTicket() {
return this.ticket;
}
@@ -46,10 +50,6 @@ public class WxMpQrCodeTicket implements Serializable {
this.url = url;
}
public static WxMpQrCodeTicket fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpQrCodeTicket.class);
}
@Override
public String toString() {
return WxMpGsonBuilder.INSTANCE.create().toJson(this);

View File

@@ -6,7 +6,7 @@ import java.io.Serializable;
/**
* 语义理解查询结果对象
*
* <p>
* http://mp.weixin.qq.com/wiki/index.php?title=语义理解
*
* @author Daniel Qian
@@ -14,7 +14,7 @@ import java.io.Serializable;
public class WxMpSemanticQueryResult implements Serializable {
/**
*
*
*/
private static final long serialVersionUID = 4811088544804441365L;
private String query;
@@ -24,6 +24,10 @@ public class WxMpSemanticQueryResult implements Serializable {
private String answer;
private String text;
public static WxMpSemanticQueryResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpSemanticQueryResult.class);
}
public String getQuery() {
return this.query;
}
@@ -72,8 +76,4 @@ public class WxMpSemanticQueryResult implements Serializable {
this.text = text;
}
public static WxMpSemanticQueryResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpSemanticQueryResult.class);
}
}

View File

@@ -12,8 +12,8 @@ import java.util.List;
/**
* 微信用户信息
* @author chanjarster
*
* @author chanjarster
*/
public class WxMpUser implements Serializable {
@@ -34,6 +34,18 @@ public class WxMpUser implements Serializable {
private Integer groupId;
private Long[] tagIds;
public static WxMpUser fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class);
}
public static List<WxMpUser> fromJsonList(String json) {
Type collectionType = new TypeToken<List<WxMpUser>>() {
}.getType();
Gson gson = WxMpGsonBuilder.INSTANCE.create();
JsonObject jsonObject = gson.fromJson(json, JsonObject.class);
return gson.fromJson(jsonObject.get("user_info_list"), collectionType);
}
public Boolean getSubscribe() {
return this.subscribe;
}
@@ -115,7 +127,7 @@ public class WxMpUser implements Serializable {
}
/**
*只有在将公众号绑定到微信开放平台帐号后,才会出现该字段。
* 只有在将公众号绑定到微信开放平台帐号后,才会出现该字段。
*/
public String getUnionId() {
return this.unionId;
@@ -158,18 +170,6 @@ public class WxMpUser implements Serializable {
this.tagIds = tagIds;
}
public static WxMpUser fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class);
}
public static List<WxMpUser> fromJsonList(String json) {
Type collectionType = new TypeToken<List<WxMpUser>>() {
}.getType();
Gson gson = WxMpGsonBuilder.INSTANCE.create();
JsonObject jsonObject = gson.fromJson(json, JsonObject.class);
return gson.fromJson(jsonObject.get("user_info_list"), collectionType);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);

View File

@@ -7,8 +7,8 @@ import java.util.List;
/**
* 关注者列表
* @author chanjarster
*
* @author chanjarster
*/
public class WxMpUserList {
@@ -16,37 +16,45 @@ public class WxMpUserList {
protected int count = -1;
protected List<String> openids = new ArrayList<>();
protected String nextOpenid;
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public int getCount() {
return this.count;
}
public void setCount(int count) {
this.count = count;
}
public List<String> getOpenids() {
return this.openids;
}
public void setOpenids(List<String> openids) {
this.openids = openids;
}
public String getNextOpenid() {
return this.nextOpenid;
}
public void setNextOpenid(String nextOpenid) {
this.nextOpenid = nextOpenid;
}
public static WxMpUserList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUserList.class);
}
public long getTotal() {
return this.total;
}
public void setTotal(long total) {
this.total = total;
}
public int getCount() {
return this.count;
}
public void setCount(int count) {
this.count = count;
}
public List<String> getOpenids() {
return this.openids;
}
public void setOpenids(List<String> openids) {
this.openids = openids;
}
public String getNextOpenid() {
return this.nextOpenid;
}
public void setNextOpenid(String nextOpenid) {
this.nextOpenid = nextOpenid;
}
@Override
public String toString() {
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
}
}

View File

@@ -12,19 +12,168 @@ import java.util.List;
/**
* 门店基础信息
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016-09-23.
*/
public class WxMpStoreBaseInfo {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* sid
* 商户自己的id用于后续审核通过收到poi_id 的通知时,做对应关系。请商户自己保证唯一识别性
*/
@SerializedName("sid")
private String sid;
/**
* business_name
* 门店名称(仅为商户名,如:国美、麦当劳,不应包含地区、地址、分店名等信息,错误示例:北京国美)
* 不能为空15个汉字或30个英文字符内
*/
@Required
@SerializedName("business_name")
private String businessName;
/**
* branch_name
* 分店名称(不应包含地区信息,不应与门店名有重复,错误示例:北京王府井店)
* 10个字以内
*/
@Required
@SerializedName("branch_name")
private String branchName;
/**
* province
* 门店所在的省份(直辖市填城市名,如:北京市)
* 10个字以内
*/
@Required
@SerializedName("province")
private String province;
/**
* city
* 门店所在的城市
* 10个字以内
*/
@Required
@SerializedName("city")
private String city;
/**
* district
* 门店所在地区
* 10个字以内
*/
@Required
@SerializedName("district")
private String district;
/**
* address
* 门店所在的详细街道地址(不要填写省市信息)
* (东莞等没有“区”行政区划的城市,该字段可不必填写。其余城市必填。)
*/
@Required
@SerializedName("address")
private String address;
/**
* telephone
* 门店的电话(纯数字,区号、分机号均由“-”隔开)
*/
@Required
@SerializedName("telephone")
private String telephone;
/**
* categories
* 门店的类型(不同级分类用“,”隔开,如:美食,川菜,火锅。详细分类参见附件:微信门店类目表)
*/
@Required
@SerializedName("categories")
private String[] categories;
/**
* offsetType
* 坐标类型1 为火星坐标目前只能选1
*/
@Required
@SerializedName("offset_type")
private Integer offsetType = 1;
/**
* longitude
* 门店所在地理位置的经度
*/
@Required
@SerializedName("longitude")
private BigDecimal longitude;
/**
* latitude
* 门店所在地理位置的纬度(经纬度均为火星坐标,最好选用腾讯地图标记的坐标)
*/
@Required
@SerializedName("latitude")
private BigDecimal latitude;
/**
* photo_list
* 图片列表url 形式,可以有多张图片,尺寸为 640*340px。必须为上一接口生成的url。
* 图片内容不允许与门店不相关,不允许为二维码、员工合照(或模特肖像)、营业执照、无门店正门的街景、地图截图、公交地铁站牌、菜单截图等
*/
@SerializedName("photo_list")
private List<WxMpStorePhoto> photos;
/**
* recommend
* 推荐品,餐厅可为推荐菜;酒店为推荐套房;景点为推荐游玩景点等,针对自己行业的推荐内容
* 200字以内
*/
@SerializedName("recommend")
private String recommend;
/**
* special
* 特色服务如免费wifi免费停车送货上门等商户能提供的特色功能或服务
*/
@SerializedName("special")
private String special;
/**
* introduction
* 商户简介,主要介绍商户信息等
* 300字以内
*/
@SerializedName("introduction")
private String introduction;
/**
* open_time
* 营业时间24 小时制表示,用“-”连接,如 8:00-20:00
*/
@SerializedName("open_time")
private String openTime;
/**
* avg_price
* 人均价格大于0 的整数
*/
@SerializedName("avg_price")
private Integer avgPrice;
/**
* 门店是否可用状态。1 表示系统错误、2 表示审核中、3 审核通过、4 审核驳回。当该字段为1、2、4 状态时poi_id 为空
*/
@SerializedName("available_state")
private Integer availableState;
/**
* 扩展字段是否正在更新中。1 表示扩展字段正在更新中,尚未生效,不允许再次更新; 0 表示扩展字段没有在更新中或更新已生效,可以再次更新
*/
@SerializedName("update_status")
private Integer updateStatus;
/**
* 门店poi id
*/
@SerializedName("poi_id")
private String poiId;
public static WxMpStoreBaseInfo fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpStoreBaseInfo.class);
}
public static WxMpStoreBaseInfoBuilder builder() {
return new WxMpStoreBaseInfoBuilder();
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public String toJson() {
JsonElement base_info = WxMpGsonBuilder.create().toJsonTree(this);
JsonObject jsonObject = new JsonObject();
@@ -34,178 +183,6 @@ public class WxMpStoreBaseInfo {
return business.toString();
}
public static class WxMpStorePhoto {
/**
* 照片url
*/
@SerializedName("photo_url")
private String photoUrl;
}
/**
* sid
* 商户自己的id用于后续审核通过收到poi_id 的通知时,做对应关系。请商户自己保证唯一识别性
*/
@SerializedName("sid")
private String sid;
/**
* business_name
* 门店名称(仅为商户名,如:国美、麦当劳,不应包含地区、地址、分店名等信息,错误示例:北京国美)
* 不能为空15个汉字或30个英文字符内
*/
@Required
@SerializedName("business_name")
private String businessName;
/**
* branch_name
* 分店名称(不应包含地区信息,不应与门店名有重复,错误示例:北京王府井店)
* 10个字以内
*/
@Required
@SerializedName("branch_name")
private String branchName;
/**
* province
* 门店所在的省份(直辖市填城市名,如:北京市)
* 10个字以内
*/
@Required
@SerializedName("province")
private String province;
/**
* city
* 门店所在的城市
* 10个字以内
*/
@Required
@SerializedName("city")
private String city;
/**
* district
* 门店所在地区
* 10个字以内
*/
@Required
@SerializedName("district")
private String district;
/**
* address
* 门店所在的详细街道地址(不要填写省市信息)
* (东莞等没有“区”行政区划的城市,该字段可不必填写。其余城市必填。)
*/
@Required
@SerializedName("address")
private String address;
/**
* telephone
* 门店的电话(纯数字,区号、分机号均由“-”隔开)
*/
@Required
@SerializedName("telephone")
private String telephone;
/**
* categories
* 门店的类型(不同级分类用“,”隔开,如:美食,川菜,火锅。详细分类参见附件:微信门店类目表)
*/
@Required
@SerializedName("categories")
private String[] categories;
/**
* offsetType
* 坐标类型1 为火星坐标目前只能选1
*/
@Required
@SerializedName("offset_type")
private Integer offsetType = 1;
/**
* longitude
* 门店所在地理位置的经度
*/
@Required
@SerializedName("longitude")
private BigDecimal longitude;
/**
* latitude
* 门店所在地理位置的纬度(经纬度均为火星坐标,最好选用腾讯地图标记的坐标)
*/
@Required
@SerializedName("latitude")
private BigDecimal latitude;
/**
* photo_list
* 图片列表url 形式,可以有多张图片,尺寸为 640*340px。必须为上一接口生成的url。
* 图片内容不允许与门店不相关,不允许为二维码、员工合照(或模特肖像)、营业执照、无门店正门的街景、地图截图、公交地铁站牌、菜单截图等
*/
@SerializedName("photo_list")
private List<WxMpStorePhoto> photos;
/**
* recommend
* 推荐品,餐厅可为推荐菜;酒店为推荐套房;景点为推荐游玩景点等,针对自己行业的推荐内容
* 200字以内
*/
@SerializedName("recommend")
private String recommend;
/**
* special
* 特色服务如免费wifi免费停车送货上门等商户能提供的特色功能或服务
*/
@SerializedName("special")
private String special;
/**
* introduction
* 商户简介,主要介绍商户信息等
* 300字以内
*/
@SerializedName("introduction")
private String introduction;
/**
* open_time
* 营业时间24 小时制表示,用“-”连接,如 8:00-20:00
*/
@SerializedName("open_time")
private String openTime;
/**
* avg_price
* 人均价格大于0 的整数
*/
@SerializedName("avg_price")
private Integer avgPrice;
/**
* 门店是否可用状态。1 表示系统错误、2 表示审核中、3 审核通过、4 审核驳回。当该字段为1、2、4 状态时poi_id 为空
*/
@SerializedName("available_state")
private Integer availableState;
/**
* 扩展字段是否正在更新中。1 表示扩展字段正在更新中,尚未生效,不允许再次更新; 0 表示扩展字段没有在更新中或更新已生效,可以再次更新
*/
@SerializedName("update_status")
private Integer updateStatus;
/**
* 门店poi id
*/
@SerializedName("poi_id")
private String poiId;
public String getSid() {
return this.sid;
}
@@ -374,8 +351,12 @@ public class WxMpStoreBaseInfo {
this.poiId = poiId;
}
public static WxMpStoreBaseInfoBuilder builder() {
return new WxMpStoreBaseInfoBuilder();
public static class WxMpStorePhoto {
/**
* 照片url
*/
@SerializedName("photo_url")
private String photoUrl;
}
public static class WxMpStoreBaseInfoBuilder {

View File

@@ -4,14 +4,14 @@ import com.google.gson.annotations.SerializedName;
import me.chanjar.weixin.common.util.ToStringUtils;
public class WxMpStoreInfo {
@SerializedName("base_info")
private WxMpStoreBaseInfo baseInfo;
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
@SerializedName("base_info")
private WxMpStoreBaseInfo baseInfo;
public WxMpStoreBaseInfo getBaseInfo() {
return this.baseInfo;
}

View File

@@ -8,44 +8,41 @@ import java.util.List;
/**
* 门店列表结果类
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016-09-27.
*
*/
public class WxMpStoreListResult {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpStoreListResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpStoreListResult.class);
}
/**
* 错误码0为正常
*/
@SerializedName("errcode")
private Integer errCode;
/**
* 错误信息
*/
@SerializedName("errmsg")
private String errMsg;
/**
* 门店信息列表
*/
@SerializedName("business_list")
private List<WxMpStoreInfo> businessList;
/**
* 门店信息总数
*/
@SerializedName("total_count")
private Integer totalCount;
public static WxMpStoreListResult fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpStoreListResult.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public Integer getTotalCount() {
return this.totalCount;
}

View File

@@ -8,13 +8,30 @@ import java.util.List;
/**
* 获取标签下粉丝列表的结果对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016-09-19.
*/
public class WxTagListUser {
/**
* "count":2,这次获取的粉丝数量
*/
@SerializedName("count")
private Integer count;
/**
* "data" 粉丝列表
*/
@SerializedName("data")
private WxTagListUserData data;
/**
* "next_openid" 拉取列表最后一个用户的openid
*/
@SerializedName("next_openid")
private String nextOpenid;
public static WxTagListUser fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json,WxTagListUser.class);
return WxMpGsonBuilder.create().fromJson(json, WxTagListUser.class);
}
public String toJson() {
@@ -26,24 +43,6 @@ public class WxTagListUser {
return ToStringUtils.toSimpleString(this);
}
/**
*"count":2,这次获取的粉丝数量
*/
@SerializedName("count")
private Integer count;
/**
*"data" 粉丝列表
*/
@SerializedName("data")
private WxTagListUserData data;
/**
*"next_openid" 拉取列表最后一个用户的openid
*/
@SerializedName("next_openid")
private String nextOpenid;
public Integer getCount() {
return this.count;
}
@@ -69,17 +68,17 @@ public class WxTagListUser {
}
public static class WxTagListUserData {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* openid 列表
*/
@SerializedName("openid")
private List<String> openidList;
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public List<String> getOpenidList() {
return this.openidList;
}

View File

@@ -9,6 +9,7 @@ import java.util.List;
/**
* 用户标签对象
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/9/2.
*/
@@ -28,6 +29,19 @@ public class WxUserTag {
*/
private Integer count;
public static WxUserTag fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(json).getAsJsonObject().get("tag"),
WxUserTag.class);
}
public static List<WxUserTag> listFromJson(String json) {
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(json).getAsJsonObject().get("tags"),
new TypeToken<List<WxUserTag>>() {
}.getType());
}
public String getName() {
return this.name;
}
@@ -52,18 +66,6 @@ public class WxUserTag {
this.id = id;
}
public static WxUserTag fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(json).getAsJsonObject().get("tag"),
WxUserTag.class);
}
public static List<WxUserTag> listFromJson(String json) {
return WxMpGsonBuilder.create().fromJson(
new JsonParser().parse(json).getAsJsonObject().get("tags"),
new TypeToken<List<WxUserTag>>(){}.getType());
}
public String toJson() {
return WxMpGsonBuilder.create().toJson(this);
}

View File

@@ -18,53 +18,36 @@ import java.util.List;
public class WxMpTemplate {
private static final JsonParser JSON_PARSER = new JsonParser();
public static List<WxMpTemplate> fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(JSON_PARSER.parse(json).getAsJsonObject().get("template_list"),
new TypeToken<List<WxMpTemplate>>() {
}.getType());
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
/**
* template_id
* 模板ID
*/
@SerializedName("template_id")
private String templateId;
/**
* title
* 模板标题
*/
@SerializedName("title")
private String title;
/**
* primary_industry
* 模板所属行业的一级行业
*/
@SerializedName("primary_industry")
private String primaryIndustry;
/**
* deputy_industry
* 模板所属行业的二级行业
*/
@SerializedName("deputy_industry")
private String deputyIndustry;
/**
* content
* 模板内容
*/
@SerializedName("content")
private String content;
/**
* example
* 模板示例
@@ -72,6 +55,17 @@ public class WxMpTemplate {
@SerializedName("example")
private String example;
public static List<WxMpTemplate> fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(JSON_PARSER.parse(json).getAsJsonObject().get("template_list"),
new TypeToken<List<WxMpTemplate>>() {
}.getType());
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public String getTemplateId() {
return this.templateId;
}

View File

@@ -22,6 +22,35 @@ public class WxMpTemplateIndustry implements Serializable {
this.secondIndustry = secondIndustry;
}
public static WxMpTemplateIndustry fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpTemplateIndustry.class);
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public String toJson() {
return WxMpGsonBuilder.create().toJson(this);
}
public Industry getPrimaryIndustry() {
return this.primaryIndustry;
}
public void setPrimaryIndustry(Industry primaryIndustry) {
this.primaryIndustry = primaryIndustry;
}
public Industry getSecondIndustry() {
return this.secondIndustry;
}
public void setSecondIndustry(Industry secondIndustry) {
this.secondIndustry = secondIndustry;
}
/**
* @author miller
* 官方文档中,创建和获取的数据结构不一样。所以采用冗余字段的方式,实现相应的接口
@@ -74,33 +103,4 @@ public class WxMpTemplateIndustry implements Serializable {
this.secondClass = secondClass;
}
}
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
}
public static WxMpTemplateIndustry fromJson(String json) {
return WxMpGsonBuilder.create().fromJson(json, WxMpTemplateIndustry.class);
}
public String toJson() {
return WxMpGsonBuilder.create().toJson(this);
}
public Industry getPrimaryIndustry() {
return this.primaryIndustry;
}
public void setPrimaryIndustry(Industry primaryIndustry) {
this.primaryIndustry = primaryIndustry;
}
public Industry getSecondIndustry() {
return this.secondIndustry;
}
public void setSecondIndustry(Industry secondIndustry) {
this.secondIndustry = secondIndustry;
}
}

View File

@@ -32,6 +32,7 @@ public class WxMpTemplateMessage implements Serializable {
private String url;
/**
* 模板跳转链接
*
* @see #url
*/
private MiniProgram miniProgram;
@@ -44,6 +45,10 @@ public class WxMpTemplateMessage implements Serializable {
public WxMpTemplateMessage() {
}
public static WxMpTemplateMessageBuilder builder() {
return new WxMpTemplateMessageBuilder();
}
public String getToUser() {
return this.toUser;
}
@@ -92,10 +97,6 @@ public class WxMpTemplateMessage implements Serializable {
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
}
public static WxMpTemplateMessageBuilder builder() {
return new WxMpTemplateMessageBuilder();
}
public static class MiniProgram {
private String appid;
private String pagePath;

View File

@@ -7,7 +7,7 @@ public class BaseBuilder<T> {
protected String toUser;
@SuppressWarnings("unchecked")
public T toUser(String toUser) {
public T toUser(String toUser) {
this.toUser = toUser;
return (T) this;
}

View File

@@ -8,8 +8,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* <pre>
* 用法: WxMpKefuMessage m = WxMpKefuMessage.IMAGE().mediaId(...).toUser(...).build();
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public final class ImageBuilder extends BaseBuilder<ImageBuilder> {
private String mediaId;

View File

@@ -9,8 +9,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* 用法:
* WxMpKefuMessage m = WxMpKefuMessage.NEWS().mediaId("xxxxx").toUser(...).build();
* </pre>
* @author Binary Wang
*
* @author Binary Wang
*/
public final class MpNewsBuilder extends BaseBuilder<MpNewsBuilder> {
private String mediaId;

View File

@@ -12,8 +12,8 @@ import java.util.List;
* 用法:
* WxMpKefuMessage m = WxMpKefuMessage.NEWS().addArticle(article).toUser(...).build();
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public final class NewsBuilder extends BaseBuilder<NewsBuilder> {

View File

@@ -8,8 +8,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* <pre>
* 用法: WxMpKefuMessage m = WxMpKefuMessage.TEXT().content(...).toUser(...).build();
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public final class TextBuilder extends BaseBuilder<TextBuilder> {
private String content;

View File

@@ -14,8 +14,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* .toUser(...)
* .build();
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public final class VideoBuilder extends BaseBuilder<VideoBuilder> {
private String mediaId;

View File

@@ -8,8 +8,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* <pre>
* 用法: WxMpKefuMessage m = WxMpKefuMessage.VOICE().mediaId(...).toUser(...).build();
* </pre>
* @author chanjarster
*
* @author chanjarster
*/
public final class VoiceBuilder extends BaseBuilder<VoiceBuilder> {
private String mediaId;

View File

@@ -8,8 +8,8 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
* <pre>
* 用法: WxMpKefuMessage m = WxMpKefuMessage.WXCARD().cardId(...).toUser(...).build();
* </pre>
* @author mgcnrx11
*
* @author mgcnrx11
*/
public final class WxCardBuilder extends BaseBuilder<WxCardBuilder> {
private String cardId;

View File

@@ -9,13 +9,13 @@ public abstract class BaseBuilder<BuilderType, ValueType> {
protected String fromUserName;
@SuppressWarnings("unchecked")
public BuilderType toUser(String touser) {
public BuilderType toUser(String touser) {
this.toUserName = touser;
return (BuilderType) this;
}
@SuppressWarnings("unchecked")
public BuilderType fromUser(String fromusername) {
public BuilderType fromUser(String fromusername) {
this.fromUserName = fromusername;
return (BuilderType) this;
}

View File

@@ -4,6 +4,7 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutImageMessage;
/**
* 图片消息builder
*
* @author chanjarster
*/
public final class ImageBuilder extends BaseBuilder<ImageBuilder, WxMpXmlOutImageMessage> {

View File

@@ -7,6 +7,7 @@ import java.util.List;
/**
* 图文消息builder
*
* @author chanjarster
*/
public final class NewsBuilder extends BaseBuilder<NewsBuilder, WxMpXmlOutNewsMessage> {
@@ -21,7 +22,7 @@ public final class NewsBuilder extends BaseBuilder<NewsBuilder, WxMpXmlOutNewsMe
@Override
public WxMpXmlOutNewsMessage build() {
WxMpXmlOutNewsMessage m = new WxMpXmlOutNewsMessage();
for(WxMpXmlOutNewsMessage.Item item : this.articles) {
for (WxMpXmlOutNewsMessage.Item item : this.articles) {
m.addArticle(item);
}
setCommon(m);

View File

@@ -4,8 +4,8 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutTextMessage;
/**
* 文本消息builder
* @author chanjarster
*
* @author chanjarster
*/
public final class TextBuilder extends BaseBuilder<TextBuilder, WxMpXmlOutTextMessage> {
private String content;

View File

@@ -23,7 +23,7 @@ public final class TransferCustomerServiceBuilder extends BaseBuilder<TransferCu
public WxMpXmlOutTransferKefuMessage build() {
WxMpXmlOutTransferKefuMessage m = new WxMpXmlOutTransferKefuMessage();
setCommon(m);
if(StringUtils.isNotBlank(this.kfAccount)){
if (StringUtils.isNotBlank(this.kfAccount)) {
WxMpXmlOutTransferKefuMessage.TransInfo transInfo = new WxMpXmlOutTransferKefuMessage.TransInfo();
transInfo.setKfAccount(this.kfAccount);
m.setTransInfo(transInfo);

View File

@@ -4,8 +4,8 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutVideoMessage;
/**
* 视频消息builder
* @author chanjarster
*
* @author chanjarster
*/
public final class VideoBuilder extends BaseBuilder<VideoBuilder, WxMpXmlOutVideoMessage> {
@@ -17,10 +17,12 @@ public final class VideoBuilder extends BaseBuilder<VideoBuilder, WxMpXmlOutVide
this.title = title;
return this;
}
public VideoBuilder description(String description) {
this.description = description;
return this;
}
public VideoBuilder mediaId(String mediaId) {
this.mediaId = mediaId;
return this;

View File

@@ -4,6 +4,7 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutVoiceMessage;
/**
* 语音消息builder
*
* @author chanjarster
*/
public final class VoiceBuilder extends BaseBuilder<VoiceBuilder, WxMpXmlOutVoiceMessage> {

View File

@@ -41,7 +41,7 @@ public class WxMpEventConstants {
* 卡券转赠事件
*/
public static final String USER_GIFTING_CARD = "user_gifting_card";
/**
* 库存报警
*/

View File

@@ -1,41 +1,45 @@
/**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
*/
// ------------------------------------------------------------------------
/**
* 针对org.apache.commons.codec.binary.Base64
* 需要导入架包commons-codec-1.9或commons-codec-1.8等其他版本)
* 官方下载地址http://commons.apache.org/proper/commons-codec/download_codec.cgi
*/
package me.chanjar.weixin.mp.util.crypto;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import org.apache.commons.codec.binary.Base64;
public class WxMpCryptUtil extends me.chanjar.weixin.common.util.crypto.WxCryptUtil {
/**
* 构造函数
*
* @param wxMpConfigStorage
*/
public WxMpCryptUtil(WxMpConfigStorage wxMpConfigStorage) {
/*
* @param token 公众平台上开发者设置的token
* @param encodingAesKey 公众平台上开发者设置的EncodingAESKey
* @param appId 公众平台appid
*/
String encodingAesKey = wxMpConfigStorage.getAesKey();
String token = wxMpConfigStorage.getToken();
String appId = wxMpConfigStorage.getAppId();
this.token = token;
this.appidOrCorpid = appId;
this.aesKey = Base64.decodeBase64(encodingAesKey + "=");
}
}
/**
* 对公众平台发送给公众账号的消息加解密示例代码.
*
* @copyright Copyright (c) 1998-2014 Tencent Inc.
* <p>
* 针对org.apache.commons.codec.binary.Base64
* 需要导入架包commons-codec-1.9或commons-codec-1.8等其他版本)
* 官方下载地址http://commons.apache.org/proper/commons-codec/download_codec.cgi
*/
// ------------------------------------------------------------------------
/**
* 针对org.apache.commons.codec.binary.Base64
* 需要导入架包commons-codec-1.9或commons-codec-1.8等其他版本)
* 官方下载地址http://commons.apache.org/proper/commons-codec/download_codec.cgi
*/
package me.chanjar.weixin.mp.util.crypto;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import org.apache.commons.codec.binary.Base64;
public class WxMpCryptUtil extends me.chanjar.weixin.common.util.crypto.WxCryptUtil {
/**
* 构造函数
*
* @param wxMpConfigStorage
*/
public WxMpCryptUtil(WxMpConfigStorage wxMpConfigStorage) {
/*
* @param token 公众平台上开发者设置的token
* @param encodingAesKey 公众平台上开发者设置的EncodingAESKey
* @param appId 公众平台appid
*/
String encodingAesKey = wxMpConfigStorage.getAesKey();
String token = wxMpConfigStorage.getToken();
String appId = wxMpConfigStorage.getAppId();
this.token = token;
this.appidOrCorpid = appId;
this.aesKey = Base64.decodeBase64(encodingAesKey + "=");
}
}

View File

@@ -1,43 +1,20 @@
package me.chanjar.weixin.mp.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
import me.chanjar.weixin.common.util.http.okhttp.OkhttpProxyInfo;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.mp.util.http.apache.ApacheMaterialDeleteRequestExecutor;
import me.chanjar.weixin.mp.util.http.jodd.JoddMaterialDeleteRequestExecutor;
import me.chanjar.weixin.mp.util.http.okhttp.OkhttpMaterialDeleteRequestExecutor;
import okhttp3.*;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
public abstract class MaterialDeleteRequestExecutor<H, P> implements RequestExecutor<Boolean, String> {
protected RequestHttp<H, P> requestHttp;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public abstract class MaterialDeleteRequestExecutor<H,P> implements RequestExecutor<Boolean, String> {
protected RequestHttp<H,P> requestHttp;
public MaterialDeleteRequestExecutor(RequestHttp requestHttp){
this.requestHttp =requestHttp;
public MaterialDeleteRequestExecutor(RequestHttp requestHttp) {
this.requestHttp = requestHttp;
}
public static RequestExecutor<Boolean, String> create(RequestHttp requestHttp){
switch (requestHttp.getRequestType()){
public static RequestExecutor<Boolean, String> create(RequestHttp requestHttp) {
switch (requestHttp.getRequestType()) {
case apacheHttp:
return new ApacheMaterialDeleteRequestExecutor(requestHttp);
case joddHttp:

View File

@@ -1,45 +1,21 @@
package me.chanjar.weixin.mp.util.http;
import jodd.http.HttpConnectionProvider;
import jodd.http.HttpRequest;
import jodd.http.HttpResponse;
import jodd.http.ProxyInfo;
import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler;
import me.chanjar.weixin.common.util.http.okhttp.OkhttpProxyInfo;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
import me.chanjar.weixin.mp.util.http.apache.ApacheMaterialNewsInfoRequestExecutor;
import me.chanjar.weixin.mp.util.http.jodd.JoddMaterialNewsInfoRequestExecutor;
import me.chanjar.weixin.mp.util.http.okhttp.OkhttpMaterialNewsInfoRequestExecutor;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import okhttp3.*;
import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
public abstract class MaterialNewsInfoRequestExecutor<H, P> implements RequestExecutor<WxMpMaterialNews, String> {
protected RequestHttp<H, P> requestHttp;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public abstract class MaterialNewsInfoRequestExecutor<H,P> implements RequestExecutor<WxMpMaterialNews, String> {
protected RequestHttp<H,P> requestHttp;
public MaterialNewsInfoRequestExecutor(RequestHttp requestHttp){
this.requestHttp =requestHttp;
public MaterialNewsInfoRequestExecutor(RequestHttp requestHttp) {
this.requestHttp = requestHttp;
}
public static RequestExecutor<WxMpMaterialNews, String> create(RequestHttp requestHttp){
switch (requestHttp.getRequestType()){
public static RequestExecutor<WxMpMaterialNews, String> create(RequestHttp requestHttp) {
switch (requestHttp.getRequestType()) {
case apacheHttp:
return new ApacheMaterialNewsInfoRequestExecutor(requestHttp);
case joddHttp:

Some files were not shown because too many files have changed in this diff Show More