1 | package com.example.fooddeliverysystem.web;
|
---|
2 |
|
---|
3 | import com.example.fooddeliverysystem.service.*;
|
---|
4 | import org.springframework.stereotype.Controller;
|
---|
5 | import org.springframework.ui.Model;
|
---|
6 | import org.springframework.web.bind.annotation.GetMapping;
|
---|
7 |
|
---|
8 | import java.util.HashSet;
|
---|
9 | import java.util.Set;
|
---|
10 |
|
---|
11 | @Controller
|
---|
12 | public class ReportsController {
|
---|
13 |
|
---|
14 | private final BestPacketsForEachSalePlaceService bestPacketsForEachSalePlaceService;
|
---|
15 | private final MostLoyalCustomerForEachPlaceService mostLoyalCustomerForEachPlaceService;
|
---|
16 |
|
---|
17 | private final FranchizeEarningsBySalePlaceService franchizeEarningsBySalePlaceService;
|
---|
18 |
|
---|
19 | private final DeliverNumberOfOrdersDeliveredBySalePlaceService deliverNumberOfOrdersDeliveredBySalePlaceService;
|
---|
20 |
|
---|
21 | private final TotalCouponsByCustomerService totalCouponsByCustomerService;
|
---|
22 | public ReportsController(BestPacketsForEachSalePlaceService bestPacketsForEachSalePlaceService,
|
---|
23 | MostLoyalCustomerForEachPlaceService mostLoyalCustomerForEachPlaceService,
|
---|
24 | FranchizeEarningsBySalePlaceService franchizeEarningsBySalePlaceService,
|
---|
25 | DeliverNumberOfOrdersDeliveredBySalePlaceService deliverNumberOfOrdersDeliveredBySalePlaceService,
|
---|
26 | TotalCouponsByCustomerService totalCouponsByCustomerService) {
|
---|
27 | this.bestPacketsForEachSalePlaceService = bestPacketsForEachSalePlaceService;
|
---|
28 | this.mostLoyalCustomerForEachPlaceService = mostLoyalCustomerForEachPlaceService;
|
---|
29 | this.franchizeEarningsBySalePlaceService = franchizeEarningsBySalePlaceService;
|
---|
30 | this.deliverNumberOfOrdersDeliveredBySalePlaceService = deliverNumberOfOrdersDeliveredBySalePlaceService;
|
---|
31 | this.totalCouponsByCustomerService = totalCouponsByCustomerService;
|
---|
32 | }
|
---|
33 |
|
---|
34 | @GetMapping("/reports/bestPacketsEachSalePlace")
|
---|
35 | public String getBestPacketsEachSalePlace(Model model){
|
---|
36 | model.addAttribute("report", this.bestPacketsForEachSalePlaceService.listAll());
|
---|
37 | return "reportsBestPacketsEachSalePlace";
|
---|
38 | }
|
---|
39 | @GetMapping("/reports/mostLoyalCustomerForEachPlace")
|
---|
40 | public String getMostLoyalCustomerForEachPlace(Model model){
|
---|
41 | model.addAttribute("report", this.mostLoyalCustomerForEachPlaceService.listAll());
|
---|
42 | return "reportsMostLoyalCustomerForEachPlace";
|
---|
43 | }
|
---|
44 | @GetMapping("/reports/franchizeEarningsBySalePlace")
|
---|
45 | public String getFranchizeEarningsBySalePlace(Model model){
|
---|
46 | model.addAttribute("report", this.franchizeEarningsBySalePlaceService.listAll());
|
---|
47 | return "reportsFranchizeEarningsBySalePlace";
|
---|
48 | }
|
---|
49 |
|
---|
50 | @GetMapping("/reports/DeliverNumberOfOrdersDeliveredBySalePlace")
|
---|
51 | public String getDeliverNumberOfOrdersDeliveredBySalePlace(Model model){
|
---|
52 | Set s = new HashSet(this.deliverNumberOfOrdersDeliveredBySalePlaceService.listAll());
|
---|
53 | model.addAttribute("report", s);
|
---|
54 | return "reportsDeliverNumberOfOrdersDeliveredBySalePlace";
|
---|
55 | }
|
---|
56 |
|
---|
57 | @GetMapping("/reports/TotalCouponsByCustomer")
|
---|
58 | public String getTotalCouponsByCustomer(Model model){
|
---|
59 | model.addAttribute("report", this.totalCouponsByCustomerService.listAll());
|
---|
60 | return "reportsTotalCouponsByCustomer";
|
---|
61 | }
|
---|
62 | }
|
---|