допил =))
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,7 +41,7 @@ function OrderFilter({ onFilterChange }) {
|
||||
<div style={{ display: 'flex', gap: '15px', alignItems: 'center', flexWrap: 'wrap' }}>
|
||||
{/* Фильтр по статусу */}
|
||||
<div>
|
||||
<label style={{ marginRight: '5px' }}>Статус: </label>
|
||||
<label style={{ marginRight: '5px', color:"#666" }}>Статус: </label>
|
||||
<select
|
||||
value={filters.status}
|
||||
onChange={(e) => handleFilterChange('status', e.target.value)}
|
||||
@@ -57,7 +57,7 @@ function OrderFilter({ onFilterChange }) {
|
||||
|
||||
{/* Сортировка */}
|
||||
<div>
|
||||
<label style={{ marginRight: '5px' }}>Сортировка: </label>
|
||||
<label style={{ marginRight: '5px', color: "#666" }}>Сортировка: </label>
|
||||
<select
|
||||
value={filters.sortBy}
|
||||
onChange={(e) => handleFilterChange('sortBy', e.target.value)}
|
||||
|
||||
@@ -22,7 +22,6 @@ public class OrderController {
|
||||
private final CustomerController customerController;
|
||||
private final DeliveryController deliveryController;
|
||||
|
||||
// Конструктор с внедрением зависимостей
|
||||
public OrderController(CustomerController customerController, DeliveryController deliveryController) {
|
||||
this.customerController = customerController;
|
||||
this.deliveryController = deliveryController;
|
||||
@@ -30,26 +29,22 @@ public class OrderController {
|
||||
}
|
||||
|
||||
private void initializeTestData() {
|
||||
// Создаем тестовых клиентов и доставки напрямую
|
||||
CustomerDTO customer1 = new CustomerDTO("c1", "Иванов Иван", "ivanov@example.com");
|
||||
CustomerDTO customer2 = new CustomerDTO("c2", "Петров Петр", "petrov@example.com");
|
||||
|
||||
DeliveryDTO delivery1 = new DeliveryDTO("578a", "IVN012021", "гоголя10", "Доставлено", "Парт петрович wwww");
|
||||
DeliveryDTO delivery2 = new DeliveryDTO("0e0f", "IVN123456", "Москва", "В пути", "1Иванов Иван");
|
||||
|
||||
// Создаем заказы с полными объектами
|
||||
orders.add(new OrderDTO("o1", customer1, delivery1, "Доставлено"));
|
||||
orders.add(new OrderDTO("o2", customer2, delivery2, "В пути"));
|
||||
}
|
||||
|
||||
// READ all
|
||||
@GetMapping
|
||||
@Operation(summary = "Получить все заказы")
|
||||
public List<OrderDTO> getAll() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
// READ one
|
||||
@GetMapping("/{id}")
|
||||
@Operation(summary = "Получить заказ по ID")
|
||||
public OrderDTO getOne(@PathVariable String id) {
|
||||
@@ -59,7 +54,6 @@ public class OrderController {
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
// Фильтрация по статусу
|
||||
@GetMapping("/status/{status}")
|
||||
@Operation(summary = "Получить заказы по статусу")
|
||||
public List<OrderDTO> getOrdersByStatus(@PathVariable String status) {
|
||||
@@ -68,7 +62,6 @@ public class OrderController {
|
||||
.toList();
|
||||
}
|
||||
|
||||
// Сортировка по статусу
|
||||
@GetMapping("/sorted/by-status")
|
||||
@Operation(summary = "Получить заказы отсортированные по статусу")
|
||||
public List<OrderDTO> getOrdersSortedByStatus() {
|
||||
@@ -77,11 +70,9 @@ public class OrderController {
|
||||
.toList();
|
||||
}
|
||||
|
||||
// CREATE
|
||||
@PostMapping
|
||||
@Operation(summary = "Создать новый заказ")
|
||||
public OrderDTO create(@RequestBody OrderDTO order) {
|
||||
// Генерируем ID если не указан
|
||||
if (order.getId() == null || order.getId().isEmpty()) {
|
||||
order.setId("order_" + System.currentTimeMillis());
|
||||
}
|
||||
@@ -89,7 +80,6 @@ public class OrderController {
|
||||
return order;
|
||||
}
|
||||
|
||||
// UPDATE
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "Обновить заказ")
|
||||
public OrderDTO update(@PathVariable String id, @RequestBody OrderDTO updatedOrder) {
|
||||
@@ -107,7 +97,6 @@ public class OrderController {
|
||||
return null;
|
||||
}
|
||||
|
||||
// DELETE
|
||||
@DeleteMapping("/{id}")
|
||||
@Operation(summary = "Удалить заказ")
|
||||
public void delete(@PathVariable String id) {
|
||||
|
||||
@@ -9,7 +9,6 @@ public class CustomerDTO {
|
||||
private String email;
|
||||
private List<OrderDTO> orders = new ArrayList<>();
|
||||
|
||||
// Конструкторы
|
||||
public CustomerDTO() {}
|
||||
|
||||
public CustomerDTO(String id, String name, String email) {
|
||||
@@ -18,7 +17,6 @@ public class CustomerDTO {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
// Основные геттеры и сеттеры
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -42,8 +40,7 @@ public class CustomerDTO {
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
// Геттеры и сеттеры для orders
|
||||
|
||||
public List<OrderDTO> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user