新增数据统计接口&支付单元测试

This commit is contained in:
jy.hu 2015-01-31 00:32:06 +08:00
parent 1df0978564
commit b07033dff3
10 changed files with 43 additions and 22 deletions

View File

@ -158,4 +158,14 @@
* 2015-01-15 * 2015-01-15
+ **weixin4j-qy**: 新增邀请成员关注接口 + **weixin4j-qy**: 新增邀请成员关注接口
* 2015-01-22
+ **weixin4j-base**: 升级fastjson到1.2.3
+ **weixin4j-mp**:调整部分实体类(*paypackage)中没有按照骆驼命名规则的属性名
* 2015-01-31
+ **weixin4j-mp**: 新增数据分析接口

View File

@ -71,8 +71,6 @@ netty的代码没有放到maven中心仓库,也没什么意义,因为最终需
接下来 接下来
------ ------
* 公众号数据分析接口
* 公众号服务应用 * 公众号服务应用
* 企业号第三方应用 * 企业号第三方应用

View File

@ -212,7 +212,6 @@
<include>**/*.pem</include> <include>**/*.pem</include>
<include>**/*.p12</include> <include>**/*.p12</include>
<include>**/*.pfx</include> <include>**/*.pfx</include>
<include>**/*.pem</include>
</includes> </includes>
</resource> </resource>
<resource> <resource>

View File

@ -24,15 +24,15 @@ import com.thoughtworks.xstream.XStream;
public class FileTokenHolder implements TokenHolder { public class FileTokenHolder implements TokenHolder {
private final XStream xstream; private final XStream xstream;
private final String tokenPath; private final String tokenPath;
private final TokenCreator tokenCretor; private final TokenCreator tokenCreator;
public FileTokenHolder(TokenCreator tokenCretor) { public FileTokenHolder(TokenCreator tokenCreator) {
this(ConfigUtil.getValue("token_path"), tokenCretor); this(ConfigUtil.getValue("token_path"), tokenCreator);
} }
public FileTokenHolder(String tokenPath, TokenCreator tokenCretor) { public FileTokenHolder(String tokenPath, TokenCreator tokenCreator) {
this.tokenPath = tokenPath; this.tokenPath = tokenPath;
this.tokenCretor = tokenCretor; this.tokenCreator = tokenCreator;
xstream = new XStream(); xstream = new XStream();
xstream.ignoreUnknownElements(); xstream.ignoreUnknownElements();
xstream.autodetectAnnotations(true); xstream.autodetectAnnotations(true);
@ -43,7 +43,7 @@ public class FileTokenHolder implements TokenHolder {
@Override @Override
public Token getToken() throws WeixinException { public Token getToken() throws WeixinException {
File token_file = new File(String.format("%s/%s.xml", tokenPath, File token_file = new File(String.format("%s/%s.xml", tokenPath,
tokenCretor.getCacheKey())); tokenCreator.getCacheKey()));
Token token = null; Token token = null;
Calendar ca = Calendar.getInstance(); Calendar ca = Calendar.getInstance();
long now_time = ca.getTimeInMillis(); long now_time = ca.getTimeInMillis();
@ -57,7 +57,7 @@ public class FileTokenHolder implements TokenHolder {
return token; return token;
} }
} }
token = tokenCretor.createToken(); token = tokenCreator.createToken();
xstream.toXML(token, new FileOutputStream(token_file)); xstream.toXML(token, new FileOutputStream(token_file));
} catch (IOException e) { } catch (IOException e) {
throw new WeixinException(e.getMessage()); throw new WeixinException(e.getMessage());

View File

@ -7,6 +7,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Consts; import org.apache.http.Consts;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -49,6 +50,9 @@ public class MapUtil {
try { try {
if (encoder && lowerCase) { if (encoder && lowerCase) {
for (Map.Entry<String, String> entry : set) { for (Map.Entry<String, String> entry : set) {
if (StringUtils.isBlank(entry.getValue())) {
continue;
}
sb.append(entry.getKey().toLowerCase()) sb.append(entry.getKey().toLowerCase())
.append("=") .append("=")
.append(URLEncoder.encode(entry.getValue(), .append(URLEncoder.encode(entry.getValue(),
@ -56,6 +60,9 @@ public class MapUtil {
} }
} else if (encoder) { } else if (encoder) {
for (Map.Entry<String, String> entry : set) { for (Map.Entry<String, String> entry : set) {
if (StringUtils.isBlank(entry.getValue())) {
continue;
}
sb.append(entry.getKey()) sb.append(entry.getKey())
.append("=") .append("=")
.append(URLEncoder.encode(entry.getValue(), .append(URLEncoder.encode(entry.getValue(),
@ -63,11 +70,17 @@ public class MapUtil {
} }
} else if (lowerCase) { } else if (lowerCase) {
for (Map.Entry<String, String> entry : set) { for (Map.Entry<String, String> entry : set) {
if (StringUtils.isBlank(entry.getValue())) {
continue;
}
sb.append(entry.getKey().toLowerCase()).append("=") sb.append(entry.getKey().toLowerCase()).append("=")
.append(entry.getValue()).append("&"); .append(entry.getValue()).append("&");
} }
} else { } else {
for (Map.Entry<String, String> entry : set) { for (Map.Entry<String, String> entry : set) {
if (StringUtils.isBlank(entry.getValue())) {
continue;
}
sb.append(entry.getKey()).append("=") sb.append(entry.getKey()).append("=")
.append(entry.getValue()).append("&"); .append(entry.getValue()).append("&");
} }

View File

@ -164,4 +164,8 @@ weixin4j-mp
+ **weixin4j-mp-api**: 退款相关类拆分为V2跟V3 + **weixin4j-mp-api**: 退款相关类拆分为V2跟V3
+ **weixin4j-mp-api**: 新增接口上报接口 + **weixin4j-mp-api**: 新增接口上报接口
* 2015-01-31
+ **weixin4j-mp-api**: 新增数据分析接口

View File

@ -143,4 +143,8 @@ weixin.properties说明
+ 退款相关类拆分为V2跟V3 + 退款相关类拆分为V2跟V3
+ 新增接口上报接口 + 新增接口上报接口
* 2015-01-31
+ 新增数据分析接口

View File

@ -233,7 +233,6 @@ public class Pay2Api extends PayApi {
} }
} }
} }
System.err.println(response.getAsString());
return response.getAsObject(new TypeReference<RefundResult>() { return response.getAsObject(new TypeReference<RefundResult>() {
}); });
} }

View File

@ -130,5 +130,5 @@ unifiedorder_uri={mch_base_url}/pay/unifiedorder
nativepay_v2_uri=weixin://wxpay/bizpayurl?sign=%s&appid=%s&productid=%s&timestamp=%s&noncestr=%s nativepay_v2_uri=weixin://wxpay/bizpayurl?sign=%s&appid=%s&productid=%s&timestamp=%s&noncestr=%s
nativepay_v3_uri=weixin://wxpay/bizpayurl?sign=%s&appid=%s&mch_id=%s&product_id=%s&time_stamp=%s&nonce_str=%s nativepay_v3_uri=weixin://wxpay/bizpayurl?sign=%s&appid=%s&mch_id=%s&product_id=%s&time_stamp=%s&nonce_str=%s
# \u83b7\u53d6\u7528\u6237\u589e\u51cf\u6570\u636e # \u6570\u636e\u7edf\u8ba1
datacube_getusersummary_uri={api_base_url}/datacube/getusersummary?access_token=%s datacube_uri={api_base_url}/datacube/%s?access_token=%s

View File

@ -2,8 +2,6 @@ package com.foxinmy.weixin4j.mp.payment.v3;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.StringUtils;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.model.WeixinMpAccount; import com.foxinmy.weixin4j.model.WeixinMpAccount;
import com.foxinmy.weixin4j.mp.payment.PayPackage; import com.foxinmy.weixin4j.mp.payment.PayPackage;
@ -120,10 +118,6 @@ public class PayPackageV3 extends PayPackage {
this.sign = sign; this.sign = sign;
} }
public void setBody(String body) {
super.setBody(StringUtils.isBlank(body) ? "服务费用" : body);
}
public String getTradeType() { public String getTradeType() {
return tradeType; return tradeType;
} }