Java tutorial
/* * Copyright(C) 2016 GMO-Z.com RUNSYSTEM JSC. All rights reserved. * * (1)????GMO??? ???????? * (2)??????GMO??? ?????? * * This software is the confidential and proprietary information of * GMO-Z.com RUNSYSTEM. You shall not disclose such Confidential Information * and shall use it only in accordance with the terms of the license * agreement you entered into with GMO-Z.com RUNSYSTEM. */ package jp.gmo.zcom.ticket.service.impl; import java.util.ArrayList; import java.util.Date; import java.util.List; import jp.gmo.zcom.ticket.dao.BookTicketDao; import jp.gmo.zcom.ticket.dto.MatchDto; import jp.gmo.zcom.ticket.entity.Floor; import jp.gmo.zcom.ticket.entity.Gate; import jp.gmo.zcom.ticket.entity.Match; import jp.gmo.zcom.ticket.entity.Seat; import jp.gmo.zcom.ticket.entity.Stand; import jp.gmo.zcom.ticket.service.BookTicketService; import jp.gmo.zcom.ticket.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; /** * @author : thuyttt * @PG_ID : BookTicketServiceImpl * @createDate : 04.08.2016 */ @Service public class BookTicketServiceImpl implements BookTicketService { @Autowired private BookTicketDao bookTicketDao; /** * get list of match * * @param stadiumId * @param matchDate * @return list match */ @Transactional(readOnly = true, propagation = Propagation.REQUIRED) @Override public List<MatchDto> getListMatch(Date matchDate) { List<Match> listMatch = bookTicketDao.getListMatch(matchDate); List<MatchDto> listMatchDto = new ArrayList<MatchDto>(); for (Match match : listMatch) { MatchDto matchDto = new MatchDto(); matchDto.setMatchId(match.getMatchId()); matchDto.setMatchName(match.getMatchName()); matchDto.setMatchDate(DateUtils.getDateByFormat(match.getMatchDate(), "dd/MM/yyyy")); matchDto.setMatchTime(match.getMatchTime()); matchDto.setStadium(bookTicketDao.getStadiumById(match.getStadiumId())); listMatchDto.add(matchDto); } return listMatchDto; } /** * get list of stand * * @param stadiumId * @return list stand */ @Transactional(readOnly = true, propagation = Propagation.REQUIRED) @Override public List<Stand> getListStand(Integer stadiumId) { return bookTicketDao.getListStand(stadiumId); } /** * get list of floor * * @param stadiumId * @param standId * @return list floor */ @Transactional(readOnly = true, propagation = Propagation.REQUIRED) @Override public List<Floor> getListFloor(Integer stadiumId, Integer standId) { return bookTicketDao.getListFloor(stadiumId, standId); } /** * get list of gate * * @param stadiumId * @param standId * @param floorId * @return list gate */ @Transactional(readOnly = true, propagation = Propagation.REQUIRED) @Override public List<Gate> getListGate(Integer stadiumId, Integer standId, Integer floorId) { return bookTicketDao.getListGate(stadiumId, standId, floorId); } /** * get list of seat * * @param stadiumId * @param standId * @param floorId * @param gateId * @return list seat */ @Transactional(readOnly = true, propagation = Propagation.REQUIRED) @Override public List<Seat> getListSeat(Integer stadiumId, Integer standId, Integer floorId, Integer gateId) { return bookTicketDao.getListSeat(stadiumId, standId, floorId, gateId); } }