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.

84 lines
3.2 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.cmdashboard.controller;
  2. import java.util.List;
  3. import java.util.Map;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.ui.Model;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import in.gov.chennaicorporation.gccoffice.cmdashboard.service.CmDashboardService;
  11. import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
  12. @RequestMapping("/gcc/dashboards")
  13. @Controller("cmdashboardcontroller")
  14. public class MainController
  15. {
  16. private final LoginUserInfo loginUserInfo;
  17. private final CmDashboardService cmdashboards;
  18. @Autowired
  19. public MainController(LoginUserInfo loginUserInfo, CmDashboardService cmdashboards)
  20. {
  21. this.cmdashboards=cmdashboards;
  22. this.loginUserInfo=loginUserInfo;
  23. }
  24. @GetMapping("/dashboard1")
  25. public String main(Model model) {
  26. String userId = LoginUserInfo.getLoginUserId();
  27. if (userId != null && !userId.isEmpty()) {
  28. System.out.println("String UserID: " + userId);
  29. }
  30. return "modules/cmdashboard/index";
  31. }
  32. @GetMapping("/dashboard2")
  33. public String viewpage(@RequestParam(value = "zonename", required = false, defaultValue = "all") String zonename, Model model) {
  34. // Fetch data for the dashboard based on the regionname
  35. List<Map<String, Object>> regionData = cmdashboards.getCombinedCmDashboardReports(zonename);
  36. List<Map<String, Object>> schemeData = cmdashboards.getCombinedCmDashboardReports(zonename);
  37. List<Map<String, Object>> typeOfWorkData = cmdashboards.getCombinedCmDashboardReports(zonename);
  38. List<Map<String, Object>> zoneData = cmdashboards.getCombinedCmDashboardReports(zonename);
  39. // Add data to the model
  40. model.addAttribute("regionData", regionData);
  41. model.addAttribute("schemeData", schemeData);
  42. model.addAttribute("typeOfWorkData", typeOfWorkData);
  43. model.addAttribute("zoneData", zoneData);
  44. String userId = LoginUserInfo.getLoginUserId();
  45. if (userId != null && !userId.isEmpty()) {
  46. System.out.println("String UserID: " + userId);
  47. }
  48. return "modules/cmdashboard/index1";
  49. }
  50. @GetMapping("/all-list")
  51. public String allList(@RequestParam(value = "zonename", required = false, defaultValue = "all") String zonename,
  52. @RequestParam(value = "schemename", required = false, defaultValue = "all") String schemename,
  53. @RequestParam(value = "typeofwork", required = false, defaultValue = "all") String typeofwork,
  54. Model model) {
  55. List<Map<String, Object>> cmLists = cmdashboards.getCmDashboardAllReportsFiltered(zonename, schemename, typeofwork);
  56. model.addAttribute("cmlist", cmLists);
  57. return "modules/cmdashboard/alldetails";
  58. }
  59. @GetMapping("/dashboard3")
  60. public String view(Model model) {
  61. String userId = LoginUserInfo.getLoginUserId();
  62. if (userId != null && !userId.isEmpty()) {
  63. System.out.println("String UserID: " + userId);
  64. }
  65. return "modules/cmdashboard/index2";
  66. }
  67. }