Changeset d14176d
- Timestamp:
- 07/07/23 12:14:58 (17 months ago)
- Branches:
- main
- Parents:
- 1dd9226
- Files:
-
- 80 edited
Legend:
- Unmodified
- Added
- Removed
-
pom.xml
r1dd9226 rd14176d 18 18 </properties> 19 19 <dependencies> 20 21 <dependency> 22 <groupId>org.springframework.boot</groupId> 23 <artifactId>spring-boot-starter-thymeleaf</artifactId> 24 </dependency> 25 26 <dependency> 27 <groupId>org.springframework.boot</groupId> 28 <artifactId>spring-boot-starter-web</artifactId> 29 </dependency> 30 20 31 <dependency> 21 32 <groupId>org.springframework.boot</groupId> 22 33 <artifactId>spring-boot-starter-data-jpa</artifactId> 23 34 </dependency> 35 36 <dependency> 37 <groupId>org.flywaydb</groupId> 38 <artifactId>flyway-maven-plugin</artifactId> 39 <version>6.2.3</version> 40 </dependency> 41 42 24 43 <dependency> 25 44 <groupId>org.springframework.boot</groupId> 26 45 <artifactId>spring-boot-starter-security</artifactId> 27 46 </dependency> 28 <dependency> 29 <groupId>org.springframework.boot</groupId> 30 <artifactId>spring-boot-starter-thymeleaf</artifactId> 31 </dependency> 32 <dependency> 33 <groupId>org.springframework.boot</groupId> 34 <artifactId>spring-boot-starter-web</artifactId> 35 </dependency> 47 36 48 <dependency> 37 49 <groupId>org.thymeleaf.extras</groupId> 38 50 <artifactId>thymeleaf-extras-springsecurity5</artifactId> 39 51 </dependency> 52 53 <dependency> 54 <groupId>com.h2database</groupId> 55 <artifactId>h2</artifactId> 56 </dependency> 57 40 58 41 59 <dependency> … … 50 68 <optional>true</optional> 51 69 </dependency> 70 71 <dependency> 72 <groupId>com.auth0</groupId> 73 <artifactId>java-jwt</artifactId> 74 <version>3.7.0</version> 75 </dependency> 76 52 77 <dependency> 53 78 <groupId>org.springframework.boot</groupId> 54 79 <artifactId>spring-boot-starter-test</artifactId> 55 80 <scope>test</scope> 81 <exclusions> 82 <exclusion> 83 <groupId>org.junit.vintage</groupId> 84 <artifactId>junit-vintage-engine</artifactId> 85 </exclusion> 86 </exclusions> 56 87 </dependency> 88 57 89 <dependency> 58 <groupId>org.springframework.security</groupId> 59 <artifactId>spring-security-test</artifactId> 60 <scope>test</scope> 90 <groupId>junit</groupId> 91 <artifactId>junit</artifactId> 61 92 </dependency> 93 94 <dependency> 95 <groupId>org.seleniumhq.selenium</groupId> 96 <artifactId>selenium-java</artifactId> 97 </dependency> 98 99 <dependency> 100 <groupId>org.seleniumhq.selenium</groupId> 101 <artifactId>htmlunit-driver</artifactId> 102 </dependency> 103 62 104 </dependencies> 63 105 -
src/main/java/project/fmo/app/projcetfmo/Model/AdminKorisnik.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; … … 8 8 @Table(name = "admin_korisnik", schema = "project", catalog = "db_202223z_va_prj_fmo") 9 9 public class AdminKorisnik { 10 @GeneratedValue(strategy = GenerationType.IDENTITY) 10 11 11 @Id 12 12 @Column(name = "id_korisnik") -
src/main/java/project/fmo/app/projcetfmo/Model/Cena.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.sql.Date; … … 7 7 8 8 @Entity 9 @Table(schema = "project", name = "cena", catalog = "db_202223z_va_prj_fmo") 9 10 @IdClass(CenaPK.class) 10 11 public class Cena { 11 @GeneratedValue(strategy = GenerationType.IDENTITY)12 12 @Id 13 13 @Column(name = "id_produkt") 14 private int idProdukt; 15 @GeneratedValue(strategy = GenerationType.IDENTITY) 14 private int idProdukt; 16 15 @Id 17 16 @Column(name = "cena_od") … … 23 22 @Column(name = "iznos") 24 23 private int iznos; 24 25 public Cena(){} 26 public Cena(int idProdukt, Date cenaOd, Date cenaDo, int iznos) { 27 this.idProdukt = idProdukt; 28 this.cenaOd = cenaOd; 29 this.cenaDo = cenaDo; 30 this.iznos = iznos; 31 } 32 33 public Cena(int idProdukt, Date cenaOd, int iznos) { 34 this.idProdukt = idProdukt; 35 this.cenaOd = cenaOd; 36 this.iznos = iznos; 37 } 25 38 26 39 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/CenaPK.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.GeneratedValue; 5 import jakarta.persistence.GenerationType; 6 import jakarta.persistence.Id; 3 import javax.persistence.*; 7 4 8 5 import java.io.Serializable; … … 13 10 @Column(name = "id_produkt") 14 11 @Id 15 @GeneratedValue(strategy = GenerationType.IDENTITY)16 12 private int idProdukt; 17 13 @Column(name = "cena_od") 18 14 @Id 19 @GeneratedValue(strategy = GenerationType.IDENTITY)20 15 private Date cenaOd; 16 17 public CenaPK (){} 18 public CenaPK(Integer idProdukt, Date cenaOd) { 19 this.idProdukt = idProdukt; 20 this.cenaOd = cenaOd; 21 } 21 22 22 23 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/Dostava.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.*; 3 import project.fmo.app.projcetfmo.Service.impl.DostavaServiceImpl; 4 5 import javax.persistence.*; 4 6 5 7 import java.sql.Date; … … 7 9 8 10 @Entity 11 @Table(schema = "project", name = "dostava", catalog = "db_202223z_va_prj_fmo") 9 12 public class Dostava { 10 @Basic 11 @Column(name = "id_korisnik") 12 private int idKorisnik; 13 @Basic 14 @Column(name = "id_naracka") 15 private int idNaracka; 16 @GeneratedValue(strategy = GenerationType.IDENTITY) 13 @ManyToOne 14 @JoinColumn(name = "id_korisnik") 15 private Dostavuvac dostavuvac; 16 @OneToOne 17 @JoinColumn(name = "id_naracka") 18 private Naracka naracka; 17 19 @Id 18 20 @Column(name = "id_dostava") … … 25 27 private String status; 26 28 29 public Dostava (){} 30 31 public Dostava(Dostavuvac dostavuvac, Naracka naracka, int idDostava, Date datum, String status) { 32 this.dostavuvac = dostavuvac; 33 this.naracka = naracka; 34 this.idDostava = idDostava; 35 this.datum = datum; 36 this.status = status; 37 } 38 27 39 public int getIdKorisnik() { 28 return idKorisnik;40 return dostavuvac.getIdKorisnik(); 29 41 } 30 42 31 43 public void setIdKorisnik(int idKorisnik) { 32 this. idKorisnik = idKorisnik;44 this.dostavuvac.setIdKorisnik(idKorisnik); 33 45 } 34 46 35 47 public int getIdNaracka() { 36 return idNaracka;48 return naracka.getIdNaracka(); 37 49 } 38 50 39 51 public void setIdNaracka(int idNaracka) { 40 this. idNaracka = idNaracka;52 this.naracka.setIdNaracka(idNaracka); 41 53 } 42 54 … … 70 82 if (o == null || getClass() != o.getClass()) return false; 71 83 Dostava dostava = (Dostava) o; 72 return idKorisnik == dostava.idKorisnik && idNaracka == dostava.idNaracka && idDostava == dostava.idDostava && Objects.equals(datum, dostava.datum) && Objects.equals(status, dostava.status);84 return dostavuvac == dostava.dostavuvac && naracka == dostava.naracka && idDostava == dostava.idDostava && Objects.equals(datum, dostava.datum) && Objects.equals(status, dostava.status); 73 85 } 74 86 75 87 @Override 76 88 public int hashCode() { 77 return Objects.hash( idKorisnik, idNaracka, idDostava, datum, status);89 return Objects.hash(dostavuvac, naracka, idDostava, datum, status); 78 90 } 79 91 } -
src/main/java/project/fmo/app/projcetfmo/Model/Dostavuvac.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "dostavuvac", catalog = "db_202223z_va_prj_fmo") 8 9 public class Dostavuvac { 9 @GeneratedValue(strategy = GenerationType.IDENTITY) 10 10 11 @Id 11 12 @Column(name = "id_korisnik") 12 13 private int idKorisnik; 14 15 public Dostavuvac(){} 13 16 14 17 public int getIdKorisnik() { -
src/main/java/project/fmo/app/projcetfmo/Model/Kategorija.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "kategorija", catalog = "db_202223z_va_prj_fmo") 8 9 public class Kategorija { 9 10 @GeneratedValue(strategy = GenerationType.IDENTITY) … … 14 15 @Column(name = "ime") 15 16 private String ime; 17 18 19 public Kategorija(){} 20 public Kategorija(String ime) { 21 this.ime = ime; 22 } 16 23 17 24 public int getIdKategorija() { -
src/main/java/project/fmo/app/projcetfmo/Model/Korisnik.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.*;4 3 4 import org.springframework.security.core.GrantedAuthority; 5 import org.springframework.security.core.userdetails.UserDetails; 6 7 import javax.persistence.*; 5 8 import java.sql.Timestamp; 9 import java.util.Collection; 10 import java.util.Collections; 6 11 import java.util.Objects; 7 12 8 13 @Entity 9 public class Korisnik { 14 @Table(schema = "project", name = "korisnik", catalog = "db_202223z_va_prj_fmo") 15 public class Korisnik implements UserDetails { 10 16 @GeneratedValue(strategy = GenerationType.IDENTITY) 11 17 @Id … … 21 27 @Column(name = "kreiran_na_datum") 22 28 private Timestamp kreiranNaDatum; 29 30 31 public Korisnik(){ 32 33 } 34 public Korisnik(String imePrezime, String passwordKorisnik, Timestamp kreiranNaDatum) { 35 this.imePrezime = imePrezime; 36 this.passwordKorisnik = passwordKorisnik; 37 this.kreiranNaDatum = kreiranNaDatum; 38 } 23 39 24 40 public int getIdKorisnik() { … … 66 82 return Objects.hash(idKorisnik, imePrezime, passwordKorisnik, kreiranNaDatum); 67 83 } 84 85 @Override 86 public Collection<? extends GrantedAuthority> getAuthorities() { 87 return null; 88 } 89 90 @Override 91 public String getPassword() { 92 return null; 93 } 94 95 @Override 96 public String getUsername() { 97 return null; 98 } 99 100 @Override 101 public boolean isAccountNonExpired() { 102 return false; 103 } 104 105 @Override 106 public boolean isAccountNonLocked() { 107 return false; 108 } 109 110 @Override 111 public boolean isCredentialsNonExpired() { 112 return false; 113 } 114 115 @Override 116 public boolean isEnabled() { 117 return false; 118 } 68 119 } -
src/main/java/project/fmo/app/projcetfmo/Model/Kupuvac.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.*;4 3 4 import javax.persistence.*; 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "kupuvac", catalog = "db_202223z_va_prj_fmo") 8 9 public class Kupuvac { 9 @GeneratedValue(strategy = GenerationType.IDENTITY) 10 10 11 @Id 11 12 @Column(name = "id_korisnik") … … 14 15 @Column(name = "mail") 15 16 private String mail; 17 18 public Kupuvac(int idKorisnik, String mail) { 19 this.idKorisnik=idKorisnik; 20 this.mail=mail; 21 } 22 23 public Kupuvac() { 24 } 16 25 17 26 public int getIdKorisnik() { -
src/main/java/project/fmo/app/projcetfmo/Model/Magacin.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "magacin", catalog = "db_202223z_va_prj_fmo") 8 9 public class Magacin { 9 @GeneratedValue(strategy = GenerationType.IDENTITY) 10 10 11 @Id 11 12 @Column(name = "id_magacin") -
src/main/java/project/fmo/app/projcetfmo/Model/Magacioner.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "magacioner", catalog = "db_202223z_va_prj_fmo") 8 9 public class Magacioner { 9 @GeneratedValue(strategy = GenerationType.IDENTITY)10 10 @Id 11 11 @Column(name = "id_korisnik") 12 12 private int idKorisnik; 13 @ Basic14 @ Column(name = "id_magacin")15 private int idMagacin;13 @ManyToOne 14 @JoinColumn(name = "id_magacin") 15 private Magacin magacin; 16 16 17 17 public int getIdKorisnik() { … … 23 23 } 24 24 25 public int getIdMagacin() {26 return idMagacin;25 public Magacin getMagacin() { 26 return magacin; 27 27 } 28 28 29 public void set IdMagacin(int idMagacin) {30 this. idMagacin = idMagacin;29 public void setMagacin(Magacin magacin) { 30 this.magacin = magacin; 31 31 } 32 32 … … 36 36 if (o == null || getClass() != o.getClass()) return false; 37 37 Magacioner that = (Magacioner) o; 38 return idKorisnik == that.idKorisnik && idMagacin == that.idMagacin;38 return idKorisnik == that.idKorisnik && magacin == that.magacin; 39 39 } 40 40 41 41 @Override 42 42 public int hashCode() { 43 return Objects.hash(idKorisnik, idMagacin);43 return Objects.hash(idKorisnik, magacin); 44 44 } 45 45 } -
src/main/java/project/fmo/app/projcetfmo/Model/Naracka.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.sql.Date; … … 7 7 8 8 @Entity 9 @Table(schema = "project", name = "naracka", catalog = "db_202223z_va_prj_fmo") 9 10 public class Naracka { 10 11 @GeneratedValue(strategy = GenerationType.IDENTITY) … … 24 25 @Column(name = "adresa") 25 26 private String adresa; 26 @Basic 27 @Column(name = "id_korisnik") 28 private int idKorisnik; 27 @ManyToOne 28 @JoinColumn(name = "id_korisnik") 29 private Kupuvac kupuvac; 30 31 public Naracka(){} 32 33 public Naracka(int vkupnoSuma, Date datum, String status, String adresa, Kupuvac kupuvac) { 34 this.vkupnoSuma = vkupnoSuma; 35 this.datum = datum; 36 this.status = status; 37 this.adresa = adresa; 38 this.kupuvac = kupuvac; 39 } 29 40 30 41 public int getIdNaracka() { … … 69 80 70 81 public int getIdKorisnik() { 71 return idKorisnik;82 return kupuvac.getIdKorisnik(); 72 83 } 73 84 74 85 public void setIdKorisnik(int idKorisnik) { 75 this. idKorisnik = idKorisnik;86 this.kupuvac.setIdKorisnik(idKorisnik); 76 87 } 77 88 … … 81 92 if (o == null || getClass() != o.getClass()) return false; 82 93 Naracka naracka = (Naracka) o; 83 return idNaracka == naracka.idNaracka && vkupnoSuma == naracka.vkupnoSuma && idKorisnik == naracka.idKorisnik&& Objects.equals(datum, naracka.datum) && Objects.equals(status, naracka.status) && Objects.equals(adresa, naracka.adresa);94 return idNaracka == naracka.idNaracka && vkupnoSuma == naracka.vkupnoSuma && kupuvac == naracka.kupuvac && Objects.equals(datum, naracka.datum) && Objects.equals(status, naracka.status) && Objects.equals(adresa, naracka.adresa); 84 95 } 85 96 86 97 @Override 87 98 public int hashCode() { 88 return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, idKorisnik);99 return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, kupuvac); 89 100 } 90 101 } -
src/main/java/project/fmo/app/projcetfmo/Model/NarackaSodrziProdukt.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; … … 9 9 @IdClass(NarackaSodrziProduktPK.class) 10 10 public class NarackaSodrziProdukt { 11 @GeneratedValue(strategy = GenerationType.IDENTITY)12 11 @Id 13 12 @Column(name = "id_produkt") 14 13 private int idProdukt; 15 @GeneratedValue(strategy = GenerationType.IDENTITY)16 14 @Id 17 15 @Column(name = "id_naracka") … … 23 21 @Column(name = "cena") 24 22 private int cena; 23 24 public NarackaSodrziProdukt(){} 25 26 public NarackaSodrziProdukt(int idProdukt, int idNaracka, int kolicina, int cena) { 27 this.idProdukt = idProdukt; 28 this.idNaracka = idNaracka; 29 this.kolicina = kolicina; 30 this.cena = cena; 31 } 25 32 26 33 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/NarackaSodrziProduktPK.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.GeneratedValue; 5 import jakarta.persistence.GenerationType; 6 import jakarta.persistence.Id; 3 import javax.persistence.*; 4 7 5 8 6 import java.io.Serializable; … … 12 10 @Column(name = "id_produkt") 13 11 @Id 14 @GeneratedValue(strategy = GenerationType.IDENTITY)15 12 private int idProdukt; 16 13 @Column(name = "id_naracka") 17 14 @Id 18 @GeneratedValue(strategy = GenerationType.IDENTITY)19 15 private int idNaracka; 16 17 public NarackaSodrziProduktPK(){} 20 18 21 19 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/Produkt.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.*; 3 import javax.persistence.*; 4 import org.springframework.boot.autoconfigure.kafka.KafkaProperties; 4 5 5 6 import java.util.Objects; 6 7 7 8 @Entity 9 @Table(schema = "project", name = "produkt", catalog = "db_202223z_va_prj_fmo") 8 10 public class Produkt { 9 11 @GeneratedValue(strategy = GenerationType.IDENTITY) … … 17 19 @Column(name = "opis") 18 20 private String opis; 19 @Basic 20 @Column(name = "id_korisnik") 21 private int idKorisnik; 21 22 @ManyToOne 23 @JoinColumn(name = "id_korisnik") 24 private AdminKorisnik adminKorisnik; 25 26 public Produkt(){} 27 28 public Produkt(String ime, String opis, AdminKorisnik adminKorisnik) { 29 this.ime = ime; 30 this.opis = opis; 31 this.adminKorisnik = adminKorisnik; 32 } 22 33 23 34 public int getIdProdukt() { … … 46 57 47 58 public int getIdKorisnik() { 48 return idKorisnik;59 return adminKorisnik.getIdKorisnik(); 49 60 } 50 61 51 public void setIdKorisnik( intidKorisnik) {52 this. idKorisnik = idKorisnik;62 public void setIdKorisnik(AdminKorisnik idKorisnik) { 63 this.adminKorisnik = idKorisnik; 53 64 } 54 65 … … 58 69 if (o == null || getClass() != o.getClass()) return false; 59 70 Produkt produkt = (Produkt) o; 60 return idProdukt == produkt.idProdukt && idKorisnik == produkt.idKorisnik && Objects.equals(ime, produkt.ime) && Objects.equals(opis, produkt.opis);71 return idProdukt == produkt.idProdukt && adminKorisnik == produkt.adminKorisnik && Objects.equals(ime, produkt.ime) && Objects.equals(opis, produkt.opis); 61 72 } 62 73 63 74 @Override 64 75 public int hashCode() { 65 return Objects.hash(idProdukt, ime, opis, idKorisnik);76 return Objects.hash(idProdukt, ime, opis, adminKorisnik); 66 77 } 67 78 } -
src/main/java/project/fmo/app/projcetfmo/Model/ProduktEOdKategorija.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; … … 9 9 @IdClass(ProduktEOdKategorijaPK.class) 10 10 public class ProduktEOdKategorija { 11 @GeneratedValue(strategy = GenerationType.IDENTITY)12 11 @Id 13 12 @Column(name = "id_produkt") 14 13 private int idProdukt; 15 @GeneratedValue(strategy = GenerationType.IDENTITY)16 14 @Id 17 15 @Column(name = "id_kategorija") 18 16 private int idKategorija; 17 18 public ProduktEOdKategorija(int idProdukt, int idKategorija) { 19 this.idProdukt = idProdukt; 20 this.idKategorija = idKategorija; 21 } 22 23 public ProduktEOdKategorija() { 24 } 25 26 public ProduktEOdKategorija(ProduktEOdKategorijaPK produktEOdKategorijaPK) { 27 this.idKategorija= produktEOdKategorijaPK.getIdKategorija(); 28 this.idProdukt=produktEOdKategorijaPK.getIdProdukt(); 29 } 19 30 20 31 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/ProduktEOdKategorijaPK.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.GeneratedValue; 5 import jakarta.persistence.GenerationType; 6 import jakarta.persistence.Id; 3 import javax.persistence.*; 4 7 5 8 6 import java.io.Serializable; … … 12 10 @Column(name = "id_produkt") 13 11 @Id 14 @GeneratedValue(strategy = GenerationType.IDENTITY)15 12 private int idProdukt; 16 13 @Column(name = "id_kategorija") 17 14 @Id 18 @GeneratedValue(strategy = GenerationType.IDENTITY) 15 19 16 private int idKategorija; 17 18 19 public ProduktEOdKategorijaPK(){} 20 public ProduktEOdKategorijaPK(int idProdukt, int idKategorija) { 21 this.idKategorija=idKategorija; 22 this.idProdukt=idProdukt; 23 } 20 24 21 25 public int getIdProdukt() { -
src/main/java/project/fmo/app/projcetfmo/Model/ProduktEVoMagacin.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; -
src/main/java/project/fmo/app/projcetfmo/Model/ProduktEVoMagacinPK.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.GeneratedValue; 5 import jakarta.persistence.GenerationType; 6 import jakarta.persistence.Id; 3 import javax.persistence.*; 4 7 5 8 6 import java.io.Serializable; -
src/main/java/project/fmo/app/projcetfmo/Model/Telefonskibroj.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.util.Objects; 6 6 7 7 @Entity 8 @Table(schema = "project", name = "telefonskibroj", catalog = "db_202223z_va_prj_fmo") 8 9 @IdClass(TelefonskibrojPK.class) 9 10 public class Telefonskibroj { 10 @GeneratedValue(strategy = GenerationType.IDENTITY) 11 11 12 @Id 12 13 @Column(name = "id_korisnik") 13 14 private int idKorisnik; 14 @GeneratedValue(strategy = GenerationType.IDENTITY) 15 15 16 @Id 16 17 @Column(name = "telefonski_broj") 17 18 private String telefonskiBroj; 19 20 public Telefonskibroj(){} 21 22 public Telefonskibroj(TelefonskibrojPK telefonskibrojPK) { 23 this.idKorisnik = telefonskibrojPK.getIdKorisnik(); 24 this.telefonskiBroj = telefonskibrojPK.getTelefonskiBroj(); 25 } 18 26 19 27 public int getIdKorisnik() { -
src/main/java/project/fmo/app/projcetfmo/Model/TelefonskibrojPK.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.Column; 4 import jakarta.persistence.GeneratedValue; 5 import jakarta.persistence.GenerationType; 6 import jakarta.persistence.Id; 3 import javax.persistence.*; 7 4 8 5 import java.io.Serializable; … … 12 9 @Column(name = "id_korisnik") 13 10 @Id 14 @GeneratedValue(strategy = GenerationType.IDENTITY)15 11 private int idKorisnik; 16 12 @Column(name = "telefonski_broj") 17 13 @Id 18 @GeneratedValue(strategy = GenerationType.IDENTITY)19 14 private String telefonskiBroj; 15 16 17 public TelefonskibrojPK(){ 18 19 } 20 public TelefonskibrojPK(int idKorisnik, String telefonskiBroj) { 21 this.idKorisnik = idKorisnik; 22 this.telefonskiBroj = telefonskiBroj; 23 } 20 24 21 25 public int getIdKorisnik() { -
src/main/java/project/fmo/app/projcetfmo/Model/exception/InvalidUserCredentialsException.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Model.exception;public class InvalidUserCredentialsException { 1 package project.fmo.app.projcetfmo.Model.exception; 2 3 public class InvalidUserCredentialsException extends RuntimeException { 4 5 public InvalidUserCredentialsException() { 6 super("Invalid user credentials exception"); 7 } 2 8 } -
src/main/java/project/fmo/app/projcetfmo/Repository/AdminRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface AdminRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.apache.catalina.User; 4 import org.springframework.data.domain.Page; 5 import org.springframework.data.domain.Pageable; 6 import org.springframework.data.jpa.repository.JpaRepository; 7 import org.springframework.data.jpa.repository.Query; 8 import project.fmo.app.projcetfmo.Model.AdminKorisnik; 9 10 import java.util.Collection; 11 12 public interface AdminRepository extends JpaRepository<AdminKorisnik, Integer> { 13 2 14 } -
src/main/java/project/fmo/app/projcetfmo/Repository/CenaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface CenaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Cena; 5 import project.fmo.app.projcetfmo.Model.CenaPK; 6 7 public interface CenaRepository extends JpaRepository<Cena, CenaPK> { 8 Cena findByIdProdukt(Integer idProdukt); 9 void deleteByIdProdukt(Integer idProdukt); 2 10 } -
src/main/java/project/fmo/app/projcetfmo/Repository/DostavaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface DostavaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Dostava; 5 import project.fmo.app.projcetfmo.Model.Dostavuvac; 6 7 import java.util.List; 8 9 public interface DostavaRepository extends JpaRepository<Dostava, Integer> { 10 List<Dostava> findByDostavuvacAndStatus(Dostavuvac dostavuvac, String status); 11 List<Dostava> findByStatus(String status); 2 12 } -
src/main/java/project/fmo/app/projcetfmo/Repository/DostavuvacRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface DostavuvacRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Dostavuvac; 5 6 public interface DostavuvacRepository extends JpaRepository<Dostavuvac, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KategorijaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KategorijaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kategorija; 5 6 public interface KategorijaRepository extends JpaRepository<Kategorija, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KorisnikRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KorisnikRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import org.springframework.data.jpa.repository.Query; 5 import project.fmo.app.projcetfmo.Model.Korisnik; 6 7 import java.util.List; 8 9 public interface KorisnikRepository extends JpaRepository<Korisnik, Integer> { 10 Korisnik findByImePrezime(String s); 11 Korisnik findByImePrezimeAndPasswordKorisnik(String s, String p); 12 13 @Query(value ="select k.id_korisnik,k.ime_prezime,\n" + 14 "\n" + 15 "(select count(n) from project.naracka as n\n" + 16 "where n.id_korisnik = k.id_korisnik)\n" + 17 "as vkupno_naracki, \n" + 18 "\n" + 19 "(select avg(vkupno_suma) from project.naracka )\n" + 20 "as prosecna_suma_na_naracka_za_site_kupuvaci,\n" + 21 "\n" + 22 "(select sum(n3.vkupno_suma) from project.naracka as n3 \n" + 23 "where k.id_korisnik = n3.id_korisnik) \n" + 24 "as vkupno_suma_od_site_naracki_na_kupuvacot,\n" + 25 "\n" + 26 "(select count(n2) from project.naracka as n2\n" + 27 "where k.id_korisnik = n2.id_korisnik \n" + 28 "and n2.datum between now() - interval '1year' and now() \n" + 29 "and n2.vkupno_suma > (select avg(vkupno_suma) from project.naracka) )\n" + 30 "as vkupno_naracki_nad_prosek_na_korisnikot,\n" + 31 "\n" + 32 "(select sum(n4.vkupno_suma) from project.naracka as n4 \n" + 33 "where k.id_korisnik = n4.id_korisnik \n" + 34 "and n4.datum between now() - interval '1year' and now() \n" + 35 "and n4.vkupno_suma > (select avg(vkupno_suma) from project.naracka) ) \n" + 36 "as vkupno_suma_na_naracki_nad_prosek_za_korisnikot\n" + 37 "\n" + 38 "from project.korisnik as k \n" + 39 "inner join project.kupuvac as k2 on k.id_korisnik = k2.id_korisnik \n" + 40 "group by k.ime_prezime,k.id_korisnik ;" , 41 nativeQuery = true) 42 List<Object> statistics2(); 2 43 } -
src/main/java/project/fmo/app/projcetfmo/Repository/KupuvacRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface KupuvacRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 6 public interface KupuvacRepository extends JpaRepository<Kupuvac, Integer> { 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Repository/NarackaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public class NarackaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 import project.fmo.app.projcetfmo.Model.Naracka; 6 7 public interface NarackaRepository extends JpaRepository<Naracka, Integer> { 8 Naracka findByKupuvacAndStatus(Kupuvac kupuvac, String status); 9 Naracka findByKupuvacAndIdNaracka(Kupuvac kupuvac, Integer idN); 10 Naracka findByKupuvac(Kupuvac k); 11 2 12 } -
src/main/java/project/fmo/app/projcetfmo/Repository/NarackaSodrziProduktRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface NarackaSodrziProduktRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.NarackaSodrziProdukt; 5 import project.fmo.app.projcetfmo.Model.NarackaSodrziProduktPK; 6 7 import javax.persistence.criteria.CriteriaBuilder; 8 import java.util.List; 9 10 public interface NarackaSodrziProduktRepository extends JpaRepository<NarackaSodrziProdukt, NarackaSodrziProduktPK> { 11 NarackaSodrziProdukt findByIdProduktAndIdNaracka(Integer idP, Integer idN); 12 List<NarackaSodrziProdukt> findByIdNaracka(Integer id); 13 void deleteByIdProdukt(Integer id); 14 List<NarackaSodrziProdukt> findByIdProdukt(Integer id); 2 15 } -
src/main/java/project/fmo/app/projcetfmo/Repository/ProduktEOdKategorijaRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface ProduktEOdKategorijaRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorija; 5 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorijaPK; 6 7 public interface ProduktEOdKategorijaRepository extends JpaRepository<ProduktEOdKategorija, ProduktEOdKategorijaPK> { 8 ProduktEOdKategorija findByIdProdukt(Integer idProdukt); 9 void deleteByIdProdukt(Integer idProdukt); 10 ProduktEOdKategorija findByIdProduktAndIdKategorija(Integer idProdukt,Integer idKategorija); 2 11 } -
src/main/java/project/fmo/app/projcetfmo/Repository/ProduktRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public interface ProduktRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.domain.Pageable; 4 import org.springframework.data.jpa.repository.JpaRepository; 5 import org.springframework.data.jpa.repository.Query; 6 import project.fmo.app.projcetfmo.Model.Produkt; 7 8 import java.util.List; 9 10 public interface ProduktRepository extends JpaRepository<Produkt, Integer> { 11 @Query(value = """ 12 select p.id_produkt,p.ime,\s 13 count(nsp) as broj_na_naracki_vo_koi_e_prisuten_produktot,\s 14 sum(nsp.kolicina) as kolicina_prodadeno_od_produktot,\s 15 16 (select avg(n4.vkupno_suma) from project.naracka as n4\s 17 join project.naracka_sodrzi_produkt nsp4 on n4.id_naracka = nsp4.id_naracka \s 18 where n4.id_naracka =nsp4.id_naracka and p.id_produkt = nsp4.id_produkt and n4.datum between now() - interval '3months'\s 19 and now()) 20 as prosecna_suma_na_naracka_vo_koja_se_sodrzi_produktot, 21 22 (select count(n2) from project.naracka as n2\040 23 join project.naracka_sodrzi_produkt nsp2 on n2.id_naracka = nsp2.id_naracka\s 24 where nsp2.id_produkt = p.id_produkt and n2.adresa like '/'\s 25 and n2.datum between now() - interval '3months' and now()) 26 as broj_na_naracki_na_produktot_koi_korisnikot_sam_ke_gi_podigne, 27 28 (select sum(nsp2.kolicina) from project.naracka as n2\s 29 join project.naracka_sodrzi_produkt nsp2 on n2.id_naracka = nsp2.id_naracka\s 30 where nsp2.id_produkt = p.id_produkt and n2.adresa like '/'\s 31 and n2.datum between now() - interval '3months' and now())\s 32 as kolicina_prodadena_na_produktot_bez_dostava, 33 34 (select count(n3) from project.naracka as n3\s 35 join project.naracka_sodrzi_produkt nsp3 on n3.id_naracka = nsp3.id_naracka\s 36 where nsp3.id_produkt = p.id_produkt and n3.adresa not like '/' and n3.datum between now() - interval '3months' and now()) 37 as broj_na_naracki_na_produktot_koi_ke_bidat_dostaveni_na_korisnikot, 38 39 (select sum(nsp3.kolicina) from project.naracka as n3\s 40 join project.naracka_sodrzi_produkt nsp3 on n3.id_naracka = nsp3.id_naracka 41 where nsp3.id_produkt = p.id_produkt and n3.adresa not like '/' and n3.datum between now() - interval '3months' and now()) 42 as kolicina_prodadena_na_produktot_preku_dostava 43 44 from project.produkt as p 45 join project.naracka_sodrzi_produkt as nsp on p.id_produkt = nsp.id_produkt\s 46 join project.naracka as n on nsp.id_naracka = n.id_naracka\s 47 where n.datum between now() - interval '3months' and now() 48 group by p.ime,p.id_produkt;""", 49 nativeQuery = true) 50 List<Object> statistics1(); 51 2 52 } -
src/main/java/project/fmo/app/projcetfmo/Repository/TelefnoskiBrojRepository.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Repository;public class TelefnoskiBrojRepository { 1 package project.fmo.app.projcetfmo.Repository; 2 3 import org.springframework.data.jpa.repository.JpaRepository; 4 import project.fmo.app.projcetfmo.Model.Telefonskibroj; 5 import project.fmo.app.projcetfmo.Model.TelefonskibrojPK; 6 7 public interface TelefnoskiBrojRepository extends JpaRepository<Telefonskibroj, TelefonskibrojPK> { 8 2 9 } -
src/main/java/project/fmo/app/projcetfmo/Service/AdminService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface AdminService { 1 package project.fmo.app.projcetfmo.Service; 2 3 public interface AdminService { 2 4 } -
src/main/java/project/fmo/app/projcetfmo/Service/AuthService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface AuthService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Korisnik; 4 5 public interface AuthService { 6 Korisnik login(String username, String password); 2 7 } -
src/main/java/project/fmo/app/projcetfmo/Service/CenaService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface CenaService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Cena; 4 5 import java.util.Date; 6 import java.util.List; 7 8 public interface CenaService { 9 10 11 Cena save(Integer idProdukt, java.sql.Date cenaOd, java.sql.Date cenaDo, int iznos); 12 Cena edit (Integer idProdukt, java.sql.Date cenaOd, java.sql.Date cenaDo, int iznos); 13 14 List<Cena> findAll(); 15 16 Cena findByIdProdukt(int idProdukt); 17 void deleteByIdProdukt(int idProdukt); 18 19 2 20 } -
src/main/java/project/fmo/app/projcetfmo/Service/DostavaService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface DostavaService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Dostava; 4 import project.fmo.app.projcetfmo.Model.Dostavuvac; 5 6 import java.util.List; 7 8 public interface DostavaService { 9 10 List<Dostava> findByIdKorisnikAndStatus(Dostavuvac dostavuvac, String status); 11 Dostava edit(Integer id); 12 13 2 14 } -
src/main/java/project/fmo/app/projcetfmo/Service/DostavuvaceService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface DostavuvaceService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Dostavuvac; 4 5 import javax.persistence.criteria.CriteriaBuilder; 6 7 public interface DostavuvaceService { 8 9 Dostavuvac findById(Integer id); 2 10 } -
src/main/java/project/fmo/app/projcetfmo/Service/KategorijaService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface KategorijaService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Kategorija; 4 5 import java.util.List; 6 7 public interface KategorijaService { 8 9 10 List<Kategorija> findAll(); 11 Kategorija save(String ime); 12 Kategorija edit(Integer id, String ime); 13 2 14 } -
src/main/java/project/fmo/app/projcetfmo/Service/KorisnikService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface KorisnikService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import org.springframework.security.core.userdetails.UserDetails; 4 import org.springframework.security.core.userdetails.UserDetailsService; 5 import project.fmo.app.projcetfmo.Model.Korisnik; 6 import project.fmo.app.projcetfmo.Repository.KorisnikRepository; 7 8 import java.sql.Date; 9 import java.util.List; 10 11 public interface KorisnikService extends UserDetailsService { 12 Korisnik findbyImePrezime (String ime); 13 Korisnik findById(Integer id); 14 Korisnik register(String username, String password, String repeatPassword, String mail, String number); 15 16 List<Object> statistics2(); 2 17 } -
src/main/java/project/fmo/app/projcetfmo/Service/KupuvacService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public class KupuvacRepository { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Kupuvac; 4 5 public interface KupuvacService { 6 7 Kupuvac findById(Integer id); 2 8 } -
src/main/java/project/fmo/app/projcetfmo/Service/NarackaService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface NarackaService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.Kupuvac; 4 import project.fmo.app.projcetfmo.Model.Naracka; 5 import project.fmo.app.projcetfmo.Model.Produkt; 6 7 import java.sql.Date; 8 import java.util.List; 9 10 public interface NarackaService { 11 12 List<Produkt> allProductsInOrder(Integer narackaId); 13 Naracka getActiveOrder(String username); 14 Naracka findByIdKorisniktAndStatus(Integer id, String s); 15 16 Naracka save(int vkupnoSuma, Date date, String status, String adresa, Kupuvac k); 17 Naracka edit(int vkupnoSuma,String status,String adresa, Integer idK, Integer idN); 18 Naracka findByKupuvac(Kupuvac k); 19 Naracka findByIdNaracka(Integer id); 20 List<Naracka> findAll(); 21 22 2 23 } -
src/main/java/project/fmo/app/projcetfmo/Service/NarackaSodrziProduktService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface NarackaSodrziProduktService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.NarackaSodrziProdukt; 4 5 import javax.persistence.criteria.CriteriaBuilder; 6 import java.util.List; 7 8 public interface NarackaSodrziProduktService { 9 NarackaSodrziProdukt findByIdProduktAndIdNaracka(Integer idP, Integer idN); 10 NarackaSodrziProdukt edit(Integer idP, Integer idN, Integer quantity, Integer price); 11 NarackaSodrziProdukt save(Integer idP, Integer idN, Integer quantity, Integer price); 12 List<NarackaSodrziProdukt> findByIdNaracka(Integer id); 13 void deleteProduct(Integer id); 14 15 List<NarackaSodrziProdukt> findAll(); 16 17 List<NarackaSodrziProdukt> findByIdProdukt(Integer id); 2 18 } -
src/main/java/project/fmo/app/projcetfmo/Service/ProduktEOdKategorijaService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface ProduktEOdKategorijaService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorija; 4 5 import java.util.List; 6 7 public interface ProduktEOdKategorijaService { 8 9 10 ProduktEOdKategorija save(int idProdukt, int idKategorija); 11 ProduktEOdKategorija edit(int idProdukt, int idKategorija); 12 13 List<ProduktEOdKategorija> findAll(); 14 15 ProduktEOdKategorija findByIdProdukt(int idProdukt); 16 void deleteByIdProdukt(int idProdukt); 17 18 ProduktEOdKategorija findByIdProduktAndIdKategorija(int idProdukt, int idKategorija); 19 2 20 } -
src/main/java/project/fmo/app/projcetfmo/Service/ProduktService.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service;public interface ProduktService { 1 package project.fmo.app.projcetfmo.Service; 2 3 import org.springframework.data.domain.Page; 4 import project.fmo.app.projcetfmo.Model.Produkt; 5 6 import java.util.List; 7 import java.util.Optional; 8 9 public interface ProduktService { 10 11 Optional<Produkt> findById(Integer id); 12 List<Produkt> findAll(); 13 Produkt save(String ime, String opis); 14 Produkt edit(Integer id,String ime, String opis); 15 void deleteById(Integer id); 16 17 List<Object> statistics1(); 18 2 19 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/AuthServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class AuthServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Korisnik; 5 import project.fmo.app.projcetfmo.Repository.KorisnikRepository; 6 import project.fmo.app.projcetfmo.Service.AuthService; 7 8 @Service 9 public class AuthServiceImpl implements AuthService { 10 11 private final KorisnikRepository korisnikRepository; 12 13 public AuthServiceImpl(KorisnikRepository korisnikRepository) { 14 this.korisnikRepository = korisnikRepository; 15 } 16 17 @Override 18 public Korisnik login(String username, String password) { 19 return korisnikRepository.findByImePrezimeAndPasswordKorisnik(username,password); 20 } 2 21 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/CenaServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class CenaServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import javax.transaction.Transactional; 4 import org.springframework.stereotype.Service; 5 import project.fmo.app.projcetfmo.Model.Cena; 6 import project.fmo.app.projcetfmo.Model.CenaPK; 7 import project.fmo.app.projcetfmo.Repository.CenaRepository; 8 import project.fmo.app.projcetfmo.Service.CenaService; 9 10 import java.sql.Date; 11 import java.util.List; 12 13 @Service 14 public class CenaServiceImpl implements CenaService { 15 16 private final CenaRepository cenaRepository; 17 18 public CenaServiceImpl(CenaRepository cenaRepository) { 19 this.cenaRepository = cenaRepository; 20 } 21 22 @Override 23 public Cena save(Integer idProdukt, java.sql.Date cenaOd, java.sql.Date cenaDo, int iznos) { 24 Cena c = new Cena(idProdukt,cenaOd,cenaDo,iznos); 25 cenaRepository.save(c); 26 return c; 27 } 28 29 @Transactional 30 @Override 31 public Cena edit(Integer idProdukt, Date cenaOd, Date cenaDo, int iznos) { 32 Cena c = cenaRepository.findByIdProdukt(idProdukt); 33 cenaRepository.deleteByIdProdukt(c.getIdProdukt()); 34 Cena c1 = new Cena(idProdukt,cenaOd,cenaDo,iznos); 35 cenaRepository.save(c1); 36 return c; 37 } 38 39 @Override 40 public List<Cena> findAll() { 41 return cenaRepository.findAll(); 42 } 43 44 @Override 45 public Cena findByIdProdukt(int idProdukt) { 46 return cenaRepository.findByIdProdukt(idProdukt); 47 } 48 49 @Transactional 50 @Override 51 public void deleteByIdProdukt(int idProdukt) { 52 cenaRepository.deleteByIdProdukt(idProdukt); 53 } 2 54 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/DostavaServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class DostavaServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Dostava; 5 import project.fmo.app.projcetfmo.Model.Dostavuvac; 6 import project.fmo.app.projcetfmo.Repository.DostavaRepository; 7 import project.fmo.app.projcetfmo.Service.DostavaService; 8 9 import java.util.List; 10 11 @Service 12 public class DostavaServiceImpl implements DostavaService { 13 14 private final DostavaRepository dostavaRepository; 15 16 public DostavaServiceImpl(DostavaRepository dostavaRepository) { 17 this.dostavaRepository = dostavaRepository; 18 } 19 20 @Override 21 public List<Dostava> findByIdKorisnikAndStatus(Dostavuvac dostavuvac, String status) { 22 return dostavaRepository.findByDostavuvacAndStatus(dostavuvac,status); 23 } 24 25 @Override 26 public Dostava edit(Integer id) { 27 Dostava d = dostavaRepository.findById(id).orElse(null); 28 assert d != null; 29 d.setStatus("dostavena"); 30 dostavaRepository.save(d); 31 return d; 32 } 2 33 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/DostavuvacServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class DostavuvacServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Dostavuvac; 5 import project.fmo.app.projcetfmo.Repository.DostavuvacRepository; 6 import project.fmo.app.projcetfmo.Service.DostavuvaceService; 7 8 @Service 9 public class DostavuvacServiceImpl implements DostavuvaceService { 10 11 private final DostavuvacRepository dostavuvacRepository; 12 13 public DostavuvacServiceImpl(DostavuvacRepository dostavuvacRepository) { 14 this.dostavuvacRepository = dostavuvacRepository; 15 } 16 17 @Override 18 public Dostavuvac findById(Integer id) { 19 return dostavuvacRepository.findById(id).orElse(null); 20 } 2 21 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/KategorijaServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class KategorijaServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Kategorija; 5 import project.fmo.app.projcetfmo.Repository.KategorijaRepository; 6 import project.fmo.app.projcetfmo.Service.KategorijaService; 7 8 import java.util.List; 9 10 @Service 11 public class KategorijaServiceImpl implements KategorijaService { 12 13 private final KategorijaRepository kategorijaRepository; 14 15 public KategorijaServiceImpl(KategorijaRepository kategorijaRepository) { 16 this.kategorijaRepository = kategorijaRepository; 17 } 18 19 @Override 20 public List<Kategorija> findAll() { 21 return kategorijaRepository.findAll(); 22 } 23 24 @Override 25 public Kategorija save(String ime) { 26 Kategorija k = new Kategorija(ime); 27 kategorijaRepository.save(k); 28 return k; 29 } 30 31 @Override 32 public Kategorija edit(Integer id, String ime) { 33 Kategorija k = kategorijaRepository.findById(id).orElse(null); 34 assert k != null; 35 k.setIme(ime); 36 kategorijaRepository.save(k); 37 return k; 38 } 2 39 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/KorisnikServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class KorisnikServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.security.core.authority.SimpleGrantedAuthority; 4 import org.springframework.security.core.userdetails.User; 5 import org.springframework.security.core.userdetails.UserDetails; 6 import org.springframework.security.core.userdetails.UsernameNotFoundException; 7 import org.springframework.security.crypto.password.PasswordEncoder; 8 import org.springframework.stereotype.Service; 9 import project.fmo.app.projcetfmo.Model.*; 10 import project.fmo.app.projcetfmo.Repository.*; 11 import project.fmo.app.projcetfmo.Service.KorisnikService; 12 13 import java.sql.Timestamp; 14 import java.time.LocalDateTime; 15 import java.util.List; 16 import java.util.Objects; 17 import java.util.stream.Collectors; 18 import java.util.stream.Stream; 19 20 @Service 21 public class KorisnikServiceImpl implements KorisnikService { 22 23 private final PasswordEncoder passwordEncoder; 24 private final AdminRepository adminRepository; 25 private final DostavuvacRepository dostavuvacRepository; 26 27 private final TelefnoskiBrojRepository telefnoskiBrojRepository; 28 private final KupuvacRepository kupuvacRepository; 29 private final KorisnikRepository korisnikRepository; 30 31 public KorisnikServiceImpl(PasswordEncoder passwordEncoder, AdminRepository adminRepository, DostavuvacRepository dostavuvacRepository, TelefnoskiBrojRepository telefnoskiBrojRepository, KupuvacRepository kupuvacRepository, KorisnikRepository korisnikRepository) { 32 this.passwordEncoder = passwordEncoder; 33 this.adminRepository = adminRepository; 34 this.dostavuvacRepository = dostavuvacRepository; 35 this.telefnoskiBrojRepository = telefnoskiBrojRepository; 36 this.kupuvacRepository = kupuvacRepository; 37 this.korisnikRepository = korisnikRepository; 38 } 39 40 @Override 41 public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 42 Korisnik korisnik = korisnikRepository.findByImePrezime(username); 43 for (AdminKorisnik a: adminRepository.findAll()) { 44 if (a.getIdKorisnik() == korisnik.getIdKorisnik()) { 45 return new User(korisnik.getImePrezime(), korisnik.getPasswordKorisnik(), Stream.of(new SimpleGrantedAuthority("ROLE_ADMIN")).collect(Collectors.toList())); 46 } 47 } 48 for (Dostavuvac a: dostavuvacRepository.findAll()) { 49 if (a.getIdKorisnik() == korisnik.getIdKorisnik()) { 50 return new User(korisnik.getImePrezime(), korisnik.getPasswordKorisnik(), Stream.of(new SimpleGrantedAuthority("ROLE_DELIVER")).collect(Collectors.toList())); 51 } 52 } 53 for (Kupuvac a: kupuvacRepository.findAll()){ 54 if (a.getIdKorisnik() == korisnik.getIdKorisnik()){ 55 return new User(korisnik.getImePrezime(),korisnik.getPasswordKorisnik(), Stream.of(new SimpleGrantedAuthority("ROLE_USER")).collect(Collectors.toList()) ); 56 } 57 } 58 return null; 59 } 60 61 @Override 62 public Korisnik findbyImePrezime(String ime) { 63 return korisnikRepository.findByImePrezime(ime); 64 } 65 66 @Override 67 public Korisnik findById(Integer id) { 68 return korisnikRepository.findById(id).orElse(null); 69 } 70 71 @Override 72 public Korisnik register(String username, String password, String repeatPassword, String mail, String number) { 73 if (username==null || username.isEmpty() || password==null || password.isEmpty()) 74 throw new RuntimeException(); 75 if (!password.equals(repeatPassword)) 76 throw new RuntimeException(); 77 78 Korisnik korisnik = new Korisnik(username,password, Timestamp.valueOf(LocalDateTime.now())); 79 korisnikRepository.save(korisnik); 80 Kupuvac k = new Kupuvac(korisnik.getIdKorisnik(), mail); 81 kupuvacRepository.save(k); 82 Telefonskibroj t = new Telefonskibroj(new TelefonskibrojPK(korisnik.getIdKorisnik(),number)); 83 telefnoskiBrojRepository.save(t); 84 return korisnik; 85 86 } 87 88 @Override 89 public List<Object> statistics2() { 90 return korisnikRepository.statistics2(); 91 } 2 92 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/KupuvacServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class KupuvacServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 import project.fmo.app.projcetfmo.Repository.KupuvacRepository; 6 import project.fmo.app.projcetfmo.Service.KupuvacService; 7 8 @Service 9 public class KupuvacServiceImpl implements KupuvacService { 10 11 private final KupuvacRepository kupuvacRepository; 12 13 public KupuvacServiceImpl(KupuvacRepository kupuvacRepository) { 14 this.kupuvacRepository = kupuvacRepository; 15 } 16 17 @Override 18 public Kupuvac findById(Integer id) { 19 return kupuvacRepository.findById(id).orElse(null); 20 } 2 21 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/NarackaServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class NarackaServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.Kupuvac; 5 import project.fmo.app.projcetfmo.Model.Naracka; 6 import project.fmo.app.projcetfmo.Model.Produkt; 7 import project.fmo.app.projcetfmo.Repository.KupuvacRepository; 8 import project.fmo.app.projcetfmo.Repository.NarackaRepository; 9 import project.fmo.app.projcetfmo.Service.NarackaService; 10 11 import java.sql.Date; 12 import java.util.List; 13 14 @Service 15 public class NarackaServiceImpl implements NarackaService { 16 17 private final NarackaRepository narackaRepository; 18 private final KupuvacRepository kupuvacRepository; 19 20 public NarackaServiceImpl(NarackaRepository narackaRepository, KupuvacRepository kupuvacRepository) { 21 this.narackaRepository = narackaRepository; 22 this.kupuvacRepository = kupuvacRepository; 23 } 24 25 @Override 26 public List<Produkt> allProductsInOrder(Integer narackaId) { 27 return null; 28 } 29 30 @Override 31 public Naracka getActiveOrder(String username) { 32 return null; 33 } 34 35 @Override 36 public Naracka findByIdKorisniktAndStatus(Integer id, String s) { 37 Kupuvac k = kupuvacRepository.findById(id).orElse(null); 38 return narackaRepository.findByKupuvacAndStatus(k,s); 39 } 40 41 @Override 42 public Naracka save(int vkupnoSuma, Date date, String status, String adresa, Kupuvac k) { 43 return narackaRepository.save(new Naracka(vkupnoSuma,date,status,adresa,k)); 44 } 45 46 @Override 47 public Naracka edit(int vkupnoSuma, String status, String adresa, Integer idK, Integer idN) { 48 Kupuvac k = kupuvacRepository.findById(idK).orElse(null); 49 Naracka n = narackaRepository.findByKupuvacAndIdNaracka(k,idN); 50 n.setVkupnoSuma(n.getVkupnoSuma()+vkupnoSuma); 51 n.setStatus(status); 52 n.setAdresa(adresa); 53 narackaRepository.save(n); 54 return n; 55 } 56 57 @Override 58 public Naracka findByKupuvac(Kupuvac k) { 59 return narackaRepository.findByKupuvac(k); 60 } 61 62 @Override 63 public Naracka findByIdNaracka(Integer id) { 64 return narackaRepository.findById(id).orElse(null); 65 } 66 67 @Override 68 public List<Naracka> findAll() { 69 return narackaRepository.findAll(); 70 } 2 71 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/NarackaSodrziProduktServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class NarackaSodrziProduktServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.stereotype.Service; 4 import project.fmo.app.projcetfmo.Model.NarackaSodrziProdukt; 5 import project.fmo.app.projcetfmo.Repository.NarackaSodrziProduktRepository; 6 import project.fmo.app.projcetfmo.Service.NarackaSodrziProduktService; 7 8 import java.util.List; 9 10 @Service 11 public class NarackaSodrziProduktServiceImpl implements NarackaSodrziProduktService { 12 13 private final NarackaSodrziProduktRepository narackaSodrziProduktRepository; 14 15 public NarackaSodrziProduktServiceImpl(NarackaSodrziProduktRepository narackaSodrziProduktRepository) { 16 this.narackaSodrziProduktRepository = narackaSodrziProduktRepository; 17 } 18 19 @Override 20 public NarackaSodrziProdukt findByIdProduktAndIdNaracka(Integer idP, Integer idN) { 21 return narackaSodrziProduktRepository.findByIdProduktAndIdNaracka(idP,idN); 22 } 23 24 @Override 25 public NarackaSodrziProdukt edit(Integer idP, Integer idN, Integer quantity, Integer price) { 26 NarackaSodrziProdukt n = narackaSodrziProduktRepository.findByIdProduktAndIdNaracka(idP,idN); 27 n.setCena(price); 28 n.setKolicina(n.getKolicina()+quantity); 29 narackaSodrziProduktRepository.save(n); 30 return n; 31 } 32 33 @Override 34 public NarackaSodrziProdukt save(Integer idP, Integer idN, Integer quantity, Integer price) { 35 NarackaSodrziProdukt n = new NarackaSodrziProdukt(idP,idN,quantity, price); 36 narackaSodrziProduktRepository.save(n); 37 return n; 38 } 39 40 @Override 41 public List<NarackaSodrziProdukt> findByIdNaracka(Integer id) { 42 return narackaSodrziProduktRepository.findByIdNaracka(id); 43 } 44 45 @Override 46 public void deleteProduct(Integer id) { 47 List<NarackaSodrziProdukt> narackaSodrziProdukts = narackaSodrziProduktRepository.findByIdProdukt(id); 48 narackaSodrziProduktRepository.deleteByIdProdukt(id); 49 } 50 51 @Override 52 public List<NarackaSodrziProdukt> findAll() { 53 return narackaSodrziProduktRepository.findAll(); 54 } 55 56 @Override 57 public List<NarackaSodrziProdukt> findByIdProdukt(Integer id) { 58 return narackaSodrziProduktRepository.findByIdProdukt(id); 59 } 60 61 2 62 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/ProduktEOdKategorijaServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class ProduktEOdKategorijaServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import javax.transaction.Transactional; 4 import org.springframework.stereotype.Service; 5 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorija; 6 import project.fmo.app.projcetfmo.Model.ProduktEOdKategorijaPK; 7 import project.fmo.app.projcetfmo.Repository.ProduktEOdKategorijaRepository; 8 import project.fmo.app.projcetfmo.Service.ProduktEOdKategorijaService; 9 import project.fmo.app.projcetfmo.Service.ProduktService; 10 11 import java.util.List; 12 13 @Service 14 public class ProduktEOdKategorijaServiceImpl implements ProduktEOdKategorijaService { 15 16 private final ProduktEOdKategorijaRepository produktEOdKategorijaRepository; 17 18 public ProduktEOdKategorijaServiceImpl(ProduktEOdKategorijaRepository produktEOdKategorijaRepository) { 19 this.produktEOdKategorijaRepository = produktEOdKategorijaRepository; 20 } 21 22 @Override 23 public ProduktEOdKategorija save(int idProdukt, int idKategorija) { 24 ProduktEOdKategorija produktEOdKategorija= new ProduktEOdKategorija(new ProduktEOdKategorijaPK(idProdukt, idKategorija)); 25 produktEOdKategorijaRepository.save(produktEOdKategorija); 26 return produktEOdKategorija; 27 } 28 29 @Transactional 30 @Override 31 public ProduktEOdKategorija edit(int idProdukt, int idKategorija) { 32 // ProduktEOdKategorijaPK pk = new ProduktEOdKategorijaPK(idProdukt,idKategorija); 33 ProduktEOdKategorija peodkD = produktEOdKategorijaRepository.findByIdProdukt(idProdukt); 34 produktEOdKategorijaRepository.deleteByIdProdukt(peodkD.getIdProdukt()); 35 ProduktEOdKategorijaPK pk = new ProduktEOdKategorijaPK(idProdukt, idKategorija); 36 ProduktEOdKategorija peodk = new ProduktEOdKategorija(pk); 37 produktEOdKategorijaRepository.save(peodk); 38 39 return peodk; 40 } 41 42 @Override 43 public List<ProduktEOdKategorija> findAll() { 44 return produktEOdKategorijaRepository.findAll(); 45 } 46 47 @Override 48 public ProduktEOdKategorija findByIdProdukt(int idProdukt) { 49 return produktEOdKategorijaRepository.findByIdProdukt(idProdukt); 50 } 51 52 @Transactional 53 @Override 54 public void deleteByIdProdukt(int idProdukt) { 55 56 this.produktEOdKategorijaRepository.deleteByIdProdukt(idProdukt); 57 } 58 59 @Override 60 public ProduktEOdKategorija findByIdProduktAndIdKategorija(int idProdukt, int idKategorija) { 61 return produktEOdKategorijaRepository.findByIdProduktAndIdKategorija(idProdukt,idKategorija); 62 } 2 63 } -
src/main/java/project/fmo/app/projcetfmo/Service/impl/ProduktServiceImpl.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Service.impl;public class ProduktServiceImpl { 1 package project.fmo.app.projcetfmo.Service.impl; 2 3 import org.springframework.data.domain.Page; 4 import org.springframework.data.domain.Pageable; 5 import org.springframework.stereotype.Service; 6 import project.fmo.app.projcetfmo.Model.AdminKorisnik; 7 import project.fmo.app.projcetfmo.Model.Produkt; 8 import project.fmo.app.projcetfmo.Repository.AdminRepository; 9 import project.fmo.app.projcetfmo.Repository.ProduktRepository; 10 import project.fmo.app.projcetfmo.Service.ProduktService; 11 12 13 import java.util.List; 14 import java.util.Optional; 15 import java.util.Random; 16 17 @Service 18 public class ProduktServiceImpl implements ProduktService { 19 20 private final ProduktRepository produktRepository; 21 private final AdminRepository adminRepository; 22 23 public ProduktServiceImpl(ProduktRepository produktRepository, AdminRepository adminRepository) { 24 this.produktRepository = produktRepository; 25 this.adminRepository = adminRepository; 26 } 27 28 @Override 29 public Optional<Produkt> findById(Integer id) { 30 return produktRepository.findById(id); 31 } 32 33 @Override 34 public List<Produkt> findAll() { 35 return produktRepository.findAll(); 36 } 37 38 @Override 39 public Produkt save(String ime, String opis) { 40 List<AdminKorisnik> list = adminRepository.findAll(); 41 Random rand = new Random(); 42 int randomIndex = rand.nextInt(list.size()); 43 AdminKorisnik a = list.get(randomIndex); 44 if (a == null){ 45 throw new RuntimeException(); 46 } 47 Produkt p = new Produkt(ime, opis, a); 48 produktRepository.save(p); 49 return p; 50 } 51 52 @Override 53 public Produkt edit(Integer id, String ime, String opis) { 54 Produkt p = produktRepository.findById(id).orElse(null); 55 if (p == null ){ 56 throw new RuntimeException(); 57 } 58 p.setIme(ime); 59 p.setOpis(opis); 60 produktRepository.save(p); 61 return p; 62 } 63 64 @Override 65 public void deleteById(Integer id) { 66 produktRepository.deleteById(id); 67 } 68 69 @Override 70 public List<Object> statistics1() { 71 return produktRepository.statistics1(); 72 } 2 73 } -
src/main/java/project/fmo/app/projcetfmo/Web/DostavaController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class DostavaController { 1 package project.fmo.app.projcetfmo.Web; 2 3 import org.springframework.stereotype.Controller; 4 import org.springframework.ui.Model; 5 import org.springframework.web.bind.annotation.GetMapping; 6 import org.springframework.web.bind.annotation.PathVariable; 7 import org.springframework.web.bind.annotation.PostMapping; 8 import org.springframework.web.bind.annotation.RequestMapping; 9 import project.fmo.app.projcetfmo.Model.Dostava; 10 import project.fmo.app.projcetfmo.Model.Dostavuvac; 11 import project.fmo.app.projcetfmo.Model.Korisnik; 12 import project.fmo.app.projcetfmo.Service.DostavaService; 13 import project.fmo.app.projcetfmo.Service.DostavuvaceService; 14 import project.fmo.app.projcetfmo.Service.KorisnikService; 15 import project.fmo.app.projcetfmo.Service.NarackaService; 16 17 import javax.servlet.http.HttpServletRequest; 18 import java.util.List; 19 20 @Controller 21 @RequestMapping("/delivery") 22 public class DostavaController { 23 24 private final DostavaService dostavaService; 25 private final DostavuvaceService dostavuvaceService; 26 private final KorisnikService korisnikService; 27 private final NarackaService narackaService; 28 29 public DostavaController(DostavaService dostavaService, DostavuvaceService dostavuvaceService, KorisnikService korisnikService, NarackaService narackaService) { 30 this.dostavaService = dostavaService; 31 this.dostavuvaceService = dostavuvaceService; 32 this.korisnikService = korisnikService; 33 this.narackaService = narackaService; 34 } 35 36 37 @GetMapping 38 public String getDelivery(Model model, HttpServletRequest req){ 39 String username = req.getRemoteUser(); 40 Korisnik korisnik = korisnikService.findbyImePrezime(username); 41 Dostavuvac dostavuvac = dostavuvaceService.findById(korisnik.getIdKorisnik()); 42 List<Dostava> dostavaList = dostavaService.findByIdKorisnikAndStatus(dostavuvac, "za dostava"); 43 model.addAttribute("user", korisnik); 44 model.addAttribute("orders", narackaService.findAll()); 45 model.addAttribute("delivers", dostavaList); 46 model.addAttribute("bodyContent", "delivery"); 47 return "master_template"; 48 } 49 50 @PostMapping("/{id}") 51 public String OrderDelivered(@PathVariable Integer id){ 52 dostavaService.edit(id); 53 return "redirect:/delivery"; 54 } 55 2 56 } -
src/main/java/project/fmo/app/projcetfmo/Web/HomeController.java
r1dd9226 rd14176d 9 9 @Controller 10 10 @RequestMapping({"/","/home"}) 11 public class StoreController {11 public class HomeController { 12 12 13 13 14 14 @GetMapping 15 public String getHomePage(){ 16 return "home"; 15 public String getHomePage(Model model){ 16 model.addAttribute("bodyContent", "home"); 17 return "master_template"; 17 18 } 18 19 20 @GetMapping("/access_denied") 21 public String getAccessDeniedPage(Model model) { 22 model.addAttribute("bodyContent", "access_denied"); 23 return "master-template"; 24 } 25 26 19 27 } -
src/main/java/project/fmo/app/projcetfmo/Web/LoginController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class LoginController { 1 package project.fmo.app.projcetfmo.Web; 2 3 4 import org.springframework.stereotype.Controller; 5 import org.springframework.ui.Model; 6 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.PostMapping; 8 import org.springframework.web.bind.annotation.RequestMapping; 9 import project.fmo.app.projcetfmo.Model.Korisnik; 10 import project.fmo.app.projcetfmo.Model.exception.InvalidUserCredentialsException; 11 import project.fmo.app.projcetfmo.Service.AuthService; 12 13 import javax.servlet.http.HttpServletRequest; 14 15 @Controller 16 @RequestMapping("/login") 17 public class LoginController { 18 19 private final AuthService authService; 20 21 public LoginController(AuthService authService) { 22 this.authService = authService; 23 } 24 25 @GetMapping 26 public String getLoginPage(Model model) { 27 model.addAttribute("bodyContent","login"); 28 return "master-template"; 29 } 30 31 @PostMapping 32 public String login(HttpServletRequest request, Model model) { 33 Korisnik user = null; 34 try{ 35 user = this.authService.login(request.getParameter("username"), 36 request.getParameter("password")); 37 request.getSession().setAttribute("user", user); 38 return "redirect:/home"; 39 } 40 catch (InvalidUserCredentialsException exception) { 41 model.addAttribute("hasError", true); 42 model.addAttribute("error", exception.getMessage()); 43 return "login"; 44 } 45 } 2 46 } -
src/main/java/project/fmo/app/projcetfmo/Web/LogoutController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class LogoutController { 1 package project.fmo.app.projcetfmo.Web; 2 3 import org.springframework.stereotype.Controller; 4 import org.springframework.web.bind.annotation.GetMapping; 5 import org.springframework.web.bind.annotation.RequestMapping; 6 7 import javax.servlet.http.HttpServletRequest; 8 9 @Controller 10 @RequestMapping("/logout") 11 public class LogoutController { 12 13 @GetMapping 14 public String logout(HttpServletRequest request) { 15 request.getSession().invalidate(); 16 return "redirect:/"; 17 } 2 18 } -
src/main/java/project/fmo/app/projcetfmo/Web/NarackaController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class NarackaController { 1 package project.fmo.app.projcetfmo.Web; 2 3 import org.springframework.stereotype.Controller; 4 import org.springframework.ui.Model; 5 import org.springframework.web.bind.annotation.*; 6 import project.fmo.app.projcetfmo.Model.*; 7 import project.fmo.app.projcetfmo.Service.*; 8 9 import javax.servlet.http.HttpServletRequest; 10 import java.util.List; 11 12 @Controller 13 @RequestMapping("/order") 14 public class NarackaController { 15 16 private final NarackaService narackaService; 17 private final NarackaSodrziProduktService narackaSodrziProduktService; 18 private final KorisnikService korisnikService; 19 private final KupuvacService kupuvacService; 20 private final CenaService cenaService; 21 22 private final ProduktService produktService; 23 24 public NarackaController(NarackaService narackaService, NarackaSodrziProduktService narackaSodrziProduktService, KorisnikService korisnikService, KupuvacService kupuvacService, CenaService cenaService, ProduktService produktService) { 25 this.narackaService = narackaService; 26 this.narackaSodrziProduktService = narackaSodrziProduktService; 27 this.korisnikService = korisnikService; 28 this.kupuvacService = kupuvacService; 29 this.cenaService = cenaService; 30 this.produktService = produktService; 31 } 32 33 @GetMapping 34 public String getShoppingCartPage(@RequestParam(required = false) String error, 35 HttpServletRequest req, 36 Model model) { 37 if (error != null && !error.isEmpty()) { 38 model.addAttribute("hasError", true); 39 model.addAttribute("error", error); 40 } 41 String username = req.getRemoteUser(); 42 Korisnik korisnik = korisnikService.findbyImePrezime(username); 43 Kupuvac kupuvac = kupuvacService.findById(korisnik.getIdKorisnik()); 44 Naracka naracka = this.narackaService.findByIdKorisniktAndStatus(kupuvac.getIdKorisnik(),"aktivna"); 45 if(naracka == null){ 46 model.addAttribute("bodyContent", "home"); 47 return "master_template"; 48 } 49 List<NarackaSodrziProdukt> narackaSodrziProdukt = narackaSodrziProduktService.findByIdNaracka(naracka.getIdNaracka()); 50 List<Produkt> produktList = produktService.findAll(); 51 model.addAttribute("order", naracka); 52 model.addAttribute("products", produktList); 53 model.addAttribute("po", narackaSodrziProdukt); 54 model.addAttribute("prices", cenaService.findAll()); 55 model.addAttribute("bodyContent", "cart"); 56 return "master_template"; 57 } 58 59 @PostMapping("/{id}/success") 60 public String processOrder(@PathVariable Integer id,HttpServletRequest req,@RequestParam(required = false) String address){ 61 Naracka n = narackaService.findByIdNaracka(id); 62 String username = req.getRemoteUser(); 63 Korisnik korisnik = korisnikService.findbyImePrezime(username); 64 Kupuvac kupuvac = kupuvacService.findById(korisnik.getIdKorisnik()); 65 if(address!=null) { 66 narackaService.edit(0, "se sprema", address, kupuvac.getIdKorisnik(), n.getIdNaracka()); 67 } 68 else { 69 narackaService.edit(0, "se sprema", "/", kupuvac.getIdKorisnik(), n.getIdNaracka()); 70 } 71 return "redirect:/products"; 72 } 73 74 75 2 76 } -
src/main/java/project/fmo/app/projcetfmo/Web/ProductController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class ProductController { 1 package project.fmo.app.projcetfmo.Web; 2 3 4 import org.springframework.format.annotation.DateTimeFormat; 5 import org.springframework.stereotype.Controller; 6 import org.springframework.ui.Model; 7 import org.springframework.web.bind.annotation.*; 8 import project.fmo.app.projcetfmo.Model.*; 9 import project.fmo.app.projcetfmo.Service.*; 10 11 12 import java.sql.Date; 13 import java.text.ParseException; 14 15 import java.time.LocalDate; 16 import java.util.List; 17 18 19 @Controller 20 @RequestMapping("/products") 21 public class ProductController { 22 23 private final ProduktService produktService; 24 private final KategorijaService kategorijaService; 25 private final ProduktEOdKategorijaService produktEOdKategorijaService; 26 private final CenaService cenaService; 27 private final NarackaService narackaService; 28 private final NarackaSodrziProduktService narackaSodrziProduktService; 29 private final KupuvacService kupuvacService; 30 private final KorisnikService korisnikService; 31 32 public ProductController(ProduktService produktService, KategorijaService kategorijaService, ProduktEOdKategorijaService produktEOdKategorijaService, CenaService cenaService, NarackaService narackaService, NarackaSodrziProduktService narackaSodrziProduktService, KupuvacService kupuvacService, KorisnikService korisnikService) { 33 this.produktService = produktService; 34 this.kategorijaService = kategorijaService; 35 this.produktEOdKategorijaService = produktEOdKategorijaService; 36 this.cenaService = cenaService; 37 this.narackaService = narackaService; 38 this.narackaSodrziProduktService = narackaSodrziProduktService; 39 this.kupuvacService = kupuvacService; 40 this.korisnikService = korisnikService; 41 } 42 43 @GetMapping 44 public String getProductPage(Model model) { 45 List<Produkt> products = this.produktService.findAll(); 46 model.addAttribute("products", products); 47 model.addAttribute("kat", kategorijaService.findAll()); 48 model.addAttribute("categories", produktEOdKategorijaService.findAll()); 49 model.addAttribute("prices", cenaService.findAll()); 50 model.addAttribute("bodyContent", "products"); 51 return "master_template"; 52 } 53 54 @GetMapping("/{id}") 55 public String getProductInfo(Model model, @PathVariable Integer id){ 56 Produkt p = produktService.findById(id).orElse(null); 57 Cena c = cenaService.findByIdProdukt(id); 58 ProduktEOdKategorija pk = produktEOdKategorijaService.findByIdProdukt(id); 59 List<Kategorija> k = kategorijaService.findAll(); 60 Kategorija kat = null; 61 for ( Kategorija kategorija : k){ 62 if (kategorija.getIdKategorija() == pk.getIdKategorija()){ 63 kat=kategorija; 64 } 65 } 66 model.addAttribute("product", p); 67 model.addAttribute("price", c); 68 model.addAttribute("category",pk); 69 if(kat != null) { 70 model.addAttribute("kat", kat); 71 } 72 model.addAttribute("bodyContent", "product_info"); 73 return "master_template"; 74 } 75 76 @PostMapping("{id}/add-to-cart") 77 public String addProductToCart(@PathVariable Integer id, 78 @RequestParam String idKorisnik, 79 @RequestParam int cena, 80 @RequestParam int quantity){ 81 Korisnik kOrisnik = korisnikService.findbyImePrezime(idKorisnik); 82 Kupuvac k = kupuvacService.findById(kOrisnik.getIdKorisnik()); 83 Naracka n = narackaService.findByIdKorisniktAndStatus(k.getIdKorisnik(),"aktivna"); 84 if (n == null){ 85 //Naracka narackaNova = new Naracka(cena*quantity, Date.valueOf(LocalDate.now()), "aktivna", "/", k); 86 Naracka narackaNova = narackaService.save(cena*quantity, Date.valueOf(LocalDate.now()), "aktivna", "/", k); 87 NarackaSodrziProdukt nsp = new NarackaSodrziProdukt(id,narackaNova.getIdNaracka(),quantity,cena); 88 narackaSodrziProduktService.save(id,narackaNova.getIdNaracka(),quantity,cena); 89 90 return "redirect:/products"; 91 } 92 else { 93 narackaService.edit(cena*quantity,n.getStatus(),n.getAdresa(),k.getIdKorisnik(),n.getIdNaracka()); 94 NarackaSodrziProdukt narackaSodrziProdukt = narackaSodrziProduktService.findByIdProduktAndIdNaracka(id,n.getIdNaracka()); 95 if(narackaSodrziProdukt == null){ 96 NarackaSodrziProdukt nova = new NarackaSodrziProdukt(id,n.getIdNaracka(),quantity,cena); 97 narackaSodrziProduktService.save(id,n.getIdNaracka(),quantity,cena); 98 } 99 else{ 100 narackaSodrziProduktService.edit(id,n.getIdNaracka(),quantity,cena); 101 } 102 return "redirect:/products"; 103 } 104 } 105 106 @DeleteMapping("/delete/{id}") 107 public String deleteProduct(@PathVariable Integer id,Model model) { 108 if(narackaSodrziProduktService.findByIdProdukt(id).size() != 0){ 109 model.addAttribute("bodyContent", "not_valid_delete"); 110 return "master_template"; 111 } 112 this.cenaService.deleteByIdProdukt(id); 113 this.produktEOdKategorijaService.deleteByIdProdukt(id); 114 this.produktService.deleteById(id); 115 return "redirect:/products"; 116 } 117 118 @GetMapping("/edit-form/{id}") 119 public String editProductPage(@PathVariable Integer id, Model model) { 120 if (this.produktService.findById(id).isPresent()) { 121 Produkt product = this.produktService.findById(id).get(); 122 Cena c = cenaService.findByIdProdukt(product.getIdProdukt()); 123 ProduktEOdKategorija produktEOdKategorija = produktEOdKategorijaService.findByIdProdukt(product.getIdProdukt()); 124 model.addAttribute("chosen", produktEOdKategorija); 125 model.addAttribute("price", c); 126 List<Kategorija> categories = this.kategorijaService.findAll(); 127 model.addAttribute("categories", categories); 128 model.addAttribute("product", product); 129 model.addAttribute("bodyContent", "add_product"); 130 return "master_template"; 131 } 132 return "redirect:/products"; 133 } 134 135 @GetMapping("/add-form") 136 public String addProductPage(Model model) { 137 List<Kategorija> categories = this.kategorijaService.findAll(); 138 model.addAttribute("categories", categories); 139 model.addAttribute("bodyContent", "add_product"); 140 return "master_template"; 141 } 142 143 @PostMapping("/add") 144 public String saveProduct( 145 @RequestParam(required = false) Integer id, 146 @RequestParam String name, 147 @RequestParam(required = false) String description, 148 @RequestParam Integer category, 149 @RequestParam Date date, 150 @RequestParam(required = false) String dateTo, 151 @RequestParam int price) throws ParseException { 152 if(dateTo.length() != 0) { 153 Date d = Date.valueOf(dateTo); 154 155 if (id != null) { 156 this.produktService.edit(id, name, description); 157 this.cenaService.edit(id, date, d, price); 158 this.produktEOdKategorijaService.edit(id, category); 159 160 } else { 161 Produkt p = this.produktService.save(name, description); 162 this.cenaService.save(p.getIdProdukt(), date, d, price); 163 this.produktEOdKategorijaService.save(p.getIdProdukt(), category); 164 } 165 } 166 else{ 167 if (id != null) { 168 this.produktService.edit(id, name, description); 169 this.cenaService.edit(id, date, null, price); 170 this.produktEOdKategorijaService.edit(id, category); 171 172 } else { 173 Produkt p = this.produktService.save(name, description); 174 this.cenaService.save(p.getIdProdukt(), date, null, price); 175 this.produktEOdKategorijaService.save(p.getIdProdukt(), category); 176 } 177 178 } 179 return "redirect:/products"; 180 } 181 182 183 184 2 185 } -
src/main/java/project/fmo/app/projcetfmo/Web/RegisterController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class RegisterController { 1 package project.fmo.app.projcetfmo.Web; 2 3 import org.springframework.stereotype.Controller; 4 import org.springframework.ui.Model; 5 import org.springframework.web.bind.annotation.GetMapping; 6 import org.springframework.web.bind.annotation.PostMapping; 7 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestParam; 9 import project.fmo.app.projcetfmo.Service.KorisnikService; 10 11 @Controller 12 @RequestMapping("/register") 13 public class RegisterController { 14 15 private final KorisnikService korisnikService; 16 17 18 public RegisterController(KorisnikService korisnikService) { 19 this.korisnikService = korisnikService; 20 } 21 22 23 @GetMapping 24 public String getRegisterPage(@RequestParam(required = false) String error, Model model) { 25 if(error != null && !error.isEmpty()) { 26 model.addAttribute("hasError", true); 27 model.addAttribute("error", error); 28 } 29 model.addAttribute("bodyContent","register"); 30 return "master_template"; 31 } 32 33 @PostMapping 34 public String register(@RequestParam String name_surname, 35 @RequestParam String password, 36 @RequestParam String repeatedPassword, 37 @RequestParam String mail, 38 @RequestParam String number) { 39 try{ 40 if(korisnikService.findbyImePrezime(name_surname) != null) throw new RuntimeException(); 41 this.korisnikService.register(name_surname, password, repeatedPassword, mail, number); 42 return "redirect:/home"; 43 } catch (RuntimeException r) { 44 return "redirect:/register?error=InvalidRegistration"; 45 } 46 } 47 48 49 2 50 } -
src/main/java/project/fmo/app/projcetfmo/Web/StatisticsController.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.Web;public class StatisticsController { 1 package project.fmo.app.projcetfmo.Web; 2 3 import org.springframework.data.domain.Page; 4 import org.springframework.stereotype.Controller; 5 import org.springframework.ui.Model; 6 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.RequestMapping; 8 import project.fmo.app.projcetfmo.Model.Korisnik; 9 import project.fmo.app.projcetfmo.Model.Produkt; 10 import project.fmo.app.projcetfmo.Service.KorisnikService; 11 import project.fmo.app.projcetfmo.Service.ProduktService; 12 13 import java.util.ArrayList; 14 import java.util.List; 15 16 @Controller 17 @RequestMapping("/statistics") 18 public class StatisticsController { 19 private final ProduktService produktService; 20 private final KorisnikService korisnikService; 21 22 public StatisticsController(ProduktService produktService, KorisnikService korisnikService) { 23 this.produktService = produktService; 24 this.korisnikService = korisnikService; 25 } 26 27 @GetMapping 28 public String getStatistics(Model model){ 29 List<Object> korisnikList = korisnikService.statistics2(); 30 List<String> ime = new ArrayList<>(); 31 List<String> id = new ArrayList<>(); 32 List<Integer> vkupno_naracki = new ArrayList<>(); 33 List<Float> prosecna_suma_na_naracka_za_site_kupuvaci = new ArrayList<>(); 34 List<Integer> vkupno_suma_od_site_naracki_na_kupuvacot = new ArrayList<>(); 35 List<Integer> vkupno_naracki_nad_prosek_na_korisnikot = new ArrayList<>(); 36 List<Integer> vkupno_suma_na_naracki_nad_prosek_za_korisnikot = new ArrayList<>(); 37 // for(int i =0 ; i< korisnikList.size();i++) { 38 // ime.add(korisnikList.get(i)[0].toString()); 39 // } 40 List<Object> produktList = produktService.statistics1(); 41 model.addAttribute("products", produktList); 42 model.addAttribute("users", korisnikList); 43 model.addAttribute("bodyContent", "statistics"); 44 return "master_template"; 45 46 } 2 47 } -
src/main/java/project/fmo/app/projcetfmo/config/CustomUsernamePasswordAuthenticationProvider.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.config;public class CustomUsernamePasswordAuthenticationProvider { 1 package project.fmo.app.projcetfmo.config; 2 3 import org.springframework.security.authentication.AuthenticationProvider; 4 import org.springframework.security.authentication.BadCredentialsException; 5 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 6 import org.springframework.security.core.Authentication; 7 import org.springframework.security.core.AuthenticationException; 8 import org.springframework.security.core.userdetails.UserDetails; 9 import org.springframework.security.crypto.password.PasswordEncoder; 10 import org.springframework.stereotype.Component; 11 import project.fmo.app.projcetfmo.Service.KorisnikService; 12 13 @Component 14 public class CustomUsernamePasswordAuthenticationProvider implements AuthenticationProvider { 15 16 private final KorisnikService korisnikService; 17 private final PasswordEncoder passwordEncoder; 18 19 public CustomUsernamePasswordAuthenticationProvider(KorisnikService korisnikService, PasswordEncoder passwordEncoder) { 20 this.korisnikService = korisnikService; 21 this.passwordEncoder = passwordEncoder; 22 } 23 24 25 @Override 26 public Authentication authenticate(Authentication authentication) throws AuthenticationException { 27 String username = authentication.getName(); 28 String password = authentication.getCredentials().toString(); 29 30 if ("".equals(username) || "".equals(password)) { 31 throw new BadCredentialsException("Invalid Credentials"); 32 } 33 34 UserDetails userDetails = this.korisnikService.loadUserByUsername(username); 35 36 if (!password.equals(userDetails.getPassword())) { 37 throw new BadCredentialsException("Password is incorrect!"); 38 } 39 return new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities()); 40 41 } 42 43 @Override 44 public boolean supports(Class<?> authentication) { 45 return authentication.equals(UsernamePasswordAuthenticationToken.class); 46 } 2 47 } -
src/main/java/project/fmo/app/projcetfmo/config/WebSecurityConfig.java
r1dd9226 rd14176d 1 package project.fmo.app.projcetfmo.config;public class WebSecurityConfig { 1 package project.fmo.app.projcetfmo.config; 2 3 import org.springframework.context.annotation.Configuration; 4 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 5 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 6 import org.springframework.security.config.annotation.web.builders.HttpSecurity; 7 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 8 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 import org.springframework.security.crypto.password.PasswordEncoder; 10 11 @Configuration 12 @EnableWebSecurity 13 @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) 14 public class WebSecurityConfig extends WebSecurityConfigurerAdapter { 15 16 17 private final PasswordEncoder passwordEncoder; 18 private final CustomUsernamePasswordAuthenticationProvider authenticationProvider; 19 20 public WebSecurityConfig(PasswordEncoder passwordEncoder, 21 CustomUsernamePasswordAuthenticationProvider authenticationProvider) { 22 this.passwordEncoder = passwordEncoder; 23 this.authenticationProvider = authenticationProvider; 24 } 25 26 @Override 27 protected void configure(HttpSecurity http) throws Exception { 28 29 http.csrf().disable() 30 .authorizeRequests() 31 .antMatchers("/","/**", "/home", "/register", "/products").permitAll() 32 .antMatchers("/admin/**").hasRole("ADMIN") 33 .anyRequest() 34 .authenticated() 35 .and() 36 .formLogin() 37 .permitAll() 38 .failureUrl("/login?error=BadCredentials") 39 .defaultSuccessUrl("/products", true) 40 .and() 41 .logout() 42 .clearAuthentication(true) 43 .invalidateHttpSession(true) 44 .deleteCookies("JSESSIONID") 45 .logoutSuccessUrl("/home") 46 .and() 47 .exceptionHandling().accessDeniedPage("/access_denied"); 48 49 } 50 51 @Override 52 protected void configure(AuthenticationManagerBuilder auth) { 53 auth.authenticationProvider(authenticationProvider); 54 } 55 2 56 } -
src/main/resources/application-prod.properties
r1dd9226 rd14176d 1 2 spring.datasource.url=jdbc:postgresql://localhost:9999/db_202223z_va_prj_fmo 3 spring.datasource.username=db_202223z_va_prj_fmo_owner 4 spring.datasource.password=2d5e9a84d3a3 5 6 7 spring.datasource.hikari.connectionTimeout=20000 8 spring.datasource.hikari.maximumPoolSize=5 9 10 spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect 11 spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 12 13 spring.jpa.hibernate.ddl-auto=validate 14 spring.jpa.show-sql=true -
src/main/resources/templates/access_denied.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div class="container py-5"> 2 <div class="row"> 3 <div class="col-md-2 text-center"> 4 <p><i class="fa fa-exclamation-triangle fa-5x"></i><br/>Status Code: 403</p> 5 </div> 6 <div class="col-md-10"> 7 <p>Sorry, your access is refused.<br/>Please go back to the previous page to continue browsing.</p> 8 <a class="btn btn-danger" href="javascript:history.back()">Go Back</a> 9 </div> 10 </div> 11 </div> -
src/main/resources/templates/add_product.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <th:block xmlns:th="http://www.thymeleaf.org"> 2 <section class="jumbotron text-center"> 3 <div class="container"> 4 <h1 class="jumbotron-heading">FMO</h1> 5 <h2 class="jumbotron-heading">Food Market Online</h2> 6 </div> 7 </section> 8 9 <div class="container"> 10 <div class="row"> 11 <div class="col-md-5"> 12 <form action="/products/add" method="POST"> 13 <input id="id" type="hidden" name="id" th:value="(${product} != null ? ${product.getIdProdukt()} : '')"> 14 <div class="form-group"> 15 <label for="name">Product name</label> 16 <input type="text" 17 class="form-control" 18 id="name" 19 name="name" 20 th:value="(${product} != null ? ${product.getIme()} : '')" 21 required 22 placeholder="Enter product name"> 23 </div> 24 <div class="form-group"> 25 <label for="price">Price</label> 26 <input type="text" 27 class="form-control" 28 id="price" 29 name="price" 30 required 31 th:value="(${price?.getIznos()} )" 32 placeholder="Price"> 33 </div> 34 <div class="form-group"> 35 <label for="Description">Description</label> 36 <input type="text" 37 class="form-control" 38 id="description" 39 name="description" 40 th:value="(${product} != null ? ${product.getOpis()} : '')" 41 placeholder="Description"> 42 </div> 43 <div class="form-group"> 44 <label>Category</label> 45 <select name="category" class="form-control"> 46 <option th:if="${chosen} != null" 47 th:selected="${chosen.getIdKategorija() != null && 48 chosen.getIdKategorija() == cat.getIdKategorija()}" 49 th:each="cat : ${categories}" 50 th:value="${cat.getIdKategorija()}" 51 th:text="${cat.getIme()}"> 52 </option> 53 <option th:if="${chosen} == null" 54 th:each="cat : ${categories}" 55 th:value="${cat.getIdKategorija()}" 56 th:text="${cat.getIme()}"> 57 </option> 58 </select> 59 </div> 60 <div class="form-group"> 61 <label>Date from</label> 62 <input type="date" 63 class="form-control" 64 id="date" 65 name="date" 66 th:value="${price?.getCenaOd()} ?: null" 67 required> 68 </div> 69 <div class="form-group"> 70 <label>Date to</label> 71 <input type="date" 72 class="form-control" 73 id="dateTo" 74 name="dateTo" 75 th:value="${price?.getCenaDo() }"> 76 </div> 77 78 <button id="submit" type="submit" class="btn btn-primary">Submit</button> 79 <a type="button" class="btn btn-primary" href="/products">Back</a> 80 </form> 81 </div> 82 </div> 83 </div> 84 85 86 </th:block> -
src/main/resources/templates/cart.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <th:block xmlns:th="http://www.thymeleaf.org"> 2 <section class="jumbotron text-center"> 3 <div class="container"> 4 <h3 class="jumbotron-heading">Shopping cart for 5 <th:block th:if="${#request.getRemoteUser() != null}" th:text="${#request.getRemoteUser()}"></th:block> 6 </h3> 7 </div> 8 </section> 9 10 <div th:if="${hasError}"> 11 <h5 class="text-center text-danger" th:text="${error}"></h5> 12 </div> 13 14 <div class="container mb-4"> 15 <div class="row"> 16 <div class="col-12" th:if="${products.size() > 0}"> 17 <div class="table-responsive"> 18 <table class="table table-striped"> 19 <thead> 20 <tr> 21 <th scope="col">Product</th> 22 <th scope="col">Total Price for product</th> 23 <th scope="col">Quantity</th> 24 </tr> 25 </thead> 26 <tbody> 27 <span th:each="p:${po}"> 28 <tr th:each="product : ${products}" th:if="${product.getIdProdukt()} == ${p.getIdProdukt()}" class="cart-item"> 29 <td th:text="${product.getIme()}"></td> 30 <td th:text="${p.getCena()}">Cena</td> 31 <td th:text="${p.getKolicina()}"></td> 32 </tr> 33 </span> 34 </tbody> 35 </table> 36 37 <div> 38 <label>Total price </label> 39 <span th:text="${order.getVkupnoSuma()}"></span></div> 40 41 <form th:action="@{'/order/{id}/success' (id=${order.getIdNaracka()})}" th:method="POST"> 42 <label>Adresa za dostava</label> 43 <input type="text" name="address" id="address" placeholder="/"> 44 <button type="submit" 45 class="btn btn-sm btn-primary cart-product"> 46 <i class="fa fa-trash">Order</i> 47 </button> 48 </form> 49 </div> 50 </div> 51 </div> 52 </div> 53 </th:block> 54 -
src/main/resources/templates/delivery.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div th:if="${delivers.size() == 0}" 2 xmlns:sec="http://www.w3.org/1999/xhtml"> 3 <h1 style="text-align: center"> No orders to deliver!</h1> 4 </div> 5 6 <div class="container mb-4" > 7 <div class="row"> 8 <div class="col-12" th:if="${delivers.size() > 0}"> 9 <div class="table-responsive"> 10 <table class="table table-striped"> 11 <thead> 12 <tr> 13 <th scope="col">Order ID</th> 14 <th scope="col">Address</th> 15 <th scope="col">Total price</th> 16 <th scope="col">Date</th> 17 18 </tr> 19 </thead> 20 <tbody> 21 <tr th:each="delivery : ${delivers} " class="product"> 22 <td th:text="${delivery.getIdNaracka()}" ></td> 23 <td th:each="order : ${orders}" th:if="${order.getIdNaracka() == delivery.getIdNaracka()}" 24 th:text="${order.getAdresa()}"></td> 25 <td th:each="order : ${orders}" th:if="${order.getIdNaracka() == delivery.getIdNaracka()}" 26 th:text="${order.getVkupnoSuma()}"></td> 27 <td th:text="${delivery.getDatum()}" 28 ></td> 29 <td class="text-right"> 30 <form th:method="POST" th:action="@{'/delivery/{id}' (id=${delivery.getIdDostava()})}"> 31 <button type="submit" 32 class="btn btn-sm btn-primary cart-product" sec:authorize="hasRole('ROLE_DELIVER')"> 33 <i class="fa fa-trash">Order delivered</i> 34 </button> 35 </form> 36 </td> 37 </tr> 38 </tbody> 39 </table> 40 </div> 41 </div> 42 </div> 43 </div> -
src/main/resources/templates/home.html
r1dd9226 rd14176d 1 < !DOCTYPE html>2 <html lang="en">3 <head>4 <meta charset="UTF-8">5 <title>$Title$</title>6 </ head>7 <body> 8 $END$ 9 </body> 10 </html> 1 <section class="jumbotron text-center" xmlns:th="http://www.thymeleaf.org"> 2 <div class="container"> 3 <h1 class="jumbotron-heading">FMO</h1> 4 <h2 class="jumbotron-heading">Food Market Online</h2> 5 </div> 6 </section> 7 8 9 10 -
src/main/resources/templates/login.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div class="container" xmlns:th="http://www.thymeleaf.org"> 2 <form class="form-signin mt-xl-5" method="post" action="/login"> 3 <h2 class="form-signin-heading">Sign in</h2> 4 <p> 5 <label for="username" class="sr-only">Username</label> 6 <input type="text" id="username" name="username" class="form-control" placeholder="Username" required="" 7 autofocus=""> 8 </p> 9 <p> 10 <label for="password" class="sr-only">Password</label> 11 <input type="password" id="password" name="password" class="form-control" placeholder="Password" 12 required=""> 13 </p> 14 15 <div th:text="${param.error}" class="text-danger"></div> 16 17 <button id="submit" class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> 18 </form> 19 </div> -
src/main/resources/templates/master_template.html
r1dd9226 rd14176d 1 1 <!DOCTYPE html> 2 <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> 2 <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" 3 xmlns:sec="http://www.w3.org/1999/xhtml"> 3 4 <head> 4 5 <meta charset="UTF-8"> … … 12 13 <body> 13 14 14 <nav class="navbar navbar-inverse"> 15 <div class="container-fluid"> 15 <header xmlns:th="http://www.thymeleaf.org"> 16 <nav class="navbar navbar-expand-md navbar-dark bg-dark"> 17 <div class="container"> 18 <a class="navbar-brand" href="/">FMO</a> 19 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" 20 aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> 21 <span class="navbar-toggler-icon"></span> 22 </button> 16 23 17 <div class="collapse navbar-collapse" id="myNavbar"> 18 <ul class="nav navbar-nav"> 19 <li class="active"><a href="home.html">Home</a></li> 20 <li><a href="products.html">Products</a></li> 21 <li><a href="statistics.html">Statistics</a></li> 22 <li><a href="delivery.html">Delivery</a></li> 23 </ul> 24 <ul class="nav navbar-nav navbar-right"> 25 <li><a href="register.html"><span class="glyphicon glyphicon-user"></span>Register</a></li> 26 <li><a href="/login"><span class="glyphicon glyphicon-user"></span>Login</a></li> 27 <li><a href="cart.html"><span class="glyphicon glyphicon-shopping-cart"></span> Cart</a></li> 28 <li><a href="/logout"><span class="glyphicon glyphicon-user"></span>Log out</a></li> 29 </ul> 24 <div class="collapse navbar-collapse justify-content-end" id="navbarsExampleDefault"> 25 <ul class="navbar-nav m-auto"> 26 <li class="nav-item m-auto"> 27 <a class="nav-link active" href="/products">Products</a> 28 </li> 29 <li class="nav-item m-auto" sec:authorize="hasRole('ROLE_ADMIN')"> 30 <a class="nav-link active" th:href="@{/statistics}" th:method="GET">Statistics</a> 31 </li> 32 <li class="nav-item m-auto" sec:authorize="hasRole('ROLE_DELIVER')"> 33 <a class="nav-link active" th:href="@{/delivery}" th:method="GET">Delivery</a> 34 </li> 35 </ul> 36 37 38 <ul class="nav navbar-nav navbar-right"> 39 40 41 <li class="nav-item" sec:authorize="hasRole('ROLE_USER')"> 42 <a class="btn btn-success btn-sm ml-3" th:href="@{/order}" th:method="GET"> 43 <i class="fa fa-shopping-cart"></i> Cart 44 </a> 45 </li> 46 <li class="nav-item" sec:authorize="isAuthenticated()"> 47 <a class="btn btn-light btn-sm ml-3" href="/logout"> 48 <i class="fa fa-shopping-cart"></i> Logout 49 </a> 50 <li class="nav-item"> 51 <a class="btn btn-light btn-sm ml-3" sec:authorize="!isAuthenticated()" href="/register"> 52 <i class="fa fa-shopping-cart"></i> Register 53 </a> 54 </li> 55 <li class="nav-item" sec:authorize="!isAuthenticated()"> 56 <a class="btn btn-light btn-sm ml-3" href="/login"> 57 <i class="fa fa-shopping-cart"></i> Login 58 </a> 59 </li> 60 </ul> 61 </div> 30 62 </div> 31 </ div>32 </ nav>63 </nav> 64 </header> 33 65 34 66 35 67 36 <section th:include="${bodyContent}"> 68 <section th:include="${bodyContent}"></section> 37 69 38 70 39 71 40 72 41 <footer class="container-fluid text-center" >73 <footer class="container-fluid text-center" style="padding-top: 100px"> 42 74 <p>FMO Store</p> 43 75 <p>2023</p> -
src/main/resources/templates/not_valid_delete.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div> 2 <h2 style="text-align: center">Produktot se naogja vo edna ili povekje naracki i zatoa ne moze da bide izbrishen!</h2> 3 <a style="text-align: center; display: block" href="/products">Back to products</a> 4 5 </div> -
src/main/resources/templates/product_info.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div xmlns:th="http://www.thymeleaf.org" > 2 3 <form class="block" th:method="post" th:action="@{'/products/{id}/add-to-cart' (id = ${product.getIdProdukt()})}"> 4 <input type="hidden" name="idKorisnik" id="idKorisnik" th:value="${#request.getRemoteUser()}"> 5 <input type="hidden" name="cena" id="cena" th:value="${price.getIznos()}"> 6 <label style="margin: auto; text-align: center; display: block; padding-top: 20px">Product name</label> 7 <p style="margin: auto; text-align: center" id="name" name="name" th:value="${product.getIme()}" th:text="${product.getIme()}"></p> 8 <label style="margin: auto; text-align: center; display: block; padding-top: 20px">Product description</label> 9 <p style="margin: auto; text-align: center" name="description" id="description" th:value="${product.getOpis()}" th:text="${product.getOpis()}"></p> 10 <label style="margin: auto; text-align: center; display: block ; padding-top: 20px">price</label> 11 <p style="margin: auto; text-align: center" name="price" id="price" th:value="${price.getIznos()}" th:text="${price.getIznos()}"></p> 12 <label style="margin: auto; text-align: center; display: block; padding-top: 20px">Category</label> 13 <p style="margin: auto; text-align: center;" name="category" id="category" th:value="${kat.getIme()}" th:text="${kat.getIme()}"></p> 14 <label style="margin: auto; text-align: center; display: block; padding-top: 20px">Quantity</label> 15 <input type="number" name="quantity" id="quantity" style="margin: auto; text-align: center; display: block" required="required"> 16 17 18 <button style="margin: auto; text-align: center; display: block; padding-top: 20px" id="submit" type="submit" class="btn btn-primary">Submit</button> 19 <a style="margin: auto; text-align: center; display: block; padding-top: 20px; width: 75px" type="button" class="btn btn-primary" href="/products">Back</a> 20 21 </form> 22 23 24 </div> -
src/main/resources/templates/products.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div xmlns:th="http://www.thymeleaf.org" xmlns:sec=""> 2 <section class="jumbotron text-center"> 3 <div class="container"> 4 <h1 class="jumbotron-heading">Food Market Online</h1> 5 <h3 class="jumbotron-heading">All products</h3> 6 </div> 7 </section> 8 <!--//th:method="GET" th:action="@{/products}"--> 9 <div class="container mb-4" > 10 <div class="row"> 11 <div class="col-12" th:if="${products.size() > 0}"> 12 <div class="table-responsive"> 13 <table class="table table-striped"> 14 <thead> 15 <tr> 16 <th scope="col">Product name</th> 17 <th scope="col">Price</th> 18 <th scope="col">Category</th> 19 20 </tr> 21 </thead> 22 <tbody> 23 <tr th:each="product : ${products} " class="product"> 24 <td th:text="${product.getIme()}" ></td> 25 <td th:each="price: ${prices}" th:if="${price.getIdProdukt()} == ${product.getIdProdukt()}" 26 th:text="${price.getIznos()}">Cena</td> 27 <td th:each="category: ${categories}" th:if="${category.getIdProdukt()} == ${product.getIdProdukt()}" 28 ><span th:each="k:${kat}" th:if="${k.getIdKategorija()} == ${category.getIdKategorija()}" 29 th:text="${k.getIme()}"></span></td> 30 <td class="text-right"> 31 <th:block sec:authorize="hasRole('ROLE_ADMIN')"> 32 <form th:action="@{'/products/delete/{id}' (id=${product.getIdProdukt()})}" 33 th:method="DELETE"> 34 <button type="submit" 35 class="btn btn-sm btn-danger delete-product"> 36 <i class="fa fa-trash">Delete</i> 37 </button> 38 </form> 39 </th:block> 40 <th:block sec:authorize="hasRole('ROLE_ADMIN')"> 41 <a th:href="@{'/products/edit-form/{id}' (id=${product.getIdProdukt()})}" 42 class="btn btn-sm btn-info edit-product"> 43 <i class="fa fa-trash">Edit</i> 44 </a> 45 </th:block> 46 <form th:method="GET" th:action="@{'/products/{id}' (id=${product.getIdProdukt()})}"> 47 <button type="submit" 48 class="btn btn-sm btn-primary cart-product" sec:authorize="hasRole('ROLE_USER')"> 49 <i class="fa fa-trash">Add product to cart</i> 50 </button> 51 </form> 52 </td> 53 </tr> 54 </tbody> 55 </table> 56 </div> 57 </div> 58 <div class="col mb-3"> 59 <div class="row"> 60 <div class="col-sm-12 col-md-12" sec:authorize="hasRole('ROLE_ADMIN')"> 61 <a href="/products/add-form" class="btn btn-block btn-dark add-product-btn"> 62 Add new product 63 </a> 64 </div> 65 </div> 66 </div> 67 </div> 68 </div> 69 </div> -
src/main/resources/templates/register.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <div class="container"> 2 <h1 th:if="${hasError}" th:text="${error}"></h1> 3 </div> 4 <div class="container"> 5 <form class="form-signin mt-xl-5" method="post" action="/register"> 6 <h2 class="form-signin-heading">Register</h2> 7 <p> 8 <label for="name_surname" class="sr-only">Name and Surname</label> 9 <input type="text" id="name_surname" name="name_surname" class="form-control" autocomplete="off" placeholder="name_surname" required="" 10 autofocus=""> 11 </p> 12 <p> 13 <label for="password" class="sr-only">Password</label> 14 <input type="password" id="password" name="password" class="form-control" placeholder="Password" autocomplete="off" 15 required=""> 16 </p> 17 <p> 18 <label for="repeatedPassword" class="sr-only">Repeat Password</label> 19 <input type="password" id="repeatedPassword" name="repeatedPassword" class="form-control" autocomplete="off" 20 placeholder="Repeat Password" required=""> 21 </p> 22 <p> 23 <label for="mail" class="sr-only">Mail</label> 24 <input type="text" id="mail" name="mail" class="form-control" placeholder="Mail" required="" autofocus="" autocomplete="off"> 25 </p> 26 <p> 27 <label for="number" class="sr-only">Telephone number</label> 28 <input type="text" id="number" name="number" class="form-control" placeholder="number" required="" autocomplete="off" 29 autofocus=""> 30 </p> 31 32 <button class="btn btn-lg btn-primary btn-block" type="submit">Register</button> 33 </form> 34 </div> 35 -
src/main/resources/templates/statistics.html
r1dd9226 rd14176d 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>$Title$</title> 6 </head> 7 <body> 8 $END$ 9 </body> 10 </html> 1 <th:block> 2 <h3 style="text-align: center;color: lightslategrey; margin: 50px">За секој корисник да се најде бројот на нарачки, да се прикаже просечна сума на сите нарачки за сите корисници, вкупна сума на нарачките на купувачот, колку негови нарачки се над глобалниот просек за сума на нарачка и колку е вкупната сума на неговите нарачки кои се над просекот</h3> 3 <div class="container mb-4" > 4 <div class="row"> 5 <div class="col-12"> 6 <div class="table-responsive"> 7 <table class="table table-striped"> 8 <thead> 9 <tr> 10 <th scope="col">ID</th> 11 <th scope="col">Ime</th> 12 <th scope="col">Vkupno naracki</th> 13 <th scope="col">Prosecna suma na naracka za site kupuvaci</th> 14 <th scope="col">Vkupna suma od site naracki na korisnikot</th> 15 <th scope="col">Vkupno naracki nad prosek na korisnikot</th> 16 <th scope="col">Vkupno suma na naracki nad prosek za korisnikot</th> 17 18 </tr> 19 </thead> 20 <tbody> 21 <tr th:each="user : ${users} " class="product"> 22 <td th:each="u : ${user}" th:text="${u} ?: '0' " ></td> 23 </tr> 24 </tbody> 25 </table> 26 </div> 27 </div> 28 </div> 29 </div> 30 31 <h3 style="text-align: center;color: lightslategrey; margin: 50px">За секој продукт наоѓаме во последните три месеци во колку нарачки е присутен, колкава е количината на продуктот во тие нарачки, просечна сума на нарачката во која е присутен продуктот, број на нарачки на продуктот кои корисникот сам ги подигнал, количина продадена на продуктот која корисникот сам ја подигнал, број на нарачки на продукот кои му биле доставени на корисникот и количина на продуктот која му била доставена на корисникот</h3> 32 <div class="container mb-4" > 33 <div class="row"> 34 <div class="col-12"> 35 <div class="table-responsive"> 36 <table class="table table-striped"> 37 <thead> 38 <tr> 39 <th scope="col">ID</th> 40 <th scope="col">Produkt ime</th> 41 <th scope="col">Broj na naracki vo koi e prisuten produktot</th> 42 <th scope="col">Kolicina prodadeno od produktot</th> 43 <th scope="col">Prosecna suma na naracka vo koja se sodrzi produktot</th> 44 <th scope="col">Broj na naracki na produktot koi korisnikot sam ke gi podigne</th> 45 <th scope="col">Kolicina prodadena na produktot bez dostava</th> 46 <th scope="col">Broj na naracki na produktot koi ke bidat dostaveni na korisnikot</th> 47 <th scope="col">Kolicina prodadena na produktot preku dostava</th> 48 </tr> 49 </thead> 50 <tbody> 51 <tr th:each="product : ${products} " class="product"> 52 <td th:each="p : ${product}" th:text="${p} ?: '0' " ></td> 53 </tr> 54 </tbody> 55 </table> 56 </div> 57 </div> 58 </div> 59 </div> 60 61 62 63 </th:block>
Note:
See TracChangeset
for help on using the changeset viewer.