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.

460 lines
18 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. package in.gov.chennaicorporation.gccoffice.pgr.contoller;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import java.util.Map;
  5. import org.apache.commons.lang3.StringUtils;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.http.ResponseEntity;
  8. import org.springframework.stereotype.Controller;
  9. import org.springframework.ui.Model;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.PathVariable;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RequestParam;
  14. import org.springframework.web.client.RestTemplate;
  15. import ch.qos.logback.core.recovery.ResilientSyslogOutputStream;
  16. import in.gov.chennaicorporation.gccoffice.configuration.AppConfig;
  17. import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisComplaintDetails;
  18. import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisComplaintReports;
  19. import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisDaskboards;
  20. import in.gov.chennaicorporation.gccoffice.pgr.service.AgeAnalysisReports;
  21. import in.gov.chennaicorporation.gccoffice.pgr.service.AllReports;
  22. import in.gov.chennaicorporation.gccoffice.pgr.service.MobileAgeAnalysisComplaintDetails;
  23. //import in.gov.chennaicorporation.gccoffice.pgr.service.MobileAgeAnalysisComplaintReports;
  24. //import in.gov.chennaicorporation.gccoffice.pgr.service.MobileAgeAnalysisReports;
  25. import in.gov.chennaicorporation.gccoffice.pgr.service.QaQcReports;
  26. import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZoneWiseDaskboards;
  27. import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZonewiseComplaintDetails;
  28. import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZonewiseComplaintReports;
  29. import in.gov.chennaicorporation.gccoffice.pgr.service.ReopenZonewiseReports;
  30. import in.gov.chennaicorporation.gccoffice.pgr.service.ZoneWiseDaskboards;
  31. import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseComplaintDetails;
  32. import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseComplaintReports;
  33. import in.gov.chennaicorporation.gccoffice.pgr.service.ZonewiseReports;
  34. @RequestMapping("/pgr")
  35. @Controller("pgrController")
  36. public class Maincontroller {
  37. // private final RestTemplate restTemplate;
  38. // private final AppConfig appConfig;
  39. @Autowired
  40. private ZoneWiseDaskboards zonewiseDaskboards;
  41. private ReopenZoneWiseDaskboards reopenzonewiseDaskboards;
  42. private AgeAnalysisDaskboards ageanalysisDaskboards;
  43. private AllReports allReports;
  44. private QaQcReports qaqcReports;
  45. private ZonewiseReports zonewiseReports;
  46. private ReopenZonewiseReports reopenzonewiseReports;
  47. private AgeAnalysisReports ageanalysisReports;
  48. //private MobileAgeAnalysisReports mobileageanalysisReports;
  49. private ZonewiseComplaintReports zonewisecomplaintReports;
  50. private ReopenZonewiseComplaintReports reopenzonewisecomplaintReports;
  51. private AgeAnalysisComplaintReports ageanalysiscomplaintReports;
  52. //private MobileAgeAnalysisComplaintReports mobileageanalysiscomplaintReports;
  53. private ZonewiseComplaintDetails zonewisecomplaintDetails;
  54. private ReopenZonewiseComplaintDetails reopenzonewisecomplaintDetails;
  55. private AgeAnalysisComplaintDetails ageanalysisComplaintDetails;
  56. private MobileAgeAnalysisComplaintDetails mobileageanalysisComplaintDetails;
  57. @Autowired
  58. public Maincontroller( RestTemplate restTemplate, AppConfig appConfig,
  59. ZoneWiseDaskboards zonewiseDaskboards,
  60. ReopenZoneWiseDaskboards reopenzonewiseDaskboards,
  61. AgeAnalysisDaskboards ageanalysisDaskboards,
  62. AllReports allReports, QaQcReports qaqcReports,
  63. ZonewiseReports zonewiseReports, ReopenZonewiseReports reopenzonewiseReports,
  64. AgeAnalysisReports ageanalysisReports,
  65. //MobileAgeAnalysisReports mobileageanalysisReports,
  66. ZonewiseComplaintReports zonewisecomplaintReports,
  67. ReopenZonewiseComplaintReports reopenzonewisecomplaintReports,
  68. AgeAnalysisComplaintReports ageanalysiscomplaintReports,
  69. //MobileAgeAnalysisComplaintReports mobileageanalysiscomplaintReports,
  70. ZonewiseComplaintDetails zonewisecomplaintDetails,
  71. ReopenZonewiseComplaintDetails reopenzonewisecomplaintDetails,
  72. AgeAnalysisComplaintDetails ageanalysisComplaintDetails,
  73. MobileAgeAnalysisComplaintDetails mobileageanalysisComplaintDetails) {
  74. /*
  75. * this.restTemplate=restTemplate; this.appConfig=appConfig;
  76. */
  77. this.zonewiseDaskboards=zonewiseDaskboards;
  78. this.reopenzonewiseDaskboards=reopenzonewiseDaskboards;
  79. this.ageanalysisDaskboards=ageanalysisDaskboards;
  80. this.allReports=allReports;
  81. this.qaqcReports=qaqcReports;
  82. this.zonewiseReports=zonewiseReports;
  83. this.reopenzonewiseReports=reopenzonewiseReports;
  84. this.ageanalysisReports=ageanalysisReports;
  85. //this.mobileageanalysisReports=mobileageanalysisReports;
  86. this.zonewisecomplaintReports=zonewisecomplaintReports;
  87. this.reopenzonewisecomplaintReports=reopenzonewisecomplaintReports;
  88. this.ageanalysiscomplaintReports=ageanalysiscomplaintReports;
  89. //this.mobileageanalysiscomplaintReports=mobileageanalysiscomplaintReports;
  90. this.zonewisecomplaintDetails=zonewisecomplaintDetails;
  91. this.reopenzonewisecomplaintDetails=reopenzonewisecomplaintDetails;
  92. this.ageanalysisComplaintDetails=ageanalysisComplaintDetails;
  93. this.mobileageanalysisComplaintDetails=mobileageanalysisComplaintDetails;
  94. }
  95. @GetMapping({"", "/", "/index"})
  96. public String home(Model model)
  97. {
  98. return "modules/pgr/index";
  99. }
  100. //This mapping used for viewing bar and piechart
  101. @GetMapping("/dashboard")
  102. public String home(Model model,
  103. @RequestParam(required = false) String DEPT_NAME,
  104. @RequestParam(required = false) String DEPTID) {
  105. System.out.println("ageanalysislist");
  106. System.out.println("reopenzonewiselist");
  107. // Check if DEPTID is provided (assuming DEPT_NAME is optional)
  108. if (StringUtils.isNotBlank(DEPTID)) {
  109. // DEPTID is provided, call the query method
  110. List<Map<String, Object>> reopenzonewisedashboardList = reopenzonewiseDaskboards.getReopenZonewisedashboardquery(DEPTID);
  111. List<Map<String, Object>> zonewisedashboardList = zonewiseDaskboards.getzonewisedaskboardQuery(DEPTID);
  112. model.addAttribute("reopenzonewisedashboardList", reopenzonewisedashboardList);
  113. model.addAttribute("zonewisedashboardList", zonewisedashboardList);
  114. }
  115. // Check if DEPT_NAME is provided
  116. if (StringUtils.isNotBlank(DEPT_NAME)) {
  117. List<Map<String, Object>> ageanalysisdashboardList = ageanalysisDaskboards.getdashboardquery(DEPT_NAME);
  118. model.addAttribute("ageanalysisdashboardList", ageanalysisdashboardList);
  119. }
  120. model.addAttribute("DEPT_NAME", DEPT_NAME);
  121. model.addAttribute("DEPTID", DEPTID);
  122. return "modules/pgr/index";
  123. }
  124. //This mapping used for get all public complaints to view
  125. @GetMapping("/allreportlist")
  126. public String Allreport(Model model,
  127. @RequestParam(required = false) String sFrDate,
  128. @RequestParam(required = false) String sToDate,
  129. @RequestParam(required = false) String sRptGroup,
  130. @RequestParam(required = false) String sRptType,
  131. @RequestParam(required = false) String cbCompStatus,
  132. @RequestParam(required = false) String mode) {
  133. System.out.println("allreportlist...fromDate... " + sFrDate + "..toDate...." + sToDate);
  134. System.out.println("group : " + sRptGroup);
  135. System.out.println("type : " + sRptType);
  136. System.out.println("status : " + cbCompStatus);
  137. System.out.println("mode : " + mode);
  138. List<Map<String, Object>> pgrreportlist = new ArrayList<>();
  139. // Pass the additional parameters to the check method
  140. if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() ) {
  141. pgrreportlist= allReports.check(sFrDate, sToDate, sRptGroup, sRptType, cbCompStatus,mode);
  142. }
  143. model.addAttribute("pgrreportlist", pgrreportlist);
  144. model.addAttribute("sFrDate",sFrDate);
  145. model.addAttribute("sToDate",sToDate);
  146. model.addAttribute("sRptGroup",sRptGroup);
  147. model.addAttribute("sRptType",sRptType==null?0:sRptType);
  148. model.addAttribute("cbCompStatus",cbCompStatus==null?0:cbCompStatus);
  149. model.addAttribute("mode",mode==null?0:mode);
  150. return "modules/pgr/allreportlist";
  151. }
  152. //This mapping used for get to view QAQC reports
  153. @GetMapping("/qaqc")
  154. public String Qaqc(Model model,
  155. @RequestParam(required = false) String sFrDate,
  156. @RequestParam(required = false) String sToDate) {
  157. System.out.println("qaqcreportlist... " + sFrDate + "..toDate...." + sToDate);
  158. List<Map<String, Object>> qaqclist = new ArrayList<>();
  159. // List<Map<String, Object>> qaqclist = qaqcReports.check1(sFrDate, sToDate);
  160. if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() ) {
  161. qaqclist= qaqcReports.check1(sFrDate, sToDate);
  162. }
  163. model.addAttribute("qaqclist", qaqclist);
  164. model.addAttribute("sFrDate", sFrDate);
  165. model.addAttribute("sToDate", sToDate);
  166. return "modules/pgr/qaqc";
  167. }
  168. //This mapping used for to see each zone uisng userIDwise withreopen reports for all public complaints
  169. @GetMapping("/useridwisereport/zonewise")
  170. public String Zonewise(
  171. Model model,
  172. @RequestParam(required = false) String sFrDate,
  173. @RequestParam( required = false) String sToDate,
  174. @RequestParam(required = false) String DEPT_NAME) {
  175. System.out.println("zonewisereportlist");
  176. System.out.println("fromdate : " +sFrDate);
  177. System.out.println("todate : " +sToDate);
  178. System.out.println("deptname : " + DEPT_NAME);
  179. List<Map<String, Object>> zonewiseList = new ArrayList<>();
  180. if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() && DEPT_NAME!=null && !DEPT_NAME.isEmpty()) {
  181. zonewiseList= zonewiseReports.getZonewise(sFrDate, sToDate,DEPT_NAME);
  182. }
  183. //List<Map<String, Object>> zonewiseList = zonewiseReports.getZonewise(sFrDate, sToDate,DEPT_NAME);
  184. model.addAttribute("zonewiselist", zonewiseList);
  185. model.addAttribute("sFrDate", sFrDate);
  186. model.addAttribute("sToDate", sToDate);
  187. model.addAttribute("DEPT_NAME", DEPT_NAME);
  188. return "modules/pgr/useridwisereport/zonewise";
  189. }
  190. //This mapping used to see a complaints using in popup message with all details of public who complaint for that problem
  191. @GetMapping("/zonecomplaintlist")
  192. public String ZoneComplaintList(
  193. Model model,
  194. @RequestParam(required = false )String sFrDate,
  195. @RequestParam(required = false )String sToDate,
  196. @RequestParam(name = "Deptid", required = false, defaultValue = "0") Integer deptId,
  197. @RequestParam(name = "PgrUserID", required = false, defaultValue = "") Integer pgrUserId) {
  198. System.out.println("zonecomplaintlist");
  199. List<Map<String, Object>> zoneComplaintList = new ArrayList<>();
  200. // Pass the additional parameters to the check method
  201. // List<Map<String, Object>> qaqclist = qaqcReports.check1(sFrDate, sToDate);
  202. if(deptId!=null && pgrUserId!=null ) {
  203. zoneComplaintList= zonewisecomplaintReports.getZoneWiseComplaints(sFrDate,sToDate,deptId, pgrUserId);
  204. }
  205. //List<Map<String, Object>> zoneComplaintList = zonewisecomplaintReports.getZoneWiseComplaints(deptId,pgrUserId);
  206. model.addAttribute("zonecomplaintlist", zoneComplaintList);
  207. return "modules/pgr/useridwisereport/complaintreports/zonecomplaintlist";
  208. }
  209. //This mapping used to get zone wise with reopen complaint details to passing with complaint number
  210. @GetMapping("/zonecomplaintdetail")
  211. public ResponseEntity<?> ZoneComplaintDetail(Model model,@RequestParam("complaintno") String COMPLAINTNUMBER) {
  212. System.out.println("\nzonecomplaintdetails.........:"+COMPLAINTNUMBER);
  213. List<Map<String, Object>> pgrreportList = zonewisecomplaintDetails.check(COMPLAINTNUMBER);
  214. // model.addAttribute("zonecomplaintlist",zonewisecomplaintDetails.check(COMPLAINTID));
  215. if (pgrreportList != null) {
  216. return ResponseEntity.ok(pgrreportList);
  217. } else {
  218. return ResponseEntity.notFound().build();
  219. }
  220. }
  221. //This mapping used for to see each zone uisng userIDwise without reopen reports for all public complaints
  222. @GetMapping("/useridwisereport/reopenedzonewise")
  223. public String Reopenzone(Model model,
  224. @RequestParam(required = false) String sFrDate,
  225. @RequestParam( required = false) String sToDate,
  226. @RequestParam(required = false) String DEPT_NAME) {
  227. System.out.println("reopenzonewisereportlist");
  228. System.out.println("fromdate : " +sFrDate);
  229. System.out.println("todate : " +sToDate);
  230. System.out.println("deptname : " + DEPT_NAME);
  231. List<Map<String, Object>> reopenzonewiseList = new ArrayList<>();
  232. if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() && DEPT_NAME!=null && !DEPT_NAME.isEmpty()) {
  233. reopenzonewiseList= reopenzonewiseReports.getReopenZonewise(sFrDate, sToDate,DEPT_NAME);
  234. }
  235. //List<Map<String, Object>> reopenzonewiseList = reopenzonewiseReports.getReopenZonewise();
  236. model.addAttribute("reopenzonewiselist", reopenzonewiseList);
  237. model.addAttribute("sFrDate", sFrDate);
  238. model.addAttribute("sToDate", sToDate);
  239. model.addAttribute("DEPT_NAME", DEPT_NAME);
  240. // model.addAttribute("reopenzonewiselist", reopenzonewiseReports.check());
  241. return "modules/pgr/useridwisereport/reopenedzonewise";
  242. }
  243. //This mapping used for to see each zone using userIDwise without reopen reports for all public complaints
  244. @GetMapping("/reopenzonecomplaintlist")
  245. public String ReopenZoneComplaintList(
  246. Model model,
  247. @RequestParam( required = false) String sFrDate,
  248. @RequestParam( required = false) String sToDate,
  249. @RequestParam(name = "Deptid", required = false, defaultValue = "0") Integer deptId,
  250. @RequestParam(name = "PgrUserID", required = false, defaultValue = "") Integer pgrUserId) {
  251. System.out.println("reopenzonecomplaintlist");
  252. List<Map<String, Object>> reopenzoneComplaintList = new ArrayList<>();
  253. if(deptId!=null && pgrUserId!=null ) {
  254. reopenzoneComplaintList= reopenzonewisecomplaintReports.getReopenZoneWiseComplaints(sFrDate, sToDate,deptId, pgrUserId);
  255. }
  256. model.addAttribute("reopenzonecomplaintlist", reopenzoneComplaintList);
  257. return "modules/pgr/useridwisereport/complaintreports/reopenzonecomplaintlist";
  258. }
  259. //This mapping used to get zone wise without reopen complaint details to passing with complaint number
  260. @GetMapping("/reopenzonecomplaintdetail")
  261. public ResponseEntity<?> ReopenZoneComplaintDetail(Model model,@RequestParam("complaintno") String COMPLAINTNUMBER) {
  262. System.out.println("\nreopenzonecomplaintdetails.........:"+COMPLAINTNUMBER);
  263. List<Map<String, Object>> pgrreportList = reopenzonewisecomplaintDetails.check(COMPLAINTNUMBER);
  264. // model.addAttribute("zonecomplaintlist",zonewisecomplaintDetails.check(COMPLAINTID));
  265. if (pgrreportList != null) {
  266. return ResponseEntity.ok(pgrreportList);
  267. } else {
  268. return ResponseEntity.notFound().build();
  269. }
  270. }
  271. //This mapping used for to see age analysis all zone wise reports
  272. @GetMapping("/useridwisereport/ageanalysis")
  273. public String Ageanalysis(Model model,
  274. @RequestParam(required = false) String sFrDate,
  275. @RequestParam( required = false) String sToDate,
  276. @RequestParam(required = false) String DEPT_NAME) {
  277. System.out.println("ageanalysisreportlist");
  278. System.out.println("fromdte : " +sFrDate);
  279. System.out.println("todte : " +sToDate);
  280. System.out.println("deptname : " + DEPT_NAME);
  281. List<Map<String, Object>> ageanalysisList = new ArrayList<>();
  282. if(sFrDate!=null && !sFrDate.isEmpty() && sToDate!=null && !sToDate.isEmpty() && DEPT_NAME!=null && !DEPT_NAME.isEmpty()) {
  283. ageanalysisList= reopenzonewiseReports.getReopenZonewise(sFrDate, sToDate,DEPT_NAME);
  284. }
  285. // List<Map<String, Object>> ageanalysisList = ageanalysisReports.getAgeAnalysiswise();
  286. model.addAttribute("ageanalysislist", ageanalysisList);
  287. model.addAttribute("sFrDate", sFrDate);
  288. model.addAttribute("sToDate", sToDate);
  289. model.addAttribute("DEPT_NAME", DEPT_NAME);
  290. //model.addAttribute("ageanalysislist", ageanalysisReports.check());
  291. return "modules/pgr/useridwisereport/ageanalysis";
  292. }
  293. @GetMapping("/ageanalysiscomplaintslist")
  294. public String AgeAnalysisComplaintList(Model model,
  295. @RequestParam(required = false)String sFrDate,
  296. @RequestParam(required = false)String sToDate,
  297. @RequestParam(name = "Deptid", required = false, defaultValue = "0") Integer deptId,
  298. @RequestParam(name = "PgrUserID", required = false, defaultValue = "") Integer pgrUserId) {
  299. System.out.println("ageanalysiscomplaintlist");
  300. List<Map<String, Object>> ageanalysisComplaintList = new ArrayList<>();
  301. // List<Map<String, Object>> ageanalysisComplaintList = ageanalysiscomplaintReports.getAgeAnalysisComplaints(deptId,pgrUserId);
  302. if(deptId!=null && pgrUserId!=null ) {
  303. ageanalysisComplaintList= ageanalysiscomplaintReports.getAgeAnalysisComplaints(sFrDate,sToDate,deptId, pgrUserId);
  304. }
  305. model.addAttribute("ageanalysiscomplaintlist", ageanalysisComplaintList);
  306. //model.addAttribute("ageanalysiscomplaintlist",ageanalysiscomplaintReports.check());
  307. return "modules/pgr/useridwisereport/complaintreports/ageanalysiscomplaintslist";
  308. }
  309. //This mapping used to get zone wise age analysis complaint details to passing with complaint number
  310. @GetMapping("/ageanalysiscomplaintdetail")
  311. public ResponseEntity<?> AgeAnalysisComplaintDetail(Model model,@RequestParam("complaintno") String COMPLAINTNUMBER) {
  312. System.out.println("\nnageanalysiscomplaintdetails.........:"+COMPLAINTNUMBER);
  313. List<Map<String, Object>> pgrreportList = ageanalysisComplaintDetails.check(COMPLAINTNUMBER);
  314. // model.addAttribute("zonecomplaintlist",zonewisecomplaintDetails.check(COMPLAINTID));
  315. if (pgrreportList != null) {
  316. return ResponseEntity.ok(pgrreportList);
  317. } else {
  318. return ResponseEntity.notFound().build();
  319. }
  320. }
  321. }