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 | }
|
---|
47 | }
|
---|