Exemplo n.º 1
0
  // 新增該場次ticket
  @SuppressWarnings("unused")
  private void scrTicket(ShowVO showVO, int n) {
    int showId = showVO.getShowId();
    int screenId = showVO.getScreenId();
    int ticketTypeId = showVO.getTicketTypeId();
    ScreenVO screenVO = new ScreenService().queryByID(showVO.getScreenId());
    int rowX = screenVO.getSeatX();
    int rowY = screenVO.getSeatY();

    @SuppressWarnings("unused")
    int count = 0;
    for (int seatX = 1; seatX <= rowX; seatX++) {
      for (int seatY = 1; seatY <= rowY; seatY++) {
        // if 前n排,空下左右各4個,共8個空位
        if (seatX <= n && seatY >= rowY - 7) {
          break;
        } else {
          ts.addTicket(seatX, seatY, showId, screenId, ticketTypeId);
          count++;
        }
      }
    } // System.out.println("新增: "  + count +"張票");
  }