日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

交易Txt文件导出

發(fā)布時間:2025/3/15 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 交易Txt文件导出 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

private void writeFYFileToTxt(List list, HttpServletRequest request, String drxh, FileOutputStream fos, String currDate, int start, int end, List<P2pLoanExtInfo> extList,List<P2pProductRate> pprList) throws APSException {
?  ?try {
??    ?List<P2pRepayInfo> ePriList = getConvertRepayInfoList(list, start, end);//去list中的第n到第m條數(shù)據(jù)
???
??    ?// 生成 匯總信息? 0002900F0230755|AC01|20150611|001A|425|1061199.91
???    StringBuilder collectInfo = new StringBuilder(ConstantsApplication.MERCHANT_NUMBER);
???    collectInfo.append("|").append(ConstantsApplication.AC_OPERATION_CODE).append("|").append(currDate);
???    collectInfo.append("|").append(drxh + "A").append("|").append(ePriList.size()).append("|").append(countFYTotalAmount(ePriList));
??    ?fos.write((collectInfo.toString() + getTxtNewLine()).getBytes());
???    fos.flush();
???    collectInfo = null;
???    // 生成明細(xì)信息

      //000001|0105|622700182400007108X|鄭紅|1402.75|14569|FZ201404220042|13950316334
      //000002|0105|622700189254026136X|李麗|2104.13|15175|FZ201404230043|18605935575
??  ?for (int i = 0; i < ePriList.size(); i++) {
????    P2pRepayInfo ePri = (P2pRepayInfo) ePriList.get(i);
????    StringBuilder detailInfo = new StringBuilder(StringOperator.getSeq(i + 1)); // 明細(xì)序列
????    detailInfo.append("|").append(ePri.getRepayOpenBankCode());
????    detailInfo.append("|").append(ePri.getRepayAccountNo()).append("|").append(ePri.getLoanName()).append("|");
????    detailInfo.append(ePri.getMonthRtnAmount()).append("|").append(ePri.getPriNumber()).append("|").append(ePri.getLoanContractNo()).append       ("|").append(ePri.getLoanNamePhone());
????    fos.write((detailInfo.toString() + getTxtNewLine()).getBytes());//內(nèi)容自動換行
????    fos.flush();//本次讀取全部寫入文件
????    detailInfo = null;
??   ?}
??} catch (Exception e) {
???e.printStackTrace();
??}
?}

?//獲得換行符
?private String getTxtNewLine() {
??byte[] newLine = new byte[2];
??newLine[0]=0x0d;
??newLine[1]=0x0a;
??return new String(newLine);
?}

//序列化字符串

public static String getSeq(int seq){
??String rslt="";
??try{
???String seqStr=String.valueOf(seq);
???if(seqStr.length()==1){
????rslt="00000"+seqStr;
???}
???if(seqStr.length()==2){
????rslt="0000"+seqStr;
???}
???if(seqStr.length()==3){
????rslt="000"+seqStr;
???}
???if(seqStr.length()==4){
????rslt="00"+seqStr;
???}
???if(seqStr.length()==5){
????rslt="0"+seqStr;
???}
???if(seqStr.length()==6){
????rslt=seqStr;
???}
??}
??catch(Exception e){
???e.printStackTrace();
??}
??return rslt;
?}

轉(zhuǎn)載于:https://www.cnblogs.com/Defry/p/4576886.html

總結(jié)

以上是生活随笔為你收集整理的交易Txt文件导出的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。