diff --git a/prototype/src/main/java/org/hso/ecommerce/ShopController.java b/prototype/src/main/java/org/hso/ecommerce/ShopController.java new file mode 100644 index 0000000..d09bd0e --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/ShopController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class ShopController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/action/somepackage/DemoAction.java b/prototype/src/main/java/org/hso/ecommerce/action/somepackage/DemoAction.java new file mode 100644 index 0000000..22f8946 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/action/somepackage/DemoAction.java @@ -0,0 +1,7 @@ +package org.hso.ecommerce.action.somepackage; + +public class DemoAction { + // TODO: remove me. + // mksubpackage + +} diff --git a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java index 9866d5e..f90906a 100644 --- a/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java +++ b/prototype/src/main/java/org/hso/ecommerce/app/RequestController.java @@ -1,7 +1,7 @@ package org.hso.ecommerce.app; -import org.hso.ecommerce.db.repos.UserRepository; -import org.hso.ecommerce.entities.User; +import org.hso.ecommerce.entities.user.UserRepository; +import org.hso.ecommerce.entities.user.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; diff --git a/prototype/src/main/java/org/hso/ecommerce/components/LoginIntercepter.java b/prototype/src/main/java/org/hso/ecommerce/components/LoginIntercepter.java index 8763618..c4a2419 100644 --- a/prototype/src/main/java/org/hso/ecommerce/components/LoginIntercepter.java +++ b/prototype/src/main/java/org/hso/ecommerce/components/LoginIntercepter.java @@ -1,7 +1,7 @@ package org.hso.ecommerce.components; -import org.hso.ecommerce.db.repos.UserRepository; -import org.hso.ecommerce.entities.User; +import org.hso.ecommerce.entities.user.UserRepository; +import org.hso.ecommerce.entities.user.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/ArticleController.java b/prototype/src/main/java/org/hso/ecommerce/controller/ArticleController.java new file mode 100644 index 0000000..5433d25 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/ArticleController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class ArticleController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/BookingController.java b/prototype/src/main/java/org/hso/ecommerce/controller/BookingController.java new file mode 100644 index 0000000..d35093e --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/BookingController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class BookingController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/LoginController.java b/prototype/src/main/java/org/hso/ecommerce/controller/LoginController.java new file mode 100644 index 0000000..5f4ebad --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/LoginController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class LoginController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java new file mode 100644 index 0000000..523bf2e --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/UserController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class UserController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/IndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/IndexController.java new file mode 100644 index 0000000..32ee4a7 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/IndexController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class IndexController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/WarehouseController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/WarehouseController.java new file mode 100644 index 0000000..9b618f7 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/WarehouseController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class WarehouseController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/IndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/IndexController.java new file mode 100644 index 0000000..ee07280 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/IndexController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern.customers; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class IndexController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/OrderController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/OrderController.java new file mode 100644 index 0000000..19db2a9 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/customers/OrderController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern.customers; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class OrderController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/IndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/IndexController.java new file mode 100644 index 0000000..c9ad42b --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/IndexController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern.suppliers; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class IndexController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OfferController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OfferController.java new file mode 100644 index 0000000..a7932b5 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OfferController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern.suppliers; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class OfferController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OrderController.java b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OrderController.java new file mode 100644 index 0000000..aa63fcd --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/intern/suppliers/OrderController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.intern.suppliers; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class OrderController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/ArticleController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ArticleController.java new file mode 100644 index 0000000..5e17f90 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/ArticleController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.shop; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class ArticleController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/CheckoutController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/CheckoutController.java new file mode 100644 index 0000000..13f3dda --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/CheckoutController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.shop; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class CheckoutController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/IndexController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/IndexController.java new file mode 100644 index 0000000..378efa1 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/IndexController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.shop; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class IndexController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/controller/shop/SearchController.java b/prototype/src/main/java/org/hso/ecommerce/controller/shop/SearchController.java new file mode 100644 index 0000000..29d47d7 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/controller/shop/SearchController.java @@ -0,0 +1,8 @@ +package org.hso.ecommerce.controller.shop; + +import org.springframework.stereotype.Controller; + +@Controller +//@RequestMapping("...") +public class SearchController { +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/Booking.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/Booking.java new file mode 100644 index 0000000..997f578 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/Booking.java @@ -0,0 +1,25 @@ +package org.hso.ecommerce.entities.booking; + +import javax.persistence.*; + +@Entity +@Table(name = "bookings") +public class Booking { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + // always >= 0 + public int amountCent; + + @ManyToOne(optional = true) + public BookingAccountEntry source; + + @ManyToOne(optional = true) + public BookingAccountEntry destination; + + @OneToOne(optional = false) + public BookingReason reason; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingAccountEntry.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingAccountEntry.java new file mode 100644 index 0000000..92e282f --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingAccountEntry.java @@ -0,0 +1,28 @@ +package org.hso.ecommerce.entities.booking; + +import org.hso.ecommerce.entities.supplier.Supplier; +import org.hso.ecommerce.entities.user.User; + +import javax.persistence.*; + +@Entity +@Table(name = "booking_account_entries") +public class BookingAccountEntry { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + public int newSumCent; + + @ManyToOne(optional = true) + public User userAccount; + + @ManyToOne(optional = true) + public Supplier supplierAccount; + + public boolean isMainAccount; + public boolean isVATAccount; + +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java new file mode 100644 index 0000000..b2bc6cc --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/BookingReason.java @@ -0,0 +1,30 @@ +package org.hso.ecommerce.entities.booking; + +import org.hso.ecommerce.entities.shop.CustomerOrder; +import org.hso.ecommerce.entities.supplier.SupplierOrder; + +import javax.persistence.*; + +@Entity +@Table(name = "booking_reasons") +public class BookingReason { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + public boolean isManuel; + public boolean isStartBooking; + + public String comment; + + @ManyToOne(optional = true) + public CustomerOrder customerOrder; + + @ManyToOne(optional = true) + public CustomerPayment customerPayment; + + @ManyToOne(optional = true) + public SupplierOrder supplierOrder; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/CustomerPayment.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/CustomerPayment.java new file mode 100644 index 0000000..037e856 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/CustomerPayment.java @@ -0,0 +1,20 @@ +package org.hso.ecommerce.entities.booking; + +import org.hso.ecommerce.entities.booking.PaymentMethod; + +import javax.persistence.*; + +@Entity +@Table(name = "customer_payments") +public class CustomerPayment { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + public int amountCent; + + @Embedded + public PaymentMethod payment; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/booking/PaymentMethod.java b/prototype/src/main/java/org/hso/ecommerce/entities/booking/PaymentMethod.java new file mode 100644 index 0000000..6cb5307 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/booking/PaymentMethod.java @@ -0,0 +1,10 @@ +package org.hso.ecommerce.entities.booking; + +import javax.persistence.Embeddable; +import javax.validation.constraints.NotNull; + +@Embeddable +public class PaymentMethod { + @NotNull + public String creditCardNumber; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/cron/BackgroundJob.java b/prototype/src/main/java/org/hso/ecommerce/entities/cron/BackgroundJob.java new file mode 100644 index 0000000..14a4ae3 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/cron/BackgroundJob.java @@ -0,0 +1,23 @@ +package org.hso.ecommerce.entities.cron; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "background_jobs") +public class BackgroundJob { + + public final String JOB_DASHBOARD = "Dashboard"; + public final String JOB_REORDER = "SupplierOrder"; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + public String jobName; + + @NotNull + public java.sql.Timestamp lastExecution; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/dashboard/DashboardSummary.java b/prototype/src/main/java/org/hso/ecommerce/entities/dashboard/DashboardSummary.java new file mode 100644 index 0000000..9f68988 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/dashboard/DashboardSummary.java @@ -0,0 +1,25 @@ +package org.hso.ecommerce.entities.dashboard; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "dashboard_summaries") +public class DashboardSummary { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + public java.sql.Date created; + + public int todaysCustomers; + public int todaysCustomersOrders; + public int todaysSuppliersOrders; + public int todaysItemsSold; + public int todaysSalesCent; + public int totalWarehouseCapacity; + public int currentWarehouseCapacity; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Address.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Address.java new file mode 100644 index 0000000..32d057b --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Address.java @@ -0,0 +1,10 @@ +package org.hso.ecommerce.entities.shop; + +import javax.persistence.Embeddable; + +@Embeddable +public class Address { + public String name; + public String addressString; + public String country = "DE"; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Article.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Article.java new file mode 100644 index 0000000..6cd198e --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Article.java @@ -0,0 +1,40 @@ +package org.hso.ecommerce.entities.shop; + +import org.hso.ecommerce.entities.supplier.ArticleOffer; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "articles") +public class Article { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @ManyToOne(optional = false) + public ArticleOffer related; + + public int shopPricePerUnitNetCent; + public int warehouseUnitsPerSlot; + + public boolean shouldReorder; + public int reorderMaxPrice; + + @NotNull + public String title; + + @NotNull + public String description; + + @OneToOne(optional = true) + public Image image; + + @ManyToMany + @JoinTable(name = "article_categories_bindings") + public Set categories = new HashSet<>(); +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Category.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Category.java new file mode 100644 index 0000000..13b0b54 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Category.java @@ -0,0 +1,25 @@ +package org.hso.ecommerce.entities.shop; + +import org.hso.ecommerce.entities.shop.Article; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.util.HashSet; +import java.util.Set; + +@Entity +@Table(name = "categories") +public class Category { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + @Column(unique = true) + public String name; + + @ManyToMany(mappedBy = "categories") + public Set
articles = new HashSet<>(); +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java new file mode 100644 index 0000000..dd7d4f8 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrder.java @@ -0,0 +1,46 @@ +package org.hso.ecommerce.entities.shop; + +import org.hso.ecommerce.entities.user.User; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Table(name = "customer_orders") +public class CustomerOrder { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @ManyToOne(optional = false) + public User customer; + + @Embedded + public Address destination; + + @OneToMany( + targetEntity = CustomerOrderPosition.class, + mappedBy = "order" + ) + public List positions = new ArrayList<>(); + + @NotNull + public java.sql.Timestamp created; + + @NotNull + public String trackingId; + + @Column(nullable = true) + public java.sql.Timestamp inDeliverySince; + + @Column(nullable = true) + public java.sql.Timestamp deliveredAt; + + public int totalNetCent; + public int totalGrossCent; + public int totalVatCent; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java new file mode 100644 index 0000000..dbe53f7 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/CustomerOrderPosition.java @@ -0,0 +1,22 @@ +package org.hso.ecommerce.entities.shop; + +import javax.persistence.*; + +@Entity +@Table(name = "customer_order_positions") +public class CustomerOrderPosition { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @ManyToOne(optional = false) + public CustomerOrder order; + + @ManyToOne(optional = false) + public Article article; + + public int pricePerUnit; + public int quantity; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java new file mode 100644 index 0000000..33eebdb --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/shop/Image.java @@ -0,0 +1,17 @@ +package org.hso.ecommerce.entities.shop; + +import javax.persistence.*; + +@Entity +@Table(name = "images") +public class Image { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @Lob + @Column(name = "data", columnDefinition = "BLOB", nullable = false) + private byte[] data; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java new file mode 100644 index 0000000..005b0b9 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/ArticleOffer.java @@ -0,0 +1,22 @@ +package org.hso.ecommerce.entities.supplier; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "article_offers") +public class ArticleOffer { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + public String manufacturer; + + @NotNull + public String articleNumber; + + public int vatPercent; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/supplier/Supplier.java b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/Supplier.java new file mode 100644 index 0000000..7649ea2 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/Supplier.java @@ -0,0 +1,23 @@ +package org.hso.ecommerce.entities.supplier; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; + +@Entity +@Table(name = "suppliers") +public class Supplier { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @Column(unique = true) + public String uuid; + + @NotNull + public String name; + + @NotNull + public String apiUrl; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/supplier/SupplierOrder.java b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/SupplierOrder.java new file mode 100644 index 0000000..e92339c --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/supplier/SupplierOrder.java @@ -0,0 +1,37 @@ +package org.hso.ecommerce.entities.supplier; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.sql.Timestamp; + +@Entity +@Table(name = "supplier_orders") +public class SupplierOrder { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + public java.sql.Timestamp created; + + @ManyToOne(optional = false) + public Supplier supplier; + + @ManyToOne(optional = false) + public ArticleOffer ordered; + + public int numberOfUnits; + public int pricePerUnitNetCent; + + // Includes discounts + public int totalPriceNet; + + @Column(nullable = true) + public Timestamp delivered; + + public boolean wasDelivered() { + return delivered != null; + } +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/User.java b/prototype/src/main/java/org/hso/ecommerce/entities/user/User.java similarity index 68% rename from prototype/src/main/java/org/hso/ecommerce/entities/User.java rename to prototype/src/main/java/org/hso/ecommerce/entities/user/User.java index 1c3c721..9b07996 100644 --- a/prototype/src/main/java/org/hso/ecommerce/entities/User.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/user/User.java @@ -1,8 +1,11 @@ -package org.hso.ecommerce.entities; +package org.hso.ecommerce.entities.user; +import org.hso.ecommerce.entities.booking.PaymentMethod; +import org.hso.ecommerce.entities.shop.Address; import org.springframework.security.crypto.bcrypt.BCrypt; import javax.persistence.*; +import javax.validation.constraints.NotNull; @Entity @@ -13,16 +16,24 @@ public class User { @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic public long id; + + @NotNull public java.sql.Timestamp created; + @NotNull @Column(unique = true) public String email; + public String passwordHash; public boolean isActive; public boolean isEmployee; - public boolean getsAds; - public boolean isB2B; + + @Embedded + private Address defaultDeliveryAddress; + + @Embedded + private PaymentMethod defaultPayment; public long getId() { return id; diff --git a/prototype/src/main/java/org/hso/ecommerce/db/repos/UserRepository.java b/prototype/src/main/java/org/hso/ecommerce/entities/user/UserRepository.java similarity index 81% rename from prototype/src/main/java/org/hso/ecommerce/db/repos/UserRepository.java rename to prototype/src/main/java/org/hso/ecommerce/entities/user/UserRepository.java index 5940480..fcbc891 100644 --- a/prototype/src/main/java/org/hso/ecommerce/db/repos/UserRepository.java +++ b/prototype/src/main/java/org/hso/ecommerce/entities/user/UserRepository.java @@ -1,6 +1,6 @@ -package org.hso.ecommerce.db.repos; +package org.hso.ecommerce.entities.user; -import org.hso.ecommerce.entities.User; +import org.hso.ecommerce.entities.user.User; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java new file mode 100644 index 0000000..97a2805 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBooking.java @@ -0,0 +1,27 @@ +package org.hso.ecommerce.entities.warehouse; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; + +@Entity +@Table(name = "warehouse_bookings") +public class WarehouseBooking { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @NotNull + public java.sql.Timestamp created; + + public boolean isInProgress; + public boolean isDone; + + @OneToMany( + mappedBy = "booking" + ) + public List positions = new ArrayList<>(); +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPosition.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPosition.java new file mode 100644 index 0000000..88ceee3 --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPosition.java @@ -0,0 +1,32 @@ +package org.hso.ecommerce.entities.warehouse; + +import org.hso.ecommerce.entities.shop.Article; + +import javax.persistence.*; + +// TODO Unify with $$$ Bookings + WarehouseBookingEntry. + +@Entity +@Table(name = "warehouse_booking_positions") +public class WarehouseBookingPosition { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @ManyToOne(optional = false) + public WarehouseBooking booking; + + @ManyToOne(optional = false) + public Article article; + + public int amount; // positive or negative + + @ManyToOne(optional = true) + public WarehouseBookingPositionSlotEntry source; + + @ManyToOne(optional = true) + public WarehouseBookingPositionSlotEntry destination; + +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java new file mode 100644 index 0000000..7529e4f --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingPositionSlotEntry.java @@ -0,0 +1,23 @@ +package org.hso.ecommerce.entities.warehouse; + +import org.hso.ecommerce.entities.shop.Article; + +import javax.persistence.*; + +@Entity +@Table(name = "warehouse_booking_position_entries") +public class WarehouseBookingPositionSlotEntry { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + @ManyToOne + public Article article; + + public int newSumArticles; + public int newSumWarehousePosition; + + public int slot; +} diff --git a/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java new file mode 100644 index 0000000..ec60c4d --- /dev/null +++ b/prototype/src/main/java/org/hso/ecommerce/entities/warehouse/WarehouseBookingReason.java @@ -0,0 +1,26 @@ +package org.hso.ecommerce.entities.warehouse; + +import org.hso.ecommerce.entities.shop.CustomerOrder; +import org.hso.ecommerce.entities.supplier.SupplierOrder; + +import javax.persistence.*; + +@Entity +@Table(name = "warehouse_booking_reasons") +public class WarehouseBookingReason { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Basic + public long id; + + public String comment; + + @ManyToOne(optional = true) + public SupplierOrder causeSupplierOrder; + + @ManyToOne(optional = true) + public CustomerOrder customerOrder; + + public boolean isManuel; +}