release 1.2
This commit is contained in:
+1
-1
@@ -261,7 +261,7 @@ public class WeixinPayProxy {
|
||||
* @param caFile
|
||||
* 证书文件(后缀为*.p12)
|
||||
* @param idQuery
|
||||
* ) 商户系统内部的订单号, transaction_id 、 out_trade_no 二选一,如果同时存在优先级:
|
||||
* 商户系统内部的订单号, transaction_id 、 out_trade_no 二选一,如果同时存在优先级:
|
||||
* transaction_id> out_trade_no
|
||||
* @param outRefundNo
|
||||
* 商户系统内部的退款单号,商 户系统内部唯一,同一退款单号多次请求只退一笔
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.JsonResult;
|
||||
import com.foxinmy.weixin4j.model.Button;
|
||||
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.HelperApi;
|
||||
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.SemResult;
|
||||
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.Lang;
|
||||
import com.foxinmy.weixin4j.msg.model.Base;
|
||||
@@ -61,6 +63,7 @@ public class WeixinProxy {
|
||||
private final QrApi qrApi;
|
||||
private final TmplApi tmplApi;
|
||||
private final HelperApi helperApi;
|
||||
private final DataApi dataApi;
|
||||
|
||||
/**
|
||||
* 默认采用文件存放Token信息
|
||||
@@ -95,6 +98,7 @@ public class WeixinProxy {
|
||||
this.qrApi = new QrApi(tokenHolder);
|
||||
this.tmplApi = new TmplApi(tokenHolder);
|
||||
this.helperApi = new HelperApi(tokenHolder);
|
||||
this.dataApi = new DataApi(tokenHolder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -921,4 +925,90 @@ public class WeixinProxy {
|
||||
*/
|
||||
public List<String> getcallbackip() throws WeixinException {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ import com.foxinmy.weixin4j.util.DateUtil;
|
||||
/**
|
||||
* 数据分析API
|
||||
* <p>
|
||||
* 1、接口侧的公众号数据的数据库中仅存储了2014年12月1日之后的数据,将查询不到在此之前的日期,即使有查到,也是不可信的脏数据;
|
||||
* 2、请开发者在调用接口获取数据后,将数据保存在自身数据库中,即加快下次用户的访问速度,也降低了微信侧接口调用的不必要损耗。
|
||||
* 1、接口侧的公众号数据的数据库中仅存储了2014年12月1日之后的数据,将查询不到在此之前的日期,即使有查到,也是不可信的脏数据;<br/>
|
||||
* 2、请开发者在调用接口获取数据后,将数据保存在自身数据库中,即加快下次用户的访问速度,也降低了微信侧接口调用的不必要损耗。<br/>
|
||||
* </p>
|
||||
*
|
||||
* @className DataApi
|
||||
@@ -42,7 +42,7 @@ public class DataApi extends MpApi {
|
||||
* 开始日期
|
||||
* @param offset
|
||||
* 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据
|
||||
* @return
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<?> datacube(DatacubeType datacubeType, Date beginDate,
|
||||
@@ -62,7 +62,7 @@ public class DataApi extends MpApi {
|
||||
* 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据
|
||||
* @param endDate
|
||||
* 截至日期
|
||||
* @return
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate)
|
||||
@@ -74,13 +74,13 @@ public class DataApi extends MpApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询日期跨度为1的统计数据
|
||||
* 查询日期跨度为0的统计数据(当天)
|
||||
*
|
||||
* @param datacubeType
|
||||
* 统计类型
|
||||
* @param date
|
||||
* 统计日期
|
||||
* @return 统计结果
|
||||
* @see {@link com.foxinmy.weixin4j.mp.api.DataApi#datacube(DatacubeType, Date,Date)}
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public List<?> datacube(DatacubeType datacubeType, Date date)
|
||||
|
||||
+11
-11
@@ -31,16 +31,16 @@ public class PayTest {
|
||||
private final static WeixinMpAccount ACCOUNT3;
|
||||
static {
|
||||
ACCOUNT2 = new WeixinMpAccount(
|
||||
"appId",
|
||||
"appSecret",
|
||||
"paySignKey",
|
||||
"appid",
|
||||
"appsecret",
|
||||
"paysignkey",
|
||||
"partnerId", "partnerKey");
|
||||
PAY2 = new WeixinPayProxy(ACCOUNT2, new FileTokenHolder(
|
||||
new WeixinTokenCreator(ACCOUNT2.getId(), ACCOUNT2.getSecret(),
|
||||
AccountType.MP)));
|
||||
ACCOUNT3 = new WeixinMpAccount("appId",
|
||||
"appSecret",
|
||||
"paySignKey", "mchId");
|
||||
ACCOUNT3 = new WeixinMpAccount("appid",
|
||||
"appsecret",
|
||||
"paysignkey", "mchId");
|
||||
PAY3 = new WeixinPayProxy(ACCOUNT3, new FileTokenHolder(
|
||||
new WeixinTokenCreator(ACCOUNT3.getId(), ACCOUNT3.getSecret(),
|
||||
AccountType.MP)));
|
||||
@@ -54,10 +54,10 @@ public class PayTest {
|
||||
@Test
|
||||
public void refundV2() throws WeixinException {
|
||||
File caFile = new File(
|
||||
"/Users/jy/download/1221928801.pfx");
|
||||
IdQuery idQuery = new IdQuery("D15012400026", IdType.TRADENO);
|
||||
System.err.println(PAY2.refundV2(caFile, idQuery, "R000000001", 2d, 2d,
|
||||
"1221928801", "111111", null, null, null));
|
||||
"/path/xxx.pfx");
|
||||
IdQuery idQuery = new IdQuery("D15020300005", IdType.TRADENO);
|
||||
System.err.println(PAY2.refundV2(caFile, idQuery, "1422925555037", 16d, 16d,
|
||||
"partnerId", "password", null, null, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,7 +110,7 @@ public class PayTest {
|
||||
@Test
|
||||
public void refundV3() throws WeixinException {
|
||||
File caFile = new File(
|
||||
"/Users/jy/download/10020674.p12");
|
||||
"/path/xxx.p12");
|
||||
IdQuery idQuery = new IdQuery("T00015", IdType.TRADENO);
|
||||
com.foxinmy.weixin4j.mp.payment.v3.RefundResult result = PAY3.refundV3(
|
||||
caFile, idQuery, "R0002", 1d, 1d, "10020674");
|
||||
|
||||
Reference in New Issue
Block a user