@@ -311,24 +311,23 @@ public WxPayBillResult downloadBill(String billDate, String billType, String tar
311311 request .checkAndSign (this .getConfig ());
312312
313313 String url = this .getPayBaseUrl () + "/pay/downloadbill" ;
314- //TODO 返回的内容可能是文件流,也有可能是xml,需要区分对待
315314 String responseContent = this .post (url , request .toXML ());
316- if (responseContent .startsWith ("<" )){
315+ if (responseContent .startsWith ("<" )) {
317316 WxPayCommonResult result = WxPayBaseResult .fromXML (responseContent , WxPayCommonResult .class );
318317 result .checkResult (this );
319318 return null ;
320- }else {
319+ } else {
321320 WxPayBillResult wxPayBillResult = billInformationDeal (responseContent );
322321 return wxPayBillResult ;
323322 }
324323 }
325324
326- private WxPayBillResult billInformationDeal (String responseContent ){
325+ private WxPayBillResult billInformationDeal (String responseContent ) {
327326 WxPayBillResult wxPayBillResult = new WxPayBillResult ();
328327
329328 String listStr = "" ;
330329 String objStr = "" ;
331- if (responseContent .indexOf ("总交易单数" ) >= 0 ) {
330+ if (responseContent .contains ("总交易单数" )) {
332331 listStr = responseContent .substring (0 , responseContent .indexOf ("总交易单数" ));
333332 objStr = responseContent .substring (responseContent .indexOf ("总交易单数" ));
334333 }
@@ -341,13 +340,13 @@ private WxPayBillResult billInformationDeal(String responseContent){
341340
342341 // 参考以上格式进行取值
343342
344- List <WxPayBillBaseResult > wxPayBillBaseResultLst = new LinkedList <WxPayBillBaseResult >();
343+ List <WxPayBillBaseResult > wxPayBillBaseResultLst = new LinkedList <>();
345344 String newStr = listStr .replaceAll ("," , " " ); // 去空格
346345 String [] tempStr = newStr .split ("`" ); // 数据分组
347346 String [] t = tempStr [0 ].split (" " );// 分组标题
348347 int j = tempStr .length / t .length ; // 计算循环次数
349348 int k = 1 ; // 纪录数组下标
350- for (int i = 0 ; i < j ; i ++){
349+ for (int i = 0 ; i < j ; i ++) {
351350 WxPayBillBaseResult wxPayBillBaseResult = new WxPayBillBaseResult ();
352351
353352 wxPayBillBaseResult .setTradeTime (tempStr [k ]);
0 commit comments