微信支付-下载账单-支持gzip

This commit is contained in:
faymanwang
2020-07-31 10:36:49 +08:00
parent ad875ac63b
commit defb571001

View File

@@ -536,15 +536,16 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
*/
@Override
public Map<String, Object> downloadbill(Date billDate, String billType) {
Map<String, Object> parameters = getDownloadBillParam(billDate, billType,false);
return downBillRet(parameters);
}
//获取公共参数
Map<String, Object> parameters = getPublicParameters();
parameters.put("bill_type", billType);
//目前只支持日账单
parameters.put("bill_date", DateUtils.formatDate(billDate, DateUtils.YYYYMMDD));
/**
* 账单根据参数返回结果
* @param parameters
* @return
*/
private Map<String, Object> downBillRet(Map<String, Object> parameters) {
//设置签名
setSign(parameters);
String respStr = requestTemplate.postForObject(getReqUrl(WxTransactionType.DOWNLOADBILL), XML.getMap2Xml(parameters), String.class);
@@ -559,6 +560,39 @@ public class WxPayService extends BasePayService<WxPayConfigStorage> implements
return ret;
}
/**
* 下载账单公共参数
* @param billDate 账单类型商户通过接口或商户经开放平台授权后其所属服务商通过接口可以获取以下账单类型trade、signcustomertrade指商户基于支付宝交易收单的业务账单signcustomer是指基于商户支付宝余额收入及支出等资金变动的帐务账单
* @param billType 账单时间日账单格式为yyyy-MM-dd月账单格式为yyyy-MM。
* @param tarType 账单返回格式 默认返回流false gzip 时候true
* @return
*/
private Map<String, Object> getDownloadBillParam(Date billDate, String billType,boolean tarType) {
//获取公共参数
Map<String, Object> parameters = getPublicParameters();
parameters.put("bill_type", billType);
//目前只支持日账单
parameters.put("bill_date", DateUtils.formatDate(billDate, DateUtils.YYYYMMDD));
if(tarType){
parameters.put("tar_type", "GZIP");
}
return parameters;
}
/**
* 目前只支持日账单
*
* @param billDate 账单类型商户通过接口或商户经开放平台授权后其所属服务商通过接口可以获取以下账单类型trade、signcustomertrade指商户基于支付宝交易收单的业务账单signcustomer是指基于商户支付宝余额收入及支出等资金变动的帐务账单
* @param billType 账单时间日账单格式为yyyy-MM-dd月账单格式为yyyy-MM。
* @param tarType 账单返回格式 默认返回流false gzip 时候true
* @return 返回支付方下载对账单的结果
*/
public Map<String, Object> downloadbill(Date billDate, String billType, Boolean tarType) {
Map<String, Object> parameters = getDownloadBillParam(billDate, billType,tarType);
//设置签名
return downBillRet(parameters);
}
/**
* @param transactionIdOrBillDate 支付平台订单号或者账单日期, 具体请 类型为{@link String }或者 {@link Date },类型须强制限制,类型不对应则抛出异常{@link PayErrorException}