/**
* remark:
* HashMap与LinkedHashMap的区别
* 这里必须使用LinkedHashMap:
* 原因是LinkedHashMap保存了记录的插入顺序,
* 在用Iterator遍历LinkedHashMap时,
* 先得到的记录肯定是先插入的
* 如果这里使用了HashMap则在resultList.addAll(summary.values())
* 之后写到Excel中时顺序就会乱掉,
* 而使用LinkedHashMap就会保持与reportTtlDataList循环记录的顺序一致
*/
Map summary = new LinkedHashMap();
summary.put("", new AribaReceiptInvoicePojo());
AribaReceiptInvoicePojo titleChange = new AribaReceiptInvoicePojo();
titleChange.setEcaGLAccount("差异汇总");
titleChange.setEcaGRQty("Y");
titleChange.setEcaActAmt("N");
summary.put("title", titleChange);
if(reportTtlDataList.size()>0){
for (int i = 0; i < reportTtlDataList.size(); i++) {
Object[] obj = reportTtlDataList.get(i);
AribaReceiptInvoicePojo c = new AribaReceiptInvoicePojo();
c.setEcaGLAccount(obj[0].toString());
c.setEcaGRQty(obj[1].toString());
c.setEcaActAmt(obj[2].toString());
summary.put("c" + i, c);
}
}
resultList.addAll(summary.values());
return resultList;