/**
  * GroupPriceRange列表页
  *
  * @param currentPage
  * @param orderBy
  * @param orderType
  * @param request
  * @return
  */
 @SecurityMapping(
     title = "团购价格区间列表",
     value = "/admin/group_price_list.htm*",
     rtype = "admin",
     rname = "团购管理",
     rcode = "group_admin",
     rgroup = "运营")
 @RequestMapping("/admin/group_price_list.htm")
 public ModelAndView list(
     HttpServletRequest request,
     HttpServletResponse response,
     String currentPage,
     String orderBy,
     String orderType) {
   ModelAndView mv =
       new JModelAndView(
           "admin/blue/group_price_list.html",
           configService.getSysConfig(),
           this.userConfigService.getUserConfig(),
           0,
           request,
           response);
   String url = this.configService.getSysConfig().getAddress();
   if (url == null || url.equals("")) {
     url = CommUtil.getURL(request);
   }
   String params = "";
   GroupPriceRangeQueryObject qo =
       new GroupPriceRangeQueryObject(currentPage, mv, orderBy, orderType);
   // WebForm wf = new WebForm();
   // wf.toQueryPo(request, qo,GroupPriceRange.class,mv);
   IPageList pList = this.grouppricerangeService.list(qo);
   CommUtil.saveIPageList2ModelAndView(url + "/admin/group_range_list.htm", "", params, pList, mv);
   return mv;
 }
Esempio n. 2
0
 /**
  * @param args
  * @throws UnsupportedEncodingException
  */
 public static void main(String[] args) {
   String path = "E:\\apache-tomcat-7.0.42\\luence";
   double size = CommUtil.fileSize(new File(path));
   System.out.println(size);
   long size1 = getFileSize(new File(path));
   System.out.println(size1);
 }
  /**
   * grouppricerange保存管理
   *
   * @param id
   * @return
   */
  @SecurityMapping(
      title = "团购价格区间保存",
      value = "/admin/group_price_save.htm*",
      rtype = "admin",
      rname = "团购管理",
      rcode = "group_admin",
      rgroup = "运营")
  @RequestMapping("/admin/group_price_save.htm")
  public ModelAndView save(
      HttpServletRequest request,
      HttpServletResponse response,
      String id,
      String currentPage,
      String cmd) {
    WebForm wf = new WebForm();
    GroupPriceRange grouppricerange = null;
    if (id.equals("")) {
      grouppricerange = wf.toPo(request, GroupPriceRange.class);
      grouppricerange.setAddTime(new Date());
    } else {
      GroupPriceRange obj = this.grouppricerangeService.getObjById(Long.parseLong(id));
      grouppricerange = (GroupPriceRange) wf.toPo(request, obj);
    }

    if (id.equals("")) {
      this.grouppricerangeService.save(grouppricerange);
    } else this.grouppricerangeService.update(grouppricerange);
    ModelAndView mv =
        new JModelAndView(
            "admin/blue/success.html",
            configService.getSysConfig(),
            this.userConfigService.getUserConfig(),
            0,
            request,
            response);
    mv.addObject("list_url", CommUtil.getURL(request) + "/admin/group_price_list.htm");
    mv.addObject("op_title", "保存价格区间成功");
    mv.addObject(
        "add_url",
        CommUtil.getURL(request) + "/admin/group_price_add.htm" + "?currentPage=" + currentPage);
    return mv;
  }
Esempio n. 4
0
 /** 这个方法非常重要,重写计算缓存key的方法,没有该方法include的url值会出错 */
 @Override
 protected String calculateKey(HttpServletRequest httpRequest) {
   // TODO Auto-generated method stub
   String url = httpRequest.getRequestURI();
   String include_url =
       CommUtil.null2String(httpRequest.getAttribute("javax.servlet.include.request_uri"));
   StringBuffer stringBuffer = new StringBuffer();
   if (include_url.equals("")) {
     stringBuffer.append(httpRequest.getRequestURI()).append(httpRequest.getQueryString());
     String key = stringBuffer.toString();
     return key;
   } else {
     stringBuffer
         .append(
             CommUtil.null2String(httpRequest.getAttribute("javax.servlet.include.request_uri")))
         .append(
             CommUtil.null2String(httpRequest.getAttribute("javax.serlvet.include.query_string")));
     String key = stringBuffer.toString();
     return key;
   }
 }
Esempio n. 5
0
 @SecurityMapping(
     title = "支付方式保存",
     value = "/seller/payment_save.htm*",
     rtype = "seller",
     rname = "支付方式",
     rcode = "payment_seller",
     rgroup = "交易管理")
 @RequestMapping("/seller/payment_save.htm")
 public ModelAndView payment_save(
     HttpServletRequest request, HttpServletResponse response, String id) {
   ModelAndView mv =
       new JModelAndView(
           "user/default/usercenter/success.html",
           configService.getSysConfig(),
           this.userConfigService.getUserConfig(),
           0,
           request,
           response);
   WebForm wf = new WebForm();
   if (!id.equals("")) {
     Payment obj = this.paymentService.getObjById(CommUtil.null2Long(id));
     Payment payment = (Payment) wf.toPo(request, obj);
     String province = request.getParameter("province").split("_")[1];
     payment.setProvince(province);
     this.paymentService.update(payment);
   } else {
     Payment payment = wf.toPo(request, Payment.class);
     payment.setAddTime(new Date());
     payment.setType("user");
     User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId());
     payment.setStore(user.getStore());
     String province = request.getParameter("province").split("_")[1];
     payment.setProvince(province);
     this.paymentService.save(payment);
   }
   mv.addObject("op_title", "支付方式保存成功");
   mv.addObject("url", CommUtil.getURL(request) + "/seller/payment.htm");
   return mv;
 }
Esempio n. 6
0
  @Override
  protected void doFilter(
      final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain)
      throws AlreadyGzippedException, AlreadyCommittedException, FilterNonReentrantException,
          LockTimeoutException, Exception {
    if (cacheURLs == null || cacheURLs.size() < 1) {
      init();
    }
    String url = request.getRequestURI();

    String include_url =
        CommUtil.null2String(request.getAttribute("javax.servlet.include.request_uri"));
    boolean flag = false;
    /*	if(url.contains("floor.htm")){
    	StringBuffer url_param = request.getRequestURL();
    	 if (request.getQueryString() != null) {
    		 url_param.append("?");
    		 url_param.append(request.getQueryString());
    	 }
    	System.out.println(url_param.toString());
    	 // 获取cookies
    	String pc_city_id = CommonUtils.getCityIdFromCookies(request);
    	url=url+"?city_id="+pc_city_id;
    	System.out.println(pc_city_id);
    	if(!cacheURLs.contains(url)){//不包含
    		cacheURLs.add(url);
    	}
    }*/
    if (cacheURLs != null && cacheURLs.size() > 0) {
      for (String cacheURL : cacheURLs) {
        if (include_url.trim().equals("")) {
          if (url.contains(cacheURL.trim())) {
            flag = true;
            break;
          }
        } else {
          if (include_url.contains(cacheURL.trim())) {
            flag = true;
            break;
          }
        }
      }
    }
    // 如果包含我们要缓存的url 就缓存该页面,否则执行正常的页面转向
    if (flag) {
      super.doFilter(request, response, chain);
    } else {
      chain.doFilter(request, response);
    }
  }
Esempio n. 7
0
 @SecurityMapping(
     title = "支付方式卸载",
     value = "/seller/payment_uninstall.htm*",
     rtype = "seller",
     rname = "支付方式",
     rcode = "payment_seller",
     rgroup = "交易管理")
 @RequestMapping("/seller/payment_uninstall.htm")
 public ModelAndView payment_uninstall(
     HttpServletRequest request, HttpServletResponse response, String mark) {
   ModelAndView mv =
       mv =
           new JModelAndView(
               "user/default/usercenter/success.html",
               configService.getSysConfig(),
               this.userConfigService.getUserConfig(),
               0,
               request,
               response);
   Map params = new HashMap();
   User user = this.userService.getObjById(SecurityUserHolder.getCurrentUser().getId());
   params.put("mark", mark);
   params.put("store_id", user.getStore().getId());
   List<Payment> objs =
       this.paymentService.query(
           "select obj from Payment obj where obj.mark=:mark and obj.store.id=:store_id",
           params,
           -1,
           -1);
   if (objs.size() > 0) {
     for (OrderForm of : objs.get(0).getOfs()) {
       of.setPayment(null);
       this.orderFormService.update(of);
     }
     this.paymentService.delete(objs.get(0).getId());
   }
   mv.addObject("op_title", "支付方式卸载成功");
   mv.addObject("url", CommUtil.getURL(request) + "/seller/payment.htm");
   return mv;
 }
Esempio n. 8
0
 /**
  * watermark保存管理
  *
  * @param id
  * @return
  */
 @SecurityMapping(
     title = "图片水印保存",
     value = "/seller/watermark_save.htm*",
     rtype = "seller",
     rname = "图片管理",
     rcode = "album_seller",
     rgroup = "其他设置")
 @RequestMapping("/seller/watermark_save.htm")
 public ModelAndView watermark_save(
     HttpServletRequest request,
     HttpServletResponse response,
     String id,
     String currentPage,
     String cmd) {
   ModelAndView mv = null;
   if (SecurityUserHolder.getCurrentUser().getStore() != null) {
     WebForm wf = new WebForm();
     WaterMark watermark = null;
     if (id.equals("")) {
       watermark = wf.toPo(request, WaterMark.class);
       watermark.setAddTime(new Date());
     } else {
       WaterMark obj = this.watermarkService.getObjById(Long.parseLong(id));
       watermark = (WaterMark) wf.toPo(request, obj);
     }
     watermark.setStore(SecurityUserHolder.getCurrentUser().getStore());
     String path = request.getSession().getServletContext().getRealPath("/") + "upload/wm";
     try {
       Map map = CommUtil.saveFileToServer(request, "wm_img", path, null, null);
       if (!map.get("fileName").equals("")) {
         Accessory wm_image = new Accessory();
         wm_image.setAddTime(new Date());
         wm_image.setHeight(CommUtil.null2Int(map.get("height")));
         wm_image.setName(CommUtil.null2String(map.get("fileName")));
         wm_image.setPath("upload/wm");
         wm_image.setSize(CommUtil.null2Float(map.get("fileSize")));
         wm_image.setUser(SecurityUserHolder.getCurrentUser());
         wm_image.setWidth(CommUtil.null2Int("width"));
         this.accessoryService.save(wm_image);
         watermark.setWm_image(wm_image);
       }
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     if (id.equals("")) {
       this.watermarkService.save(watermark);
     } else this.watermarkService.update(watermark);
     mv =
         new JModelAndView(
             "success.html",
             configService.getSysConfig(),
             this.userConfigService.getUserConfig(),
             1,
             request,
             response);
     mv.addObject("op_title", "水印设置成功");
   } else {
     mv =
         new JModelAndView(
             "error.html",
             configService.getSysConfig(),
             this.userConfigService.getUserConfig(),
             1,
             request,
             response);
     mv.addObject("op_title", "您尚未开店");
   }
   mv.addObject("url", CommUtil.getURL(request) + "/seller/watermark.htm");
   return mv;
 }