Ejemplo n.º 1
0
 /**
  * 发卡
  *
  * @author cai.yc 2012-11-20
  * @param model
  * @param query query.createCount : 生成数量,为必填项目,最大不能超过50000<br>
  *     query.cityCode : 六位城市代码,如201000<br>
  *     query.typeCode : 四位类型服务级别代码,如0102表示类型为01,服务级别为02<br>
  * @param req
  * @param res
  * @return 返回"c"含义:<br>
  *     "A0000" : 成功<br>
  *     "A0001" : 卡号剩余数量不够<br>
  *     "A0002" : 输入的发卡数量不合法可能为0,或超过500000<br>
  */
 @RequestMapping("/doCreateCard.html")
 public String doCreateCardAction(
     ModelMap model, CardQueryModel query, HttpServletRequest req, HttpServletResponse res) {
   int leftCount = cardBO.cardIdLeft(query);
   if (query.getCreateCount() == null) {
     model.put("c", "A0003");
   } else if (query.getCreateCount() <= 0 || query.getCreateCount() > 500000) {
     // 发卡数量不合法
     model.put("c", "A0002");
   } else if (leftCount < query.getCreateCount()) {
     // 剩余数量不足
     model.put("c", "A0001");
     model.put("d", leftCount);
   } else {
     // 参数合法,生成卡、激活码
     query.setCreateIp(req.getRemoteHost());
     query.setCreateUserId((String) req.getSession().getAttribute("MY120_MARKET_LOGIN_USER_INFO"));
     int result = cardBO.createCard(query);
     model.put("timestamp", query.getGmtCreate());
     model.put("cardTypeName", cardTypeBO.getCardTypeName(query.getTypeCode()));
     model.put("d", result);
     model.put("c", "A0000");
   }
   return "card/do_create_card.html";
 }
Ejemplo n.º 2
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.º 3
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);
 }
Ejemplo n.º 4
0
 /**
  * 分页查询卡信息集合
  *
  * @param
  * @return
  * @author 王磊<*****@*****.**>
  * @since 2012-11-21上午10:12:02
  */
 @RequestMapping("/doSearchCardInfoList.html")
 public ModelAndView doSearchCardInfoListAction(ModelMap model, CardQueryModel query) {
   ModelAndView jsonView = new ModelAndView("libJsonView");
   query.setIsLimit("1");
   try {
     Map<String, Object> result = cardBO.selectCardInfoList(query);
     JSONObject obj = new JSONObject();
     obj.put("sumcount", result.get("sumcount"));
     obj.put("count", result.get("count"));
     obj.put("data", result.get("data"));
     jsonView.addObject(obj);
   } catch (Exception e) {
     e.printStackTrace();
   }
   return jsonView;
 }