Загрузка данных
@startuml
skinparam classAttributeIconSize 0
' =========================
' Покупатели и корзина
' =========================
class Customer {
- id: int
- firstName: String
- lastName: String
- phone: String
- email: String
- birthDate: Date
- registrationDate: Date
+ createOrder(): Order
+ viewOrders(): List<Order>
}
class Basket {
- id: int
- createdAt: DateTime
+ addProduct(product: Product, quantity: int)
+ removeProduct(product: Product)
+ clear()
+ getTotalPrice(): Decimal
}
class BasketItem {
- id: int
- quantity: int
+ getTotalPrice(): Decimal
}
Customer "1" *-- "0..1" Basket
Basket "1" *-- "0..*" BasketItem
BasketItem "0..*" --> "1" Product
' =========================
' Заказы и оплата
' =========================
class Order {
- id: int
- orderDate: DateTime
- status: OrderStatus
- totalPrice: Decimal
+ calculateTotal(): Decimal
+ changeStatus(status: OrderStatus)
+ cancel()
}
class OrderItem {
- id: int
- quantity: int
- price: Decimal
+ getTotalPrice(): Decimal
}
class Payment {
- id: int
- amount: Decimal
- paymentDate: DateTime
- paymentMethod: PaymentMethod
- status: PaymentStatus
+ process()
+ refund()
}
enum OrderStatus {
CREATED
PAID
PROCESSING
COMPLETED
CANCELLED
}
enum PaymentMethod {
CASH
BANK_CARD
ONLINE
}
enum PaymentStatus {
PENDING
SUCCESSFUL
FAILED
REFUNDED
}
Customer "1" -- "0..*" Order
Order "1" *-- "1..*" OrderItem
OrderItem "0..*" --> "1" Product
Order "1" *-- "0..*" Payment
' =========================
' Товары
' =========================
class Product {
- id: int
- name: String
- description: String
- price: Decimal
- article: String
+ changePrice(price: Decimal)
}
class Category {
- id: int
- name: String
- description: String
}
class Manufacturer {
- id: int
- name: String
- country: String
}
Category "1" -- "0..*" Product
Category "0..1" <-- "0..*" Category : parent
Manufacturer "1" -- "0..*" Product
' =========================
' Склад
' =========================
class Warehouse {
- id: int
- name: String
- address: String
}
class Stock {
- id: int
- quantity: int
- reservedQuantity: int
+ increase(quantity: int)
+ decrease(quantity: int)
+ reserve(quantity: int)
+ getAvailableQuantity(): int
}
Warehouse "1" *-- "0..*" Stock
Stock "0..*" --> "1" Product
' =========================
' Поставки
' =========================
class Supplier {
- id: int
- name: String
- phone: String
- email: String
}
class Supply {
- id: int
- supplyDate: DateTime
- status: SupplyStatus
+ calculateTotal(): Decimal
}
class SupplyItem {
- id: int
- quantity: int
- purchasePrice: Decimal
+ getTotalPrice(): Decimal
}
enum SupplyStatus {
CREATED
IN_TRANSIT
RECEIVED
CANCELLED
}
Supplier "1" -- "0..*" Supply
Supply "1" *-- "1..*" SupplyItem
SupplyItem "0..*" --> "1" Product
Supply "0..*" --> "1" Warehouse
' =========================
' Сотрудники
' =========================
class Staff {
- id: int
- firstName: String
- lastName: String
- position: String
- phone: String
+ processOrder(order: Order)
+ acceptSupply(supply: Supply)
}
Staff "0..*" -- "1" Warehouse
Staff "1" -- "0..*" Order : processes
@enduml