release 1.2

This commit is contained in:
jinyu 2015-02-05 19:55:33 +08:00
parent 681d8afd1d
commit d8d294fea9
20 changed files with 140 additions and 34 deletions

View File

@ -166,6 +166,10 @@
+ **weixin4j-mp**:调整部分实体类(*paypackage)中没有按照骆驼命名规则的属性名 + **weixin4j-mp**:调整部分实体类(*paypackage)中没有按照骆驼命名规则的属性名
* 2015-01-31 * 2015-01-31
+ **weixin4j-mp**: 新增数据分析接口 + **weixin4j-mp**: 新增数据分析接口
* 2015-02-05
+ release 1.2

View File

@ -30,20 +30,20 @@ weixin4j
如何获取API 如何获取API
---------- ----------
###1.maven依赖(1.1,2014-12-18 released) ###1.maven依赖(1.2,2015-02-05 released)
微信公众平台API 微信公众平台API
<dependency> <dependency>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-mp-api</artifactId> <artifactId>weixin4j-mp-api</artifactId>
<version>1.1</version> <version>1.2</version>
</dependency> </dependency>
微信企业号API 微信企业号API
<dependency> <dependency>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-qy-api</artifactId> <artifactId>weixin4j-qy-api</artifactId>
<version>1.1</version> <version>1.2</version>
</dependency> </dependency>
以上依赖如果出现Missing artifact错误 请尝试在eclipse里这么做 以上依赖如果出现Missing artifact错误 请尝试在eclipse里这么做

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>weixin4j</name> <name>weixin4j</name>
<url>https://github.com/foxinmy/weixin4j</url> <url>https://github.com/foxinmy/weixin4j</url>
@ -90,6 +90,13 @@
<version>${maven.resources.plugin.version}</version> <version>${maven.resources.plugin.version}</version>
<configuration> <configuration>
<encoding>${project.build.sourceEncoding}</encoding> <encoding>${project.build.sourceEncoding}</encoding>
<!-- 过滤证书文件 -->
<nonFilteredFileExtensions>
<nonFilteredFileExtension>pem</nonFilteredFileExtension>
<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
<nonFilteredFileExtension>p12</nonFilteredFileExtension>
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-base</artifactId> <artifactId>weixin4j-base</artifactId>
<name>weixin4j-base</name> <name>weixin4j-base</name>

View File

@ -40,7 +40,7 @@ import com.foxinmy.weixin4j.util.MapUtil;
import com.thoughtworks.xstream.mapper.CannotResolveClassException; import com.thoughtworks.xstream.mapper.CannotResolveClassException;
/** /**
* 调用微信相关接口的HttpRequest,对于其他请求可能并不 * 调用微信相关接口的HttpRequest,对于其他请求可能并不
* *
* @className HttpRequest * @className HttpRequest
* @author jy * @author jy

View File

@ -113,7 +113,7 @@ public class HttpWeixinMessage implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "HttpMessage [toUserName=" + toUserName + ", encryptContent=" return "HttpWeixinMessage [toUserName=" + toUserName + ", encryptContent="
+ encryptContent + ", encryptType=" + encryptType + encryptContent + ", encryptType=" + encryptType
+ ", echoStr=" + echoStr + ", timeStamp=" + timeStamp + ", echoStr=" + echoStr + ", timeStamp=" + timeStamp
+ ", nonce=" + nonce + ", signature=" + signature + ", token=" + ", nonce=" + nonce + ", signature=" + signature + ", token="

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-mp</artifactId> <artifactId>weixin4j-mp</artifactId>
<name>weixin4j-mp</name> <name>weixin4j-mp</name>

View File

@ -30,6 +30,7 @@ weixin4j-mp-api
* Pay2Api `V2支付API` * Pay2Api `V2支付API`
* Pay3Api `V3支付API` * Pay3Api `V3支付API`
* DataApi `数据统计API` * DataApi `数据统计API`
如何使用 如何使用

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-mp</artifactId> <artifactId>weixin4j-mp</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-mp-api</artifactId> <artifactId>weixin4j-mp-api</artifactId>
<name>weixin4j-mp-api</name> <name>weixin4j-mp-api</name>

View File

@ -261,7 +261,7 @@ public class WeixinPayProxy {
* @param caFile * @param caFile
* 证书文件(后缀为*.p12) * 证书文件(后缀为*.p12)
* @param idQuery * @param idQuery
* ) 商户系统内部的订单号, transaction_id out_trade_no 二选一,如果同时存在优先级: * 商户系统内部的订单号, transaction_id out_trade_no 二选一,如果同时存在优先级:
* transaction_id> out_trade_no * transaction_id> out_trade_no
* @param outRefundNo * @param outRefundNo
* 商户系统内部的退款单号, 户系统内部唯一,同一退款单号多次请求只退一笔 * 商户系统内部的退款单号, 户系统内部唯一,同一退款单号多次请求只退一笔

View File

@ -9,6 +9,7 @@ import com.foxinmy.weixin4j.exception.WeixinException;
import com.foxinmy.weixin4j.http.JsonResult; import com.foxinmy.weixin4j.http.JsonResult;
import com.foxinmy.weixin4j.model.Button; import com.foxinmy.weixin4j.model.Button;
import com.foxinmy.weixin4j.mp.api.CustomApi; import com.foxinmy.weixin4j.mp.api.CustomApi;
import com.foxinmy.weixin4j.mp.api.DataApi;
import com.foxinmy.weixin4j.mp.api.GroupApi; import com.foxinmy.weixin4j.mp.api.GroupApi;
import com.foxinmy.weixin4j.mp.api.HelperApi; import com.foxinmy.weixin4j.mp.api.HelperApi;
import com.foxinmy.weixin4j.mp.api.MassApi; import com.foxinmy.weixin4j.mp.api.MassApi;
@ -29,6 +30,7 @@ import com.foxinmy.weixin4j.mp.model.QRParameter;
import com.foxinmy.weixin4j.mp.model.SemQuery; import com.foxinmy.weixin4j.mp.model.SemQuery;
import com.foxinmy.weixin4j.mp.model.SemResult; import com.foxinmy.weixin4j.mp.model.SemResult;
import com.foxinmy.weixin4j.mp.model.User; import com.foxinmy.weixin4j.mp.model.User;
import com.foxinmy.weixin4j.mp.type.DatacubeType;
import com.foxinmy.weixin4j.mp.type.IndustryType; import com.foxinmy.weixin4j.mp.type.IndustryType;
import com.foxinmy.weixin4j.mp.type.Lang; import com.foxinmy.weixin4j.mp.type.Lang;
import com.foxinmy.weixin4j.msg.model.Base; import com.foxinmy.weixin4j.msg.model.Base;
@ -61,6 +63,7 @@ public class WeixinProxy {
private final QrApi qrApi; private final QrApi qrApi;
private final TmplApi tmplApi; private final TmplApi tmplApi;
private final HelperApi helperApi; private final HelperApi helperApi;
private final DataApi dataApi;
/** /**
* 默认采用文件存放Token信息 * 默认采用文件存放Token信息
@ -95,6 +98,7 @@ public class WeixinProxy {
this.qrApi = new QrApi(tokenHolder); this.qrApi = new QrApi(tokenHolder);
this.tmplApi = new TmplApi(tokenHolder); this.tmplApi = new TmplApi(tokenHolder);
this.helperApi = new HelperApi(tokenHolder); this.helperApi = new HelperApi(tokenHolder);
this.dataApi = new DataApi(tokenHolder);
} }
/** /**
@ -921,4 +925,90 @@ public class WeixinProxy {
public List<String> getcallbackip() throws WeixinException { public List<String> getcallbackip() throws WeixinException {
return helperApi.getcallbackip(); return helperApi.getcallbackip();
} }
/**
* 数据统计
*
* @param datacubeType
* 数据统计类型
* @param beginDate
* 获取数据的起始日期begin_date和end_date的差值需小于最大时间跨度比如最大时间跨度为1时
* begin_date和end_date的差值只能为0才能小于1否则会报错
* @param endDate
* 获取数据的结束日期end_date允许设置的最大值为昨日
* @see com.foxinmy.weixin4j.mp.api.DataApi
* @see com.foxinmy.weixin4j.mp.datacube.UserSummary
* @see com.foxinmy.weixin4j.mp.datacube.ArticleSummary
* @see com.foxinmy.weixin4j.mp.datacube.ArticleTotal
* @see com.foxinmy.weixin4j.mp.datacube.ArticleDatacubeShare
* @see com.foxinmy.weixin4j.mp.datacube.UpstreamMsg
* @see com.foxinmy.weixin4j.mp.datacube.UpstreamMsgDist
* @see com.foxinmy.weixin4j.mp.datacube.InterfaceSummary
* @return 统计结果
* @see <a
* href="http://mp.weixin.qq.com/wiki/3/ecfed6e1a0a03b5f35e5efac98e864b7.html">用户分析</a>
* @see <a
* href="http://mp.weixin.qq.com/wiki/8/c0453610fb5131d1fcb17b4e87c82050.html">图文分析</a>
* @see <a
* href="http://mp.weixin.qq.com/wiki/12/32d42ad542f2e4fc8a8aa60e1bce9838.html">消息分析</a>
* @see <a
* href="http://mp.weixin.qq.com/wiki/8/30ed81ae38cf4f977194bf1a5db73668.html">接口分析</a>
* @throws WeixinException
*/
public List<?> datacube(DatacubeType datacubeType, Date beginDate,
Date endDate) throws WeixinException {
return dataApi.datacube(datacubeType, beginDate, endDate);
}
/**
* 数据统计
*
* @param datacubeType
* 统计类型
* @param beginDate
* 开始日期
* @param offset
* 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#datacube(DatacubeType, Date,Date)}
* @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException
*/
public List<?> datacube(DatacubeType datacubeType, Date beginDate,
int offset) throws WeixinException {
return dataApi.datacube(datacubeType, beginDate, offset);
}
/**
* 数据统计
*
* @param datacubeType
* 统计类型
* @param offset
* 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据
* @param endDate
* 截至日期
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#datacube(DatacubeType, Date,Date)}
* @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException
*/
public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate)
throws WeixinException {
return dataApi.datacube(datacubeType, offset, endDate);
}
/**
* 查询日期跨度为0的统计数据(当天)
*
* @param datacubeType
* 统计类型
* @param date
* 统计日期
* @see {@link com.foxinmy.weixin4j.mp.WeixinProxy#datacube(DatacubeType, Date,Date)}
* @see com.foxinmy.weixin4j.mp.api.DataApi
* @throws WeixinException
*/
public List<?> datacube(DatacubeType datacubeType, Date date)
throws WeixinException {
return dataApi.datacube(datacubeType, date);
}
} }

View File

@ -16,8 +16,8 @@ import com.foxinmy.weixin4j.util.DateUtil;
/** /**
* 数据分析API * 数据分析API
* <p> * <p>
* 1接口侧的公众号数据的数据库中仅存储了2014年12月1日之后的数据将查询不到在此之前的日期即使有查到也是不可信的脏数据 * 1接口侧的公众号数据的数据库中仅存储了2014年12月1日之后的数据将查询不到在此之前的日期即使有查到也是不可信的脏数据<br/>
* 2请开发者在调用接口获取数据后将数据保存在自身数据库中即加快下次用户的访问速度也降低了微信侧接口调用的不必要损耗 * 2请开发者在调用接口获取数据后将数据保存在自身数据库中即加快下次用户的访问速度也降低了微信侧接口调用的不必要损耗<br/>
* </p> * </p>
* *
* @className DataApi * @className DataApi
@ -42,7 +42,7 @@ public class DataApi extends MpApi {
* 开始日期 * 开始日期
* @param offset * @param offset
* 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据 * 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据
* @return * @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, Date beginDate, public List<?> datacube(DatacubeType datacubeType, Date beginDate,
@ -62,7 +62,7 @@ public class DataApi extends MpApi {
* 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据 * 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据
* @param endDate * @param endDate
* 截至日期 * 截至日期
* @return * @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate) public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate)
@ -74,13 +74,13 @@ public class DataApi extends MpApi {
} }
/** /**
* 查询日期跨度为1的统计数据 * 查询日期跨度为0的统计数据(当天)
* *
* @param datacubeType * @param datacubeType
* 统计类型 * 统计类型
* @param date * @param date
* 统计日期 * 统计日期
* @return 统计结果 * @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
* @throws WeixinException * @throws WeixinException
*/ */
public List<?> datacube(DatacubeType datacubeType, Date date) public List<?> datacube(DatacubeType datacubeType, Date date)

View File

@ -31,16 +31,16 @@ public class PayTest {
private final static WeixinMpAccount ACCOUNT3; private final static WeixinMpAccount ACCOUNT3;
static { static {
ACCOUNT2 = new WeixinMpAccount( ACCOUNT2 = new WeixinMpAccount(
"appId", "appid",
"appSecret", "appsecret",
"paySignKey", "paysignkey",
"partnerId", "partnerKey"); "partnerId", "partnerKey");
PAY2 = new WeixinPayProxy(ACCOUNT2, new FileTokenHolder( PAY2 = new WeixinPayProxy(ACCOUNT2, new FileTokenHolder(
new WeixinTokenCreator(ACCOUNT2.getId(), ACCOUNT2.getSecret(), new WeixinTokenCreator(ACCOUNT2.getId(), ACCOUNT2.getSecret(),
AccountType.MP))); AccountType.MP)));
ACCOUNT3 = new WeixinMpAccount("appId", ACCOUNT3 = new WeixinMpAccount("appid",
"appSecret", "appsecret",
"paySignKey", "mchId"); "paysignkey", "mchId");
PAY3 = new WeixinPayProxy(ACCOUNT3, new FileTokenHolder( PAY3 = new WeixinPayProxy(ACCOUNT3, new FileTokenHolder(
new WeixinTokenCreator(ACCOUNT3.getId(), ACCOUNT3.getSecret(), new WeixinTokenCreator(ACCOUNT3.getId(), ACCOUNT3.getSecret(),
AccountType.MP))); AccountType.MP)));
@ -54,10 +54,10 @@ public class PayTest {
@Test @Test
public void refundV2() throws WeixinException { public void refundV2() throws WeixinException {
File caFile = new File( File caFile = new File(
"/Users/jy/download/1221928801.pfx"); "/path/xxx.pfx");
IdQuery idQuery = new IdQuery("D15012400026", IdType.TRADENO); IdQuery idQuery = new IdQuery("D15020300005", IdType.TRADENO);
System.err.println(PAY2.refundV2(caFile, idQuery, "R000000001", 2d, 2d, System.err.println(PAY2.refundV2(caFile, idQuery, "1422925555037", 16d, 16d,
"1221928801", "111111", null, null, null)); "partnerId", "password", null, null, null));
} }
@Test @Test
@ -110,7 +110,7 @@ public class PayTest {
@Test @Test
public void refundV3() throws WeixinException { public void refundV3() throws WeixinException {
File caFile = new File( File caFile = new File(
"/Users/jy/download/10020674.p12"); "/path/xxx.p12");
IdQuery idQuery = new IdQuery("T00015", IdType.TRADENO); IdQuery idQuery = new IdQuery("T00015", IdType.TRADENO);
com.foxinmy.weixin4j.mp.payment.v3.RefundResult result = PAY3.refundV3( com.foxinmy.weixin4j.mp.payment.v3.RefundResult result = PAY3.refundV3(
caFile, idQuery, "R0002", 1d, 1d, "10020674"); caFile, idQuery, "R0002", 1d, 1d, "10020674");

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-mp</artifactId> <artifactId>weixin4j-mp</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-mp-server</artifactId> <artifactId>weixin4j-mp-server</artifactId>
<name>weixin4j-mp-server</name> <name>weixin4j-mp-server</name>

View File

@ -12,6 +12,7 @@
<!-- 控制台输出日志 --> <!-- 控制台输出日志 -->
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n
</pattern> </pattern>
</encoder> </encoder>
@ -31,6 +32,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern> </pattern>
</encoder> </encoder>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j</artifactId> <artifactId>weixin4j</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-qy</artifactId> <artifactId>weixin4j-qy</artifactId>
<name>weixin4j-qy</name> <name>weixin4j-qy</name>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-qy</artifactId> <artifactId>weixin4j-qy</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-qy-api</artifactId> <artifactId>weixin4j-qy-api</artifactId>
<name>weixin4j-qy-api</name> <name>weixin4j-qy-api</name>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.foxinmy</groupId> <groupId>com.foxinmy</groupId>
<artifactId>weixin4j-qy</artifactId> <artifactId>weixin4j-qy</artifactId>
<version>1.2-SNAPSHOT</version> <version>1.2</version>
</parent> </parent>
<artifactId>weixin4j-qy-server</artifactId> <artifactId>weixin4j-qy-server</artifactId>
<name>weixin4j-qy-server</name> <name>weixin4j-qy-server</name>

View File

@ -9,7 +9,7 @@ import com.foxinmy.weixin4j.type.MessageType;
/** /**
* 用户进入应用的事件推送 * 用户进入应用的事件推送
* *
* @className * @className EnterAgentAction
* @author jy * @author jy
* @date 2014年12月28日 * @date 2014年12月28日
* @since JDK 1.7 * @since JDK 1.7

View File

@ -12,6 +12,7 @@
<!-- 控制台输出日志 --> <!-- 控制台输出日志 -->
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - %msg%n
</pattern> </pattern>
</encoder> </encoder>
@ -31,6 +32,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<charset>UTF-8</charset>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</pattern> </pattern>
</encoder> </encoder>