@@ -4,8 +4,9 @@ | |||||
### 注意: | ### 注意: | ||||
1. ***本项目Fork自chanjarster/weixin-java-tools,但由于原项目已停止维护,故单独维护和发布,且发布到maven上的groupId也会不同,详细信息见下文。*** | 1. ***本项目Fork自chanjarster/weixin-java-tools,但由于原项目已停止维护,故单独维护和发布,且发布到maven上的groupId也会不同,详细信息见下文。*** | ||||
1. ***自2.0.0版本以来,主要是公众号的接口调整比较大,主要是为了解决主接口类过于庞大不方便管理的问题,将接口实现代码按模块进行拆分。*** | |||||
1. 最新更新:2016-08-31 发布2.1.0正式版! | |||||
1. ***自2.0.0版本以来,公众号的接口调整比较大,主要是为了解决主接口类过于庞大不方便管理的问题,将接口实现代码按模块进行拆分。*** | |||||
1. 本SDK要求的最低JDK版本是7,为解决少量还在使用JDK6的用户,特意抽出独立的代码分支项目,请参考 https://github.com/binarywang/weixin-java-tools-for-jdk6 ,其他更早的JDK版本则需要自己改造实现; | |||||
1. 最新更新:2016-09-30 发布2.2.0正式版! | |||||
=========== | =========== | ||||
@@ -19,9 +20,9 @@ | |||||
=========== | =========== | ||||
## 版本说明 | ## 版本说明 | ||||
* 本项目定为每月发布一次正式版,版本号格式为X.X.0(如2.0.0,2.1.0等),月初或月底发布新版本,遇到重大问题需修复会及时提交新版本,欢迎大家随时提交Pull Request; | |||||
* BUG修复和新特性一般会先发布成小版本作为临时版本(如2.0.1,2.0.2等,即尾号不为0,以区别于正式版); | |||||
* 目前最新版本号为 ![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/weixin-java-parent.svg) ,也可以通过访问链接[【公众号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-mp%22) 、[【企业号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-cp%22) | |||||
1. 本项目定为每月发布一次正式版,版本号格式为X.X.0(如2.1.0,2.2.0等),月初或月底发布新版本,遇到重大问题需修复会及时提交新版本,欢迎大家随时提交Pull Request; | |||||
1. BUG修复和新特性一般会先发布成小版本作为临时版本(如2.0.1,2.0.2等,即尾号不为0,以区别于正式版); | |||||
1. 目前最新版本号为 ![Maven Central](https://img.shields.io/maven-central/v/com.github.binarywang/weixin-java-parent.svg) ,也可以通过访问链接 [【公众号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-mp%22) 、[【企业号】](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.github.binarywang%22%20AND%20a%3A%22weixin-java-cp%22) | |||||
分别查看所有最新的版本。 | 分别查看所有最新的版本。 | ||||
## Maven & Gradle | ## Maven & Gradle | ||||
@@ -33,12 +34,12 @@ maven: | |||||
<dependency> | <dependency> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-mp</artifactId> | <artifactId>weixin-java-mp</artifactId> | ||||
<version>2.1.0</version> | |||||
<version>2.2.0</version> | |||||
</dependency> | </dependency> | ||||
``` | ``` | ||||
gradle: | gradle: | ||||
```groovy | ```groovy | ||||
compile 'com.github.binarywang:weixin-java-mp:2.1.0' | |||||
compile 'com.github.binarywang:weixin-java-mp:2.2.0' | |||||
``` | ``` | ||||
* 企业号: | * 企业号: | ||||
@@ -48,14 +49,16 @@ maven: | |||||
<dependency> | <dependency> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-cp</artifactId> | <artifactId>weixin-java-cp</artifactId> | ||||
<version>2.1.0</version> | |||||
<version>2.2.0</version> | |||||
</dependency> | </dependency> | ||||
``` | ``` | ||||
gradle: | gradle: | ||||
```groovy | ```groovy | ||||
compile 'com.github.binarywang:weixin-java-cp:2.1.0' | |||||
compile 'com.github.binarywang:weixin-java-cp:2.2.0' | |||||
``` | ``` | ||||
=========== | |||||
#### 本项目主要存放在github上,地址为 : | #### 本项目主要存放在github上,地址为 : | ||||
* https://github.com/wechat-group/weixin-java-tools | * https://github.com/wechat-group/weixin-java-tools | ||||
* ===========但同时会在其他几个网站同步更新,地址分别是: | * ===========但同时会在其他几个网站同步更新,地址分别是: | ||||
@@ -63,15 +66,16 @@ compile 'com.github.binarywang:weixin-java-cp:2.1.0' | |||||
* http://git.oschina.net/binary/weixin-java-tools | * http://git.oschina.net/binary/weixin-java-tools | ||||
* https://git.coding.net/binarywang/weixin-java-tools.git | * https://git.coding.net/binarywang/weixin-java-tools.git | ||||
=========== | |||||
## 目前可参考的Demo项目有两个: | ## 目前可参考的Demo项目有两个: | ||||
1. https://github.com/wechat-group/weixin-mp-demo | 1. https://github.com/wechat-group/weixin-mp-demo | ||||
1. https://github.com/wechat-group/weixin-java-tools-springmvc | 1. https://github.com/wechat-group/weixin-java-tools-springmvc | ||||
=========== | |||||
## 关于代码贡献 | ## 关于代码贡献 | ||||
* 非常欢迎和感谢对本项目发起Pull Request的同学,本项目代码风格为使用2个空格代表一个Tab,因此在提交代码时请注意一下,否则很容易在IDE格式化代码后与原代码产生大量diff,这样会给其他人阅读代码带来极大的困扰。 | |||||
* 为了便于设置,本项目引入editorconfig插件,请使用eclipse的同学在贡献代码前安装相关插件,IntelliJ IDEA则自带支持,无需额外安装插件。 | |||||
* 本项目可以采用两种方式接受代码贡献: | |||||
1. 非常欢迎和感谢对本项目发起Pull Request的同学,本项目代码风格为使用2个空格代表一个Tab,因此在提交代码时请注意一下,否则很容易在IDE格式化代码后与原代码产生大量diff,这样会给其他人阅读代码带来极大的困扰。 | |||||
1. 为了便于设置,本项目引入editorconfig插件,请使用eclipse的同学在贡献代码前安装相关插件,IntelliJ IDEA则自带支持,无需额外安装插件。 | |||||
1. 本项目可以采用两种方式接受代码贡献: | |||||
1. 第一种就是基于[Git Flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)开发流程,因此在发起Pull Request的时候请选择develop分支。 | |||||
1. 另外一种贡献代码的方式就是加入SDK Developers开发组,如果对自己的代码足够自信,可以随时提交代码,注意要随时进行单元测试,保证提交代码没有明显问题,具体加入方式,请咨询管理员。 | |||||
1. 第一种就是基于[Git Flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)开发流程,因此在发起Pull Request的时候请选择develop分支。 | |||||
1. 另外一种贡献代码的方式就是加入SDK Developers开发组,前提是对自己的代码足够自信就可以申请加入,加入之后可以随时直接提交代码,但要注意对所做的修改或新增的代码进行单元测试,保证提交代码没有明显问题,具体加入方式,请咨询管理员。 |
@@ -2,7 +2,7 @@ allprojects { | |||||
apply plugin: 'maven' | apply plugin: 'maven' | ||||
group = 'com.github.binarywang' | group = 'com.github.binarywang' | ||||
version = '2.1.0-SNAPSHOT' | |||||
version = '2.2.0' | |||||
} | } | ||||
subprojects { | subprojects { | ||||
@@ -5,7 +5,7 @@ | |||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-parent</artifactId> | <artifactId>weixin-java-parent</artifactId> | ||||
<version>2.1.2</version> | |||||
<version>2.3.0-SNAPSHOT</version> | |||||
<packaging>pom</packaging> | <packaging>pom</packaging> | ||||
<name>WeiXin Java Tools - Parent</name> | <name>WeiXin Java Tools - Parent</name> | ||||
<description>微信公众号、企业号上级POM</description> | <description>微信公众号、企业号上级POM</description> | ||||
@@ -72,11 +72,6 @@ | |||||
<version>${logback.version}</version> | <version>${logback.version}</version> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.httpcomponents</groupId> | |||||
<artifactId>fluent-hc</artifactId> | |||||
<version>${httpclient.version}</version> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.apache.httpcomponents</groupId> | <groupId>org.apache.httpcomponents</groupId> | ||||
<artifactId>httpmime</artifactId> | <artifactId>httpmime</artifactId> | ||||
@@ -6,7 +6,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-parent</artifactId> | <artifactId>weixin-java-parent</artifactId> | ||||
<version>2.1.2</version> | |||||
<version>2.3.0-SNAPSHOT</version> | |||||
</parent> | </parent> | ||||
<artifactId>weixin-java-common</artifactId> | <artifactId>weixin-java-common</artifactId> | ||||
@@ -93,6 +93,8 @@ public class WxConsts { | |||||
public static final String EVT_KF_CREATE_SESSION = "kf_create_session"; // 客服接入会话 | public static final String EVT_KF_CREATE_SESSION = "kf_create_session"; // 客服接入会话 | ||||
public static final String EVT_KF_CLOSE_SESSION = "kf_close_session"; // 客服关闭会话 | public static final String EVT_KF_CLOSE_SESSION = "kf_close_session"; // 客服关闭会话 | ||||
public static final String EVT_KF_SWITCH_SESSION = "kf_switch_session"; // 客服转接会话 | public static final String EVT_KF_SWITCH_SESSION = "kf_switch_session"; // 客服转接会话 | ||||
public static final String EVT_POI_CHECK_NOTIFY = "poi_check_notify"; //门店审核事件推送 | |||||
/////////////////////// | /////////////////////// | ||||
// 上传多媒体文件的类型 | // 上传多媒体文件的类型 | ||||
/////////////////////// | /////////////////////// | ||||
@@ -13,6 +13,11 @@ public class WxErrorException extends Exception { | |||||
this.error = error; | this.error = error; | ||||
} | } | ||||
public WxErrorException(WxError error, Throwable cause) { | |||||
super(error.toString(), cause); | |||||
this.error = error; | |||||
} | |||||
public WxError getError() { | public WxError getError() { | ||||
return this.error; | return this.error; | ||||
} | } | ||||
@@ -5,6 +5,7 @@ import org.apache.http.impl.client.CloseableHttpClient; | |||||
/** | /** | ||||
* httpclient build interface | * httpclient build interface | ||||
* @author kakotor | |||||
*/ | */ | ||||
public interface ApacheHttpClientBuilder { | public interface ApacheHttpClientBuilder { | ||||
@@ -1,6 +1,8 @@ | |||||
package me.chanjar.weixin.common.util.http; | package me.chanjar.weixin.common.util.http; | ||||
import me.chanjar.weixin.common.util.StringUtils; | |||||
import java.io.IOException; | |||||
import java.util.concurrent.TimeUnit; | |||||
import org.apache.http.annotation.NotThreadSafe; | import org.apache.http.annotation.NotThreadSafe; | ||||
import org.apache.http.auth.AuthScope; | import org.apache.http.auth.AuthScope; | ||||
import org.apache.http.auth.UsernamePasswordCredentials; | import org.apache.http.auth.UsernamePasswordCredentials; | ||||
@@ -21,11 +23,11 @@ import org.apache.http.impl.client.HttpClients; | |||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | ||||
import org.apache.http.protocol.HttpContext; | import org.apache.http.protocol.HttpContext; | ||||
import java.io.IOException; | |||||
import java.util.concurrent.TimeUnit; | |||||
import me.chanjar.weixin.common.util.StringUtils; | |||||
/** | /** | ||||
* httpclient 连接管理器 | * httpclient 连接管理器 | ||||
* @author kakotor | |||||
*/ | */ | ||||
@NotThreadSafe | @NotThreadSafe | ||||
public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder { | public class DefaultApacheHttpClientBuilder implements ApacheHttpClientBuilder { | ||||
@@ -6,7 +6,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-parent</artifactId> | <artifactId>weixin-java-parent</artifactId> | ||||
<version>2.1.2</version> | |||||
<version>2.3.0-SNAPSHOT</version> | |||||
</parent> | </parent> | ||||
<artifactId>weixin-java-cp</artifactId> | <artifactId>weixin-java-cp</artifactId> | ||||
@@ -6,7 +6,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.github.binarywang</groupId> | <groupId>com.github.binarywang</groupId> | ||||
<artifactId>weixin-java-parent</artifactId> | <artifactId>weixin-java-parent</artifactId> | ||||
<version>2.1.2</version> | |||||
<version>2.3.0-SNAPSHOT</version> | |||||
</parent> | </parent> | ||||
<artifactId>weixin-java-mp</artifactId> | <artifactId>weixin-java-mp</artifactId> | ||||
<name>WeiXin Java Tools - MP</name> | <name>WeiXin Java Tools - MP</name> | ||||
@@ -6,8 +6,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpCardResult; | |||||
/** | /** | ||||
* 卡券相关接口 | * 卡券相关接口 | ||||
* Created by Binary Wang on 2016/7/27. | |||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author YuJian(mgcnrx11@hotmail.com) on 01/11/2016 | |||||
*/ | */ | ||||
public interface WxMpCardService { | public interface WxMpCardService { | ||||
@@ -1,71 +0,0 @@ | |||||
package me.chanjar.weixin.mp.api; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | |||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | |||||
import java.util.List; | |||||
/** | |||||
* 用户分组相关操作接口 | |||||
* @author Binary Wang | |||||
* 分组接口属于老接口,不知道啥时候被替换成用户标签接口 | |||||
* | |||||
*/ | |||||
@Deprecated | |||||
public interface WxMpGroupService { | |||||
/** | |||||
* <pre> | |||||
* 分组管理接口 - 创建分组 | |||||
* 最多支持创建500个分组 | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口 | |||||
* </pre> | |||||
* | |||||
* @param name 分组名字(30个字符以内) | |||||
*/ | |||||
WxMpGroup groupCreate(String name) throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 分组管理接口 - 查询所有分组 | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口 | |||||
* </pre> | |||||
*/ | |||||
List<WxMpGroup> groupGet() throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 分组管理接口 - 查询用户所在分组 | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口 | |||||
* </pre> | |||||
* | |||||
* @param openid 微信用户的openid | |||||
*/ | |||||
long userGetGroup(String openid) throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 分组管理接口 - 修改分组名 | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口 | |||||
* | |||||
* 如果id为0(未分组),1(黑名单),2(星标组),或者不存在的id,微信会返回系统繁忙的错误 | |||||
* </pre> | |||||
* | |||||
* @param group 要更新的group,group的id,name必须设置 | |||||
*/ | |||||
void groupUpdate(WxMpGroup group) throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 分组管理接口 - 移动用户分组 | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口 | |||||
* | |||||
* 如果to_groupid为0(未分组),1(黑名单),2(星标组),或者不存在的id,微信会返回系统繁忙的错误 | |||||
* </pre> | |||||
* | |||||
* @param openid 用户openid | |||||
* @param to_groupid 移动到的分组id | |||||
*/ | |||||
void userUpdateGroup(String openid, long to_groupid) throws WxErrorException; | |||||
} |
@@ -171,7 +171,7 @@ public class WxMpMessageRouter { | |||||
} else { | } else { | ||||
res = rule.service(wxMessage, this.wxMpService, this.sessionManager, this.exceptionHandler); | res = rule.service(wxMessage, this.wxMpService, this.sessionManager, this.exceptionHandler); | ||||
// 在同步操作结束,session访问结束 | // 在同步操作结束,session访问结束 | ||||
this.log.debug("End session access: async=false, sessionId={}", wxMessage.getFromUserName()); | |||||
this.log.debug("End session access: async=false, sessionId={}", wxMessage.getFromUser()); | |||||
sessionEndAccess(wxMessage); | sessionEndAccess(wxMessage); | ||||
} | } | ||||
} | } | ||||
@@ -183,7 +183,7 @@ public class WxMpMessageRouter { | |||||
for (Future<?> future : futures) { | for (Future<?> future : futures) { | ||||
try { | try { | ||||
future.get(); | future.get(); | ||||
WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUserName()); | |||||
WxMpMessageRouter.this.log.debug("End session access: async=true, sessionId={}", wxMessage.getFromUser()); | |||||
// 异步操作结束,session访问结束 | // 异步操作结束,session访问结束 | ||||
sessionEndAccess(wxMessage); | sessionEndAccess(wxMessage); | ||||
} catch (InterruptedException e) { | } catch (InterruptedException e) { | ||||
@@ -203,7 +203,7 @@ public class WxMpMessageRouter { | |||||
StringBuffer messageId = new StringBuffer(); | StringBuffer messageId = new StringBuffer(); | ||||
if (wxMessage.getMsgId() == null) { | if (wxMessage.getMsgId() == null) { | ||||
messageId.append(wxMessage.getCreateTime()) | messageId.append(wxMessage.getCreateTime()) | ||||
.append("-").append(wxMessage.getFromUserName()) | |||||
.append("-").append(wxMessage.getFromUser()) | |||||
.append("-").append(wxMessage.getEventKey() == null ? "" : wxMessage.getEventKey()) | .append("-").append(wxMessage.getEventKey() == null ? "" : wxMessage.getEventKey()) | ||||
.append("-").append(wxMessage.getEvent() == null ? "" : wxMessage.getEvent()) | .append("-").append(wxMessage.getEvent() == null ? "" : wxMessage.getEvent()) | ||||
; | ; | ||||
@@ -221,7 +221,7 @@ public class WxMpMessageRouter { | |||||
*/ | */ | ||||
protected void sessionEndAccess(WxMpXmlMessage wxMessage) { | protected void sessionEndAccess(WxMpXmlMessage wxMessage) { | ||||
InternalSession session = ((InternalSessionManager)this.sessionManager).findSession(wxMessage.getFromUserName()); | |||||
InternalSession session = ((InternalSessionManager)this.sessionManager).findSession(wxMessage.getFromUser()); | |||||
if (session != null) { | if (session != null) { | ||||
session.endAccess(); | session.endAccess(); | ||||
} | } | ||||
@@ -168,7 +168,7 @@ public class WxMpMessageRouterRule { | |||||
*/ | */ | ||||
protected boolean test(WxMpXmlMessage wxMessage) { | protected boolean test(WxMpXmlMessage wxMessage) { | ||||
return | return | ||||
(this.fromUser == null || this.fromUser.equals(wxMessage.getFromUserName())) | |||||
(this.fromUser == null || this.fromUser.equals(wxMessage.getFromUser())) | |||||
&& | && | ||||
(this.msgType == null || this.msgType.toLowerCase().equals((wxMessage.getMsgType()==null?null:wxMessage.getMsgType().toLowerCase()))) | (this.msgType == null || this.msgType.toLowerCase().equals((wxMessage.getMsgType()==null?null:wxMessage.getMsgType().toLowerCase()))) | ||||
&& | && | ||||
@@ -1,16 +1,10 @@ | |||||
package me.chanjar.weixin.mp.api; | package me.chanjar.weixin.mp.api; | ||||
import java.util.Map; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPrepayIdResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderResult; | |||||
import me.chanjar.weixin.mp.bean.pay.*; | |||||
import java.io.File; | |||||
import java.util.Map; | |||||
/** | /** | ||||
* 微信支付相关接口 | * 微信支付相关接口 | ||||
@@ -23,7 +17,7 @@ public interface WxMpPayService { | |||||
* 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1) | * 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1) | ||||
* 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识" | * 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识" | ||||
* 接口地址:https://api.mch.weixin.qq.com/pay/unifiedorder | * 接口地址:https://api.mch.weixin.qq.com/pay/unifiedorder | ||||
* @throws WxErrorException | |||||
* @throws WxErrorException | |||||
* | * | ||||
*/ | */ | ||||
WxUnifiedOrderResult unifiedOrder(WxUnifiedOrderRequest request) | WxUnifiedOrderResult unifiedOrder(WxUnifiedOrderRequest request) | ||||
@@ -40,7 +34,7 @@ public interface WxMpPayService { | |||||
/** | /** | ||||
* 该接口提供所有微信支付订单的查询,当支付通知处理异常戒丢失的情冴,商户可以通过该接口查询订单支付状态。 | * 该接口提供所有微信支付订单的查询,当支付通知处理异常戒丢失的情冴,商户可以通过该接口查询订单支付状态。 | ||||
* 详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2 | * 详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2 | ||||
* @throws WxErrorException | |||||
* @throws WxErrorException | |||||
* | * | ||||
*/ | */ | ||||
WxMpPayResult getJSSDKPayResult(String transactionId, String outTradeNo) | WxMpPayResult getJSSDKPayResult(String transactionId, String outTradeNo) | ||||
@@ -54,18 +48,15 @@ public interface WxMpPayService { | |||||
WxMpPayCallback getJSSDKCallbackData(String xmlData); | WxMpPayCallback getJSSDKCallbackData(String xmlData); | ||||
/** | /** | ||||
* <pre> | |||||
* 微信支付-申请退款 | * 微信支付-申请退款 | ||||
* 详见 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4 | * 详见 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4 | ||||
* | |||||
* @param parameters 需要传入的退款参数的Map。以下几项为参数的必须项:<br/> | |||||
* <li/> transaction_id | |||||
* <li/> out_trade_no (仅在上述transaction_id为空时是必须项) | |||||
* <li/> out_refund_no | |||||
* <li/> total_fee | |||||
* <li/> refund_fee | |||||
* 接口链接:https://api.mch.weixin.qq.com/secapi/pay/refund | |||||
* </pre> | |||||
* @param keyFile 证书文件对象 | |||||
* @return 退款操作结果 | * @return 退款操作结果 | ||||
*/ | */ | ||||
WxMpPayRefundResult refundPay(Map<String, String> parameters) throws WxErrorException; | |||||
WxMpPayRefundResult refund(WxMpPayRefundRequest request, File keyFile) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -78,12 +69,26 @@ public interface WxMpPayService { | |||||
/** | /** | ||||
* 发送微信红包给个人用户 | * 发送微信红包给个人用户 | ||||
* <pre> | |||||
* <pre> | |||||
* 文档详见: | * 文档详见: | ||||
* 发送普通红包 https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3 | * 发送普通红包 https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3 | ||||
* 发送裂变红包 https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5&index=4 | * 发送裂变红包 https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_5&index=4 | ||||
* </pre> | * </pre> | ||||
* @param keyFile 证书文件对象 | |||||
*/ | |||||
WxRedpackResult sendRedpack(WxSendRedpackRequest request, File keyFile) throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 企业付款业务是基于微信支付商户平台的资金管理能力,为了协助商户方便地实现企业向个人付款,针对部分有开发能力的商户,提供通过API完成企业付款的功能。 | |||||
* 比如目前的保险行业向客户退保、给付、理赔。 | |||||
* 企业付款将使用商户的可用余额,需确保可用余额充足。查看可用余额、充值、提现请登录商户平台“资金管理”https://pay.weixin.qq.com/进行操作。 | |||||
* 注意:与商户微信支付收款资金并非同一账户,需要单独充值。 | |||||
* 文档详见:https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_2 | |||||
* 接口链接:https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers | |||||
* @param keyFile 证书文件对象 | |||||
* </pre> | |||||
*/ | */ | ||||
WxRedpackResult sendRedpack(WxSendRedpackRequest request) throws WxErrorException; | |||||
WxEntPayResult entPay(WxEntPayRequest request, File keyFile) throws WxErrorException; | |||||
} | } |
@@ -4,7 +4,7 @@ import me.chanjar.weixin.common.bean.WxJsapiSignature; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.http.RequestExecutor; | import me.chanjar.weixin.common.util.http.RequestExecutor; | ||||
import me.chanjar.weixin.mp.bean.WxMpIndustry; | import me.chanjar.weixin.mp.bean.WxMpIndustry; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassNews; | import me.chanjar.weixin.mp.bean.WxMpMassNews; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage; | import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage; | ||||
@@ -88,7 +88,7 @@ public interface WxMpService { | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | ||||
* </pre> | * </pre> | ||||
* | * | ||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage) | |||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassTagMessage) | |||||
* @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) | * @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) | ||||
*/ | */ | ||||
WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException; | WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException; | ||||
@@ -99,7 +99,7 @@ public interface WxMpService { | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | ||||
* </pre> | * </pre> | ||||
* | * | ||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassGroupMessage) | |||||
* @see #massGroupMessageSend(me.chanjar.weixin.mp.bean.WxMpMassTagMessage) | |||||
* @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) | * @see #massOpenIdsMessageSend(me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage) | ||||
*/ | */ | ||||
WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException; | WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException; | ||||
@@ -112,7 +112,7 @@ public interface WxMpService { | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=高级群发接口 | ||||
* </pre> | * </pre> | ||||
*/ | */ | ||||
WxMpMassSendResult massGroupMessageSend(WxMpMassGroupMessage message) throws WxErrorException; | |||||
WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -322,14 +322,6 @@ public interface WxMpService { | |||||
*/ | */ | ||||
WxMpUserService getUserService(); | WxMpUserService getUserService(); | ||||
/** | |||||
* 返回用户分组相关接口方法的实现类对象,以方便调用个其各种接口 | |||||
* | |||||
* @return WxMpGroupService | |||||
*/ | |||||
WxMpGroupService getGroupService(); | |||||
/** | /** | ||||
* 返回用户标签相关接口方法的实现类对象,以方便调用个其各种接口 | * 返回用户标签相关接口方法的实现类对象,以方便调用个其各种接口 | ||||
* | * | ||||
@@ -1,15 +1,15 @@ | |||||
package me.chanjar.weixin.mp.api; | package me.chanjar.weixin.mp.api; | ||||
import java.util.List; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 门店管理的相关接口代码 | * 门店管理的相关接口代码 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-09-23. | * Created by Binary Wang on 2016-09-23. | ||||
*/ | */ | ||||
public interface WxMpStoreService { | public interface WxMpStoreService { | ||||
@@ -27,11 +27,39 @@ public interface WxMpStoreService { | |||||
*/ | */ | ||||
void add(WxMpStoreBaseInfo request) throws WxErrorException; | void add(WxMpStoreBaseInfo request) throws WxErrorException; | ||||
/** | |||||
* <pre> | |||||
* 查询门店信息 | |||||
* 创建门店后获取poi_id 后,商户可以利用poi_id,查询具体某条门店的信息。 | |||||
* 若在查询时,update_status 字段为1,表明在5 个工作日内曾用update 接口修改过门店扩展字段,该扩展字段为最新的修改字段,尚未经过审核采纳,因此不是最终结果。 | |||||
* 最终结果会在5 个工作日内,最终确认是否采纳,并前端生效(但该扩展字段的采纳过程不影响门店的可用性,即available_state仍为审核通过状态) | |||||
* 注:扩展字段为公共编辑信息(大家都可修改),修改将会审核,并决定是否对修改建议进行采纳,但不会影响该门店的生效可用状态。 | |||||
* 详情请见: <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 | |||||
* @throws WxErrorException | |||||
*/ | |||||
WxMpStoreBaseInfo get(String poiId) throws WxErrorException; | |||||
/** | |||||
* <pre> | |||||
* 删除门店 | |||||
* 商户可以通过该接口,删除已经成功创建的门店。请商户慎重调用该接口。 | |||||
* 详情请见: <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 | |||||
* @throws WxErrorException | |||||
*/ | |||||
void delete(String poiId) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
* 查询门店列表(指定查询起始位置和个数) | * 查询门店列表(指定查询起始位置和个数) | ||||
* 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。 | * 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。 | ||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | * 详情请见: <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> | * </pre> | ||||
* @param begin 开始位置,0 即为从第一条开始查询 | * @param begin 开始位置,0 即为从第一条开始查询 | ||||
* @param limit 返回数据条数,最大允许50,默认为20 | * @param limit 返回数据条数,最大允许50,默认为20 | ||||
@@ -44,8 +72,32 @@ public interface WxMpStoreService { | |||||
* 查询门店列表(所有) | * 查询门店列表(所有) | ||||
* 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。 | * 商户可以通过该接口,批量查询自己名下的门店list,并获取已审核通过的poi_id(所有状态均会返回poi_id,但该poi_id不一定为最终id)、商户自身sid 用于对应、商户名、分店名、地址字段。 | ||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | * 详情请见: <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> | * </pre> | ||||
* @throws WxErrorException | * @throws WxErrorException | ||||
*/ | */ | ||||
List<WxMpStoreInfo> listAll() throws WxErrorException; | List<WxMpStoreInfo> listAll() throws WxErrorException; | ||||
/** | |||||
* <pre> | |||||
* 修改门店服务信息 | |||||
* 商户可以通过该接口,修改门店的服务信息,包括:sid、图片列表、营业时间、推荐、特色服务、简介、人均价格、电话8个字段(名称、坐标、地址等不可修改)修改后需要人工审核。 | |||||
* 详情请见: <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; | |||||
/** | |||||
* <pre> | |||||
* 门店类目表 | |||||
* 类目名称接口是为商户提供自己门店类型信息的接口。门店类目定位的越规范,能够精准的吸引更多用户,提高曝光率。 | |||||
* 详情请见: <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; | |||||
} | } |
@@ -1,14 +1,14 @@ | |||||
package me.chanjar.weixin.mp.api; | package me.chanjar.weixin.mp.api; | ||||
import java.util.List; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.bean.WxMpUserQuery; | import me.chanjar.weixin.mp.bean.WxMpUserQuery; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpUser; | import me.chanjar.weixin.mp.bean.result.WxMpUser; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList; | import me.chanjar.weixin.mp.bean.result.WxMpUserList; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 用户管理和统计相关操作接口 | |||||
* 用户管理相关操作接口 | |||||
* | * | ||||
* @author Binary Wang | * @author Binary Wang | ||||
*/ | */ | ||||
@@ -42,9 +42,9 @@ public interface WxMpUserService { | |||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息 | * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息 | ||||
* </pre> | * </pre> | ||||
* | * | ||||
* @param openidList 用户openid列表 | |||||
* @param openids 用户openid列表 | |||||
*/ | */ | ||||
List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException; | |||||
List<WxMpUser> userInfoList(List<String> openids) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -1,15 +1,15 @@ | |||||
package me.chanjar.weixin.mp.api; | package me.chanjar.weixin.mp.api; | ||||
import java.util.List; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser; | import me.chanjar.weixin.mp.bean.tag.WxTagListUser; | ||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag; | import me.chanjar.weixin.mp.bean.tag.WxUserTag; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 用户标签管理相关接口 | * 用户标签管理相关接口 | ||||
* Created by Binary Wang on 2016/9/2. | * Created by Binary Wang on 2016/9/2. | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* | * | ||||
*/ | */ | ||||
public interface WxMpUserTagService { | public interface WxMpUserTagService { | ||||
@@ -44,7 +44,7 @@ public interface WxMpUserTagService { | |||||
* </pre> | * </pre> | ||||
* | * | ||||
*/ | */ | ||||
Boolean tagUpdate(Integer id, String name) throws WxErrorException; | |||||
Boolean tagUpdate(Long tagId, String name) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -54,7 +54,7 @@ public interface WxMpUserTagService { | |||||
* </pre> | * </pre> | ||||
* | * | ||||
*/ | */ | ||||
Boolean tagDelete(Integer id) throws WxErrorException; | |||||
Boolean tagDelete(Long tagId) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -64,7 +64,8 @@ public interface WxMpUserTagService { | |||||
* </pre> | * </pre> | ||||
* | * | ||||
*/ | */ | ||||
WxTagListUser tagListUser(Integer tagId, String nextOpenid) throws WxErrorException; | |||||
WxTagListUser tagListUser(Long tagId, String nextOpenid) | |||||
throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -74,7 +75,7 @@ public interface WxMpUserTagService { | |||||
* </pre> | * </pre> | ||||
* | * | ||||
*/ | */ | ||||
boolean batchTagging(Integer tagId, String[] openids) throws WxErrorException; | |||||
boolean batchTagging(Long tagId, String[] openids) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
@@ -84,7 +85,7 @@ public interface WxMpUserTagService { | |||||
* </pre> | * </pre> | ||||
* | * | ||||
*/ | */ | ||||
boolean batchUntagging(Integer tagId, String[] openids) throws WxErrorException; | |||||
boolean batchUntagging(Long tagId, String[] openids) throws WxErrorException; | |||||
/** | /** | ||||
@@ -1,32 +1,21 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import java.text.Format; | |||||
import java.util.Date; | |||||
import java.util.List; | |||||
import org.apache.commons.lang3.time.FastDateFormat; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.WxMpDataCubeService; | import me.chanjar.weixin.mp.api.WxMpDataCubeService; | ||||
import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||
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 org.apache.commons.lang3.time.FastDateFormat; | |||||
import java.text.Format; | |||||
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) | * @author binarywang (https://github.com/binarywang) | ||||
*/ | */ | ||||
public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | ||||
protected final Logger log = LoggerFactory.getLogger(WxMpDataCubeServiceImpl.class); | |||||
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/datacube"; | private static final String API_URL_PREFIX = "https://api.weixin.qq.com/datacube"; | ||||
private final Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd"); | private final Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd"); | ||||
@@ -44,7 +33,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeUserSummary.fromJson(responseContent); | return WxDataCubeUserSummary.fromJson(responseContent); | ||||
} | } | ||||
@@ -55,7 +43,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeUserCumulate.fromJson(responseContent); | return WxDataCubeUserCumulate.fromJson(responseContent); | ||||
} | } | ||||
@@ -66,7 +53,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleResult.fromJson(responseContent); | return WxDataCubeArticleResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -77,7 +63,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleTotal.fromJson(responseContent); | return WxDataCubeArticleTotal.fromJson(responseContent); | ||||
} | } | ||||
@@ -88,7 +73,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleResult.fromJson(responseContent); | return WxDataCubeArticleResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -99,7 +83,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleResult.fromJson(responseContent); | return WxDataCubeArticleResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -110,7 +93,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleResult.fromJson(responseContent); | return WxDataCubeArticleResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -121,7 +103,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeArticleResult.fromJson(responseContent); | return WxDataCubeArticleResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -133,7 +114,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -145,7 +125,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -157,7 +136,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -169,7 +147,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -181,7 +158,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -193,7 +169,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -205,7 +180,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeMsgResult.fromJson(responseContent); | return WxDataCubeMsgResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -217,7 +191,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeInterfaceResult.fromJson(responseContent); | return WxDataCubeInterfaceResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -229,7 +202,6 @@ public class WxMpDataCubeServiceImpl implements WxMpDataCubeService { | |||||
param.addProperty("begin_date", this.dateFormat.format(beginDate)); | param.addProperty("begin_date", this.dateFormat.format(beginDate)); | ||||
param.addProperty("end_date", this.dateFormat.format(endDate)); | param.addProperty("end_date", this.dateFormat.format(endDate)); | ||||
String responseContent = this.wxMpService.post(url, param.toString()); | String responseContent = this.wxMpService.post(url, param.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent); | |||||
return WxDataCubeInterfaceResult.fromJson(responseContent); | return WxDataCubeInterfaceResult.fromJson(responseContent); | ||||
} | } | ||||
} | } |
@@ -1,84 +0,0 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.gson.JsonElement; | |||||
import com.google.gson.JsonObject; | |||||
import com.google.gson.JsonParser; | |||||
import com.google.gson.reflect.TypeToken; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | |||||
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; | |||||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor; | |||||
import me.chanjar.weixin.common.util.json.GsonHelper; | |||||
import me.chanjar.weixin.mp.api.WxMpGroupService; | |||||
import me.chanjar.weixin.mp.api.WxMpService; | |||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | |||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
import java.util.List; | |||||
/** | |||||
* Created by Binary Wang on 2016/7/21. | |||||
*/ | |||||
@Deprecated | |||||
public class WxMpGroupServiceImpl implements WxMpGroupService { | |||||
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/groups"; | |||||
private WxMpService wxMpService; | |||||
public WxMpGroupServiceImpl(WxMpService wxMpService) { | |||||
this.wxMpService = wxMpService; | |||||
} | |||||
@Override | |||||
public WxMpGroup groupCreate(String name) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/create"; | |||||
JsonObject json = new JsonObject(); | |||||
JsonObject groupJson = new JsonObject(); | |||||
json.add("group", groupJson); | |||||
groupJson.addProperty("name", name); | |||||
String responseContent = this.wxMpService.execute( | |||||
new SimplePostRequestExecutor(), | |||||
url, | |||||
json.toString()); | |||||
return WxMpGroup.fromJson(responseContent); | |||||
} | |||||
@Override | |||||
public List<WxMpGroup> groupGet() throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/get"; | |||||
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, null); | |||||
/* | |||||
* 操蛋的微信API,创建时返回的是 { group : { id : ..., name : ...} } | |||||
* 查询时返回的是 { groups : [ { id : ..., name : ..., count : ... }, ... ] } | |||||
*/ | |||||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||||
return WxMpGsonBuilder.INSTANCE.create().fromJson(tmpJsonElement.getAsJsonObject().get("groups"), | |||||
new TypeToken<List<WxMpGroup>>() { | |||||
}.getType()); | |||||
} | |||||
@Override | |||||
public long userGetGroup(String openid) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/getid"; | |||||
JsonObject o = new JsonObject(); | |||||
o.addProperty("openid", openid); | |||||
String responseContent = this.wxMpService.execute(new SimplePostRequestExecutor(), url, o.toString()); | |||||
JsonElement tmpJsonElement = new JsonParser().parse(responseContent); | |||||
return GsonHelper.getAsLong(tmpJsonElement.getAsJsonObject().get("groupid")); | |||||
} | |||||
@Override | |||||
public void groupUpdate(WxMpGroup group) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/update"; | |||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, group.toJson()); | |||||
} | |||||
@Override | |||||
public void userUpdateGroup(String openid, long to_groupid) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/members/update"; | |||||
JsonObject json = new JsonObject(); | |||||
json.addProperty("openid", openid); | |||||
json.addProperty("to_groupid", to_groupid); | |||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString()); | |||||
} | |||||
} |
@@ -1,6 +1,13 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import java.io.File; | |||||
import java.util.Date; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
@@ -10,12 +17,12 @@ import me.chanjar.weixin.mp.api.WxMpService; | |||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage; | import me.chanjar.weixin.mp.bean.WxMpCustomMessage; | ||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest; | import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest; | ||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest; | import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest; | ||||
import me.chanjar.weixin.mp.bean.kefu.result.*; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import java.io.File; | |||||
import java.util.Date; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList; | |||||
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList; | |||||
/** | /** | ||||
* | * | ||||
@@ -38,7 +45,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
throws WxErrorException { | throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send"; | String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send"; | ||||
String responseContent = this.wxMpService.post(url, message.toJson()); | String responseContent = this.wxMpService.post(url, message.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -60,7 +67,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
throws WxErrorException { | throws WxErrorException { | ||||
String url = API_URL_PREFIX + "/kfaccount/add"; | String url = API_URL_PREFIX + "/kfaccount/add"; | ||||
String responseContent = this.wxMpService.post(url, request.toJson()); | String responseContent = this.wxMpService.post(url, request.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -68,14 +75,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
throws WxErrorException { | throws WxErrorException { | ||||
String url = API_URL_PREFIX + "/kfaccount/update"; | String url = API_URL_PREFIX + "/kfaccount/update"; | ||||
String responseContent = this.wxMpService.post(url, request.toJson()); | String responseContent = this.wxMpService.post(url, request.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException { | public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException { | ||||
String url = API_URL_PREFIX + "/kfaccount/inviteworker"; | String url = API_URL_PREFIX + "/kfaccount/inviteworker"; | ||||
String responseContent = this.wxMpService.post(url, request.toJson()); | String responseContent = this.wxMpService.post(url, request.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -84,14 +91,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount; | String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount; | ||||
WxMediaUploadResult responseContent = this.wxMpService | WxMediaUploadResult responseContent = this.wxMpService | ||||
.execute(new MediaUploadRequestExecutor(), url, imgFile); | .execute(new MediaUploadRequestExecutor(), url, imgFile); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
public boolean kfAccountDel(String kfAccount) throws WxErrorException { | public boolean kfAccountDel(String kfAccount) throws WxErrorException { | ||||
String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount; | String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount; | ||||
String responseContent = this.wxMpService.get(url, null); | String responseContent = this.wxMpService.get(url, null); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -100,7 +107,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); | WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); | ||||
String url = API_URL_PREFIX + "/kfsession/create"; | String url = API_URL_PREFIX + "/kfsession/create"; | ||||
String responseContent = this.wxMpService.post(url, request.toJson()); | String responseContent = this.wxMpService.post(url, request.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -109,7 +116,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService { | |||||
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); | WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); | ||||
String url = API_URL_PREFIX + "/kfsession/close"; | String url = API_URL_PREFIX + "/kfsession/close"; | ||||
String responseContent = this.wxMpService.post(url, request.toJson()); | String responseContent = this.wxMpService.post(url, request.toJson()); | ||||
return true; | |||||
return responseContent != null; | |||||
} | } | ||||
@Override | @Override | ||||
@@ -1,38 +1,37 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import java.lang.reflect.Field; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.Map.Entry; | |||||
import java.util.SortedMap; | |||||
import java.util.TreeMap; | |||||
import org.apache.commons.codec.digest.DigestUtils; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.joor.Reflect; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.google.common.collect.Maps; | import com.google.common.collect.Maps; | ||||
import com.thoughtworks.xstream.XStream; | import com.thoughtworks.xstream.XStream; | ||||
import com.thoughtworks.xstream.annotations.XStreamAlias; | import com.thoughtworks.xstream.annotations.XStreamAlias; | ||||
import me.chanjar.weixin.common.annotation.Required; | import me.chanjar.weixin.common.annotation.Required; | ||||
import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer; | import me.chanjar.weixin.common.util.xml.XStreamInitializer; | ||||
import me.chanjar.weixin.mp.api.WxMpPayService; | import me.chanjar.weixin.mp.api.WxMpPayService; | ||||
import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPayResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxMpPrepayIdResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderResult; | |||||
import me.chanjar.weixin.mp.bean.pay.*; | |||||
import org.apache.commons.codec.digest.DigestUtils; | |||||
import org.apache.commons.lang3.ArrayUtils; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.apache.http.client.methods.CloseableHttpResponse; | |||||
import org.apache.http.client.methods.HttpPost; | |||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier; | |||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |||||
import org.apache.http.entity.StringEntity; | |||||
import org.apache.http.impl.client.CloseableHttpClient; | |||||
import org.apache.http.impl.client.HttpClients; | |||||
import org.apache.http.ssl.SSLContexts; | |||||
import org.apache.http.util.EntityUtils; | |||||
import org.joor.Reflect; | |||||
import javax.net.ssl.SSLContext; | |||||
import java.io.File; | |||||
import java.io.FileInputStream; | |||||
import java.lang.reflect.Field; | |||||
import java.security.KeyStore; | |||||
import java.util.*; | |||||
import java.util.Map.Entry; | |||||
/** | /** | ||||
* Created by Binary Wang on 2016/7/28. | * Created by Binary Wang on 2016/7/28. | ||||
@@ -41,9 +40,11 @@ import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderResult; | |||||
*/ | */ | ||||
public class WxMpPayServiceImpl implements WxMpPayService { | public class WxMpPayServiceImpl implements WxMpPayService { | ||||
private static final List<String> TRADE_TYPES = Lists.newArrayList("JSAPI", | |||||
"NATIVE", "APP"); | |||||
private final Logger log = LoggerFactory.getLogger(WxMpPayServiceImpl.class); | |||||
private static final String PAY_BASE_URL = "https://api.mch.weixin.qq.com"; | |||||
private static final String[] TRADE_TYPES = new String[]{"JSAPI","NATIVE", "APP"}; | |||||
private static final String[] REFUND_ACCOUNT = new String[]{"REFUND_SOURCE_RECHARGE_FUNDS", | |||||
"REFUND_SOURCE_UNSETTLED_FUNDS"}; | |||||
private WxMpService wxMpService; | private WxMpService wxMpService; | ||||
public WxMpPayServiceImpl(WxMpService wxMpService) { | public WxMpPayServiceImpl(WxMpService wxMpService) { | ||||
@@ -81,7 +82,7 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
} | } | ||||
request.append("</xml>"); | request.append("</xml>"); | ||||
String url = "https://api.mch.weixin.qq.com/pay/orderquery"; | |||||
String url = PAY_BASE_URL + "/pay/orderquery"; | |||||
String responseContent = this.wxMpService.post(url, request.toString()); | String responseContent = this.wxMpService.post(url, request.toString()); | ||||
XStream xstream = XStreamInitializer.getInstance(); | XStream xstream = XStreamInitializer.getInstance(); | ||||
xstream.alias("xml", WxMpPayResult.class); | xstream.alias("xml", WxMpPayResult.class); | ||||
@@ -102,33 +103,25 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
} | } | ||||
@Override | @Override | ||||
public WxMpPayRefundResult refundPay(Map<String, String> parameters) | |||||
public WxMpPayRefundResult refund(WxMpPayRefundRequest request, File keyFile) | |||||
throws WxErrorException { | throws WxErrorException { | ||||
SortedMap<String, String> refundParams = new TreeMap<>(parameters); | |||||
refundParams.put("appid", | |||||
this.wxMpService.getWxMpConfigStorage().getAppId()); | |||||
refundParams.put("mch_id", | |||||
this.wxMpService.getWxMpConfigStorage().getPartnerId()); | |||||
refundParams.put("nonce_str", System.currentTimeMillis() + ""); | |||||
refundParams.put("op_user_id", | |||||
this.wxMpService.getWxMpConfigStorage().getPartnerId()); | |||||
String sign = this.createSign(refundParams, | |||||
this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | |||||
refundParams.put("sign", sign); | |||||
StringBuilder request = new StringBuilder("<xml>"); | |||||
for (Map.Entry<String, String> para : refundParams.entrySet()) { | |||||
request.append(String.format("<%s>%s</%s>", para.getKey(), | |||||
para.getValue(), para.getKey())); | |||||
} | |||||
request.append("</xml>"); | |||||
checkParameters(request); | |||||
String url = "https://api.mch.weixin.qq.com/secapi/pay/refund"; | |||||
String responseContent = this.wxMpService.post(url, request.toString()); | |||||
XStream xstream = XStreamInitializer.getInstance(); | XStream xstream = XStreamInitializer.getInstance(); | ||||
xstream.processAnnotations(WxMpPayRefundResult.class); | xstream.processAnnotations(WxMpPayRefundResult.class); | ||||
WxMpPayRefundResult wxMpPayRefundResult = (WxMpPayRefundResult) xstream | |||||
.fromXML(responseContent); | |||||
xstream.processAnnotations(WxMpPayRefundRequest.class); | |||||
request.setAppid(this.wxMpService.getWxMpConfigStorage().getAppId()); | |||||
String partnerId = this.wxMpService.getWxMpConfigStorage().getPartnerId(); | |||||
request.setMchId(partnerId); | |||||
request.setNonceStr( System.currentTimeMillis() + ""); | |||||
request.setOpUserId(partnerId); | |||||
String sign = this.createSign(this.xmlBean2Map(request), this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | |||||
request.setSign(sign); | |||||
String url = PAY_BASE_URL + "/secapi/pay/refund"; | |||||
String responseContent = this.executeRequestWithKeyFile(url, keyFile, xstream.toXML(request), partnerId); | |||||
WxMpPayRefundResult wxMpPayRefundResult = (WxMpPayRefundResult) xstream.fromXML(responseContent); | |||||
if (!"SUCCESS".equalsIgnoreCase(wxMpPayRefundResult.getResultCode()) | if (!"SUCCESS".equalsIgnoreCase(wxMpPayRefundResult.getResultCode()) | ||||
|| !"SUCCESS".equalsIgnoreCase(wxMpPayRefundResult.getReturnCode())) { | || !"SUCCESS".equalsIgnoreCase(wxMpPayRefundResult.getReturnCode())) { | ||||
@@ -145,6 +138,20 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
return wxMpPayRefundResult; | return wxMpPayRefundResult; | ||||
} | } | ||||
private void checkParameters(WxMpPayRefundRequest request) { | |||||
checkNotNullParams(request); | |||||
if (StringUtils.isNotBlank(request.getRefundAccount())) { | |||||
if(!ArrayUtils.contains(REFUND_ACCOUNT, request.getRefundAccount())){ | |||||
throw new IllegalArgumentException("refund_account目前必须为" + Arrays.toString(REFUND_ACCOUNT) + "其中之一"); | |||||
} | |||||
} | |||||
if (StringUtils.isBlank(request.getOutTradeNo()) && StringUtils.isBlank(request.getTransactionId())) { | |||||
throw new IllegalArgumentException("transaction_id 和 out_trade_no 不能同时为空,必须提供一个"); | |||||
} | |||||
} | |||||
@Override | @Override | ||||
public boolean checkJSSDKCallbackDataSignature(Map<String, String> kvm, | public boolean checkJSSDKCallbackDataSignature(Map<String, String> kvm, | ||||
String signature) { | String signature) { | ||||
@@ -153,27 +160,28 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
} | } | ||||
@Override | @Override | ||||
public WxRedpackResult sendRedpack(WxSendRedpackRequest request) | |||||
public WxRedpackResult sendRedpack(WxSendRedpackRequest request, File keyFile) | |||||
throws WxErrorException { | throws WxErrorException { | ||||
XStream xstream = XStreamInitializer.getInstance(); | XStream xstream = XStreamInitializer.getInstance(); | ||||
xstream.processAnnotations(WxSendRedpackRequest.class); | xstream.processAnnotations(WxSendRedpackRequest.class); | ||||
xstream.processAnnotations(WxRedpackResult.class); | xstream.processAnnotations(WxRedpackResult.class); | ||||
request.setWxAppid(this.wxMpService.getWxMpConfigStorage().getAppId()); | request.setWxAppid(this.wxMpService.getWxMpConfigStorage().getAppId()); | ||||
request.setMchId(this.wxMpService.getWxMpConfigStorage().getPartnerId()); | |||||
String mchId = this.wxMpService.getWxMpConfigStorage().getPartnerId(); | |||||
request.setMchId(mchId); | |||||
request.setNonceStr(System.currentTimeMillis() + ""); | request.setNonceStr(System.currentTimeMillis() + ""); | ||||
String sign = this.createSign(xmlBean2Map(request), | |||||
String sign = this.createSign(this.xmlBean2Map(request), | |||||
this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | ||||
request.setSign(sign); | request.setSign(sign); | ||||
String url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack"; | |||||
String url = PAY_BASE_URL + "/mmpaymkttransfers/sendredpack"; | |||||
if (request.getAmtType() != null) { | if (request.getAmtType() != null) { | ||||
//裂变红包 | //裂变红包 | ||||
url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendgroupredpack"; | |||||
url = PAY_BASE_URL + "/mmpaymkttransfers/sendgroupredpack"; | |||||
} | } | ||||
String responseContent = this.wxMpService.post(url, xstream.toXML(request)); | |||||
String responseContent = this.executeRequestWithKeyFile(url, keyFile, xstream.toXML(request), mchId); | |||||
WxRedpackResult redpackResult = (WxRedpackResult) xstream | WxRedpackResult redpackResult = (WxRedpackResult) xstream | ||||
.fromXML(responseContent); | .fromXML(responseContent); | ||||
if ("FAIL".equals(redpackResult.getResultCode())) { | if ("FAIL".equals(redpackResult.getResultCode())) { | ||||
@@ -245,11 +253,11 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
request.setMchId(this.wxMpService.getWxMpConfigStorage().getPartnerId()); | request.setMchId(this.wxMpService.getWxMpConfigStorage().getPartnerId()); | ||||
request.setNonceStr(System.currentTimeMillis() + ""); | request.setNonceStr(System.currentTimeMillis() + ""); | ||||
String sign = this.createSign(xmlBean2Map(request), | |||||
String sign = this.createSign(this.xmlBean2Map(request), | |||||
this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | ||||
request.setSign(sign); | request.setSign(sign); | ||||
String url = "https://api.mch.weixin.qq.com/pay/unifiedorder"; | |||||
String url = PAY_BASE_URL + "/pay/unifiedorder"; | |||||
String responseContent = this.wxMpService.post(url, xstream.toXML(request)); | String responseContent = this.wxMpService.post(url, xstream.toXML(request)); | ||||
WxUnifiedOrderResult result = (WxUnifiedOrderResult) xstream | WxUnifiedOrderResult result = (WxUnifiedOrderResult) xstream | ||||
@@ -261,11 +269,25 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
} | } | ||||
return result; | return result; | ||||
} | } | ||||
private void checkParameters(WxUnifiedOrderRequest request) { | private void checkParameters(WxUnifiedOrderRequest request) { | ||||
checkNotNullParams(request); | |||||
if (! ArrayUtils.contains(TRADE_TYPES, request.getTradeType())) { | |||||
throw new IllegalArgumentException("trade_type目前必须为" + Arrays.toString(TRADE_TYPES) + "其中之一"); | |||||
} | |||||
if ("JSAPI".equals(request.getTradeType()) && request.getOpenid() == null) { | |||||
throw new IllegalArgumentException("当 trade_type是'JSAPI'时未指定openid"); | |||||
} | |||||
if ("NATIVE".equals(request.getTradeType()) && request.getProductId() == null) { | |||||
throw new IllegalArgumentException("当 trade_type是'NATIVE'时未指定product_id"); | |||||
} | |||||
} | |||||
private void checkNotNullParams(Object request) { | |||||
List<String> nullFields = Lists.newArrayList(); | List<String> nullFields = Lists.newArrayList(); | ||||
for (Entry<String, Reflect> entry : Reflect.on(request).fields() | for (Entry<String, Reflect> entry : Reflect.on(request).fields() | ||||
.entrySet()) { | .entrySet()) { | ||||
@@ -284,21 +306,6 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
if (!nullFields.isEmpty()) { | if (!nullFields.isEmpty()) { | ||||
throw new IllegalArgumentException("必填字段[" + nullFields + "]必须提供值"); | throw new IllegalArgumentException("必填字段[" + nullFields + "]必须提供值"); | ||||
} | } | ||||
if (!TRADE_TYPES.contains(request.getTradeType())) { | |||||
throw new IllegalArgumentException( | |||||
"trade_type目前必须为" + TRADE_TYPES + "其中之一"); | |||||
} | |||||
if ("JSAPI".equals(request.getTradeType()) && request.getOpenid() == null) { | |||||
throw new IllegalArgumentException("当 trade_type是'JSAPI'时未指定openid"); | |||||
} | |||||
if ("NATIVE".equals(request.getTradeType()) | |||||
&& request.getProductId() == null) { | |||||
throw new IllegalArgumentException("当 trade_type是'NATIVE'时未指定product_id"); | |||||
} | |||||
} | } | ||||
@Override | @Override | ||||
@@ -336,4 +343,52 @@ public class WxMpPayServiceImpl implements WxMpPayService { | |||||
return payInfo; | return payInfo; | ||||
} | } | ||||
@Override | |||||
public WxEntPayResult entPay(WxEntPayRequest request, File keyFile) throws WxErrorException { | |||||
checkNotNullParams(request); | |||||
XStream xstream = XStreamInitializer.getInstance(); | |||||
xstream.processAnnotations(WxEntPayRequest.class); | |||||
xstream.processAnnotations(WxEntPayResult.class); | |||||
request.setMchAppid(this.wxMpService.getWxMpConfigStorage().getAppId()); | |||||
request.setMchId(this.wxMpService.getWxMpConfigStorage().getPartnerId()); | |||||
request.setNonceStr(System.currentTimeMillis() + ""); | |||||
String sign = this.createSign(xmlBean2Map(request), this.wxMpService.getWxMpConfigStorage().getPartnerKey()); | |||||
request.setSign(sign); | |||||
String url = PAY_BASE_URL + "/mmpaymkttransfers/promotion/transfers"; | |||||
String responseContent = this.executeRequestWithKeyFile(url, keyFile, xstream.toXML(request), request.getMchId()); | |||||
WxEntPayResult result = (WxEntPayResult) xstream.fromXML(responseContent); | |||||
if ("FAIL".equals(result.getResultCode())) { | |||||
throw new WxErrorException( | |||||
WxError.newBuilder().setErrorMsg(result.getErrCode() + ":" + result.getErrCodeDes()).build()); | |||||
} | |||||
return result; | |||||
} | |||||
private String executeRequestWithKeyFile( String url, File keyFile, String requestStr, String mchId) throws WxErrorException { | |||||
try (FileInputStream inputStream = new FileInputStream(keyFile)) { | |||||
KeyStore keyStore = KeyStore.getInstance("PKCS12"); | |||||
keyStore.load(inputStream, mchId.toCharArray()); | |||||
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mchId.toCharArray()).build(); | |||||
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1" }, null, | |||||
new DefaultHostnameVerifier()); | |||||
try (CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build()) { | |||||
HttpPost httpPost = new HttpPost(url); | |||||
httpPost.setEntity(new StringEntity(new String(requestStr.getBytes("UTF-8"), "ISO-8859-1"))); | |||||
try (CloseableHttpResponse response = httpclient.execute(httpPost)) { | |||||
return EntityUtils.toString(response.getEntity()); | |||||
} | |||||
} | |||||
} catch (Exception e) { | |||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build(), e); | |||||
} | |||||
} | |||||
} | } |
@@ -1,23 +1,9 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import java.io.IOException; | |||||
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.HttpGet; | |||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier; | |||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |||||
import org.apache.http.impl.client.BasicResponseHandler; | |||||
import org.apache.http.impl.client.CloseableHttpClient; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import com.google.gson.JsonArray; | import com.google.gson.JsonArray; | ||||
import com.google.gson.JsonElement; | import com.google.gson.JsonElement; | ||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import com.google.gson.JsonParser; | import com.google.gson.JsonParser; | ||||
import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||
import me.chanjar.weixin.common.bean.WxJsapiSignature; | import me.chanjar.weixin.common.bean.WxJsapiSignature; | ||||
import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
@@ -26,39 +12,22 @@ import me.chanjar.weixin.common.session.StandardSessionManager; | |||||
import me.chanjar.weixin.common.session.WxSessionManager; | import me.chanjar.weixin.common.session.WxSessionManager; | ||||
import me.chanjar.weixin.common.util.RandomUtils; | import me.chanjar.weixin.common.util.RandomUtils; | ||||
import me.chanjar.weixin.common.util.crypto.SHA1; | import me.chanjar.weixin.common.util.crypto.SHA1; | ||||
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder; | |||||
import me.chanjar.weixin.common.util.http.DefaultApacheHttpClientBuilder; | |||||
import me.chanjar.weixin.common.util.http.RequestExecutor; | |||||
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; | |||||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor; | |||||
import me.chanjar.weixin.common.util.http.URIUtil; | |||||
import me.chanjar.weixin.mp.api.WxMpCardService; | |||||
import me.chanjar.weixin.mp.api.WxMpConfigStorage; | |||||
import me.chanjar.weixin.mp.api.WxMpDataCubeService; | |||||
import me.chanjar.weixin.mp.api.WxMpGroupService; | |||||
import me.chanjar.weixin.mp.api.WxMpKefuService; | |||||
import me.chanjar.weixin.mp.api.WxMpMaterialService; | |||||
import me.chanjar.weixin.mp.api.WxMpMenuService; | |||||
import me.chanjar.weixin.mp.api.WxMpPayService; | |||||
import me.chanjar.weixin.mp.api.WxMpQrcodeService; | |||||
import me.chanjar.weixin.mp.api.WxMpService; | |||||
import me.chanjar.weixin.mp.api.WxMpStoreService; | |||||
import me.chanjar.weixin.mp.api.WxMpUserBlacklistService; | |||||
import me.chanjar.weixin.mp.api.WxMpUserService; | |||||
import me.chanjar.weixin.mp.api.WxMpUserTagService; | |||||
import me.chanjar.weixin.mp.bean.WxMpIndustry; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassNews; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo; | |||||
import me.chanjar.weixin.mp.bean.WxMpSemanticQuery; | |||||
import me.chanjar.weixin.mp.bean.WxMpTemplateMessage; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||||
import me.chanjar.weixin.common.util.http.*; | |||||
import me.chanjar.weixin.mp.api.*; | |||||
import me.chanjar.weixin.mp.bean.*; | |||||
import me.chanjar.weixin.mp.bean.result.*; | |||||
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.HttpGet; | |||||
import org.apache.http.conn.ssl.DefaultHostnameVerifier; | |||||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |||||
import org.apache.http.impl.client.BasicResponseHandler; | |||||
import org.apache.http.impl.client.CloseableHttpClient; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import java.io.IOException; | |||||
public class WxMpServiceImpl implements WxMpService { | public class WxMpServiceImpl implements WxMpService { | ||||
@@ -86,8 +55,6 @@ public class WxMpServiceImpl implements WxMpService { | |||||
private WxMpUserService userService = new WxMpUserServiceImpl(this); | private WxMpUserService userService = new WxMpUserServiceImpl(this); | ||||
private WxMpGroupService groupService = new WxMpGroupServiceImpl(this); | |||||
private WxMpUserTagService tagService = new WxMpUserTagServiceImpl(this); | private WxMpUserTagService tagService = new WxMpUserTagServiceImpl(this); | ||||
private WxMpQrcodeService qrCodeService = new WxMpQrcodeServiceImpl(this); | private WxMpQrcodeService qrCodeService = new WxMpQrcodeServiceImpl(this); | ||||
@@ -211,35 +178,35 @@ public class WxMpServiceImpl implements WxMpService { | |||||
@Override | @Override | ||||
public WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException { | public WxMpMassUploadResult massNewsUpload(WxMpMassNews news) throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews"; | String url = "https://api.weixin.qq.com/cgi-bin/media/uploadnews"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, news.toJson()); | |||||
String responseContent = this.post(url, news.toJson()); | |||||
return WxMpMassUploadResult.fromJson(responseContent); | return WxMpMassUploadResult.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException { | public WxMpMassUploadResult massVideoUpload(WxMpMassVideo video) throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/media/uploadvideo"; | String url = "https://api.weixin.qq.com/cgi-bin/media/uploadvideo"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, video.toJson()); | |||||
String responseContent = this.post(url, video.toJson()); | |||||
return WxMpMassUploadResult.fromJson(responseContent); | return WxMpMassUploadResult.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public WxMpMassSendResult massGroupMessageSend(WxMpMassGroupMessage message) throws WxErrorException { | |||||
public WxMpMassSendResult massGroupMessageSend(WxMpMassTagMessage message) throws WxErrorException { | |||||
String url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall"; | String url = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, message.toJson()); | |||||
String responseContent = this.post(url, message.toJson()); | |||||
return WxMpMassSendResult.fromJson(responseContent); | return WxMpMassSendResult.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException { | public WxMpMassSendResult massOpenIdsMessageSend(WxMpMassOpenIdsMessage message) throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/message/mass/send"; | String url = "https://api.weixin.qq.com/cgi-bin/message/mass/send"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, message.toJson()); | |||||
String responseContent = this.post(url, message.toJson()); | |||||
return WxMpMassSendResult.fromJson(responseContent); | return WxMpMassSendResult.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public WxMpMassSendResult massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage) throws Exception { | public WxMpMassSendResult massMessagePreview(WxMpMassPreviewMessage wxMpMassPreviewMessage) throws Exception { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/message/mass/preview"; | String url = "https://api.weixin.qq.com/cgi-bin/message/mass/preview"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, wxMpMassPreviewMessage.toJson()); | |||||
String responseContent = this.post(url, wxMpMassPreviewMessage.toJson()); | |||||
return WxMpMassSendResult.fromJson(responseContent); | return WxMpMassSendResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -249,7 +216,7 @@ public class WxMpServiceImpl implements WxMpService { | |||||
JsonObject o = new JsonObject(); | JsonObject o = new JsonObject(); | ||||
o.addProperty("action", "long2short"); | o.addProperty("action", "long2short"); | ||||
o.addProperty("long_url", long_url); | o.addProperty("long_url", long_url); | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, o.toString()); | |||||
String responseContent = this.post(url, o.toString()); | |||||
JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent); | JsonElement tmpJsonElement = JSON_PARSER.parse(responseContent); | ||||
return tmpJsonElement.getAsJsonObject().get("short_url").getAsString(); | return tmpJsonElement.getAsJsonObject().get("short_url").getAsString(); | ||||
} | } | ||||
@@ -273,20 +240,20 @@ public class WxMpServiceImpl implements WxMpService { | |||||
throw new IllegalArgumentException("industry id is empty"); | throw new IllegalArgumentException("industry id is empty"); | ||||
} | } | ||||
String url = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry"; | String url = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry"; | ||||
return execute(new SimplePostRequestExecutor(), url, wxMpIndustry.toJson()); | |||||
return this.post(url, wxMpIndustry.toJson()); | |||||
} | } | ||||
@Override | @Override | ||||
public WxMpIndustry getIndustry() throws WxErrorException { | public WxMpIndustry getIndustry() throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/template/get_industry"; | String url = "https://api.weixin.qq.com/cgi-bin/template/get_industry"; | ||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, null); | |||||
String responseContent = this.get(url, null); | |||||
return WxMpIndustry.fromJson(responseContent); | return WxMpIndustry.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException { | public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/semantic/semproxy/search"; | String url = "https://api.weixin.qq.com/semantic/semproxy/search"; | ||||
String responseContent = execute(new SimplePostRequestExecutor(), url, semanticQuery.toJson()); | |||||
String responseContent = this.post(url, semanticQuery.toJson()); | |||||
return WxMpSemanticQueryResult.fromJson(responseContent); | return WxMpSemanticQueryResult.fromJson(responseContent); | ||||
} | } | ||||
@@ -480,6 +447,7 @@ public class WxMpServiceImpl implements WxMpService { | |||||
} | } | ||||
return null; | return null; | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
this.log.error("\n[URL]: {}\n[PARAMS]: {}\n[EXCEPTION]: {}", uri, data, e.getMessage()); | |||||
throw new RuntimeException(e); | throw new RuntimeException(e); | ||||
} | } | ||||
} | } | ||||
@@ -559,11 +527,6 @@ public class WxMpServiceImpl implements WxMpService { | |||||
return this.userService; | return this.userService; | ||||
} | } | ||||
@Override | |||||
public WxMpGroupService getGroupService() { | |||||
return this.groupService; | |||||
} | |||||
@Override | @Override | ||||
public WxMpUserTagService getUserTagService() { | public WxMpUserTagService getUserTagService() { | ||||
return this.tagService; | return this.tagService; | ||||
@@ -1,14 +1,9 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import java.lang.reflect.Field; | |||||
import java.util.List; | |||||
import java.util.Map.Entry; | |||||
import org.joor.Reflect; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import com.google.gson.JsonParser; | |||||
import com.google.gson.reflect.TypeToken; | |||||
import me.chanjar.weixin.common.annotation.Required; | import me.chanjar.weixin.common.annotation.Required; | ||||
import me.chanjar.weixin.common.bean.result.WxError; | import me.chanjar.weixin.common.bean.result.WxError; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
@@ -17,6 +12,12 @@ import me.chanjar.weixin.mp.api.WxMpStoreService; | |||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
import org.joor.Reflect; | |||||
import java.lang.reflect.Field; | |||||
import java.util.List; | |||||
import java.util.Map.Entry; | |||||
/** | /** | ||||
* Created by Binary Wang on 2016/9/26. | * Created by Binary Wang on 2016/9/26. | ||||
@@ -44,6 +45,32 @@ public class WxMpStoreServiceImpl implements WxMpStoreService { | |||||
} | } | ||||
} | } | ||||
@Override | |||||
public WxMpStoreBaseInfo get(String poiId) throws WxErrorException { | |||||
String url = API_BASE_URL + "/getpoi"; | |||||
JsonObject paramObject = new JsonObject(); | |||||
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()); | |||||
} | |||||
@Override | |||||
public void delete(String poiId) throws WxErrorException { | |||||
String url = API_BASE_URL + "/delpoi"; | |||||
JsonObject paramObject = new JsonObject(); | |||||
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); | |||||
} | |||||
} | |||||
private void checkParameters(WxMpStoreBaseInfo request) { | private void checkParameters(WxMpStoreBaseInfo request) { | ||||
List<String> nullFields = Lists.newArrayList(); | List<String> nullFields = Lists.newArrayList(); | ||||
for (Entry<String, Reflect> entry : Reflect.on(request).fields() | for (Entry<String, Reflect> entry : Reflect.on(request).fields() | ||||
@@ -104,4 +131,28 @@ public class WxMpStoreServiceImpl implements WxMpStoreService { | |||||
return stores; | return stores; | ||||
} | } | ||||
@Override | |||||
public void update(WxMpStoreBaseInfo request) throws WxErrorException { | |||||
String url = API_BASE_URL + "/updatepoi"; | |||||
String response = this.wxMpService.post(url, request.toJson()); | |||||
WxError wxError = WxError.fromJson(response); | |||||
if (wxError.getErrorCode() != 0) { | |||||
throw new WxErrorException(wxError); | |||||
} | |||||
} | |||||
@Override | |||||
public List<String> listCategories() throws WxErrorException { | |||||
String url = API_BASE_URL + "/getwxcategory"; | |||||
String response = this.wxMpService.get(url, null); | |||||
WxError wxError = WxError.fromJson(response); | |||||
if (wxError.getErrorCode() != 0) { | |||||
throw new WxErrorException(wxError); | |||||
} | |||||
return WxMpGsonBuilder.create().fromJson( | |||||
new JsonParser().parse(response).getAsJsonObject().get("category_list"), | |||||
new TypeToken<List<String>>(){}.getType()); | |||||
} | |||||
} | } |
@@ -12,19 +12,15 @@ import me.chanjar.weixin.mp.bean.tag.WxTagListUser; | |||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag; | import me.chanjar.weixin.mp.bean.tag.WxUserTag; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
* | * | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/9/2. | * Created by Binary Wang on 2016/9/2. | ||||
*/ | */ | ||||
public class WxMpUserTagServiceImpl implements WxMpUserTagService { | public class WxMpUserTagServiceImpl implements WxMpUserTagService { | ||||
protected final Logger log = LoggerFactory | |||||
.getLogger(WxMpDataCubeServiceImpl.class); | |||||
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags"; | private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags"; | ||||
private WxMpService wxMpService; | private WxMpService wxMpService; | ||||
@@ -42,8 +38,6 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.add("tag", tagJson); | json.add("tag", tagJson); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
return WxUserTag.fromJson(responseContent); | return WxUserTag.fromJson(responseContent); | ||||
} | } | ||||
@@ -52,13 +46,11 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
String url = API_URL_PREFIX + "/get"; | String url = API_URL_PREFIX + "/get"; | ||||
String responseContent = this.wxMpService.get(url, null); | String responseContent = this.wxMpService.get(url, null); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, "[empty]", | |||||
responseContent); | |||||
return WxUserTag.listFromJson(responseContent); | return WxUserTag.listFromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public Boolean tagUpdate(Integer id, String name) throws WxErrorException { | |||||
public Boolean tagUpdate(Long id, String name) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/update"; | String url = API_URL_PREFIX + "/update"; | ||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
@@ -68,7 +60,6 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.add("tag", tagJson); | json.add("tag", tagJson); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), responseContent); | |||||
WxError wxError = WxError.fromJson(responseContent); | WxError wxError = WxError.fromJson(responseContent); | ||||
if (wxError.getErrorCode() == 0) { | if (wxError.getErrorCode() == 0) { | ||||
return true; | return true; | ||||
@@ -78,7 +69,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
} | } | ||||
@Override | @Override | ||||
public Boolean tagDelete(Integer id) throws WxErrorException { | |||||
public Boolean tagDelete(Long id) throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/delete"; | String url = API_URL_PREFIX + "/delete"; | ||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
@@ -87,8 +78,6 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.add("tag", tagJson); | json.add("tag", tagJson); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
WxError wxError = WxError.fromJson(responseContent); | WxError wxError = WxError.fromJson(responseContent); | ||||
if (wxError.getErrorCode() == 0) { | if (wxError.getErrorCode() == 0) { | ||||
return true; | return true; | ||||
@@ -98,7 +87,8 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
} | } | ||||
@Override | @Override | ||||
public WxTagListUser tagListUser(Integer tagId, String nextOpenid) throws WxErrorException { | |||||
public WxTagListUser tagListUser(Long tagId, String nextOpenid) | |||||
throws WxErrorException { | |||||
String url = "https://api.weixin.qq.com/cgi-bin/user/tag/get"; | String url = "https://api.weixin.qq.com/cgi-bin/user/tag/get"; | ||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
@@ -106,14 +96,13 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.addProperty("next_openid", StringUtils.trimToEmpty(nextOpenid)); | json.addProperty("next_openid", StringUtils.trimToEmpty(nextOpenid)); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
return WxTagListUser.fromJson(responseContent); | return WxTagListUser.fromJson(responseContent); | ||||
} | } | ||||
@Override | @Override | ||||
public boolean batchTagging(Integer tagId, String[] openids) throws WxErrorException { | |||||
String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchtagging"; | |||||
public boolean batchTagging(Long tagId, String[] openids) | |||||
throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/members/batchtagging"; | |||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
json.addProperty("tagid", tagId); | json.addProperty("tagid", tagId); | ||||
@@ -124,8 +113,6 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.add("openid_list", openidArrayJson); | json.add("openid_list", openidArrayJson); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
WxError wxError = WxError.fromJson(responseContent); | WxError wxError = WxError.fromJson(responseContent); | ||||
if (wxError.getErrorCode() == 0) { | if (wxError.getErrorCode() == 0) { | ||||
return true; | return true; | ||||
@@ -135,8 +122,9 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
} | } | ||||
@Override | @Override | ||||
public boolean batchUntagging(Integer tagId, String[] openids) throws WxErrorException { | |||||
String url = "https://api.weixin.qq.com/cgi-bin/tags/members/batchuntagging"; | |||||
public boolean batchUntagging(Long tagId, String[] openids) | |||||
throws WxErrorException { | |||||
String url = API_URL_PREFIX + "/members/batchuntagging"; | |||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
json.addProperty("tagid", tagId); | json.addProperty("tagid", tagId); | ||||
@@ -147,8 +135,6 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
json.add("openid_list", openidArrayJson); | json.add("openid_list", openidArrayJson); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
WxError wxError = WxError.fromJson(responseContent); | WxError wxError = WxError.fromJson(responseContent); | ||||
if (wxError.getErrorCode() == 0) { | if (wxError.getErrorCode() == 0) { | ||||
return true; | return true; | ||||
@@ -159,14 +145,12 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService { | |||||
@Override | @Override | ||||
public List<Integer> userTagList(String openid) throws WxErrorException { | public List<Integer> userTagList(String openid) throws WxErrorException { | ||||
String url = "https://api.weixin.qq.com/cgi-bin/tags/getidlist"; | |||||
String url = API_URL_PREFIX + "/getidlist"; | |||||
JsonObject json = new JsonObject(); | JsonObject json = new JsonObject(); | ||||
json.addProperty("openid", openid); | json.addProperty("openid", openid); | ||||
String responseContent = this.wxMpService.post(url, json.toString()); | String responseContent = this.wxMpService.post(url, json.toString()); | ||||
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), | |||||
responseContent); | |||||
return WxMpGsonBuilder.create().fromJson( | return WxMpGsonBuilder.create().fromJson( | ||||
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"), | new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"), | ||||
@@ -1,52 +0,0 @@ | |||||
package me.chanjar.weixin.mp.bean; | |||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
import java.io.Serializable; | |||||
/** | |||||
* 微信用户分组 | |||||
* @author chanjarster | |||||
* | |||||
*/ | |||||
public class WxMpGroup implements Serializable { | |||||
/** | |||||
* | |||||
*/ | |||||
private static final long serialVersionUID = 1554709708638735270L; | |||||
private long id = -1; | |||||
private String name; | |||||
private long count; | |||||
public long getId() { | |||||
return this.id; | |||||
} | |||||
public void setId(long id) { | |||||
this.id = id; | |||||
} | |||||
public String getName() { | |||||
return this.name; | |||||
} | |||||
public void setName(String name) { | |||||
this.name = name; | |||||
} | |||||
public long getCount() { | |||||
return this.count; | |||||
} | |||||
public void setCount(long count) { | |||||
this.count = count; | |||||
} | |||||
public static WxMpGroup fromJson(String json) { | |||||
return WxMpGsonBuilder.create().fromJson(json, WxMpGroup.class); | |||||
} | |||||
public String toJson() { | |||||
return WxMpGsonBuilder.create().toJson(this); | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return "WxMpGroup [id=" + this.id + ", name=" + this.name + ", count=" + this.count + "]"; | |||||
} | |||||
} |
@@ -1,26 +1,23 @@ | |||||
package me.chanjar.weixin.mp.bean; | package me.chanjar.weixin.mp.bean; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 分组群发的消息 | |||||
* 按标签群发的消息 | |||||
* | * | ||||
* @author chanjarster | * @author chanjarster | ||||
*/ | */ | ||||
public class WxMpMassGroupMessage implements Serializable { | |||||
public class WxMpMassTagMessage implements Serializable { | |||||
/** | |||||
* | |||||
*/ | |||||
private static final long serialVersionUID = -6625914040986749286L; | private static final long serialVersionUID = -6625914040986749286L; | ||||
private Long groupId; | |||||
private Long tagId; | |||||
private String msgtype; | private String msgtype; | ||||
private String content; | private String content; | ||||
private String mediaId; | private String mediaId; | ||||
public WxMpMassGroupMessage() { | |||||
public WxMpMassTagMessage() { | |||||
super(); | super(); | ||||
} | } | ||||
@@ -64,16 +61,16 @@ public class WxMpMassGroupMessage implements Serializable { | |||||
return WxMpGsonBuilder.INSTANCE.create().toJson(this); | return WxMpGsonBuilder.INSTANCE.create().toJson(this); | ||||
} | } | ||||
public Long getGroupId() { | |||||
return this.groupId; | |||||
public Long getTagId() { | |||||
return this.tagId; | |||||
} | } | ||||
/** | /** | ||||
* 如果不设置则就意味着发给所有用户 | * 如果不设置则就意味着发给所有用户 | ||||
* @param groupId | |||||
* @param tagId | |||||
*/ | */ | ||||
public void setGroupId(Long groupId) { | |||||
this.groupId = groupId; | |||||
public void setTagId(Long tagId) { | |||||
this.tagId = tagId; | |||||
} | } | ||||
} | } |
@@ -20,11 +20,10 @@ import me.chanjar.weixin.mp.util.xml.XStreamTransformer; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
* 微信推送过来的消息,也是同步回复给用户的消息,xml格式 | |||||
* 相关字段的解释看微信开发者文档: | |||||
* http://mp.weixin.qq.com/wiki/index.php?title=接收普通消息 | |||||
* http://mp.weixin.qq.com/wiki/index.php?title=接收事件推送 | |||||
* http://mp.weixin.qq.com/wiki/index.php?title=接收语音识别结果 | |||||
* 微信推送过来的消息,xml格式 | |||||
* 部分未注释的字段的解释请查阅相关微信开发文档: | |||||
* <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140453&token=&lang=zh_CN">接收普通消息</a> | |||||
* <a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140454&token=&lang=zh_CN">接收事件推送</a> | |||||
* </pre> | * </pre> | ||||
* | * | ||||
* @author chanjarster | * @author chanjarster | ||||
@@ -40,11 +39,11 @@ public class WxMpXmlMessage implements Serializable { | |||||
@XStreamAlias("ToUserName") | @XStreamAlias("ToUserName") | ||||
@XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
private String toUserName; | |||||
private String toUser; | |||||
@XStreamAlias("FromUserName") | @XStreamAlias("FromUserName") | ||||
@XStreamConverter(value = XStreamCDataConverter.class) | @XStreamConverter(value = XStreamCDataConverter.class) | ||||
private String fromUserName; | |||||
private String fromUser; | |||||
@XStreamAlias("CreateTime") | @XStreamAlias("CreateTime") | ||||
private Long createTime; | private Long createTime; | ||||
@@ -209,12 +208,75 @@ public class WxMpXmlMessage implements Serializable { | |||||
@XStreamAlias("SendLocationInfo") | @XStreamAlias("SendLocationInfo") | ||||
private SendLocationInfo sendLocationInfo = new SendLocationInfo(); | private SendLocationInfo sendLocationInfo = new SendLocationInfo(); | ||||
public String getToUserName() { | |||||
return this.toUserName; | |||||
/////////////////////////////////////// | |||||
// 门店审核事件推送 | |||||
/////////////////////////////////////// | |||||
/** | |||||
* UniqId | |||||
* 商户自己内部ID,即字段中的sid | |||||
*/ | |||||
@XStreamAlias("UniqId") | |||||
private String storeUniqId; | |||||
/** | |||||
* PoiId | |||||
* 微信的门店ID,微信内门店唯一标示ID | |||||
*/ | |||||
@XStreamAlias("PoiId") | |||||
private String poiId; | |||||
/** | |||||
* Result | |||||
* 审核结果,成功succ 或失败fail | |||||
*/ | |||||
@XStreamAlias("Result") | |||||
private String result; | |||||
/** | |||||
* msg | |||||
* 成功的通知信息,或审核失败的驳回理由 | |||||
*/ | |||||
@XStreamAlias("msg") | |||||
private String msg; | |||||
public String getStoreUniqId() { | |||||
return this.storeUniqId; | |||||
} | |||||
public void setStoreUniqId(String storeUniqId) { | |||||
this.storeUniqId = storeUniqId; | |||||
} | |||||
public String getPoiId() { | |||||
return this.poiId; | |||||
} | |||||
public void setPoiId(String poiId) { | |||||
this.poiId = poiId; | |||||
} | |||||
public String getResult() { | |||||
return this.result; | |||||
} | |||||
public void setResult(String result) { | |||||
this.result = result; | |||||
} | |||||
public String getMsg() { | |||||
return this.msg; | |||||
} | |||||
public void setMsg(String msg) { | |||||
this.msg = msg; | |||||
} | |||||
public String getToUser() { | |||||
return this.toUser; | |||||
} | } | ||||
public void setToUserName(String toUserName) { | |||||
this.toUserName = toUserName; | |||||
public void setToUser(String toUser) { | |||||
this.toUser = toUser; | |||||
} | } | ||||
public Long getCreateTime() { | public Long getCreateTime() { | ||||
@@ -419,12 +481,12 @@ public class WxMpXmlMessage implements Serializable { | |||||
this.recognition = recognition; | this.recognition = recognition; | ||||
} | } | ||||
public String getFromUserName() { | |||||
return this.fromUserName; | |||||
public String getFromUser() { | |||||
return this.fromUser; | |||||
} | } | ||||
public void setFromUserName(String fromUserName) { | |||||
this.fromUserName = fromUserName; | |||||
public void setFromUser(String fromUser) { | |||||
this.fromUser = fromUser; | |||||
} | } | ||||
public static WxMpXmlMessage fromXml(String xml) { | public static WxMpXmlMessage fromXml(String xml) { | ||||
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 图文分析数据接口返回结果对象 | * 图文分析数据接口返回结果对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/24. | * Created by Binary Wang on 2016/8/24. | ||||
*/ | */ | ||||
public class WxDataCubeArticleResult extends WxDataCubeBaseResult { | public class WxDataCubeArticleResult extends WxDataCubeBaseResult { | ||||
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 图文分析数据接口返回结果对象 | * 图文分析数据接口返回结果对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/24. | * Created by Binary Wang on 2016/8/24. | ||||
*/ | */ | ||||
public class WxDataCubeArticleTotal extends WxDataCubeBaseResult { | public class WxDataCubeArticleTotal extends WxDataCubeBaseResult { | ||||
@@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName; | |||||
/** | /** | ||||
* 获取图文群发总数据接口(getarticletotal)中的详细字段 | * 获取图文群发总数据接口(getarticletotal)中的详细字段 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/24. | * Created by Binary Wang on 2016/8/24. | ||||
*/ | */ | ||||
public class WxDataCubeArticleTotalDetail { | public class WxDataCubeArticleTotalDetail { | ||||
@@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; | |||||
/** | /** | ||||
* 统计接口的共用属性类 | * 统计接口的共用属性类 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/25. | * Created by Binary Wang on 2016/8/25. | ||||
*/ | */ | ||||
public class WxDataCubeBaseResult { | public class WxDataCubeBaseResult { | ||||
@@ -29,5 +29,5 @@ public class WxDataCubeBaseResult { | |||||
public void setRefDate(String refDate) { | public void setRefDate(String refDate) { | ||||
this.refDate = refDate; | this.refDate = refDate; | ||||
} | } | ||||
} | } |
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 接口分析数据接口返回结果对象 | * 接口分析数据接口返回结果对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/30. | * Created by Binary Wang on 2016/8/30. | ||||
*/ | */ | ||||
public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult { | public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult { | ||||
@@ -98,5 +98,5 @@ public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult { | |||||
new TypeToken<List<WxDataCubeInterfaceResult>>() { | new TypeToken<List<WxDataCubeInterfaceResult>>() { | ||||
}.getType()); | }.getType()); | ||||
} | } | ||||
} | } |
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 消息分析数据接口返回结果对象 | * 消息分析数据接口返回结果对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/8/29. | * Created by Binary Wang on 2016/8/29. | ||||
*/ | */ | ||||
public class WxDataCubeMsgResult extends WxDataCubeBaseResult { | public class WxDataCubeMsgResult extends WxDataCubeBaseResult { | ||||
@@ -0,0 +1,284 @@ | |||||
package me.chanjar.weixin.mp.bean.pay; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||||
/** | |||||
* <pre> | |||||
* 企业付款请求对象 | |||||
* 注释中各行每个字段描述对应如下: | |||||
* <li>字段名 | |||||
* <li>变量名 | |||||
* <li>是否必填 | |||||
* <li>类型 | |||||
* <li>示例值 | |||||
* <li>描述 | |||||
* </pre> | |||||
* Created by Binary Wang on 2016/10/02. | |||||
* @author binarywang (https://github.com/binarywang) | |||||
*/ | |||||
@XStreamAlias("xml") | |||||
public class WxEntPayRequest { | |||||
/** | |||||
* <pre> | |||||
* 公众账号appid | |||||
* mch_appid | |||||
* 是 | |||||
* wx8888888888888888 | |||||
* String | |||||
* 微信分配的公众账号ID(企业号corpid即为此appId) | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("mch_appid") | |||||
private String mchAppid; | |||||
/** | |||||
* <pre> | |||||
* 商户号 | |||||
* mchid | |||||
* 是 | |||||
* 1900000109 | |||||
* String(32) | |||||
* 微信支付分配的商户号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("mchid") | |||||
private String mchId; | |||||
/** | |||||
* <pre> | |||||
* 设备号 | |||||
* device_info | |||||
* 否 | |||||
* 13467007045764 | |||||
* String(32) | |||||
*微信支付分配的终端设备号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("device_info") | |||||
private String deviceInfo; | |||||
/** | |||||
* <pre> | |||||
* 随机字符串 | |||||
* nonce_str | |||||
*是 | |||||
*5K8264ILTKCH16CQ2502SI8ZNMTM67VS | |||||
*String(32) | |||||
*随机字符串,不长于32位 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("nonce_str") | |||||
private String nonceStr; | |||||
/** | |||||
* <pre> | |||||
* 签名 | |||||
* sign | |||||
* 是 | |||||
* C380BEC2BFD727A4B6845133519F3AD6 | |||||
* String(32) | |||||
*签名,详见签名算法 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("sign") | |||||
private String sign; | |||||
/** | |||||
* <pre> | |||||
* 商户订单号 | |||||
* partner_trade_no | |||||
* 是 | |||||
* 10000098201411111234567890 | |||||
* String | |||||
* 商户订单号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("partner_trade_no") | |||||
private String partnerTradeNo; | |||||
/** | |||||
* <pre> | |||||
* 需保持唯一性 用户openid | |||||
* openid | |||||
* 是 | |||||
* oxTWIuGaIt6gTKsQRLau2M0yL16E | |||||
* String | |||||
* 商户appid下,某用户的openid | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("openid") | |||||
private String openid; | |||||
/** | |||||
* <pre> | |||||
* 校验用户姓名选项 | |||||
* check_name | |||||
* 是 | |||||
* OPTION_CHECK | |||||
* String | |||||
* NO_CHECK:不校验真实姓名 | |||||
* FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账) | |||||
* OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功) | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("check_name") | |||||
private String checkName; | |||||
/** | |||||
* <pre> | |||||
* 收款用户姓名 | |||||
* re_user_name | |||||
* 可选 | |||||
* 马花花 | |||||
* String | |||||
* 收款用户真实姓名。 | |||||
* 如果check_name设置为FORCE_CHECK或OPTION_CHECK, 则必填用户真实姓名 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("re_user_name") | |||||
private String reUserName; | |||||
/** | |||||
* <pre> | |||||
* 金额 | |||||
* amount | |||||
* 是 | |||||
* 10099 | |||||
* int | |||||
* 企业付款金额, 单位为分 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("amount") | |||||
private Integer amount; | |||||
/** | |||||
* <pre> | |||||
* 企业付款描述信息 | |||||
* desc | |||||
* 是 | |||||
* 理赔 | |||||
* String | |||||
* 企业付款操作说明信息。必填。 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("desc") | |||||
private String description; | |||||
/** | |||||
* <pre> | |||||
* Ip地址 | |||||
* spbill_create_ip | |||||
* 是 | |||||
* 192.168.0.1 | |||||
* String(32) | |||||
* 调用接口的机器Ip地址 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("spbill_create_ip") | |||||
private String spbillCreateIp; | |||||
public String getMchAppid() { | |||||
return mchAppid; | |||||
} | |||||
public void setMchAppid(String mchAppid) { | |||||
this.mchAppid = mchAppid; | |||||
} | |||||
public String getMchId() { | |||||
return mchId; | |||||
} | |||||
public void setMchId(String mchId) { | |||||
this.mchId = mchId; | |||||
} | |||||
public String getDeviceInfo() { | |||||
return deviceInfo; | |||||
} | |||||
public void setDeviceInfo(String deviceInfo) { | |||||
this.deviceInfo = deviceInfo; | |||||
} | |||||
public String getNonceStr() { | |||||
return nonceStr; | |||||
} | |||||
public void setNonceStr(String nonceStr) { | |||||
this.nonceStr = nonceStr; | |||||
} | |||||
public String getSign() { | |||||
return sign; | |||||
} | |||||
public void setSign(String sign) { | |||||
this.sign = sign; | |||||
} | |||||
public String getPartnerTradeNo() { | |||||
return partnerTradeNo; | |||||
} | |||||
public void setPartnerTradeNo(String partnerTradeNo) { | |||||
this.partnerTradeNo = partnerTradeNo; | |||||
} | |||||
public String getOpenid() { | |||||
return openid; | |||||
} | |||||
public void setOpenid(String openid) { | |||||
this.openid = openid; | |||||
} | |||||
public String getCheckName() { | |||||
return checkName; | |||||
} | |||||
public void setCheckName(String checkName) { | |||||
this.checkName = checkName; | |||||
} | |||||
public String getReUserName() { | |||||
return reUserName; | |||||
} | |||||
public void setReUserName(String reUserName) { | |||||
this.reUserName = reUserName; | |||||
} | |||||
public Integer getAmount() { | |||||
return amount; | |||||
} | |||||
public void setAmount(Integer amount) { | |||||
this.amount = amount; | |||||
} | |||||
public String getDescription() { | |||||
return description; | |||||
} | |||||
public void setDescription(String description) { | |||||
this.description = description; | |||||
} | |||||
public String getSpbillCreateIp() { | |||||
return spbillCreateIp; | |||||
} | |||||
public void setSpbillCreateIp(String spbillCreateIp) { | |||||
this.spbillCreateIp = spbillCreateIp; | |||||
} | |||||
@Override | |||||
public String toString() { | |||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||||
} | |||||
} |
@@ -0,0 +1,190 @@ | |||||
package me.chanjar.weixin.mp.bean.pay; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||||
/** | |||||
* 企业付款返回结果 | |||||
* Created by Binary Wang on 2016/10/02. | |||||
* @author binarywang (https://github.com/binarywang) | |||||
*/ | |||||
@XStreamAlias("xml") | |||||
public class WxEntPayResult { | |||||
/** | |||||
* 返回状态码 | |||||
*/ | |||||
@XStreamAlias("return_code") | |||||
private String returnCode; | |||||
/** | |||||
* 返回信息 | |||||
*/ | |||||
@XStreamAlias("return_msg") | |||||
private String returnMsg; | |||||
//############以下字段在return_code为SUCCESS的时候有返回 | |||||
/** | |||||
* 商户appid | |||||
*/ | |||||
@XStreamAlias("mch_appid") | |||||
private String mchAppid; | |||||
/** | |||||
* 商户号 | |||||
*/ | |||||
@XStreamAlias("mchid") | |||||
private String mchId; | |||||
/** | |||||
* 设备号 | |||||
*/ | |||||
@XStreamAlias("device_info") | |||||
private String deviceInfo; | |||||
/** | |||||
* 随机字符串 | |||||
*/ | |||||
@XStreamAlias("nonce_str") | |||||
private String nonceStr; | |||||
/** | |||||
* 业务结果 | |||||
*/ | |||||
@XStreamAlias("result_code") | |||||
private String resultCode; | |||||
/** | |||||
* 错误代码 | |||||
*/ | |||||
@XStreamAlias("err_code") | |||||
private String errCode; | |||||
/** | |||||
* 错误代码描述 | |||||
*/ | |||||
@XStreamAlias("err_code_des") | |||||
private String errCodeDes; | |||||
//############以下字段在return_code 和result_code都为SUCCESS的时候有返回############## | |||||
/** | |||||
* 商户订单号 | |||||
*/ | |||||
@XStreamAlias("partner_trade_no") | |||||
private String partnerTradeNo; | |||||
/** | |||||
* 微信订单号 | |||||
*/ | |||||
@XStreamAlias("payment_no") | |||||
private String paymentNo; | |||||
/** | |||||
* 微信支付成功时间 | |||||
*/ | |||||
@XStreamAlias("payment_time") | |||||
private String paymentTime; | |||||
@Override | |||||
public String toString() { | |||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||||
} | |||||
public String getReturnCode() { | |||||
return returnCode; | |||||
} | |||||
public void setReturnCode(String returnCode) { | |||||
this.returnCode = returnCode; | |||||
} | |||||
public String getReturnMsg() { | |||||
return returnMsg; | |||||
} | |||||
public void setReturnMsg(String returnMsg) { | |||||
this.returnMsg = returnMsg; | |||||
} | |||||
public String getMchAppid() { | |||||
return mchAppid; | |||||
} | |||||
public void setMchAppid(String mchAppid) { | |||||
this.mchAppid = mchAppid; | |||||
} | |||||
public String getMchId() { | |||||
return mchId; | |||||
} | |||||
public void setMchId(String mchId) { | |||||
this.mchId = mchId; | |||||
} | |||||
public String getDeviceInfo() { | |||||
return deviceInfo; | |||||
} | |||||
public void setDeviceInfo(String deviceInfo) { | |||||
this.deviceInfo = deviceInfo; | |||||
} | |||||
public String getNonceStr() { | |||||
return nonceStr; | |||||
} | |||||
public void setNonceStr(String nonceStr) { | |||||
this.nonceStr = nonceStr; | |||||
} | |||||
public String getResultCode() { | |||||
return resultCode; | |||||
} | |||||
public void setResultCode(String resultCode) { | |||||
this.resultCode = resultCode; | |||||
} | |||||
public String getErrCode() { | |||||
return errCode; | |||||
} | |||||
public void setErrCode(String errCode) { | |||||
this.errCode = errCode; | |||||
} | |||||
public String getErrCodeDes() { | |||||
return errCodeDes; | |||||
} | |||||
public void setErrCodeDes(String errCodeDes) { | |||||
this.errCodeDes = errCodeDes; | |||||
} | |||||
public String getPartnerTradeNo() { | |||||
return partnerTradeNo; | |||||
} | |||||
public void setPartnerTradeNo(String partnerTradeNo) { | |||||
this.partnerTradeNo = partnerTradeNo; | |||||
} | |||||
public String getPaymentNo() { | |||||
return paymentNo; | |||||
} | |||||
public void setPaymentNo(String paymentNo) { | |||||
this.paymentNo = paymentNo; | |||||
} | |||||
public String getPaymentTime() { | |||||
return paymentTime; | |||||
} | |||||
public void setPaymentTime(String paymentTime) { | |||||
this.paymentTime = paymentTime; | |||||
} | |||||
} |
@@ -0,0 +1,301 @@ | |||||
package me.chanjar.weixin.mp.bean.pay; | |||||
import com.thoughtworks.xstream.annotations.XStreamAlias; | |||||
import me.chanjar.weixin.common.annotation.Required; | |||||
/** | |||||
* <pre> | |||||
* 微信支付-申请退款请求参数 | |||||
* 注释中各行每个字段描述对应如下: | |||||
* <li>字段名 | |||||
* <li>变量名 | |||||
* <li>是否必填 | |||||
* <li>类型 | |||||
* <li>示例值 | |||||
* <li>描述 | |||||
* </pre> | |||||
* | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-10-08. | |||||
*/ | |||||
@XStreamAlias("xml") | |||||
public class WxMpPayRefundRequest { | |||||
/** | |||||
* <pre> | |||||
* 公众账号ID | |||||
* appid | |||||
* 是 | |||||
* String(32) | |||||
* wx8888888888888888 | |||||
* 微信分配的公众账号ID(企业号corpid即为此appId) | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("appid") | |||||
private String appid; | |||||
/** | |||||
* <pre> | |||||
* 商户号 | |||||
* mch_id | |||||
* 是 | |||||
* String(32) | |||||
* 1900000109 | |||||
* 微信支付分配的商户号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("mch_id") | |||||
private String mchId; | |||||
/** | |||||
* <pre> | |||||
* 设备号 | |||||
* device_info | |||||
* 否 | |||||
* String(32) | |||||
* 13467007045764 | |||||
* 终端设备号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("device_info") | |||||
private String deviceInfo; | |||||
/** | |||||
* <pre> | |||||
* 随机字符串 | |||||
* nonce_str | |||||
* 是 | |||||
* String(32) | |||||
* 5K8264ILTKCH16CQ2502SI8ZNMTM67VS | |||||
* 随机字符串,不长于32位。推荐随机数生成算法 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("nonce_str") | |||||
private String nonceStr; | |||||
/** | |||||
* <pre> | |||||
* 签名 | |||||
* sign | |||||
* 是 | |||||
* String(32) | |||||
* C380BEC2BFD727A4B6845133519F3AD6 | |||||
* 签名,详见签名生成算法 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("sign") | |||||
private String sign; | |||||
/** | |||||
* <pre> | |||||
* 微信订单号 | |||||
* transaction_id | |||||
* 跟out_trade_no二选一 | |||||
* String(28) | |||||
* 1217752501201400000000000000 | |||||
* 微信生成的订单号,在支付通知中有返回 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("transaction_id") | |||||
private String transactionId; | |||||
/** | |||||
* <pre> | |||||
* 商户订单号 | |||||
* out_trade_no | |||||
* 跟transaction_id二选一 | |||||
* String(32) | |||||
* 1217752501201400000000000000 | |||||
* 商户侧传给微信的订单号 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("out_trade_no") | |||||
private String outTradeNo; | |||||
/** | |||||
* <pre> | |||||
* 商户退款单号 | |||||
* out_refund_no | |||||
* 是 | |||||
* String(32) | |||||
* 1217752501201400000000000000 | |||||
* 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔 | |||||
* </pre> | |||||
*/ | |||||
@Required | |||||
@XStreamAlias("out_refund_no") | |||||
private String outRefundNo; | |||||
/** | |||||
* <pre> | |||||
* 订单金额 | |||||
* total_fee | |||||
* 是 | |||||
* Int | |||||
* 100 | |||||
* 订单总金额,单位为分,只能为整数,详见支付金额 | |||||
* </pre> | |||||
*/ | |||||
@Required | |||||
@XStreamAlias("total_fee") | |||||
private Integer totalFee; | |||||
/** | |||||
* <pre> | |||||
* 退款金额 | |||||
* refund_fee | |||||
* 是 | |||||
* Int | |||||
* 100 | |||||
* 退款总金额,订单总金额,单位为分,只能为整数,详见支付金额 | |||||
* </pre> | |||||
*/ | |||||
@Required | |||||
@XStreamAlias("refund_fee") | |||||
private Integer refundFee; | |||||
/** | |||||
* <pre> | |||||
* 货币种类 | |||||
* refund_fee_type | |||||
* 否 | |||||
* String(8) | |||||
* CNY | |||||
* 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("refund_fee_type") | |||||
private String refundFeeType; | |||||
/** | |||||
* <pre> | |||||
* 操作员 | |||||
* op_user_id | |||||
* 是 | |||||
* String(32) | |||||
* 1900000109 | |||||
* 操作员帐号, 默认为商户号 | |||||
* </pre> | |||||
*/ | |||||
//@Required | |||||
@XStreamAlias("op_user_id") | |||||
private String opUserId; | |||||
/** | |||||
* <pre> | |||||
* 退款资金来源 | |||||
* refund_account | |||||
* 否 | |||||
* String(30) | |||||
* REFUND_SOURCE_RECHARGE_FUNDS | |||||
* 仅针对老资金流商户使用, | |||||
* <li>REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款), | |||||
* <li>REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款 | |||||
* </pre> | |||||
*/ | |||||
@XStreamAlias("refund_account") | |||||
private String refundAccount; | |||||
public String getAppid() { | |||||
return appid; | |||||
} | |||||
public void setAppid(String appid) { | |||||
this.appid = appid; | |||||
} | |||||
public String getMchId() { | |||||
return mchId; | |||||
} | |||||
public void setMchId(String mchId) { | |||||
this.mchId = mchId; | |||||
} | |||||
public String getDeviceInfo() { | |||||
return deviceInfo; | |||||
} | |||||
public void setDeviceInfo(String deviceInfo) { | |||||
this.deviceInfo = deviceInfo; | |||||
} | |||||
public String getNonceStr() { | |||||
return nonceStr; | |||||
} | |||||
public void setNonceStr(String nonceStr) { | |||||
this.nonceStr = nonceStr; | |||||
} | |||||
public String getSign() { | |||||
return sign; | |||||
} | |||||
public void setSign(String sign) { | |||||
this.sign = sign; | |||||
} | |||||
public String getTransactionId() { | |||||
return transactionId; | |||||
} | |||||
public void setTransactionId(String transactionId) { | |||||
this.transactionId = transactionId; | |||||
} | |||||
public String getOutTradeNo() { | |||||
return outTradeNo; | |||||
} | |||||
public void setOutTradeNo(String outTradeNo) { | |||||
this.outTradeNo = outTradeNo; | |||||
} | |||||
public String getOutRefundNo() { | |||||
return outRefundNo; | |||||
} | |||||
public void setOutRefundNo(String outRefundNo) { | |||||
this.outRefundNo = outRefundNo; | |||||
} | |||||
public Integer getTotalFee() { | |||||
return totalFee; | |||||
} | |||||
public void setTotalFee(Integer totalFee) { | |||||
this.totalFee = totalFee; | |||||
} | |||||
public Integer getRefundFee() { | |||||
return refundFee; | |||||
} | |||||
public void setRefundFee(Integer refundFee) { | |||||
this.refundFee = refundFee; | |||||
} | |||||
public String getRefundFeeType() { | |||||
return refundFeeType; | |||||
} | |||||
public void setRefundFeeType(String refundFeeType) { | |||||
this.refundFeeType = refundFeeType; | |||||
} | |||||
public String getOpUserId() { | |||||
return opUserId; | |||||
} | |||||
public void setOpUserId(String opUserId) { | |||||
this.opUserId = opUserId; | |||||
} | |||||
public String getRefundAccount() { | |||||
return refundAccount; | |||||
} | |||||
public void setRefundAccount(String refundAccount) { | |||||
this.refundAccount = refundAccount; | |||||
} | |||||
} |
@@ -1,278 +1,279 @@ | |||||
package me.chanjar.weixin.mp.bean.pay; | package me.chanjar.weixin.mp.bean.pay; | ||||
import java.io.Serializable; | |||||
import com.thoughtworks.xstream.annotations.XStreamAlias; | import com.thoughtworks.xstream.annotations.XStreamAlias; | ||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import java.io.Serializable; | |||||
/** | /** | ||||
* <pre> | |||||
* 微信支付-申请退款返回结果 | * 微信支付-申请退款返回结果 | ||||
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4 | * https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4 | ||||
* </pre> | |||||
* @author liukaitj | * @author liukaitj | ||||
* | * | ||||
*/ | */ | ||||
@XStreamAlias("xml") | @XStreamAlias("xml") | ||||
public class WxMpPayRefundResult implements Serializable { | public class WxMpPayRefundResult implements Serializable { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@XStreamAlias("return_code") | @XStreamAlias("return_code") | ||||
private String returnCode; | private String returnCode; | ||||
@XStreamAlias("return_msg") | @XStreamAlias("return_msg") | ||||
private String returnMsg; | private String returnMsg; | ||||
@XStreamAlias("result_code") | @XStreamAlias("result_code") | ||||
private String resultCode; | private String resultCode; | ||||
@XStreamAlias("err_code") | @XStreamAlias("err_code") | ||||
private String errCode; | private String errCode; | ||||
@XStreamAlias("err_code_des") | @XStreamAlias("err_code_des") | ||||
private String errCodeDes; | private String errCodeDes; | ||||
@XStreamAlias("appid") | @XStreamAlias("appid") | ||||
private String appid; | private String appid; | ||||
@XStreamAlias("mch_id") | @XStreamAlias("mch_id") | ||||
private String mchId; | private String mchId; | ||||
@XStreamAlias("device_info") | @XStreamAlias("device_info") | ||||
private String deviceInfo; | private String deviceInfo; | ||||
@XStreamAlias("nonce_str") | @XStreamAlias("nonce_str") | ||||
private String nonceStr; | private String nonceStr; | ||||
@XStreamAlias("sign") | @XStreamAlias("sign") | ||||
private String sign; | private String sign; | ||||
@XStreamAlias("transaction_id") | @XStreamAlias("transaction_id") | ||||
private String transactionId; | private String transactionId; | ||||
@XStreamAlias("out_trade_no") | @XStreamAlias("out_trade_no") | ||||
private String outTradeNo; | private String outTradeNo; | ||||
@XStreamAlias("out_refund_no") | @XStreamAlias("out_refund_no") | ||||
private String outRefundNo; | private String outRefundNo; | ||||
@XStreamAlias("refund_id") | @XStreamAlias("refund_id") | ||||
private String refundId; | private String refundId; | ||||
@XStreamAlias("refund_channel") | @XStreamAlias("refund_channel") | ||||
private String refundChannel; | private String refundChannel; | ||||
@XStreamAlias("refund_fee") | @XStreamAlias("refund_fee") | ||||
private String refundFee; | private String refundFee; | ||||
@XStreamAlias("total_fee") | @XStreamAlias("total_fee") | ||||
private String totalFee; | private String totalFee; | ||||
@XStreamAlias("fee_type") | @XStreamAlias("fee_type") | ||||
private String feeType; | private String feeType; | ||||
@XStreamAlias("cash_fee") | @XStreamAlias("cash_fee") | ||||
private String cashFee; | private String cashFee; | ||||
@XStreamAlias("cash_refund_fee") | @XStreamAlias("cash_refund_fee") | ||||
private String cashRefundfee; | |||||
private String cashRefundFee; | |||||
@XStreamAlias("coupon_refund_fee") | @XStreamAlias("coupon_refund_fee") | ||||
private String couponRefundFee; | private String couponRefundFee; | ||||
@XStreamAlias("coupon_refund_count") | @XStreamAlias("coupon_refund_count") | ||||
private String couponRefundCount; | private String couponRefundCount; | ||||
@XStreamAlias("coupon_refund_id") | @XStreamAlias("coupon_refund_id") | ||||
private String couponRefundId; | private String couponRefundId; | ||||
public String getReturnCode() { | public String getReturnCode() { | ||||
return this.returnCode; | return this.returnCode; | ||||
} | } | ||||
public void setReturnCode(String returnCode) { | public void setReturnCode(String returnCode) { | ||||
this.returnCode = returnCode; | this.returnCode = returnCode; | ||||
} | } | ||||
public String getReturnMsg() { | public String getReturnMsg() { | ||||
return this.returnMsg; | return this.returnMsg; | ||||
} | } | ||||
public void setReturnMsg(String returnMsg) { | public void setReturnMsg(String returnMsg) { | ||||
this.returnMsg = returnMsg; | this.returnMsg = returnMsg; | ||||
} | } | ||||
public String getResultCode() { | public String getResultCode() { | ||||
return this.resultCode; | return this.resultCode; | ||||
} | } | ||||
public void setResultCode(String resultCode) { | public void setResultCode(String resultCode) { | ||||
this.resultCode = resultCode; | this.resultCode = resultCode; | ||||
} | } | ||||
public String getErrCode() { | public String getErrCode() { | ||||
return this.errCode; | return this.errCode; | ||||
} | } | ||||
public void setErrCode(String errCode) { | public void setErrCode(String errCode) { | ||||
this.errCode = errCode; | this.errCode = errCode; | ||||
} | } | ||||
public String getErrCodeDes() { | public String getErrCodeDes() { | ||||
return this.errCodeDes; | return this.errCodeDes; | ||||
} | } | ||||
public void setErrCodeDes(String errCodeDes) { | public void setErrCodeDes(String errCodeDes) { | ||||
this.errCodeDes = errCodeDes; | this.errCodeDes = errCodeDes; | ||||
} | } | ||||
public String getAppid() { | public String getAppid() { | ||||
return this.appid; | return this.appid; | ||||
} | } | ||||
public void setAppid(String appid) { | public void setAppid(String appid) { | ||||
this.appid = appid; | this.appid = appid; | ||||
} | } | ||||
public String getMchId() { | public String getMchId() { | ||||
return this.mchId; | return this.mchId; | ||||
} | } | ||||
public void setMchId(String mchId) { | public void setMchId(String mchId) { | ||||
this.mchId = mchId; | this.mchId = mchId; | ||||
} | } | ||||
public String getDeviceInfo() { | public String getDeviceInfo() { | ||||
return this.deviceInfo; | return this.deviceInfo; | ||||
} | } | ||||
public void setDeviceInfo(String deviceInfo) { | public void setDeviceInfo(String deviceInfo) { | ||||
this.deviceInfo = deviceInfo; | this.deviceInfo = deviceInfo; | ||||
} | } | ||||
public String getNonceStr() { | public String getNonceStr() { | ||||
return this.nonceStr; | return this.nonceStr; | ||||
} | } | ||||
public void setNonceStr(String nonceStr) { | public void setNonceStr(String nonceStr) { | ||||
this.nonceStr = nonceStr; | this.nonceStr = nonceStr; | ||||
} | } | ||||
public String getSign() { | public String getSign() { | ||||
return this.sign; | return this.sign; | ||||
} | } | ||||
public void setSign(String sign) { | public void setSign(String sign) { | ||||
this.sign = sign; | this.sign = sign; | ||||
} | } | ||||
public String getTransactionId() { | public String getTransactionId() { | ||||
return this.transactionId; | return this.transactionId; | ||||
} | } | ||||
public void setTransactionId(String transactionId) { | public void setTransactionId(String transactionId) { | ||||
this.transactionId = transactionId; | this.transactionId = transactionId; | ||||
} | } | ||||
public String getOutTradeNo() { | public String getOutTradeNo() { | ||||
return this.outTradeNo; | return this.outTradeNo; | ||||
} | } | ||||
public void setOutTradeNo(String outTradeNo) { | public void setOutTradeNo(String outTradeNo) { | ||||
this.outTradeNo = outTradeNo; | this.outTradeNo = outTradeNo; | ||||
} | } | ||||
public String getOutRefundNo() { | public String getOutRefundNo() { | ||||
return this.outRefundNo; | return this.outRefundNo; | ||||
} | } | ||||
public void setOutRefundNo(String outRefundNo) { | public void setOutRefundNo(String outRefundNo) { | ||||
this.outRefundNo = outRefundNo; | this.outRefundNo = outRefundNo; | ||||
} | } | ||||
public String getRefundId() { | public String getRefundId() { | ||||
return this.refundId; | return this.refundId; | ||||
} | } | ||||
public void setRefundId(String refundId) { | public void setRefundId(String refundId) { | ||||
this.refundId = refundId; | this.refundId = refundId; | ||||
} | } | ||||
public String getRefundChannel() { | public String getRefundChannel() { | ||||
return this.refundChannel; | return this.refundChannel; | ||||
} | } | ||||
public void setRefundChannel(String refundChannel) { | public void setRefundChannel(String refundChannel) { | ||||
this.refundChannel = refundChannel; | this.refundChannel = refundChannel; | ||||
} | } | ||||
public String getRefundFee() { | public String getRefundFee() { | ||||
return this.refundFee; | return this.refundFee; | ||||
} | } | ||||
public void setRefundFee(String refundFee) { | public void setRefundFee(String refundFee) { | ||||
this.refundFee = refundFee; | this.refundFee = refundFee; | ||||
} | } | ||||
public String getTotalFee() { | public String getTotalFee() { | ||||
return this.totalFee; | return this.totalFee; | ||||
} | } | ||||
public void setTotalFee(String totalFee) { | public void setTotalFee(String totalFee) { | ||||
this.totalFee = totalFee; | this.totalFee = totalFee; | ||||
} | } | ||||
public String getFeeType() { | public String getFeeType() { | ||||
return this.feeType; | return this.feeType; | ||||
} | } | ||||
public void setFeeType(String feeType) { | public void setFeeType(String feeType) { | ||||
this.feeType = feeType; | this.feeType = feeType; | ||||
} | } | ||||
public String getCashFee() { | public String getCashFee() { | ||||
return this.cashFee; | return this.cashFee; | ||||
} | } | ||||
public void setCashFee(String cashFee) { | public void setCashFee(String cashFee) { | ||||
this.cashFee = cashFee; | this.cashFee = cashFee; | ||||
} | } | ||||
public String getCashRefundfee() { | |||||
return this.cashRefundfee; | |||||
public String getCashRefundFee() { | |||||
return this.cashRefundFee; | |||||
} | } | ||||
public void setCashRefundfee(String cashRefundfee) { | |||||
this.cashRefundfee = cashRefundfee; | |||||
public void setCashRefundFee(String cashRefundFee) { | |||||
this.cashRefundFee = cashRefundFee; | |||||
} | } | ||||
public String getCouponRefundFee() { | public String getCouponRefundFee() { | ||||
return this.couponRefundFee; | return this.couponRefundFee; | ||||
} | } | ||||
public void setCouponRefundFee(String couponRefundFee) { | public void setCouponRefundFee(String couponRefundFee) { | ||||
this.couponRefundFee = couponRefundFee; | this.couponRefundFee = couponRefundFee; | ||||
} | } | ||||
public String getCouponRefundCount() { | public String getCouponRefundCount() { | ||||
return this.couponRefundCount; | return this.couponRefundCount; | ||||
} | } | ||||
public void setCouponRefundCount(String couponRefundCount) { | public void setCouponRefundCount(String couponRefundCount) { | ||||
this.couponRefundCount = couponRefundCount; | this.couponRefundCount = couponRefundCount; | ||||
} | } | ||||
public String getCouponRefundId() { | public String getCouponRefundId() { | ||||
return this.couponRefundId; | return this.couponRefundId; | ||||
} | } | ||||
public void setCouponRefundId(String couponRefundId) { | public void setCouponRefundId(String couponRefundId) { | ||||
this.couponRefundId = couponRefundId; | this.couponRefundId = couponRefundId; | ||||
} | } | ||||
@Override | @Override | ||||
public String toString() { | public String toString() { | ||||
return "[" + | |||||
"return_code:" + this.returnCode + ";" + | |||||
"return_msg" + this.returnMsg + ";"; | |||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | |||||
} | } | ||||
} | } |
@@ -1,124 +0,0 @@ | |||||
package me.chanjar.weixin.mp.bean.pay; | |||||
import java.io.Serializable; | |||||
/** | |||||
* <pre> | |||||
* 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"返回的结果 | |||||
* 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1) | |||||
* </pre> | |||||
* | |||||
* @author chanjarster | |||||
*/ | |||||
@Deprecated | |||||
public class WxMpPrepayIdResult implements Serializable { | |||||
private static final long serialVersionUID = -8970574397788396143L; | |||||
private String return_code; | |||||
private String return_msg; | |||||
private String appid; | |||||
private String mch_id; | |||||
private String nonce_str; | |||||
private String sign; | |||||
private String result_code; | |||||
private String prepay_id; | |||||
private String trade_type; | |||||
private String err_code; | |||||
private String err_code_des; | |||||
private String code_url; | |||||
public String getReturn_code() { | |||||
return this.return_code; | |||||
} | |||||
public void setReturn_code(String return_code) { | |||||
this.return_code = return_code; | |||||
} | |||||
public String getReturn_msg() { | |||||
return this.return_msg; | |||||
} | |||||
public void setReturn_msg(String return_msg) { | |||||
this.return_msg = return_msg; | |||||
} | |||||
public String getAppid() { | |||||
return this.appid; | |||||
} | |||||
public void setAppid(String appid) { | |||||
this.appid = appid; | |||||
} | |||||
public String getMch_id() { | |||||
return this.mch_id; | |||||
} | |||||
public void setMch_id(String mch_id) { | |||||
this.mch_id = mch_id; | |||||
} | |||||
public String getNonce_str() { | |||||
return this.nonce_str; | |||||
} | |||||
public void setNonce_str(String nonce_str) { | |||||
this.nonce_str = nonce_str; | |||||
} | |||||
public String getSign() { | |||||
return this.sign; | |||||
} | |||||
public void setSign(String sign) { | |||||
this.sign = sign; | |||||
} | |||||
public String getResult_code() { | |||||
return this.result_code; | |||||
} | |||||
public void setResult_code(String result_code) { | |||||
this.result_code = result_code; | |||||
} | |||||
public String getPrepay_id() { | |||||
return this.prepay_id; | |||||
} | |||||
public void setPrepay_id(String prepay_id) { | |||||
this.prepay_id = prepay_id; | |||||
} | |||||
public String getTrade_type() { | |||||
return this.trade_type; | |||||
} | |||||
public void setTrade_type(String trade_type) { | |||||
this.trade_type = trade_type; | |||||
} | |||||
public String getErr_code() { | |||||
return this.err_code; | |||||
} | |||||
public void setErr_code(String err_code) { | |||||
this.err_code = err_code; | |||||
} | |||||
public String getErr_code_des() { | |||||
return this.err_code_des; | |||||
} | |||||
public void setErr_code_des(String err_code_des) { | |||||
this.err_code_des = err_code_des; | |||||
} | |||||
public String getCode_url() { | |||||
return this.code_url; | |||||
} | |||||
public void setCode_url(String code_url) { | |||||
this.code_url = code_url; | |||||
} | |||||
} |
@@ -11,7 +11,7 @@ import me.chanjar.weixin.common.annotation.Required; | |||||
* <pre> | * <pre> | ||||
* 统一下单请求参数对象 | * 统一下单请求参数对象 | ||||
* 参考文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1 | * 参考文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1 | ||||
* 每个字段描述对应如下: | |||||
* 注释中各行每个字段描述对应如下: | |||||
* <li>字段名 | * <li>字段名 | ||||
* <li>变量名 | * <li>变量名 | ||||
* <li>是否必填 | * <li>是否必填 | ||||
@@ -121,6 +121,9 @@ public class WxMpUser implements Serializable { | |||||
this.subscribeTime = subscribeTime; | this.subscribeTime = subscribeTime; | ||||
} | } | ||||
/** | |||||
*只有在将公众号绑定到微信开放平台帐号后,才会出现该字段。 | |||||
*/ | |||||
public String getUnionId() { | public String getUnionId() { | ||||
return this.unionId; | return this.unionId; | ||||
} | } | ||||
@@ -1,21 +1,19 @@ | |||||
package me.chanjar.weixin.mp.bean.store; | package me.chanjar.weixin.mp.bean.store; | ||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import com.google.gson.JsonElement; | import com.google.gson.JsonElement; | ||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import com.google.gson.annotations.SerializedName; | import com.google.gson.annotations.SerializedName; | ||||
import me.chanjar.weixin.common.annotation.Required; | import me.chanjar.weixin.common.annotation.Required; | ||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | ||||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
import org.apache.commons.lang3.builder.ToStringStyle; | |||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
/** | /** | ||||
* 门店基础信息 | * 门店基础信息 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-09-23. | * Created by Binary Wang on 2016-09-23. | ||||
*/ | */ | ||||
public class WxMpStoreBaseInfo { | public class WxMpStoreBaseInfo { | ||||
@@ -24,6 +22,10 @@ public class WxMpStoreBaseInfo { | |||||
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE); | ||||
} | } | ||||
public static WxMpStoreBaseInfo fromJson(String json) { | |||||
return WxMpGsonBuilder.create().fromJson(json, WxMpStoreBaseInfo.class); | |||||
} | |||||
public String toJson() { | public String toJson() { | ||||
JsonElement base_info = WxMpGsonBuilder.create().toJsonTree(this); | JsonElement base_info = WxMpGsonBuilder.create().toJsonTree(this); | ||||
JsonObject jsonObject = new JsonObject(); | JsonObject jsonObject = new JsonObject(); | ||||
@@ -22,4 +22,4 @@ public class WxMpStoreInfo { | |||||
this.baseInfo = baseInfo; | this.baseInfo = baseInfo; | ||||
} | } | ||||
} | |||||
} |
@@ -11,7 +11,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 门店列表结果类 | * 门店列表结果类 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-09-27. | * Created by Binary Wang on 2016-09-27. | ||||
* | * | ||||
*/ | */ | ||||
@@ -1,15 +1,17 @@ | |||||
package me.chanjar.weixin.mp.bean.tag; | package me.chanjar.weixin.mp.bean.tag; | ||||
import com.google.gson.annotations.SerializedName; | |||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
import java.util.List; | |||||
import org.apache.commons.lang3.builder.ToStringBuilder; | import org.apache.commons.lang3.builder.ToStringBuilder; | ||||
import org.apache.commons.lang3.builder.ToStringStyle; | import org.apache.commons.lang3.builder.ToStringStyle; | ||||
import java.util.List; | |||||
import com.google.gson.annotations.SerializedName; | |||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 获取标签下粉丝列表的结果对象 | * 获取标签下粉丝列表的结果对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-09-19. | * Created by Binary Wang on 2016-09-19. | ||||
*/ | */ | ||||
public class WxTagListUser { | public class WxTagListUser { | ||||
@@ -46,7 +48,7 @@ public class WxTagListUser { | |||||
private String nextOpenid; | private String nextOpenid; | ||||
public Integer getCount() { | public Integer getCount() { | ||||
return count; | |||||
return this.count; | |||||
} | } | ||||
public void setCount(Integer count) { | public void setCount(Integer count) { | ||||
@@ -54,7 +56,7 @@ public class WxTagListUser { | |||||
} | } | ||||
public WxTagListUserData getData() { | public WxTagListUserData getData() { | ||||
return data; | |||||
return this.data; | |||||
} | } | ||||
public void setData(WxTagListUserData data) { | public void setData(WxTagListUserData data) { | ||||
@@ -62,7 +64,7 @@ public class WxTagListUser { | |||||
} | } | ||||
public String getNextOpenid() { | public String getNextOpenid() { | ||||
return nextOpenid; | |||||
return this.nextOpenid; | |||||
} | } | ||||
public void setNextOpenid(String nextOpenid) { | public void setNextOpenid(String nextOpenid) { | ||||
@@ -82,7 +84,7 @@ public class WxTagListUser { | |||||
private List<String> openidList; | private List<String> openidList; | ||||
public List<String> getOpenidList() { | public List<String> getOpenidList() { | ||||
return openidList; | |||||
return this.openidList; | |||||
} | } | ||||
public void setOpenidList(List<String> openidList) { | public void setOpenidList(List<String> openidList) { | ||||
@@ -12,14 +12,14 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder; | |||||
/** | /** | ||||
* 用户标签对象 | * 用户标签对象 | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/9/2. | * Created by Binary Wang on 2016/9/2. | ||||
*/ | */ | ||||
public class WxUserTag { | public class WxUserTag { | ||||
/** | /** | ||||
* id 标签id,由微信分配 | * id 标签id,由微信分配 | ||||
*/ | */ | ||||
private Integer id; | |||||
private Long id; | |||||
/** | /** | ||||
* name 标签名,UTF8编码 | * name 标签名,UTF8编码 | ||||
@@ -47,11 +47,11 @@ public class WxUserTag { | |||||
this.count = count; | this.count = count; | ||||
} | } | ||||
public Integer getId() { | |||||
public Long getId() { | |||||
return this.id; | return this.id; | ||||
} | } | ||||
public void setId(Integer id) { | |||||
public void setId(Long id) { | |||||
this.id = id; | this.id = id; | ||||
} | } | ||||
@@ -1,49 +0,0 @@ | |||||
/* | |||||
* KINGSTAR MEDIA SOLUTIONS Co.,LTD. Copyright c 2005-2013. All rights reserved. | |||||
* | |||||
* This source code is the property of KINGSTAR MEDIA SOLUTIONS LTD. It is intended | |||||
* only for the use of KINGSTAR MEDIA application development. Reengineering, reproduction | |||||
* arose from modification of the original source, or other redistribution of this source | |||||
* is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD. | |||||
*/ | |||||
package me.chanjar.weixin.mp.util.json; | |||||
import com.google.gson.*; | |||||
import me.chanjar.weixin.common.util.json.GsonHelper; | |||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | |||||
import java.lang.reflect.Type; | |||||
public class WxMpGroupGsonAdapter implements JsonSerializer<WxMpGroup>, JsonDeserializer<WxMpGroup> { | |||||
@Override | |||||
public JsonElement serialize(WxMpGroup group, Type typeOfSrc, JsonSerializationContext context) { | |||||
JsonObject json = new JsonObject(); | |||||
JsonObject groupJson = new JsonObject(); | |||||
groupJson.addProperty("name", group.getName()); | |||||
groupJson.addProperty("id", group.getId()); | |||||
groupJson.addProperty("count", group.getCount()); | |||||
json.add("group", groupJson); | |||||
return json; | |||||
} | |||||
@Override | |||||
public WxMpGroup deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { | |||||
WxMpGroup group = new WxMpGroup(); | |||||
JsonObject groupJson = json.getAsJsonObject(); | |||||
if (json.getAsJsonObject().get("group") != null) { | |||||
groupJson = json.getAsJsonObject().get("group").getAsJsonObject(); | |||||
} | |||||
if (groupJson.get("name") != null && !groupJson.get("name").isJsonNull()) { | |||||
group.setName(GsonHelper.getAsString(groupJson.get("name"))); | |||||
} | |||||
if (groupJson.get("id") != null && !groupJson.get("id").isJsonNull()) { | |||||
group.setId(GsonHelper.getAsPrimitiveLong(groupJson.get("id"))); | |||||
} | |||||
if (groupJson.get("count") != null && !groupJson.get("count").isJsonNull()) { | |||||
group.setCount(GsonHelper.getAsPrimitiveLong(groupJson.get("count"))); | |||||
} | |||||
return group; | |||||
} | |||||
} |
@@ -2,10 +2,35 @@ package me.chanjar.weixin.mp.util.json; | |||||
import com.google.gson.Gson; | import com.google.gson.Gson; | ||||
import com.google.gson.GsonBuilder; | import com.google.gson.GsonBuilder; | ||||
import me.chanjar.weixin.mp.bean.*; | |||||
import me.chanjar.weixin.mp.bean.WxMpCard; | |||||
import me.chanjar.weixin.mp.bean.WxMpCustomMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpIndustry; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassNews; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo; | |||||
import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate; | |||||
import me.chanjar.weixin.mp.bean.WxMpMaterialNews; | |||||
import me.chanjar.weixin.mp.bean.WxMpTemplateMessage; | |||||
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate; | ||||
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary; | ||||
import me.chanjar.weixin.mp.bean.result.*; | |||||
import me.chanjar.weixin.mp.bean.result.WxMediaImgUploadResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpCardResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialCountResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialFileBatchGetResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialNewsBatchGetResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialUploadResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpMaterialVideoInfoResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpUser; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult; | |||||
import me.chanjar.weixin.mp.bean.result.WxMpUserList; | |||||
public class WxMpGsonBuilder { | public class WxMpGsonBuilder { | ||||
@@ -15,9 +40,8 @@ public class WxMpGsonBuilder { | |||||
INSTANCE.disableHtmlEscaping(); | INSTANCE.disableHtmlEscaping(); | ||||
INSTANCE.registerTypeAdapter(WxMpCustomMessage.class, new WxMpCustomMessageGsonAdapter()); | INSTANCE.registerTypeAdapter(WxMpCustomMessage.class, new WxMpCustomMessageGsonAdapter()); | ||||
INSTANCE.registerTypeAdapter(WxMpMassNews.class, new WxMpMassNewsGsonAdapter()); | INSTANCE.registerTypeAdapter(WxMpMassNews.class, new WxMpMassNewsGsonAdapter()); | ||||
INSTANCE.registerTypeAdapter(WxMpMassGroupMessage.class, new WxMpMassGroupMessageGsonAdapter()); | |||||
INSTANCE.registerTypeAdapter(WxMpMassTagMessage.class, new WxMpMassTagMessageGsonAdapter()); | |||||
INSTANCE.registerTypeAdapter(WxMpMassOpenIdsMessage.class, new WxMpMassOpenIdsMessageGsonAdapter()); | INSTANCE.registerTypeAdapter(WxMpMassOpenIdsMessage.class, new WxMpMassOpenIdsMessageGsonAdapter()); | ||||
INSTANCE.registerTypeAdapter(WxMpGroup.class, new WxMpGroupGsonAdapter()); | |||||
INSTANCE.registerTypeAdapter(WxMpUser.class, new WxMpUserGsonAdapter()); | INSTANCE.registerTypeAdapter(WxMpUser.class, new WxMpUserGsonAdapter()); | ||||
INSTANCE.registerTypeAdapter(WxMpUserList.class, new WxUserListGsonAdapter()); | INSTANCE.registerTypeAdapter(WxMpUserList.class, new WxUserListGsonAdapter()); | ||||
INSTANCE.registerTypeAdapter(WxMpMassVideo.class, new WxMpMassVideoAdapter()); | INSTANCE.registerTypeAdapter(WxMpMassVideo.class, new WxMpMassVideoAdapter()); | ||||
@@ -8,27 +8,28 @@ | |||||
*/ | */ | ||||
package me.chanjar.weixin.mp.util.json; | package me.chanjar.weixin.mp.util.json; | ||||
import java.lang.reflect.Type; | |||||
import com.google.gson.JsonElement; | import com.google.gson.JsonElement; | ||||
import com.google.gson.JsonObject; | import com.google.gson.JsonObject; | ||||
import com.google.gson.JsonSerializationContext; | import com.google.gson.JsonSerializationContext; | ||||
import com.google.gson.JsonSerializer; | import com.google.gson.JsonSerializer; | ||||
import me.chanjar.weixin.common.api.WxConsts; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | |||||
import java.lang.reflect.Type; | |||||
import me.chanjar.weixin.common.api.WxConsts; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage; | |||||
public class WxMpMassGroupMessageGsonAdapter implements JsonSerializer<WxMpMassGroupMessage> { | |||||
public class WxMpMassTagMessageGsonAdapter implements JsonSerializer<WxMpMassTagMessage> { | |||||
@Override | @Override | ||||
public JsonElement serialize(WxMpMassGroupMessage message, Type typeOfSrc, JsonSerializationContext context) { | |||||
public JsonElement serialize(WxMpMassTagMessage message, Type typeOfSrc, JsonSerializationContext context) { | |||||
JsonObject messageJson = new JsonObject(); | JsonObject messageJson = new JsonObject(); | ||||
JsonObject filter = new JsonObject(); | JsonObject filter = new JsonObject(); | ||||
if(null == message.getGroupId()) { | |||||
if(null == message.getTagId()) { | |||||
filter.addProperty("is_to_all", true); | filter.addProperty("is_to_all", true); | ||||
} else { | } else { | ||||
filter.addProperty("is_to_all", false); | filter.addProperty("is_to_all", false); | ||||
filter.addProperty("group_id", message.getGroupId()); | |||||
filter.addProperty("tag_id", message.getTagId()); | |||||
} | } | ||||
messageJson.add("filter", filter); | messageJson.add("filter", filter); | ||||
@@ -14,9 +14,9 @@ import me.chanjar.weixin.common.api.WxConsts; | |||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassNews; | import me.chanjar.weixin.mp.bean.WxMpMassNews; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage; | ||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage; | |||||
import me.chanjar.weixin.mp.bean.WxMpMassVideo; | import me.chanjar.weixin.mp.bean.WxMpMassVideo; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; | import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; | ||||
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult; | import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult; | ||||
@@ -68,11 +68,11 @@ public class WxMpMassMessageAPITest { | |||||
@Test | @Test | ||||
public void testTextMassGroupMessageSend() throws WxErrorException { | public void testTextMassGroupMessageSend() throws WxErrorException { | ||||
WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage(); | |||||
WxMpMassTagMessage massMessage = new WxMpMassTagMessage(); | |||||
massMessage.setMsgtype(WxConsts.MASS_MSG_TEXT); | massMessage.setMsgtype(WxConsts.MASS_MSG_TEXT); | ||||
massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>"); | massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>"); | ||||
massMessage | massMessage | ||||
.setGroupId(this.wxService.getGroupService().groupGet().get(0).getId()); | |||||
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId()); | |||||
WxMpMassSendResult massResult = this.wxService | WxMpMassSendResult massResult = this.wxService | ||||
.massGroupMessageSend(massMessage); | .massGroupMessageSend(massMessage); | ||||
@@ -83,11 +83,11 @@ public class WxMpMassMessageAPITest { | |||||
@Test(dataProvider="massMessages") | @Test(dataProvider="massMessages") | ||||
public void testMediaMassGroupMessageSend(String massMsgType, String mediaId) | public void testMediaMassGroupMessageSend(String massMsgType, String mediaId) | ||||
throws WxErrorException { | throws WxErrorException { | ||||
WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage(); | |||||
WxMpMassTagMessage massMessage = new WxMpMassTagMessage(); | |||||
massMessage.setMsgtype(massMsgType); | massMessage.setMsgtype(massMsgType); | ||||
massMessage.setMediaId(mediaId); | massMessage.setMediaId(mediaId); | ||||
massMessage | massMessage | ||||
.setGroupId(this.wxService.getGroupService().groupGet().get(0).getId()); | |||||
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId()); | |||||
WxMpMassSendResult massResult = this.wxService | WxMpMassSendResult massResult = this.wxService | ||||
.massGroupMessageSend(massMessage); | .massGroupMessageSend(massMessage); | ||||
@@ -195,7 +195,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(false).handler(new WxSessionMessageHandler()).end(); | .rule().async(false).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -215,7 +215,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(true).handler(new WxSessionMessageHandler()).end(); | .rule().async(true).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -229,7 +229,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(false).handler(new WxSessionMessageHandler()).end(); | .rule().async(false).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -249,7 +249,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(true).handler(new WxSessionMessageHandler()).end(); | .rule().async(true).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -268,7 +268,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(false).handler(new WxSessionMessageHandler()).end(); | .rule().async(false).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -282,7 +282,7 @@ public class WxMpMessageRouterTest { | |||||
.rule().async(true).handler(new WxSessionMessageHandler()).end(); | .rule().async(true).handler(new WxSessionMessageHandler()).end(); | ||||
WxMpXmlMessage msg = new WxMpXmlMessage(); | WxMpXmlMessage msg = new WxMpXmlMessage(); | ||||
msg.setFromUserName("abc"); | |||||
msg.setFromUser("abc"); | |||||
router.route(msg); | router.route(msg); | ||||
Thread.sleep(2000l); | Thread.sleep(2000l); | ||||
@@ -295,7 +295,7 @@ public class WxMpMessageRouterTest { | |||||
@Override | @Override | ||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService, | public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService, | ||||
WxSessionManager sessionManager) { | WxSessionManager sessionManager) { | ||||
sessionManager.getSession(wxMessage.getFromUserName()); | |||||
sessionManager.getSession(wxMessage.getFromUser()); | |||||
return null; | return null; | ||||
} | } | ||||
@@ -1,62 +0,0 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | |||||
import com.google.inject.Inject; | |||||
import me.chanjar.weixin.common.exception.WxErrorException; | |||||
import me.chanjar.weixin.mp.api.ApiTestModule; | |||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage; | |||||
import me.chanjar.weixin.mp.bean.WxMpGroup; | |||||
import org.testng.Assert; | |||||
import org.testng.annotations.Guice; | |||||
import org.testng.annotations.Test; | |||||
import java.util.List; | |||||
/** | |||||
* 测试分组接口 | |||||
* | |||||
* @author chanjarster | |||||
*/ | |||||
@Deprecated | |||||
@Test(groups = "groupAPI") | |||||
@Guice(modules = ApiTestModule.class) | |||||
public class WxMpGroupServiceImplTest { | |||||
@Inject | |||||
protected WxMpServiceImpl wxService; | |||||
protected WxMpGroup group; | |||||
public void testGroupCreate() throws WxErrorException { | |||||
WxMpGroup res = this.wxService.getGroupService().groupCreate("测试分组1"); | |||||
Assert.assertEquals(res.getName(), "测试分组1"); | |||||
} | |||||
@Test(dependsOnMethods="testGroupCreate") | |||||
public void testGroupGet() throws WxErrorException { | |||||
List<WxMpGroup> groupList = this.wxService.getGroupService().groupGet(); | |||||
Assert.assertNotNull(groupList); | |||||
Assert.assertTrue(groupList.size() > 0); | |||||
for (WxMpGroup g : groupList) { | |||||
this.group = g; | |||||
Assert.assertNotNull(g.getName()); | |||||
} | |||||
} | |||||
@Test(dependsOnMethods={"testGroupGet", "testGroupCreate"}) | |||||
public void getGroupUpdate() throws WxErrorException { | |||||
this.group.setName("分组改名"); | |||||
this.wxService.getGroupService().groupUpdate(this.group); | |||||
} | |||||
public void testGroupQueryUserGroup() throws WxErrorException { | |||||
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage(); | |||||
long groupid = this.wxService.getGroupService().userGetGroup(configStorage.getOpenid()); | |||||
Assert.assertTrue(groupid != -1l); | |||||
} | |||||
public void testGroupMoveUser() throws WxErrorException { | |||||
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage(); | |||||
this.wxService.getGroupService().userUpdateGroup(configStorage.getOpenid(), this.wxService.getGroupService().groupGet().get(3).getId()); | |||||
} | |||||
} |
@@ -1,17 +1,14 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import org.testng.annotations.Guice; | |||||
import org.testng.annotations.Test; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage; | import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage; | ||||
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult; | |||||
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest; | |||||
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderResult; | |||||
import me.chanjar.weixin.mp.bean.pay.*; | |||||
import org.testng.annotations.Guice; | |||||
import org.testng.annotations.Test; | |||||
import java.io.File; | |||||
/** | /** | ||||
* 测试支付相关接口 | * 测试支付相关接口 | ||||
@@ -25,21 +22,6 @@ public class WxMpPayServiceImplTest { | |||||
@Inject | @Inject | ||||
protected WxMpServiceImpl wxService; | protected WxMpServiceImpl wxService; | ||||
@Test | |||||
public void testGetPrepayId() throws Exception { | |||||
} | |||||
@Test | |||||
public void testGetJsapiPayInfo() throws Exception { | |||||
} | |||||
@Test | |||||
public void testGetNativePayInfo() throws Exception { | |||||
} | |||||
@Test | @Test | ||||
public void testGetPayInfo() throws Exception { | public void testGetPayInfo() throws Exception { | ||||
@@ -56,8 +38,15 @@ public class WxMpPayServiceImplTest { | |||||
} | } | ||||
@Test | @Test | ||||
public void testRefundPay() throws Exception { | |||||
public void testRefund() throws Exception { | |||||
WxMpPayRefundRequest request = new WxMpPayRefundRequest(); | |||||
request.setOutRefundNo("aaa"); | |||||
request.setOutTradeNo("1111"); | |||||
request.setTotalFee(1222); | |||||
request.setRefundFee(111); | |||||
File keyFile = new File("E:\\dlt.p12"); | |||||
WxMpPayRefundResult result = this.wxService.getPayService().refund(request, keyFile); | |||||
System.err.println(result); | |||||
} | } | ||||
@Test | @Test | ||||
@@ -73,13 +62,14 @@ public class WxMpPayServiceImplTest { | |||||
request.setMchBillno("aaaa"); | request.setMchBillno("aaaa"); | ||||
request | request | ||||
.setReOpenid(((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()); | .setReOpenid(((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()); | ||||
WxRedpackResult redpackResult = this.wxService.getPayService().sendRedpack(request); | |||||
File keyFile = new File("E:\\dlt.p12"); | |||||
WxRedpackResult redpackResult = this.wxService.getPayService().sendRedpack(request, keyFile); | |||||
System.err.println(redpackResult); | System.err.println(redpackResult); | ||||
} | } | ||||
/** | /** | ||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest)}. | * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest)}. | ||||
* @throws WxErrorException | |||||
* @throws WxErrorException | |||||
*/ | */ | ||||
@Test | @Test | ||||
public void testUnifiedOrder() throws WxErrorException { | public void testUnifiedOrder() throws WxErrorException { | ||||
@@ -89,4 +79,16 @@ public class WxMpPayServiceImplTest { | |||||
.tradeType("JSAPI").openid("122").outTradeNo("111111").build()); | .tradeType("JSAPI").openid("122").outTradeNo("111111").build()); | ||||
System.err.println(result); | System.err.println(result); | ||||
} | } | ||||
} | |||||
/** | |||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#entPay(WxEntPayRequest, File)}. | |||||
* @throws WxErrorException | |||||
*/ | |||||
@Test | |||||
public final void testEntPay() throws WxErrorException { | |||||
File keyFile = new File("E:\\dlt.p12"); | |||||
WxEntPayRequest request = new WxEntPayRequest(); | |||||
System.err.println(this.wxService.getPayService().entPay(request, keyFile)); | |||||
} | |||||
} |
@@ -1,23 +1,22 @@ | |||||
package me.chanjar.weixin.mp.api.impl; | package me.chanjar.weixin.mp.api.impl; | ||||
import static org.junit.Assert.assertNotNull; | |||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
import org.testng.annotations.Guice; | |||||
import org.testng.annotations.Test; | |||||
import com.google.inject.Inject; | import com.google.inject.Inject; | ||||
import me.chanjar.weixin.common.exception.WxErrorException; | import me.chanjar.weixin.common.exception.WxErrorException; | ||||
import me.chanjar.weixin.mp.api.ApiTestModule; | import me.chanjar.weixin.mp.api.ApiTestModule; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo; | ||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult; | ||||
import org.testng.annotations.Guice; | |||||
import org.testng.annotations.Test; | |||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
import static org.junit.Assert.assertNotNull; | |||||
/** | /** | ||||
* @author 王彬 (Binary Wang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016-09-23. | |||||
* | * | ||||
*/ | */ | ||||
@Test | @Test | ||||
@@ -28,18 +27,41 @@ public class WxMpStoreServiceImplTest { | |||||
/** | /** | ||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpStoreServiceImpl#add(me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo)}. | * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpStoreServiceImpl#add(me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo)}. | ||||
* @throws WxErrorException | |||||
* @throws WxErrorException | |||||
*/ | */ | ||||
public void testAdd() throws WxErrorException { | public void testAdd() throws WxErrorException { | ||||
this.wxMpService.getStoreService() | this.wxMpService.getStoreService() | ||||
.add(WxMpStoreBaseInfo.builder().businessName("haha").branchName("abc") | .add(WxMpStoreBaseInfo.builder().businessName("haha").branchName("abc") | ||||
.province("aaa").district("aaa").telephone("122").address("abc") | |||||
.categories(new String[] { "美食,江浙菜" }) | |||||
.province("aaa").district("aaa").telephone("122").address("abc").categories(new String[] { "美食,江浙菜" }) | |||||
.longitude(new BigDecimal("115.32375")) | .longitude(new BigDecimal("115.32375")) | ||||
.latitude(new BigDecimal("25.097486")).city("aaa").offsetType(1) | .latitude(new BigDecimal("25.097486")).city("aaa").offsetType(1) | ||||
.build()); | .build()); | ||||
} | } | ||||
public void testUpdate() throws WxErrorException { | |||||
this.wxMpService.getStoreService() | |||||
.update(WxMpStoreBaseInfo.builder().poiId("291503654").telephone("020-12345678") | |||||
.sid("aaa").avgPrice(35).openTime("8:00-20:00").special("免费wifi,外卖服务") | |||||
.introduction("麦当劳是全球大型跨国连锁餐厅,1940 年创立于美国,在世界上大约拥有3 万间分店。主要售卖汉堡包,以及薯条、炸鸡、汽水、冰品、沙拉、水果等快餐食品").offsetType(1) | |||||
.build()); | |||||
} | |||||
public void testGet() throws WxErrorException { | |||||
WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654"); | |||||
assertNotNull(result); | |||||
System.err.println(result); | |||||
} | |||||
public void testDelete() throws WxErrorException { | |||||
this.wxMpService.getStoreService().delete("463558057"); | |||||
} | |||||
public void testListCategories() throws WxErrorException { | |||||
List<String> result = this.wxMpService.getStoreService().listCategories(); | |||||
assertNotNull(result); | |||||
System.err.println(result); | |||||
} | |||||
public void testList() throws WxErrorException { | public void testList() throws WxErrorException { | ||||
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); | WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); | ||||
assertNotNull(result); | assertNotNull(result); | ||||
@@ -13,7 +13,7 @@ import java.util.List; | |||||
/** | /** | ||||
* | * | ||||
* @author binarywang(https://github.com/binarywang) | |||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> | |||||
* Created by Binary Wang on 2016/9/2. | * Created by Binary Wang on 2016/9/2. | ||||
*/ | */ | ||||
@Test | @Test | ||||
@@ -22,7 +22,7 @@ public class WxMpUserTagServiceImplTest { | |||||
@Inject | @Inject | ||||
protected WxMpServiceImpl wxService; | protected WxMpServiceImpl wxService; | ||||
private Integer tagId = 2; | |||||
private Long tagId = 2L; | |||||
@Test | @Test | ||||
public void testTagCreate() throws Exception { | public void testTagCreate() throws Exception { | ||||
@@ -62,6 +62,14 @@ public class WxMpUserTagServiceImplTest { | |||||
Assert.assertNotNull(res); | Assert.assertNotNull(res); | ||||
} | } | ||||
@Test | |||||
public void testBatchTagging() throws Exception { | |||||
String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()}; | |||||
boolean res = this.wxService.getUserTagService().batchTagging(this.tagId, openids); | |||||
System.out.println(res); | |||||
Assert.assertTrue(res); | |||||
} | |||||
@Test | @Test | ||||
public void testBatchUntagging() throws Exception { | public void testBatchUntagging() throws Exception { | ||||
String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()}; | String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()}; | ||||
@@ -54,8 +54,8 @@ public class WxMpXmlMessageTest { | |||||
+ "</SendLocationInfo>" | + "</SendLocationInfo>" | ||||
+ "</xml>"; | + "</xml>"; | ||||
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml); | WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml); | ||||
Assert.assertEquals(wxMessage.getToUserName(), "toUser"); | |||||
Assert.assertEquals(wxMessage.getFromUserName(), "fromUser"); | |||||
Assert.assertEquals(wxMessage.getToUser(), "toUser"); | |||||
Assert.assertEquals(wxMessage.getFromUser(), "fromUser"); | |||||
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l)); | Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l)); | ||||
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT); | Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT); | ||||
Assert.assertEquals(wxMessage.getContent(), "this is a test"); | Assert.assertEquals(wxMessage.getContent(), "this is a test"); | ||||
@@ -135,8 +135,8 @@ public class WxMpXmlMessageTest { | |||||
+ "</SendLocationInfo>" | + "</SendLocationInfo>" | ||||
+ "</xml>"; | + "</xml>"; | ||||
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml); | WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml); | ||||
Assert.assertEquals(wxMessage.getToUserName(), "toUser"); | |||||
Assert.assertEquals(wxMessage.getFromUserName(), "fromUser"); | |||||
Assert.assertEquals(wxMessage.getToUser(), "toUser"); | |||||
Assert.assertEquals(wxMessage.getFromUser(), "fromUser"); | |||||
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l)); | Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l)); | ||||
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT); | Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT); | ||||
Assert.assertEquals(wxMessage.getContent(), "this is a test"); | Assert.assertEquals(wxMessage.getContent(), "this is a test"); | ||||
@@ -50,18 +50,18 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa | |||||
} | } | ||||
protected void letsGo(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException { | protected void letsGo(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException { | ||||
WxSession session = sessionManager.getSession(wxMessage.getFromUserName()); | |||||
WxSession session = sessionManager.getSession(wxMessage.getFromUser()); | |||||
if (session.getAttribute("guessing") == null) { | if (session.getAttribute("guessing") == null) { | ||||
WxMpCustomMessage m = WxMpCustomMessage | WxMpCustomMessage m = WxMpCustomMessage | ||||
.TEXT() | .TEXT() | ||||
.toUser(wxMessage.getFromUserName()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.content("请猜一个100以内的数字") | .content("请猜一个100以内的数字") | ||||
.build(); | .build(); | ||||
wxMpService.getKefuService().customMessageSend(m); | wxMpService.getKefuService().customMessageSend(m); | ||||
} else { | } else { | ||||
WxMpCustomMessage m = WxMpCustomMessage | WxMpCustomMessage m = WxMpCustomMessage | ||||
.TEXT() | .TEXT() | ||||
.toUser(wxMessage.getFromUserName()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.content("放弃了吗?那请重新猜一个100以内的数字") | .content("放弃了吗?那请重新猜一个100以内的数字") | ||||
.build(); | .build(); | ||||
wxMpService.getKefuService().customMessageSend(m); | wxMpService.getKefuService().customMessageSend(m); | ||||
@@ -74,7 +74,7 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa | |||||
protected void giveHint(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException { | protected void giveHint(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException { | ||||
WxSession session = sessionManager.getSession(wxMessage.getFromUserName()); | |||||
WxSession session = sessionManager.getSession(wxMessage.getFromUser()); | |||||
if (session.getAttribute("guessing") == null) { | if (session.getAttribute("guessing") == null) { | ||||
return; | return; | ||||
@@ -89,7 +89,7 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa | |||||
if (guessNumber < answer) { | if (guessNumber < answer) { | ||||
WxMpCustomMessage m = WxMpCustomMessage | WxMpCustomMessage m = WxMpCustomMessage | ||||
.TEXT() | .TEXT() | ||||
.toUser(wxMessage.getFromUserName()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.content("小了") | .content("小了") | ||||
.build(); | .build(); | ||||
wxMpService.getKefuService().customMessageSend(m); | wxMpService.getKefuService().customMessageSend(m); | ||||
@@ -97,14 +97,14 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa | |||||
} else if (guessNumber > answer) { | } else if (guessNumber > answer) { | ||||
WxMpCustomMessage m = WxMpCustomMessage | WxMpCustomMessage m = WxMpCustomMessage | ||||
.TEXT() | .TEXT() | ||||
.toUser(wxMessage.getFromUserName()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.content("大了") | .content("大了") | ||||
.build(); | .build(); | ||||
wxMpService.getKefuService().customMessageSend(m); | wxMpService.getKefuService().customMessageSend(m); | ||||
} else { | } else { | ||||
WxMpCustomMessage m = WxMpCustomMessage | WxMpCustomMessage m = WxMpCustomMessage | ||||
.TEXT() | .TEXT() | ||||
.toUser(wxMessage.getFromUserName()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.content("Bingo!") | .content("Bingo!") | ||||
.build(); | .build(); | ||||
session.removeAttribute("guessing"); | session.removeAttribute("guessing"); | ||||
@@ -24,8 +24,8 @@ public class DemoImageHandler implements WxMpMessageHandler { | |||||
= WxMpXmlOutMessage | = WxMpXmlOutMessage | ||||
.IMAGE() | .IMAGE() | ||||
.mediaId(wxMediaUploadResult.getMediaId()) | .mediaId(wxMediaUploadResult.getMediaId()) | ||||
.fromUser(wxMessage.getToUserName()) | |||||
.toUser(wxMessage.getFromUserName()) | |||||
.fromUser(wxMessage.getToUser()) | |||||
.toUser(wxMessage.getFromUser()) | |||||
.build(); | .build(); | ||||
return m; | return m; | ||||
} catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
@@ -21,7 +21,7 @@ public class DemoOAuth2Handler implements WxMpMessageHandler { | |||||
wxMpService.getWxMpConfigStorage().getOauth2redirectUri(), | wxMpService.getWxMpConfigStorage().getOauth2redirectUri(), | ||||
WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2</a>"; | WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2</a>"; | ||||
return WxMpXmlOutMessage.TEXT().content(href) | return WxMpXmlOutMessage.TEXT().content(href) | ||||
.fromUser(wxMessage.getToUserName()).toUser(wxMessage.getFromUserName()) | |||||
.fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser()) | |||||
.build(); | .build(); | ||||
} | } | ||||
} | } |
@@ -17,8 +17,8 @@ public class DemoTextHandler implements WxMpMessageHandler { | |||||
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, | public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, | ||||
WxMpService wxMpService, WxSessionManager sessionManager) { | WxMpService wxMpService, WxSessionManager sessionManager) { | ||||
WxMpXmlOutTextMessage m | WxMpXmlOutTextMessage m | ||||
= WxMpXmlOutMessage.TEXT().content("测试加密消息").fromUser(wxMessage.getToUserName()) | |||||
.toUser(wxMessage.getFromUserName()).build(); | |||||
= WxMpXmlOutMessage.TEXT().content("测试加密消息").fromUser(wxMessage.getToUser()) | |||||
.toUser(wxMessage.getFromUser()).build(); | |||||
return m; | return m; | ||||
} | } | ||||
@@ -6,6 +6,8 @@ | |||||
<accessToken>可以不填写</accessToken> | <accessToken>可以不填写</accessToken> | ||||
<expiresTime>可以不填写</expiresTime> | <expiresTime>可以不填写</expiresTime> | ||||
<openid>某个加你公众号的用户的openId</openid> | <openid>某个加你公众号的用户的openId</openid> | ||||
<partnerId>微信商户平台ID</partnerId> | |||||
<partnerKey>商户平台设置的API密钥</partnerKey> | |||||
<templateId>模版消息的模版ID</templateId> | <templateId>模版消息的模版ID</templateId> | ||||
<oauth2redirectUri>网页授权获取用户信息回调地址</oauth2redirectUri> | <oauth2redirectUri>网页授权获取用户信息回调地址</oauth2redirectUri> | ||||
<qrconnectRedirectUrl>网页应用授权登陆回调地址</qrconnectRedirectUrl> | <qrconnectRedirectUrl>网页应用授权登陆回调地址</qrconnectRedirectUrl> | ||||
@@ -5,9 +5,6 @@ | |||||
<classes> | <classes> | ||||
<class name="me.chanjar.weixin.mp.api.WxMpBusyRetryTest" /> | <class name="me.chanjar.weixin.mp.api.WxMpBusyRetryTest" /> | ||||
<class name="me.chanjar.weixin.mp.api.WxMpBaseAPITest" /> | <class name="me.chanjar.weixin.mp.api.WxMpBaseAPITest" /> | ||||
<class name="me.chanjar.weixin.mp.api.WxMpCustomMessageAPITest" /> | |||||
<class name="me.chanjar.weixin.mp.api.impl.WxMpMenuAPITest" /> | |||||
<class name="me.chanjar.weixin.mp.api.impl.WxMpGroupServiceImplTest" /> | |||||
<class name="me.chanjar.weixin.mp.api.WxMpMassMessageAPITest" /> | <class name="me.chanjar.weixin.mp.api.WxMpMassMessageAPITest" /> | ||||
<class name="me.chanjar.weixin.mp.api.impl.WxMpUserServiceImplTest" /> | <class name="me.chanjar.weixin.mp.api.impl.WxMpUserServiceImplTest" /> | ||||
<class name="me.chanjar.weixin.mp.api.impl.WxMpQrCodeServiceImplTest" /> | <class name="me.chanjar.weixin.mp.api.impl.WxMpQrCodeServiceImplTest" /> | ||||