Read the code and highlight errors. /** * A client with a purchased ticket can choose a specific seat for an additional fee. * The base price of seats is determined by tariffs (external service). * For clients with certain tariffs (PREMIUM, ULTRA), a discount is applied at payment. * When booking, an invoice is issued to the client for payment. Payment management is handled by a third-party service. */ @Service public class SeatBookingService { @Autowired private SeatBookingRepository seatBookingRepository; @Autowired private TicketRepository ticketRepository; @Autowired private TariffClient tariffClient; @Autowired private CustomerClient customerClient; @Autowired private PaymentClient paymentClient; /** * Booking. * @param seatCode seat code (e.g., 19A) * @param ticketId ticket ID */ @Transactional public void bookSeat(String seatCode, UUID ticketId) { var ticket = ticketRepository.findById(ticketId); //book var seatBooking = new SeatBooking(seatCode, ticket.get().getFlightId(), ticketId, BookingStatus.BOOKED); seatBookingRepository.save(seatBooking); //find base tariff for the selected seat on the plane var basePrice = tariffClient.getBasePrice(ticket.get().getPlaneModel(), seatCode); //find customer data Long userId = (Long) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); var userData = customerClient.getCustomer(userId); System.out.println("User found " + userData.getFio() + " document number " + userData.getDocument()); var price = basePrice; if (userData.getTariff() == "PREMIUM") { //50% discount price = basePrice * 0.5d; } if (userData.getTariff() == "ULTRA") { //20% discount price = basePrice * 0.8d; } var invoice = new Invoice(price, ticketId, userId); //issue invoice paymentClient.sendInvoice(invoice); System.out.println("Invoice issued"); } @Data @Table("seat_booking") public class SeatBooking { @Column private String seatCode; @Column private UUID flightId; @Column private UUID ticketId; @Column private BookingStatus status; } public enum BookingStatus { BOOKED, PAID; }
Java
Can you list the types of classes that exist in Kotlin?
What is the difference between the dependency and dependencyManagement sections in a Maven configuration file?
Why are ArrayList and array the fundamental data structures in Java?
What types of table joins have you used in your SQL queries?
How to register a JDBC driver?
Explain the principle of dynamic routing of method calls in object-oriented programming.
How do loops in Java differ?
Have you participated in setting up or working with the stage environment for testing or deployment?
What is mutual exclusion?
Describe the general practical principles of working with JavaServer Pages (JSP).
How do you use dependency injection in your projects?
How is automatic resource closing implemented using the try-with-resources construct?
What happens when an exception is thrown in a thread?
What is the purpose of the assert operator in Java programming language?
Which method within an object do you think is the most important and frequently used?
Can the use of a component be replaced with a service in Spring, and which of these alternatives is more preferable?
Какое отличие между модификаторами доступа protected и package-private (default) в языке Java?
Is it permissible to use console log output in the context of microservices architecture?
How do you assess the attractiveness and potential of this project?