main #20

Open
student-33039 wants to merge 5 commits from student-33039/NTO-2025-Backend-TeamTask:main into main
Showing only changes of commit cd9bde6641 - Show all commits

View File

@@ -2,8 +2,10 @@ package com.example.nto.service.impl;
import com.example.nto.entity.Booking;
import com.example.nto.entity.Employee;
import com.example.nto.entity.Place;
import com.example.nto.repository.EmployeeRepository;
import com.example.nto.service.EmployeeService;
import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -29,6 +31,7 @@ public class EmployeeServiceImpl implements EmployeeService {
}
@Override
@Transactional
public Optional<Map<String, Object>> getEmployeeInfo(String code) {
Optional<Employee> employeeOpt = employeeRepository.findByCode(code);
@@ -43,12 +46,17 @@ public class EmployeeServiceImpl implements EmployeeService {
Map<String, Map<String, Object>> bookingsMap = new HashMap<>();
// Используем bookingList вместо bookings
if (employee.getBookingList() != null) {
for (Booking booking : employee.getBookingList()) {
Map<String, Object> bookingInfo = new HashMap<>();
bookingInfo.put("id", booking.getId());
bookingInfo.put("place", booking.getPlace());
Place place = booking.getPlace();
String placeName = "";
if (place != null) {
placeName = place.getPlace();
}
bookingInfo.put("place", placeName);
bookingsMap.put(booking.getDate().toString(), bookingInfo);
}