失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 民生银行信用卡电子账单读取

民生银行信用卡电子账单读取

时间:2019-04-26 23:19:12

相关推荐

民生银行信用卡电子账单读取

/*** 民生银行账单解读* Created by LYH on /8/28.*/public class MinShengBankBill {public static String temp_hello = "尊敬的";public static String temp_cardbill = "您好!感谢您使用本行信用卡,特别呈上您";public static List<TempBillModal> readBillModal(String mailContent){//public static TempBillModal readBill(Document document) {List<TempBillModal> tempBillModalList = new ArrayList<TempBillModal>();TempBillModal billModal = new TempBillModal();Document document = Jsoup.parse(mailContent);tempBillModalList.add(billModal);//持卡人String cardUserStr = document.select("font:containsOwn(尊敬的)").first().text();cardUserStr = cardUserStr.substring(cardUserStr.indexOf(temp_hello) +temp_hello.length(),cardUserStr.indexOf(":"));billModal.setCarduser(cardUserStr);System.out.println("持卡人:"+cardUserStr);//账单月份String billStr = document.select("font:containsOwn(您好!感谢您使用本行信用卡,特别呈上您)").first().parent().parent().nextElementSibling().text();String year= billStr.substring(0,billStr.indexOf("年"));billStr = billStr.substring(billStr.indexOf("年")+1,billStr.indexOf("月"));if(billStr.trim().indexOf("0")==0){billStr = billStr.substring(1,billStr.length());}int month = Integer.parseInt(billStr);billModal.setBillmonth(month);System.out.println("账单月份:"+billStr);//账单日Elements billDateElements = document.select("font:containsOwn(Statement Date)").first().parents();String billDateStr = billDateElements.get(10).nextElementSibling().text().replaceAll("/", "-");billModal.setBilldate(billDateStr);System.out.println("账单日:"+billDateStr);//还款日Elements repayElements = document.select("font:containsOwn(Payment Due Date)").first().parents();String repayDateStr = repayElements.get(10).nextElementSibling().text().replaceAll("/", "-");billModal.setRepaydate(repayDateStr);System.out.println("还款日:"+repayDateStr);Element repayElement = document.select("font:containsOwn(RMB/USD Account)").first().parents().get(10);//本期应还金额String needPayStr = repayElement.nextElementSibling().text().replace("RMB ", "").replaceAll(",", "").replaceAll(" ","");billModal.setNeddrepay(new BigDecimal(needPayStr));System.out.println("应还金额:"+needPayStr);//最低应还金额String lowPayStr = repayElement.nextElementSibling().nextElementSibling().text().replace("RMB ", "").replaceAll(",", "").replaceAll(" ","");billModal.setLowrepay(new BigDecimal(lowPayStr));System.out.println("最低还款金额:" + lowPayStr);billModal.setBillDetailList(new ArrayList<BillDetail>());billModal.setBankname("民生银行");//交易明细Elements detailElements = document.select("span#loopband3").first().child(0).child(0).children();for(Element detailElement:detailElements){BillDetail billDetail = new BillDetail();billModal.getBillDetailList().add(billDetail);Element detail = detailElement.child(0).child(0).child(0).child(0).child(1).child(0).child(0).child(0).child(0).child(0).child(0).child(0).child(0);String detailDateStr = detail.child(1).text();detailDateStr = year+"-"+detailDateStr.replaceAll("/","-");billDetail.setTradedate(detailDateStr);System.out.println("交易日:"+detailDateStr);String detailStr = detail.child(3).text();billDetail.setDetail(detailStr);System.out.println("交易摘要:"+detailStr);String detailMoneyStr = detail.child(4).text().replace(",","");billDetail.setMoney(new BigDecimal(detailMoneyStr));System.out.println("交易金额:"+detailMoneyStr);String cardLastNum = detail.child(5).text();System.out.println("卡号后四位:"+cardLastNum);}return tempBillModalList;}/* public static void main(String[] args) {try {Document document = Jsoup.connect("http://127.0.0.1/card/minsheng.html").get();MinShengBankBill.readBill(document);} catch (IOException e) {e.printStackTrace();}}*/}

如果觉得《民生银行信用卡电子账单读取》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。