/** 导出EXCELL */ public void exportFtpFile() { response.setContentType("application/vnd.ms-excel; charset=GBK"); OutputStream fOut = null; try { fOut = response.getOutputStream(); StringBuffer cvs = ftpFileService.export(getParams()); byte[] buffer = cvs.toString().getBytes("GBK"); response.reset(); response.addHeader( "Content-Disposition", "attachment;filename=" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date()) + ".csv"); response.addHeader("Content-Length", "" + buffer.length); response.setHeader("Content-Type", "application/vnd.ms-excel"); response.setContentType("application/ms-excel"); response.getOutputStream().write(buffer); response.getOutputStream().close(); } catch (Exception e) { e.printStackTrace(); } finally { try { fOut.flush(); fOut.close(); } catch (Exception e) { } } }
@SuppressWarnings("unchecked") public String getFtpFile() { try { Map<String, Object> map = ftpFileService.getFtpFileByName( getParams(), (this.page - 1) * this.pageSize, this.page * this.pageSize); rows = JSONObject.fromObject(map); } catch (Exception e) { logger.error("查询一致率错误:" + e); } return SUCCESS; }
public String listComponent() { String userType = this.request.getParameter("userType"); List<component> orgs = ftpFileService.listComponent(userType); component com = new component(); com.setCode("0"); com.setName("--请选择--"); orgs.add(0, com); try { _rows = JSONArray.fromObject(orgs); } catch (Exception e) { logger.error("查询平台错误:" + e); } return SUCCESS; }