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
96 lines
3.4 KiB
package in.gov.chennaicorporation.gccoffice.cmworks.controller;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import in.gov.chennaicorporation.gccoffice.cmworks.service.WorksService;
|
|
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
|
|
|
|
@RequestMapping("/gcc/works")
|
|
@Controller("worksController")
|
|
public class MainController {
|
|
|
|
private final LoginUserInfo loginUserInfo;
|
|
private final WorksService dashboards;
|
|
|
|
|
|
@Autowired
|
|
public MainController(LoginUserInfo loginUserInfo,
|
|
WorksService dashboards) {
|
|
this.loginUserInfo = loginUserInfo;
|
|
this.dashboards = dashboards;
|
|
}
|
|
|
|
|
|
// This method to show the dashboard of regionwise,zonewise,typeofwork,scheme wise works counts
|
|
|
|
@GetMapping({"", "/", "/dashboard"})
|
|
public String main(@RequestParam(value = "zonename", required = false, defaultValue = "all") String zonename, Model model) {
|
|
|
|
// Fetch data for the dashboard based on the regionname
|
|
List<Map<String, Object>> regionData = dashboards.getCombinedCmDashboardReports(zonename);
|
|
List<Map<String, Object>> schemeData = dashboards.getCombinedCmDashboardReports(zonename);
|
|
List<Map<String, Object>> typeOfWorkData = dashboards.getCombinedCmDashboardReports(zonename);
|
|
List<Map<String, Object>> zoneData = dashboards.getCombinedCmDashboardReports(zonename);
|
|
|
|
// Add data to the model
|
|
model.addAttribute("regionData", regionData);
|
|
model.addAttribute("schemeData", schemeData);
|
|
model.addAttribute("typeOfWorkData", typeOfWorkData);
|
|
model.addAttribute("zoneData", zoneData);
|
|
// Log the user ID
|
|
String userId = LoginUserInfo.getLoginUserId();
|
|
if (userId != null && !userId.isEmpty()) {
|
|
System.out.println("String UserID: " + userId);
|
|
}
|
|
|
|
return "modules/cmworks/dashboard";
|
|
}
|
|
|
|
|
|
//This method used to show the image and estimate number details of works
|
|
|
|
@GetMapping("/cmworksdetails")
|
|
public String worksdetails(Model model) {
|
|
|
|
List<Map<String, Object>> workslist = dashboards.getImageUrl();
|
|
|
|
model.addAttribute("workslist",workslist);
|
|
return "modules/cmworks/cmworksdetails";
|
|
}
|
|
|
|
//This method used to show the all related details of works
|
|
|
|
@GetMapping("/all-list")
|
|
public String allList(Model model) {
|
|
|
|
List<Map<String, Object>> cmLists = dashboards.getCmDashboardAllReports();
|
|
model.addAttribute("cmlist", cmLists);
|
|
return "modules/cmworks/cmworksdetails1";
|
|
}
|
|
|
|
//This method used to show the tradelicense details dashboard
|
|
|
|
|
|
@GetMapping("/tradedashboard")
|
|
public String tradelicense(@RequestParam(value = "divisionName", required = false, defaultValue = "All") String divisionName,Model model) {
|
|
|
|
List<Map<String, Object>> tradelicense = new ArrayList<>();
|
|
|
|
if(divisionName!=null && divisionName.isEmpty()) {
|
|
tradelicense = dashboards.getTradelicenseReports(divisionName);
|
|
}
|
|
model.addAttribute("tradelicense", tradelicense);
|
|
return "modules/cmworks/cmworkstradelicense";
|
|
}
|
|
|
|
|
|
}
|