SGR is the new system for recycling PET bottles implemented in Romania, similar to other countries in the EU. It works by adding a deposit to the price of PET containers, which could be cashed out once the container is returned to one of the selected locations (usually in stores).
- Spring Boot
- JPA
- Hibernate
It is necessary to create a configuration file (you can also use a CLI configuration if you prefere, more info available at the Spring documentation)
In the usual approach, the file is found under src/main/resources/application.properties
and follows the general Spring configuration structure
For a quick start, only the following properties are necessary:
spring.application.name
spring.jpa.generate-ddl
spring.jpa.show-sql
spring.datasource.driver-class-name
spring.datasource.url
spring.datasource.username
spring.datasource.password
SGRItem
is a simple product that takes part in the SGR systemSGRStore
is a location that canISSUE
products orCONSUME
(orSCAN
) products.SGRPretGarantie
is a price for the return issued at a certain point in time. The latest one is always valid, but the system keeps track of past onesSGRPurchase
represents anISSUE
transaction (i.e. a product is bought from aSGRStore
)
ISSUE
represents a purchase of an SGR itemCONSUME
(orSCAN
) represents the return of a previously purchased SGR item
Item flow:
SGRItem
gets createdSGRStore A
executes anISSUE
transaction and creates aSGRPurchase
for the itemSGRStore B
executes aCONSUME
transaction and theSGRPurchase
is marked asSGRComplete
Note: Store A and B can be the same store, or completely different ones