Ignore:
Timestamp:
07/07/23 12:14:58 (16 months ago)
Author:
HristijanMitic00 <hristijan.mitic.01@…>
Branches:
main
Parents:
1dd9226
Message:

First commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/project/fmo/app/projcetfmo/Web/StatisticsController.java

    r1dd9226 rd14176d  
    1 package project.fmo.app.projcetfmo.Web;public class StatisticsController {
     1package project.fmo.app.projcetfmo.Web;
     2
     3import org.springframework.data.domain.Page;
     4import org.springframework.stereotype.Controller;
     5import org.springframework.ui.Model;
     6import org.springframework.web.bind.annotation.GetMapping;
     7import org.springframework.web.bind.annotation.RequestMapping;
     8import project.fmo.app.projcetfmo.Model.Korisnik;
     9import project.fmo.app.projcetfmo.Model.Produkt;
     10import project.fmo.app.projcetfmo.Service.KorisnikService;
     11import project.fmo.app.projcetfmo.Service.ProduktService;
     12
     13import java.util.ArrayList;
     14import java.util.List;
     15
     16@Controller
     17@RequestMapping("/statistics")
     18public 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    }
    247}
Note: See TracChangeset for help on using the changeset viewer.