private void dealWithAmt(Cell cell, String amt) { if (StringUtil.isEmpty(amt)) { cell.setCellValue(""); } else { cell.setCellValue(Double.valueOf(amt)); } }
@SuppressWarnings("unchecked") public String execute() throws Exception { Context context = getContext(); Context sessionContext = this.getSessionContext(); String cstNo = sessionContext.getDataAsStr("cstNo"); String operChannel = sessionContext.getDataAsStr("operChannel"); Context parentContext = context.getParent(); String flowNo = parentContext.getDataAsStr("flowNo"); context.put("accountNo", accNo); context.put("beginDate", fromDate); context.put("flowNo", flowNo); context.put("endDate", toDate); context.put("cashFlag", "1"); context.put("currency", "01"); context.put("sortType", "1"); context.put("pageNo", pageNo); context.put("pageSize", PersonConstants.APP_PAGE_SIZE + ""); context.put("operChannel", operChannel); context.put("cstNo", cstNo); IcopClientManager.callChannelService(context, "PSVR000003"); detailList2 = (List<Map<String, Object>>) context.getDataElement("accountDetailList"); if (detailList2 != null && detailList2.size() > 0) { for (int i = 0; i < detailList2.size(); i++) { Map<String, Object> map = detailList2.get(i); BigDecimal creditamt = new BigDecimal((String) map.get("creditamt")); creditamtSum = creditamtSum.add(creditamt); BigDecimal debitamt = new BigDecimal((String) map.get("debitamt")); debitamtSum = debitamtSum.add(debitamt); map.put( "currency", EBWebContextUtil.getAprShowMsg("CURRENCY_TYPE", (String) map.get("currency"))); map.put( "loanFlagTxt", EBWebContextUtil.getAprShowMsg("LOANFLAG_TYPE", (String) map.get("loanFlag"))); map.put("accountName", cstNameHost); map.put("accountNo", accNo); detailList.add(map); } } if (!StringUtil.isEmpty(type)) { if ("txt".equals(type)) { inputStream = generateTxt(detailList); contentType = MimeType.TXT.toString(); } else if ("xls".equals(type)) { inputStream = generateExcel(detailList); contentType = MimeType.XLS.toString(); } else if ("pdf".equals(type)) { inputStream = generatePdf(detailList); contentType = MimeType.PDF.toString(); } } filename = fromDate + "-" + toDate + "." + type; return SUCCESS; }
private String formatDate(String date) { if (!StringUtil.isEmpty(date)) { if (date.length() >= STR_6) { return date.substring(0, STR_4) + "-" + date.substring(STR_4, STR_6) + "-" + date.substring(STR_6, STR_8); } else { return date; } } else { return ""; } }