优化对账方法

This commit is contained in:
Binary Wang 2018-11-01 21:56:52 +08:00
parent 74dafd2901
commit 897394e05e

View File

@ -90,14 +90,17 @@ import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
*/ */
public abstract class BaseWxPayServiceImpl implements WxPayService { public abstract class BaseWxPayServiceImpl implements WxPayService {
private static final String PAY_BASE_URL = "https://api.mch.weixin.qq.com"; private static final String PAY_BASE_URL = "https://api.mch.weixin.qq.com";
private static final String TOTAL_FUND_COUNT = "资金流水总笔数";
private static final String TOTAL_DEAL_COUNT = "总交易单数";
/** /**
* The Log. * The Log.
*/ */
protected final Logger log = LoggerFactory.getLogger(this.getClass()); final Logger log = LoggerFactory.getLogger(this.getClass());
/** /**
* The constant wxApiData. * The constant wxApiData.
*/ */
protected static ThreadLocal<WxPayApiData> wxApiData = new ThreadLocal<>(); static ThreadLocal<WxPayApiData> wxApiData = new ThreadLocal<>();
private EntPayService entPayService = new EntPayServiceImpl(this); private EntPayService entPayService = new EntPayServiceImpl(this);
@ -523,6 +526,10 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
} }
} }
if (StringUtils.isEmpty(responseContent)) {
return null;
}
return this.handleBill(request.getBillType(), responseContent); return this.handleBill(request.getBillType(), responseContent);
} }
@ -563,9 +570,9 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
String listStr = ""; String listStr = "";
String objStr = ""; String objStr = "";
if (responseContent.contains("总交易单数")) { if (responseContent.contains(TOTAL_DEAL_COUNT)) {
listStr = responseContent.substring(0, responseContent.indexOf("总交易单数")); listStr = responseContent.substring(0, responseContent.indexOf(TOTAL_DEAL_COUNT));
objStr = responseContent.substring(responseContent.indexOf("总交易单数")); objStr = responseContent.substring(responseContent.indexOf(TOTAL_DEAL_COUNT));
} }
/* /*
@ -695,9 +702,9 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
String listStr = ""; String listStr = "";
String objStr = ""; String objStr = "";
if (StringUtils.isNotBlank(responseContent) && responseContent.contains("资金流水总笔数")) { if (StringUtils.isNotBlank(responseContent) && responseContent.contains(TOTAL_FUND_COUNT)) {
listStr = responseContent.substring(0, responseContent.indexOf("资金流水总笔数")); listStr = responseContent.substring(0, responseContent.indexOf(TOTAL_FUND_COUNT));
objStr = responseContent.substring(responseContent.indexOf("资金流水总笔数")); objStr = responseContent.substring(responseContent.indexOf(TOTAL_FUND_COUNT));
} }
/* /*
* 记账时间:2018-02-01 04:21:23 微信支付业务单号:50000305742018020103387128253 资金流水单号:1900009231201802015884652186 业务名称:退款 * 记账时间:2018-02-01 04:21:23 微信支付业务单号:50000305742018020103387128253 资金流水单号:1900009231201802015884652186 业务名称:退款