This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user