Example #1
0
  public String showEditUpdate() {
    Seller seller = (Seller) getSession().getAttribute(FrontContainer.SELLER_INFO);
    if (seller == null || StringUtils.isBlank(seller.getOwner_mobile())) {
      return "toLogin";
    }
    String imgTitle = getRequest().getParameter("indexImg.title");
    String picture = getRequest().getParameter("indexImg.picture");
    String order1 = getRequest().getParameter("indexImg.order1");
    IndexImg indexImg1 = new IndexImg();
    indexImg1.setTitle(imgTitle);
    indexImg1.setPicture(picture);
    if (StringUtils.isNotBlank(order1)) {
      indexImg1.setOrder1(Integer.valueOf(order1));
    }

    indexImg1.setOwner_id(seller.getId());
    indexImgService.update(indexImg1);
    IndexImg indexImg2 = new IndexImg();
    indexImg2.setOwner_id(seller.getId());
    indexImgs = indexImgService.selectList(indexImg2);
    indexImgSize = indexImgs.size();

    selectLeftMenu = "show";
    e = sellerService.selectById(seller.getId());
    setSelectMenu(FrontContainer.not_select_menu); // 设置主菜单为不选中
    return "showpage";
  }
Example #2
0
  public String showDelete() {
    Seller seller = (Seller) getSession().getAttribute(FrontContainer.SELLER_INFO);
    if (seller == null || StringUtils.isBlank(seller.getOwner_mobile())) {
      return "toLogin";
    }
    String imgId = getRequest().getParameter("e.id");

    //        String picture = getRequest().getParameter("e.show_img");
    //        String order1 = getRequest().getParameter("e.order1");
    IndexImg indexImg1 = indexImgService.selectById(imgId);
    String picture = indexImg1.getPicture();
    // indexImg1.setPicture(picture);

    // indexImg1.setOwner_id(seller.getId());
    indexImgService.delete(indexImg1);
    // String realPath= ServletActionContext.getServletContext().getRealPath("/");
    String path = ServletActionContext.getServletContext().getRealPath("/") + picture;
    if (StringUtils.isNotBlank(path)) {
      // path = pDir + path;
      File file = new File(path);

      if (file.exists()) {
        deleteFile(file);
        // getResponse().getWriter().write("succeed");
      }
    }
    IndexImg indexImg2 = new IndexImg();
    indexImg2.setOwner_id(seller.getId());
    indexImgs = indexImgService.selectList(indexImg2);
    indexImgSize = indexImgs.size();
    selectLeftMenu = "show";
    e = sellerService.selectById(seller.getId());
    setSelectMenu(FrontContainer.not_select_menu); // 设置主菜单为不选中
    return show();
  }
Example #3
0
  public String show() {
    Seller seller = (Seller) getSession().getAttribute(FrontContainer.SELLER_INFO);
    if (seller == null || StringUtils.isBlank(seller.getOwner_mobile())) {
      return "toLogin";
    }

    selectLeftMenu = "show";
    e = sellerService.selectById(seller.getId());
    setSelectMenu(FrontContainer.not_select_menu); // 设置主菜单为不选中

    IndexImg indexImg2 = new IndexImg();
    indexImg2.setOwner_id(seller.getId());
    indexImgs = indexImgService.selectList(indexImg2);
    indexImgSize = indexImgs.size();
    return "showpage";
  }
Example #4
0
  public String showUpdate() {
    Seller seller = (Seller) getSession().getAttribute(FrontContainer.SELLER_INFO);
    if (seller == null || StringUtils.isBlank(seller.getOwner_mobile())) {
      return "toLogin";
    }
    String imgTitle = getRequest().getParameter("e.title");
    String picture = getRequest().getParameter("e.show_img");
    if (picture != null && !picture.isEmpty()) {
      if (picture.startsWith("/JJShop")) {
        picture = picture.substring(picture.indexOf("/JJShop"));
      }
    }
    String order1 = getRequest().getParameter("e.order1");

    IndexImg indexImg1 = new IndexImg();
    indexImg1.setTitle(imgTitle);
    indexImg1.setPicture(picture);
    if (StringUtils.isNotBlank(order1)) {
      Pattern p = Pattern.compile("\\d+");
      Matcher m = p.matcher(order1);
      if (m.find()) {
        indexImg1.setOrder1(Integer.valueOf(order1));
      } else {
        indexImg1.setOrder1(1);
      }

    } else {
      indexImg1.setOrder1(1);
    }

    indexImg1.setOwner_id(seller.getId());
    indexImgService.insert(indexImg1);
    IndexImg indexImg2 = new IndexImg();
    indexImg2.setOwner_id(seller.getId());
    indexImgs = indexImgService.selectList(indexImg2);
    indexImgSize = indexImgs.size();

    selectLeftMenu = "show";
    e = sellerService.selectById(seller.getId());
    setSelectMenu(FrontContainer.not_select_menu); // 设置主菜单为不选中
    return "showpage";
  }
Example #5
0
  public String toShop() {
    String sellerID = getRequest().getParameter("sellerID");
    if (StringUtils.isBlank(sellerID)) {
      return null;
    }
    e.clear();
    // e.setOwner_id(sellerID);
    e = sellerService.selectById(sellerID);
    IndexImg indexImg1 = new IndexImg();
    indexImg1.setOwner_id(sellerID);
    // indexImg = indexImgService.getSellerImg(indexImg);
    // e.setIndexIMG(indexImg.getPicture());
    indexImgs = indexImgService.selectList(indexImg1);

    net.jeeshop.services.front.sellerproduct.bean.Product p =
        new net.jeeshop.services.front.sellerproduct.bean.Product();
    p.setOwner_id(sellerID);
    p.setStatus(2);
    List<net.jeeshop.services.front.sellerproduct.bean.Product> products =
        productService.selectList(p);
    e.setProducts(products);
    return "toSellerShop";
  }