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

package in.gov.chennaicorporation.gccoffice.cmdashboard.controller;
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.cmdashboard.service.CmDashboardService;
import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo;
@RequestMapping("/gcc/dashboards")
@Controller("cmdashboardcontroller")
public class MainController
{
private final LoginUserInfo loginUserInfo;
private final CmDashboardService cmdashboards;
@Autowired
public MainController(LoginUserInfo loginUserInfo, CmDashboardService cmdashboards)
{
this.cmdashboards=cmdashboards;
this.loginUserInfo=loginUserInfo;
}
@GetMapping("/dashboard1")
public String main(Model model) {
String userId = LoginUserInfo.getLoginUserId();
if (userId != null && !userId.isEmpty()) {
System.out.println("String UserID: " + userId);
}
return "modules/cmdashboard/index";
}
@GetMapping("/dashboard2")
public String viewpage(@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 = cmdashboards.getCombinedCmDashboardReports(zonename);
List<Map<String, Object>> schemeData = cmdashboards.getCombinedCmDashboardReports(zonename);
List<Map<String, Object>> typeOfWorkData = cmdashboards.getCombinedCmDashboardReports(zonename);
List<Map<String, Object>> zoneData = cmdashboards.getCombinedCmDashboardReports(zonename);
// Add data to the model
model.addAttribute("regionData", regionData);
model.addAttribute("schemeData", schemeData);
model.addAttribute("typeOfWorkData", typeOfWorkData);
model.addAttribute("zoneData", zoneData);
String userId = LoginUserInfo.getLoginUserId();
if (userId != null && !userId.isEmpty()) {
System.out.println("String UserID: " + userId);
}
return "modules/cmdashboard/index1";
}
@GetMapping("/all-list")
public String allList(@RequestParam(value = "zonename", required = false, defaultValue = "all") String zonename,
@RequestParam(value = "schemename", required = false, defaultValue = "all") String schemename,
@RequestParam(value = "typeofwork", required = false, defaultValue = "all") String typeofwork,
Model model) {
List<Map<String, Object>> cmLists = cmdashboards.getCmDashboardAllReportsFiltered(zonename, schemename, typeofwork);
model.addAttribute("cmlist", cmLists);
return "modules/cmdashboard/alldetails";
}
@GetMapping("/dashboard3")
public String view(Model model) {
String userId = LoginUserInfo.getLoginUserId();
if (userId != null && !userId.isEmpty()) {
System.out.println("String UserID: " + userId);
}
return "modules/cmdashboard/index2";
}
}