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.
 
 

292 lines
12 KiB

//package in.gov.chennaicorporation.gccoffice.pgr.contoller;
//
//import java.text.ParseException;
//
//import java.text.SimpleDateFormat;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.io.InputStreamResource;
//import org.springframework.core.io.Resource;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisComplaintReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisDaskboards;
//import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.AllReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.MobileAgeAnalysisComplaintReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.MobileAgeAnalysisReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.QaQcReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZonewiseComplaintReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZonewiseReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseComplaintDetails;
//import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseComplaintReports;
//import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseReports;
//
//@RestController
//@RequestMapping("/pgr/api")
//public class PgrApiController {
//
// @Autowired
// private AllReports allReports;
// private QaQcReports qaqcReports;
// private ZonewiseReports zonewiseReports;
//
// private ReopenZonewiseReports reopenzonewiseReports;
// private AgeAnalysisDaskboards ageanalysisDaskboards;
// private AgeAnalysisReports ageanalysisReports;
// private MobileAgeAnalysisReports mobileageanalysisReports;
// private ZonewiseComplaintReports zonewisecomplaintReports;
// private ReopenZonewiseComplaintReports reopenzonewisecomplaintReports;
// private AgeAnalysisComplaintReports ageanalysiscomplaintReports;
// private MobileAgeAnalysisComplaintReports mobileageanalysiscomplaintReports;
// private ZonewiseComplaintDetails zonewisecomplaintDetails;
//
//
// @Autowired
// public PgrApiController(AllReports allReports, QaQcReports qaqcReports,
// ZonewiseReports zonewiseReports, ReopenZonewiseReports reopenzonewiseReports,
// AgeAnalysisReports ageanalysisReports,
// MobileAgeAnalysisReports mobileAgeAnalysisReports,
// ZonewiseComplaintReports zonewisecomplaintReports,
// ReopenZonewiseComplaintReports reopenzonewisecomplaintReports,
// AgeAnalysisComplaintReports ageanalysiscomplaintReports,
// MobileAgeAnalysisComplaintReports mobileageanalysiscomplaintReports,
// ZonewiseComplaintDetails zonewisecomplaintDetails) {
// this.allReports= allReports;
// this.qaqcReports=qaqcReports;
// this.zonewiseReports=zonewiseReports;
// this.reopenzonewiseReports=reopenzonewiseReports;
// this.ageanalysisReports=ageanalysisReports;
// this.mobileageanalysisReports=mobileageanalysisReports;
// this.zonewisecomplaintReports=zonewisecomplaintReports;
// this.reopenzonewisecomplaintReports=reopenzonewisecomplaintReports;
// this.ageanalysiscomplaintReports=ageanalysiscomplaintReports;
// this.mobileageanalysiscomplaintReports=mobileageanalysiscomplaintReports;
// this.zonewisecomplaintDetails=zonewisecomplaintDetails;
// }
//
// @GetMapping("/getAllReports")
// public List getAllReports() {
//
// System.out.println("AllReports Api...");
// return allReports.check(null, null, null, null, null, null);
// }
//
//
//// @GetMapping("/getMyQuery")
//// public String getMyQuery( @RequestParam(required = false) String sFrDate,
//// @RequestParam(required = false) String sToDate,
//// @RequestParam(required = false) String sRptGroup,
//// @RequestParam(required = false) String sRptType,
//// @RequestParam(required = false) String cbCompStatus,
//// @RequestParam(required = false) String mode){
//// System.out.println("hi how are you");
//// List<Map<String, Object>> pgrreportlist = new ArrayList<>();
//// // Pass the additional parameters to the check method
//// if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() ) {
//// pgrreportlist= allReports.check(sFrDate, sToDate, sRptGroup, sRptType, cbCompStatus,mode);
//// }
////
////
//// return pgrreportlist();
//// }
//
//
//
// @GetMapping("/getMyQuery")
// public List<Map<String, Object>> getMyQuery(
// @RequestParam(required = false) String sFrDate,
// @RequestParam(required = false) String sToDate,
// @RequestParam(required = false) String sRptGroup,
// @RequestParam(required = false) String sRptType,
// @RequestParam(required = false) String cbCompStatus,
// @RequestParam(required = false) String mode) {
//
// System.out.println("Get all reports.....");
// List<Map<String, Object>> pgrreportlist = new ArrayList<>();
//
// // Pass the additional parameters to the check method
// if (sFrDate != null && !sFrDate.isEmpty() && sToDate != null && !sToDate.isEmpty()) {
// pgrreportlist = allReports.check(sFrDate, sToDate, sRptGroup, sRptType, cbCompStatus, mode);
// }
//
// return pgrreportlist;
// }
//
//// @GetMapping("/getMyQuery")
//// public ResponseEntity<List<Map<String, Object>>> getMyQuery(
//// @RequestParam(required = false) String sFrDate,
//// @RequestParam(required = false) String sToDate,
//// @RequestParam(required = false) String sRptGroup,
//// @RequestParam(required = false) String sRptType,
//// @RequestParam(required = false) String cbCompStatus,
//// @RequestParam(required = false) String mode) {
////
//// // Log statement
//// System.out.println("Request received with parameters: " + sFrDate + ", " + sToDate + ", " + sRptGroup + ", " + sRptType + ", " + cbCompStatus + ", " + mode);
////
//// List<Map<String, Object>> pgrreportlist = new ArrayList<>();
////
//// // Pass the additional parameters to the check method
//// if (sFrDate != null && !sFrDate.isEmpty() && sToDate != null && !sToDate.isEmpty()) {
//// pgrreportlist = allReports.check(sFrDate, sToDate, sRptGroup, sRptType, cbCompStatus, mode);
//// }
////
//// // Return the response in JSON format
//// return new ResponseEntity<>(pgrreportlist, HttpStatus.OK);
//// }
//
//
//
//
// @GetMapping("/dashboard")
// public Map<String, Object> getDashboardData(@RequestParam(required = false) String DEPT_NAME) {
// // Call your service method to get the dashboard data based on the department
// List<Map<String, Object>> ageanalysisdashboardList = ageanalysisDaskboards.getdashboardquery(DEPT_NAME);
//
// // Assuming you want to return the first item from the list (you may need to adjust this based on your actual logic)
// Map<String, Object> result = ageanalysisdashboardList.isEmpty() ? Map.of() : ageanalysisdashboardList.get(0);
//
// return result;
// }
//
// @GetMapping("/filtered-reports")
//
// public List<Map<String, Object>> filterReports(@RequestParam("sFrDate") String sFrDate,@RequestParam("sToDate") String sToDate){
//
// // Set the dates in the service
//
// allReports.setdates(sFrDate, sToDate);
//
//
//
// // Call the check method to get the filtered data
//
// List<Map<String, Object>> filteredReports = allReports.check(sFrDate, sToDate, sToDate, sToDate, sToDate);
//
//
//
// return filteredReports;
//
// }
//
// @GetMapping("/getqaqcQuery")
// public List getqaqcQuery(){
// System.out.println("hi how are you qaqc");
// return qaqcReports.check1();
// }
//
// @GetMapping("/getzoneQuery")
// public List getzoneQuery(){
// System.out.println("hi how are you zonewise");
// return zonewiseReports.check();
// }
//
// @GetMapping("/getzonecomplaintQuery")
// public List getzonecomplaintQuery(@PathVariable String nos){
// System.out.println("hi how are you zonewisecomplaints");
// return zonewisecomplaintReports.check(nos, nos, nos, nos, nos, nos, nos);
// }
//
// @GetMapping("/getzonecomplaintdetailsQuery")
// public List getzonecomdetailsQuery(@PathVariable String COMPLAINTNUMBER){
// System.out.println("hi how are you zonewisecomplaintsdetails");
// return zonewisecomplaintDetails.check(COMPLAINTNUMBER);
// }
//
// @GetMapping("/getreopenzoneQuery")
// public List getreopenzoneQuery(){
// System.out.println("hi how are you reopenzonewise");
// return reopenzonewiseReports.check();
// }
//
// @GetMapping("/getreopenzonecomplaintQuery")
// public List getreopenzonecomplaintQuery(){
// System.out.println("hi how are you reopenzonewisecomplaints");
// return reopenzonewisecomplaintReports.check();
// }
//
//
//
// @GetMapping("/getageanalysisQuery")
// public List getageanalysisQuery(){
// System.out.println("hi how are you ageanalysis");
// return ageanalysisReports.check();
// }
//
// @GetMapping("/getageanalysiscomplaintQuery")
// public List getageanalysiscomplaintQuery(){
// System.out.println("hi how are you ageanalysiscomplaints");
// return ageanalysiscomplaintReports.check();
// }
//
// @GetMapping("/getmobileageanalysisQuery")
// public List getmobileageanalysisQuery(){
// System.out.println("hi how are you mobileageanalysis");
// return mobileageanalysisReports.check();
// }
//
// @GetMapping("/getmobileageanalysiscomplaintQuery")
// public List getmobileageanalysiscomplaintQuery(){
// System.out.println("hi how are you mobileageanalysiscomplaints");
// return mobileageanalysiscomplaintReports.check();
// }
//
// @GetMapping("/getreports")
// public ResponseEntity<Resource> getreports(@RequestParam String sFrDate,
// @RequestParam String sToDate
// ) {
//
//
// System.out.println(sFrDate+" "+sToDate);
// String datetype;
// String type = "";
// if(type.equals("new")) {
// datetype="ct.entrydate";
// }else if(type.equals("modify")) {
// datetype="mt.modifydate";
// }
// else {
// datetype=type;
// }
// SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
// SimpleDateFormat outputFormat = new SimpleDateFormat("dd/MM/yyyy");
// String frDate="";
// String toDate="";
// try {
//
// Date sFrdate = inputFormat.parse(sFrDate);
// Date sTodate = inputFormat.parse(sToDate);
//
// frDate = outputFormat.format(sFrdate);
// toDate = outputFormat.format(sTodate);
//
// System.out.println(frDate + " " + toDate );
//
//
// } catch (ParseException e) {
// e.printStackTrace();
// }
// return (ResponseEntity<Resource>) allReports.check(sFrDate,sToDate, toDate, toDate, toDate);
//
// // InputStreamResource file = new InputStreamResource(allReports.check(frDate,toDate));
//
//// return ResponseEntity.ok()
//// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + filename)
//// .contentType(MediaType.parseMediaType("application/vnd.ms-excel"))
//// .body(file);
// }
//
//}