source: src/main/java/com/example/fooddeliverysystem/web/ReportsController.java

Last change on this file was 8d11f8c, checked in by jovanmanchev <jovanmanchev3003@…>, 20 months ago

code added, trial 2

  • Property mode set to 100644
File size: 3.1 KB
Line 
1package com.example.fooddeliverysystem.web;
2
3import com.example.fooddeliverysystem.service.*;
4import org.springframework.stereotype.Controller;
5import org.springframework.ui.Model;
6import org.springframework.web.bind.annotation.GetMapping;
7
8import java.util.HashSet;
9import java.util.Set;
10
11@Controller
12public 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}
Note: See TracBrowser for help on using the repository browser.