public LotStatusResponse getLotStatus(StatusRequest statusRequest) { LotStatusResponse lotResponse = null; try { LotsDAO lotsDAO = new LotsDAO(); LotStatusDTO lotStatusDto = lotsDAO.getLotStatus(statusRequest); if (lotStatusDto != null) { String lotStatus = getLotImplementationStatus(lotStatusDto.getStartDate(), lotStatusDto.getEndDate()); lotResponse = new LotStatusResponse( lotStatusDto.getHasHigestBidChanged(), lotStatusDto.getHighestBid(), lotStatusDto.getHigestBidUser(), lotStatusDto.getCurrentServerTime(), lotStatus); } else { LotDTO lotDTo = lotsDAO.getLotById(statusRequest.getLotid()); String lotStatus = getLotImplementationStatus(lotDTo.getStartDate(), lotDTo.getEndDate()); lotResponse = new LotStatusResponse(false, 0, 0, DateUtil.getCurrentServerTime(), lotStatus); } } catch (SQLException s) { s.printStackTrace(); } catch (IOException s) { s.printStackTrace(); } return lotResponse; }
public LotsResponse getLotById(int id) { LotsResponse lotsResponse = null; try { LotsDAO lotsDAO = new LotsDAO(); LotDTO lotDTO = lotsDAO.getLotById(id); lotsResponse = buildLotResponseFromDTOs(lotDTO); } catch (SQLException s) { s.printStackTrace(); } catch (IOException s) { s.printStackTrace(); } return lotsResponse; }