Ejemplo n.º 1
0
 /**
  * 下载卡号,激活码 excel文件(根据发卡时间gmt_create)
  *
  * @author cai.yc 2012-11-20
  * @param model
  * @param query query.gmtCreate : 发卡时间,为必填参数
  * @return 指定发卡时间的所有卡列表的excel文件,默认文件名为日期
  * @throws Exception
  */
 @SuppressWarnings("unchecked")
 @RequestMapping("/downloadCard.html")
 public ModelAndView doExcelAction(ModelMap model, CardQueryModel query) throws Exception {
   query.setPageindex("0");
   query.setPagesize("20");
   String[] columnKey = {"number", "cdkey"};
   String[] columnValue = {"卡号", "激活码"};
   Map<String, Object> result = cardBO.selectCardInfoList(query);
   List<Map<String, Object>> dataList = (List<Map<String, Object>>) result.get("data");
   SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
   ViewExcelPOI viewExcel =
       new ViewExcelPOI(columnKey, columnValue, dataList, format.format(new Date()));
   return new ModelAndView(viewExcel);
 }
Ejemplo n.º 2
0
 /**
  * 导出excel
  *
  * @param
  * @return
  * @author 王磊<*****@*****.**>
  * @since 2012-11-21上午10:13:01
  */
 @SuppressWarnings("unchecked")
 @RequestMapping("/doExcel.html")
 public ModelAndView doExcelForCreateAction(ModelMap model, CardQueryModel query)
     throws Exception {
   query.setPageindex("0");
   query.setPagesize("20");
   String[] columnKey = {
     "number", "cdkey", "cardTypeName", "cardPrice", "cityName", "status", "gmtCreate", "createIp"
   };
   String[] columnValue = {"卡号", "激活码", "类型", "价格", "发行城市", "使用状态", "发卡时间", "IP地址"};
   Map<String, Object> result = cardBO.selectCardInfoList(query);
   List<Map<String, Object>> dataList = (List<Map<String, Object>>) result.get("data");
   SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
   ViewExcelPOI viewExcel =
       new ViewExcelPOI(columnKey, columnValue, dataList, format.format(new Date()));
   return new ModelAndView(viewExcel);
 }