Service is compiling
but shows error
500 in swagger ui and
not giving output help!
Below are controller, service,implementation codes ,please help me get through this.
Rest all services are working fine
controller
@ApiOperation(value="Returns all bookings") //Operation to view all bookings
@ApiResponses(value= {
@ApiResponse(code=201, message="All Bookings found"),
@ApiResponse(code=404, message="No such booking found")
})
@GetMapping(value = "/booking/all", produces = MediaType.APPLICATION_JSON_VALUE)
public List<Booking> getAllBooking() throws BookingNotFoundException {
logger.info("View all booking service started..");
return bookingService.getAllBookings();
}
Service Implementation
@Override
public List<Booking> getAllBookings() {
return BookingUtil.convertBookingEntityListIntoBookingList(bookingRepo.findAll());
}
Service
public List<Booking> getAllBookings();
util
public static BookingEntity convertBookingIntoBookingEntity(Booking booking)
{
return new BookingEntity(booking.getJourneyDate(),booking.getBookingDate(),booking.getCancelDate(),
booking.getFare(),booking.getBookingStatus(),booking.getVehicleType(),RouteUtil.convertRouteIntoRouteEntity(booking.getRoute()),
UserUtil.convertUserIntoUserEntity(booking.getUser()));
}
public static Booking convertBookingEntityIntoBooking(BookingEntity bookingEntity)
{
return new Booking(bookingEntity.getBookingId(),bookingEntity.getJourneyDate(),bookingEntity.getBookingDate()
,bookingEntity.getCancelDate(),bookingEntity.getFare(),bookingEntity.getBookingStatus(),
bookingEntity.getVehicleType(),RouteUtil.convertRouteEntityIntoRoute(bookingEntity.getRoute()),
UserUtil.convertUserEntityIntoUser(bookingEntity.getUser()));
}
public static List<Booking> convertRouteEntityListIntoBookingList(List<BookingEntity> bookingEntityList) {
List<Booking> booking = new ArrayList<Booking>();
for(BookingEntity bookingEntity: bookingEntityList) {
booking.add(convertBookingEntityIntoBooking(bookingEntity));
}
return booking;
}
public static List<Booking> convertBookingEntityListIntoBookingList(List<BookingEntity> bookingEntityList)
{
List<Booking> bookings = new ArrayList<Booking>();
for(BookingEntity bookingEntity: bookingEntityList) {
bookings.add(convertBookingEntityIntoBooking(bookingEntity));
}
return bookings;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…