コード例 #1
0
  public String itemDetail() {
    logger.info("11111___________");
    String itemFlag = ServletActionContext.getRequest().getParameter("itemFlag");
    if (itemFlag == null) return "sessionDestory";

    ItemInfoDto itemInfoDto = iItemInfo.getItemInfoDto(itemFlag);
    if (itemInfoDto == null) {
      return "sessionDestory";
    }

    AuctionInfoDto auctionInfoDto = iAuctionInfo.getAuctionInfoDto(itemInfoDto.getAuctionId());
    if (auctionInfoDto == null || ("0").equals(auctionInfoDto.getPublishFlag())) {
      return "sessionDestory";
    }
    auctionInfoDto.setCompanyName(
        iCompanyInfo.getCompanyInfo(auctionInfoDto.getAuctionCompanyId()).getCompanyName());
    auctionInfoDto.setCompanyInterfaceFlag(
        iCompanyInfo
            .getCompanyInfo(auctionInfoDto.getAuctionCompanyId())
            .getCompanyInterfaceFlag());
    ServletActionContext.getRequest().setAttribute("auctionInfoDto", auctionInfoDto);

    List<AuctionInfoDto> auctionInfoDtoListTop = iAuctionInfo.getAuctionInfoDtoListTop();
    ServletActionContext.getRequest().setAttribute("auctionInfoDtoListTop", auctionInfoDtoListTop);

    ServletActionContext.getRequest().setAttribute("itemInfoDto", itemInfoDto);

    String indexPrev = "" + (Long.parseLong(itemInfoDto.getItemNumber()) - 1);
    ItemInfoDto itemInfoDtoPrev =
        iItemInfo.getItemInfoDtoByIndexAndAuction(indexPrev, itemInfoDto.getAuctionId());
    if (itemInfoDtoPrev != null) {
      ServletActionContext.getRequest().setAttribute("prevFlag", ("" + itemInfoDtoPrev.getId()));
    } else {
      ServletActionContext.getRequest().setAttribute("prevFlag", "-1");
    }
    String indexNext = "" + (Long.parseLong(itemInfoDto.getItemNumber()) + 1);
    ItemInfoDto itemInfoDtoNext =
        iItemInfo.getItemInfoDtoByIndexAndAuction(indexNext, itemInfoDto.getAuctionId());
    if (itemInfoDtoNext != null) {
      ServletActionContext.getRequest().setAttribute("nextFlag", ("" + itemInfoDtoNext.getId()));
    } else {
      ServletActionContext.getRequest().setAttribute("nextFlag", "-1");
    }

    List<Object[]> itemInfoListSimilar =
        iItemInfo.getItemInfoListSimilar(itemInfoDto.getItemType(), "" + itemInfoDto.getId());
    ServletActionContext.getRequest().setAttribute("itemInfoListSimilar", itemInfoListSimilar);

    List<UploadImgInfo> uploadImgInfoList = new ArrayList<UploadImgInfo>();
    if (itemInfoDto.getInterfaceImgUrl() != null
        && !"".equals(itemInfoDto.getInterfaceImgUrl())) { // interface
      UploadImgInfo uploadImgInfo = new UploadImgInfo();
      uploadImgInfo.setUploadUrl(itemInfoDto.getInterfaceImgUrl());
      uploadImgInfoList.add(uploadImgInfo);
    } else {
      uploadImgInfoList = iUploadImgInfo.getUploadImgInfoList("5", itemFlag);
    }
    ServletActionContext.getRequest().setAttribute("uploadImgInfoList", uploadImgInfoList);

    HttpServletRequest request = ServletActionContext.getRequest();
    String requestUrl =
        request.getRequestURL()
            + (request.getQueryString() == null ? "" : "?" + request.getQueryString());
    String requestUrl_n = "";
    try {
      requestUrl_n = java.net.URLEncoder.encode(requestUrl, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    ServletActionContext.getRequest().setAttribute("requestUrl", requestUrl_n);

    return "itemDetail";
  }
コード例 #2
0
  public String auctionDetail() {
    logger.info("11111___________");
    String auctionFlag = ServletActionContext.getRequest().getParameter("auctionFlag");
    if (auctionFlag == null) {
      return "sessionDestory";
    }

    AuctionInfoDtoIndex auctionInfoDtoIndex = iAuctionInfo.getAuctionInfoIndexDto(auctionFlag);
    if (auctionInfoDtoIndex == null || ("0").equals(auctionInfoDtoIndex.getPublishFlag())) {
      return "sessionDestory";
    }
    auctionInfoDtoIndex.setCompanyName(
        iCompanyInfo.getCompanyInfo(auctionInfoDtoIndex.getAuctionCompanyId()).getCompanyName());
    auctionInfoDtoIndex.setCompanyInterfaceFlag(
        iCompanyInfo
            .getCompanyInfo(auctionInfoDtoIndex.getAuctionCompanyId())
            .getCompanyInterfaceFlag());
    ServletActionContext.getRequest().setAttribute("auctionInfoDtoIndex", auctionInfoDtoIndex);

    List<AuctionInfoDto> auctionInfoDtoListTop = iAuctionInfo.getAuctionInfoDtoListTop();
    ServletActionContext.getRequest().setAttribute("auctionInfoDtoListTop", auctionInfoDtoListTop);

    String currentPage = ServletActionContext.getRequest().getParameter("currentPage");
    if (currentPage == null || ("").equals(currentPage)) {
      currentPage = "1";
    }
    ServletActionContext.getRequest().setAttribute("currentPage", currentPage);
    String url =
        ServletActionContext.getActionMapping().getName() + "?auctionFlag=" + auctionFlag + "&";
    long count = Long.valueOf(iItemInfo.getItemInfoDtoCount(auctionFlag));
    BasePage basePage = new BasePage(count, currentPage, url);
    List<ItemInfoDto> itemInfoDtoList = iItemInfo.getItemInfoDtoList(auctionFlag, basePage);
    ServletActionContext.getRequest().setAttribute("basePage", basePage);
    if (itemInfoDtoList != null && itemInfoDtoList.size() > 0) {
      for (int j = 0; j < itemInfoDtoList.size(); j++) {
        ItemInfoDto itemInfoDto = itemInfoDtoList.get(j);
        String itemFlag = "" + itemInfoDto.getId(); // item id
        List<UploadImgInfo> uploadImgInfoList = iUploadImgInfo.getUploadImgInfoList("5", itemFlag);
        if (uploadImgInfoList == null) {
          if (itemInfoDto.getInterfaceImgUrl() == null
              || "".equals(itemInfoDto.getInterfaceImgUrl())) {
            itemInfoDto.setImgCountFlag("0");
            itemInfoDto.setImgUrl("");
          } else {
            itemInfoDto.setImgCountFlag("0");
            itemInfoDto.setImgUrl(itemInfoDto.getInterfaceImgUrl());
          }
        } else {
          if (uploadImgInfoList.size() == 0) {
            itemInfoDto.setImgCountFlag("0");
            itemInfoDto.setImgUrl("");
          } else if (uploadImgInfoList.size() == 1) {
            itemInfoDto.setImgCountFlag("0");
            itemInfoDto.setImgUrl(uploadImgInfoList.get(0).getUploadUrl());
          } else if (uploadImgInfoList.size() > 1) {
            itemInfoDto.setImgCountFlag("1");
            itemInfoDto.setImgUrl(uploadImgInfoList.get(0).getUploadUrl());
          }
        }
      }
    }
    ServletActionContext.getRequest().setAttribute("itemInfoDtoList", itemInfoDtoList);

    HttpServletRequest request = ServletActionContext.getRequest();
    String requestUrl =
        request.getRequestURL()
            + (request.getQueryString() == null ? "" : "?" + request.getQueryString());
    String requestUrl_n = "";
    try {
      requestUrl_n = java.net.URLEncoder.encode(requestUrl, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    ServletActionContext.getRequest().setAttribute("requestUrl", requestUrl_n);

    return "auctionDetail";
  }