public String onETLRptData() { List<String> msgList = new ArrayList<>(); try { if (selectedOptions.isEmpty()) { MessageUtil.addInfo("请选择导入的报表..."); return null; } for (String option : selectedOptions) { String fileSn = StringUtils.leftPad("" + (Integer.parseInt(option) - 1), 2, '0'); String rptSn = StringUtils.leftPad(option, 2, '0'); String filename = "LIST_" + fileSn + "_371000000.dat"; String rptType = "10" + rptSn; eclImportService.importDataFromTxt(startdate, filename, rptType, msgList); } MessageUtil.addInfo("数据处理结果如下:"); for (String s : msgList) { MessageUtil.addInfo(s); } } catch (Exception ex) { logger.error("数据处理错误。", ex); for (String s : msgList) { MessageUtil.addError(s); } MessageUtil.addError("数据处理错误。" + ex.getMessage()); } return null; }
private String checkAndTransInputDate() { Date date = null; try { date = new SimpleDateFormat("yyyyMMdd").parse(startdate); } catch (ParseException e) { MessageUtil.addError("日期输入错误。"); return null; } return (new SimpleDateFormat("yyyyMMdd").format(date)); }