下载对账单错误修复

This commit is contained in:
jinyu 2016-12-21 00:00:27 +08:00
parent fe8166d1a4
commit b2e5c108fd
4 changed files with 57 additions and 8 deletions

View File

@ -21,6 +21,7 @@ import com.foxinmy.weixin4j.payment.mch.SettlementRecord;
import com.foxinmy.weixin4j.type.CurrencyType; import com.foxinmy.weixin4j.type.CurrencyType;
import com.foxinmy.weixin4j.util.DateUtil; import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.RandomUtil; import com.foxinmy.weixin4j.util.RandomUtil;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.xml.XmlStream; import com.foxinmy.weixin4j.xml.XmlStream;
/** /**
@ -48,6 +49,20 @@ public class CashApi extends MchApi {
* *
* @param redpacket * @param redpacket
* 红包信息 * 红包信息
* @see #sendRedpack(Redpacket,String)
*/
public RedpacketSendResult sendRedpack(Redpacket redpacket)
throws WeixinException {
return sendRedpack(redpacket, null);
}
/**
* 发放红包 企业向微信用户个人发现金红包
*
* @param redpacket
* 红包信息
* @param appId
* 应用ID 可为空 主要是针对企业号支付时传入的agentid
* @return 发放结果 * @return 发放结果
* @see com.foxinmy.weixin4j.payment.mch.Redpacket * @see com.foxinmy.weixin4j.payment.mch.Redpacket
* @see com.foxinmy.weixin4j.payment.mch.RedpacketSendResult * @see com.foxinmy.weixin4j.payment.mch.RedpacketSendResult
@ -59,10 +74,13 @@ public class CashApi extends MchApi {
* 发放裂变红包接口</a> * 发放裂变红包接口</a>
* @throws WeixinException * @throws WeixinException
*/ */
public RedpacketSendResult sendRedpack(Redpacket redpacket) public RedpacketSendResult sendRedpack(Redpacket redpacket, String appId)
throws WeixinException { throws WeixinException {
super.declareMerchant(redpacket); super.declareMerchant(redpacket);
JSONObject obj = (JSONObject) JSON.toJSON(redpacket); JSONObject obj = (JSONObject) JSON.toJSON(redpacket);
if (StringUtil.isNotBlank(appId)) {
obj.put("appid", appId);
}
obj.put("wxappid", obj.remove("appid")); obj.put("wxappid", obj.remove("appid"));
obj.put("sign", weixinSignature.sign(obj)); obj.put("sign", weixinSignature.sign(obj));
String param = XmlStream.map2xml(obj); String param = XmlStream.map2xml(obj);

View File

@ -73,11 +73,14 @@ public class WeixinResponse implements HttpResponse {
return messageConverter.convert(clazz, response); return messageConverter.convert(clazz, response);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("IO error on convert to " throw new RuntimeException("IO error on convert to "
+ typeReference, e); + clazz, e);
} }
} }
} }
throw new RuntimeException("cannot convert to " + typeReference); if (clazz.isAssignableFrom(ApiResult.class)) {
return (T) new ApiResult();
}
throw new RuntimeException("cannot convert to " + clazz);
} }
@Override @Override

View File

@ -29,8 +29,13 @@ public class MediaItem implements Serializable {
/** /**
* 媒体素材名称 * 媒体素材名称
*/ */
@JSONField(name = "filename") @JSONField(name = "name")
private String name; private String name;
/**
* 图文页的URL或者当获取的列表是图片素材列表时该字段是图片的URL
*/
@JSONField(name = "url")
private String url;
/** /**
* 媒体素材最后更新时间 * 媒体素材最后更新时间
*/ */
@ -58,6 +63,14 @@ public class MediaItem implements Serializable {
this.name = name; this.name = name;
} }
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUpdateTime() { public String getUpdateTime() {
return updateTime; return updateTime;
} }
@ -81,7 +94,8 @@ public class MediaItem implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "MediaItem [mediaId=" + mediaId + ", name=" + name return "MediaItem [mediaId=" + mediaId + ", name=" + name + ",url="
+ ", updateTime=" + updateTime + ", articles=" + articles + "]"; + url + ", updateTime=" + updateTime + ", articles=" + articles
+ "]";
} }
} }

View File

@ -676,6 +676,20 @@ public class WeixinPayProxy {
* *
* @param redpacket * @param redpacket
* 红包信息 * 红包信息
* @see #sendRedpack(Redpacket,String)
*/
public RedpacketSendResult sendRedpack(Redpacket redpacket)
throws WeixinException {
return cashApi.sendRedpack(redpacket);
}
/**
* 发放红包 企业向微信用户个人发现金红包
*
* @param redpacket
* 红包信息
* @param appId
* 应用ID 可为空 主要是针对企业号支付时传入的agentid
* @return 发放结果 * @return 发放结果
* @see com.foxinmy.weixin4j.api.CashApi * @see com.foxinmy.weixin4j.api.CashApi
* @see com.foxinmy.weixin4j.payment.mch.Redpacket * @see com.foxinmy.weixin4j.payment.mch.Redpacket
@ -688,9 +702,9 @@ public class WeixinPayProxy {
* 发放裂变红包接口</a> * 发放裂变红包接口</a>
* @throws WeixinException * @throws WeixinException
*/ */
public RedpacketSendResult sendRedpack(Redpacket redpacket) public RedpacketSendResult sendRedpack(Redpacket redpacket, String appId)
throws WeixinException { throws WeixinException {
return cashApi.sendRedpack(redpacket); return cashApi.sendRedpack(redpacket, appId);
} }
/** /**