CM works overall dashboard integrate with gcc_office_portal
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.4 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.cmworks.controller;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Map;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.ui.Model;
  8. import org.springframework.web.bind.annotation.GetMapping;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestParam;
  11. import in.gov.chennaicorporation.gccoffice.cmworks.service.WorksService;
  12. import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
  13. @RequestMapping("/gcc/works")
  14. @Controller("worksController")
  15. public class MainController {
  16. private final LoginUserInfo loginUserInfo;
  17. private final WorksService dashboards;
  18. @Autowired
  19. public MainController(LoginUserInfo loginUserInfo,
  20. WorksService dashboards) {
  21. this.loginUserInfo = loginUserInfo;
  22. this.dashboards = dashboards;
  23. }
  24. // This method to show the dashboard of regionwise,zonewise,typeofwork,scheme wise works counts
  25. @GetMapping({"", "/", "/dashboard"})
  26. public String main(@RequestParam(value = "zonename", required = false, defaultValue = "all") String zonename, Model model) {
  27. // Fetch data for the dashboard based on the regionname
  28. List<Map<String, Object>> regionData = dashboards.getCombinedCmDashboardReports(zonename);
  29. List<Map<String, Object>> schemeData = dashboards.getCombinedCmDashboardReports(zonename);
  30. List<Map<String, Object>> typeOfWorkData = dashboards.getCombinedCmDashboardReports(zonename);
  31. List<Map<String, Object>> zoneData = dashboards.getCombinedCmDashboardReports(zonename);
  32. // Add data to the model
  33. model.addAttribute("regionData", regionData);
  34. model.addAttribute("schemeData", schemeData);
  35. model.addAttribute("typeOfWorkData", typeOfWorkData);
  36. model.addAttribute("zoneData", zoneData);
  37. // Log the user ID
  38. String userId = LoginUserInfo.getLoginUserId();
  39. if (userId != null && !userId.isEmpty()) {
  40. System.out.println("String UserID: " + userId);
  41. }
  42. return "modules/cmworks/dashboard";
  43. }
  44. //This method used to show the image and estimate number details of works
  45. @GetMapping("/cmworksdetails")
  46. public String worksdetails(Model model) {
  47. List<Map<String, Object>> workslist = dashboards.getImageUrl();
  48. model.addAttribute("workslist",workslist);
  49. return "modules/cmworks/cmworksdetails";
  50. }
  51. //This method used to show the all related details of works
  52. @GetMapping("/all-list")
  53. public String allList(Model model) {
  54. List<Map<String, Object>> cmLists = dashboards.getCmDashboardAllReports();
  55. model.addAttribute("cmlist", cmLists);
  56. return "modules/cmworks/cmworksdetails1";
  57. }
  58. //This method used to show the tradelicense details dashboard
  59. @GetMapping("/tradedashboard")
  60. public String tradelicense(@RequestParam(value = "divisionName", required = false, defaultValue = "All") String divisionName,Model model) {
  61. List<Map<String, Object>> tradelicense = new ArrayList<>();
  62. if(divisionName!=null && divisionName.isEmpty()) {
  63. tradelicense = dashboards.getTradelicenseReports(divisionName);
  64. }
  65. model.addAttribute("tradelicense", tradelicense);
  66. return "modules/cmworks/cmworkstradelicense";
  67. }
  68. }