main #8
@@ -9,13 +9,11 @@ import com.example.nto.repository.PlaceRepository;
|
||||
import com.example.nto.service.BookingService;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
package com.example.nto.controller;
|
||||
|
||||
import com.example.nto.entity.Booking;
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.excepation.EmployeeNotFoundException;
|
||||
import com.example.nto.repository.BookingRepository;
|
||||
import com.example.nto.repository.EmployeeRepository;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
* =================================
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.example.nto.excepation;
|
||||
|
||||
public class ConflictException extends RuntimeException {
|
||||
public ConflictException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.example.nto.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class PlaceServise {
|
||||
private final PlaceRepository placeRepository;
|
||||
|
||||
public PlaceServise(PlaceRepository placeRepository) {
|
||||
this.placeRepository = placeRepository;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public class BookingServiceImpl implements BookingService {
|
||||
if (employee == null) {
|
||||
throw new EmployeeNotFoundException("Employee not found with code: " + employeeCode);
|
||||
}
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate endDate = today.plusDays(3);
|
||||
List<Booking> bookings = bookingRepository.findByDateBetween(today, endDate);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package com.example.nto.service.impl;
|
||||
import com.example.nto.entity.Booking;
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.excepation.EmployeeNotFoundException;
|
||||
import com.example.nto.repository.BookingRepository;
|
||||
@@ -8,8 +7,6 @@ import com.example.nto.service.EmployeeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
@@ -19,13 +16,8 @@ import java.util.List;
|
||||
*/
|
||||
@Service
|
||||
public class EmployeeServiceImpl implements EmployeeService {
|
||||
|
||||
@Autowired
|
||||
private EmployeeRepository employeeRepository;
|
||||
|
||||
@Autowired
|
||||
private BookingRepository bookingRepository;
|
||||
|
||||
@Override
|
||||
public Employee getEmployeeWithBookings(String code) {
|
||||
if (code == null || code.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user