From 896d4a20d313903a74c4ec2c36ae8e9940f7e5d0 Mon Sep 17 00:00:00 2001 From: Balaji <104271023+tbalaji0001@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:49:14 +0530 Subject: [PATCH] New Module updated New Module updated --- .../chennaicorporation/gccoffice/.DS_Store | Bin 18436 -> 18436 bytes .../gccoffice/callcenterqaqc/.DS_Store | Bin 6148 -> 6148 bytes .../DomesticWasteApiController.java | 278 +++ .../DomesticWasteMainController.java | 73 + .../controller/ScpApiController.java | 534 ++++++ .../controller/ScpMaincontroller.java | 55 + .../service/DomesticWasteService.java | 308 ++++ .../callcenterqaqc/service/ScpService.java | 299 ++++ .../controller/APIController.java | 15 + .../controller/MainController.java | 7 + .../com_petition/service/Petition.java | 65 + .../gccoffice/configuration/AppConfig.java | 3 +- .../configuration/DataSourceConfig.java | 23 + .../m_petition/controller/APIController.java | 17 + .../m_petition/controller/MainController.java | 7 + .../m_petition/service/Petition.java | 67 + .../gccoffice/vendor/.DS_Store | Bin 0 -> 6148 bytes .../vendor/controller/ApiController.java | 31 +- .../vendor/controller/MainController.java | 48 +- .../vendor/service/StreetVendorService.java | 60 +- .../vendor/service/createventService.java | 66 +- .../vtrack/service/VehicleService.java | 49 + .../controller/APIController.java | 15 + .../controller/MainController.java | 8 + .../zerohours_petition/service/Petition.java | 54 + .../resources/templates/modules/.DS_Store | Bin 16388 -> 16388 bytes .../callcenterqaqc/domesticwastecancel.html | 783 ++++++++ .../domesticwastecheckstatus.html | 459 +++++ .../domesticwastecomplaints.html | 1579 +++++++++++++++++ .../modules/callcenterqaqc/overallreport.html | 17 +- .../modules/callcenterqaqc/scpreport.html | 1040 +++++++++++ .../callcenterqaqc/scpverification.html | 1149 ++++++++++++ .../modules/com_petition/pending_list.html | 351 ++++ .../modules/m_petition/pending_list.html | 351 ++++ .../modules/vendors/RequestList.html | 6 +- .../vendors/streetVendorRequestForm.html | 114 +- .../vendors/streetVendorRequestList.html | 98 +- .../modules/vendors/zonerequests.html | 1574 ++++++++++++++++ .../zerohours_petition/pending_list.html | 290 +++ 39 files changed, 9825 insertions(+), 68 deletions(-) create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteApiController.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteMainController.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpApiController.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpMaincontroller.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/DomesticWasteService.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ScpService.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/vendor/.DS_Store create mode 100644 src/main/resources/templates/modules/callcenterqaqc/domesticwastecancel.html create mode 100644 src/main/resources/templates/modules/callcenterqaqc/domesticwastecheckstatus.html create mode 100644 src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html create mode 100644 src/main/resources/templates/modules/callcenterqaqc/scpreport.html create mode 100644 src/main/resources/templates/modules/callcenterqaqc/scpverification.html create mode 100644 src/main/resources/templates/modules/com_petition/pending_list.html create mode 100644 src/main/resources/templates/modules/m_petition/pending_list.html create mode 100644 src/main/resources/templates/modules/vendors/zonerequests.html create mode 100644 src/main/resources/templates/modules/zerohours_petition/pending_list.html diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store b/src/main/java/in/gov/chennaicorporation/gccoffice/.DS_Store index 651c30b996ca64b8e7ad86d97199cd8d28d5583d..b4f1448f0cc45c218bced6a4c9bc8a6ba025ce4a 100644 GIT binary patch delta 185 zcmZpfz}PZ@ae@>R6X!%3W6{G53=Av`3<3-cB@CHBT$xl}T(DV?aWUg$0~eNw-J+9i z^^Z^7tTFk$!B?O#Gs|Xn4i*VUo5>Ce5|d?3_%|CXoMz@sDNfEw%FoYXn0!D!b zRyGcp&}2O=*~yVQe48g~&1ab`#@Nf~HgSUTW`2Xue3P%}#Q;S*C$l>U1D&&3#zBQe ZfD!1R1|SB~AST1)0GG9!@0zeP0|1-8G?D-S delta 161 zcmZpfz}PZ@ae@>RL;FM-W6^^Q3=Av`3<3-cB@CHBT$z(@7(B61d9r~E%VcgQ(aACf z!i=nw=h;e3V&> getItemsList() { + String apiUrl = appConfig.domesticurl + "/get-all-masters"; + Map responseMap = new HashMap<>(); + + try { + String response = restTemplate.getForObject(apiUrl, String.class); + + responseMap.put("status", "success"); + responseMap.put("data", new ObjectMapper().readValue(response, Object.class)); // parse JSON array into list + return ResponseEntity.ok(responseMap); + + } catch (HttpClientErrorException | HttpServerErrorException ex) { + responseMap.put("status", "error"); + responseMap.put("code", ex.getStatusCode().value()); + responseMap.put("message", ex.getStatusText()); + responseMap.put("details", ex.getResponseBodyAsString()); + return ResponseEntity.status(ex.getStatusCode()).body(responseMap); + + } catch (ResourceAccessException ex) { + responseMap.put("status", "error"); + responseMap.put("code", HttpStatus.SERVICE_UNAVAILABLE.value()); + responseMap.put("message", "Service unavailable"); + responseMap.put("details", ex.getMessage()); + return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(responseMap); + + } catch (Exception ex) { + responseMap.put("status", "error"); + responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); + responseMap.put("message", "Unexpected error"); + responseMap.put("details", ex.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); + } + } + + @PostMapping("/saverequest") + public ResponseEntity saveRequest( + @RequestParam String user_name, + @RequestParam String mobile, + @RequestParam String address, + @RequestParam String latitude, + @RequestParam String longitude, + @RequestParam String street_name, + @RequestParam String street_id, + @RequestParam String remarks, + @RequestParam("items") String itemsJson, + @RequestParam String userId,@RequestParam String zone,@RequestParam String ward) { + + try { + Map result = domesticWasteService.saveMultipleWasteRequests( + user_name, mobile, address, + latitude, longitude, + street_name, street_id, remarks, + itemsJson,userId,zone,ward + ); + + return ResponseEntity.ok(result); + + } catch (Exception e) { + return ResponseEntity.status(500).body(Map.of("status", false, "message", e.getMessage())); + } + } + + @GetMapping("/getalldomesticwastelist") + public Map getFilterReports( + @RequestParam(required = false) String startDate, + @RequestParam(required = false) String endDate, + @RequestParam(required = false) String mobile, + @RequestParam(required = false) String requestId) { + Map response = new HashMap<>(); + + try { + System.out.println("startDate="+startDate); + System.out.println("endDate="+endDate); + System.out.println("mobile="+mobile); + System.out.println("requestId="+requestId); + + List> details =domesticWasteService.getAllComplaintsList(startDate,endDate,mobile,requestId) ; + System.out.println(details); + if (details == null || details.isEmpty()) { + response.put("status", "nodata"); + response.put("message", "No Data"); + } + else { + response.put("status", "success"); + response.put("details", details); + } + + } + catch (Exception e) { + response.put("status", "error"); + response.put("message", "An error occurred while fetching data."); + e.printStackTrace(); + } + + return response; + } + + + + @GetMapping("/checkstatusbymobile") + public Map getStatusByMobileNumber( + @RequestParam(required = false) String mobile) { + + Map response = new HashMap<>(); + try { + System.out.println("mobile=" + mobile); + + // Construct external API URL + String url = appConfig.domesticurl + "/get-user-bymobile?mobile=" + mobile; + + // Call the external API + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity apiResponse = restTemplate.getForEntity(url, String.class); + + if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { + ObjectMapper mapper = new ObjectMapper(); + + // Convert JSON string to List of Maps + List> itemsList = mapper.readValue(apiResponse.getBody(), + new TypeReference>>() {}); + + if (itemsList.isEmpty()) { + response.put("status", "no data"); + response.put("data", Collections.emptyList()); + } else { + response.put("status", "success"); + response.put("data", itemsList); + } + } else { + response.put("status", "no data"); + response.put("data", Collections.emptyList()); + } + + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + + + @GetMapping("/getpendingcomplaints") + public Map getpendingcomplaints( + @RequestParam String startDate, + @RequestParam String endDate, + @RequestParam (required = false) String mobile) { + + Map response = new HashMap<>(); + try { + + List> list = domesticWasteService.getpendingcomplaints(startDate,endDate,mobile); + + if (!list.isEmpty()) { + + response.put("status", "success"); + response.put("data", list); + + } else { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } + + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + @GetMapping("/getDetailsByReqId") + public Map getDetailsByReqId( + @RequestParam String requestId) { + + Map response = new HashMap<>(); + try { + + List> list = domesticWasteService.getDetailsByReqId(requestId); + + if (!list.isEmpty()) { + + response.put("status", "success"); + response.put("data", list); + + } else { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } + + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + @PostMapping("/cancelbyagents") + public ResponseEntity> saveAnswer(@RequestParam String requestId,@RequestParam String remarks,@RequestParam String userId) { + Map response = new HashMap<>(); + + try { + boolean success = domesticWasteService.changeStatus(requestId,remarks,userId); + if (success) { + response.put("status", "success"); + response.put("message", "Complaint cancelled successfully!"); + return ResponseEntity.ok(response); + } else { + response.put("status", "error"); + response.put("message", "Fail to Update."); + return ResponseEntity.status(500).body(response); + } + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", "Exception: " + e.getMessage()); + return ResponseEntity.status(500).body(response); + } + } + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteMainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteMainController.java new file mode 100644 index 0000000..5bf3873 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/DomesticWasteMainController.java @@ -0,0 +1,73 @@ +package in.gov.chennaicorporation.gccoffice.callcenterqaqc.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 in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAgentsService; +import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; + +@RequestMapping("/gcc/domestic_waste") +@Controller("callCenterDomesticWasteController") +public class DomesticWasteMainController { + + @Autowired + private QaqcAgentsService agentsService; + + @GetMapping("/registerpage") + public String viewDomesticWastepage(Model model) { + String loginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(loginUserId); + + model.addAttribute("LoginUserId", loginUserId); + model.addAttribute("userId",userId); + model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); + model.addAttribute("UserRole", LoginUserInfo.getUserRole()); + + List> agent=agentsService.getAgentName(userId); + model.addAttribute("agent", agent); + + return "modules/callcenterqaqc/domesticwastecomplaints"; + } + + + @GetMapping("/checkstatus") + public String viewComplaintspage(Model model) { + String loginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(loginUserId); + + model.addAttribute("LoginUserId", loginUserId); + model.addAttribute("userId",userId); + model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); + model.addAttribute("UserRole", LoginUserInfo.getUserRole()); + + List> agent=agentsService.getAgentName(userId); + model.addAttribute("agent", agent); + + return "modules/callcenterqaqc/domesticwastecheckstatus"; + } + + @GetMapping("/cancelpage") + public String viewpendingpage(Model model) { + String loginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(loginUserId); + + model.addAttribute("LoginUserId", loginUserId); + model.addAttribute("userId",userId); + model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); + model.addAttribute("UserRole", LoginUserInfo.getUserRole()); + + List> agent=agentsService.getAgentName(userId); + model.addAttribute("agent", agent); + + return "modules/callcenterqaqc/domesticwastecancel"; + } + + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpApiController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpApiController.java new file mode 100644 index 0000000..3d6463f --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpApiController.java @@ -0,0 +1,534 @@ +package in.gov.chennaicorporation.gccoffice.callcenterqaqc.controller; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; +import org.springframework.web.client.ResourceAccessException; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.ScpService; + +@RestController +@RequestMapping("/gcc/api/scp") +public class ScpApiController { + + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private ScpService scpservice; + + @GetMapping("/getdatabyfilters") + public Map getdatabyfilters( + @RequestParam String startDate, + @RequestParam String endDate, + @RequestParam String zone, + @RequestParam String ward) { + + Map response = new HashMap<>(); + + try { + + DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); + + String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); + String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); + + // Build API URL + String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpfilterReports" + + "?assetTypeId=2" + + "&fromDate=" + formattedStartDate + + "&toDate=" + formattedEndDate + + "&loginId=5662"; + + if (!zone.isEmpty()) { + apiUrl += "&zone=" + zone; + } + if (!ward.isEmpty()) { + apiUrl += "&ward=" + ward; + } + + System.out.println("apiUrl=" + apiUrl); + + // Call the external API + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity apiResponse = restTemplate.getForEntity(apiUrl, String.class); + + if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { + + ObjectMapper mapper = new ObjectMapper(); + + // Parse full JSON + JsonNode rootNode = mapper.readTree(apiResponse.getBody()); + + // Extract "scpreport" array + JsonNode reportNode = rootNode.path("scpreport"); + + if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } else { + // Convert JSON array → List> + List> reportList = mapper.convertValue( + reportNode, + new TypeReference>>() {} + ); + + response.put("status", "success"); + response.put("data", reportList); + if(zone.isEmpty() && ward.isEmpty()) { + response.put("table", "table1"); + } + else if(ward.isEmpty() && !zone.isEmpty()) { + response.put("table", "table2"); + } + else if(!ward.isEmpty() && !zone.isEmpty()) { + response.put("table", "table3"); + } + + } + } else { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + @GetMapping("/getzones") + public ResponseEntity> getzones() { + String apiUrl = "https://gccservices.in/gccrestservices/dropdown/api/zone"; + Map responseMap = new HashMap<>(); + + try { + RestTemplate restTemplate = new RestTemplate(); + String response = restTemplate.getForObject(apiUrl, String.class); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode rootArray = objectMapper.readTree(response); + + // ✅ The response is an array, so get the first element + if (rootArray.isArray() && rootArray.size() > 0) { + JsonNode firstObject = rootArray.get(0); + + boolean status = firstObject.path("status").asBoolean(false); + + if (status) { + JsonNode dataArray = firstObject.path("data"); + responseMap.put("status", "success"); + responseMap.put("code", 200); + responseMap.put("message", "Data found"); + responseMap.put("data", objectMapper.convertValue( + dataArray, new TypeReference>>() {})); + return ResponseEntity.ok(responseMap); + } else { + responseMap.put("status", "failure"); + responseMap.put("code", 404); + responseMap.put("message", "No Zones found"); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); + } + } else { + responseMap.put("status", "failure"); + responseMap.put("code", 404); + responseMap.put("message", "Invalid response format"); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); + } + + } catch (Exception ex) { + responseMap.put("status", "error"); + responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); + responseMap.put("message", "Unexpected error occurred"); + responseMap.put("details", ex.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); + } + } + + + @GetMapping("/getwardbyzone") + public ResponseEntity> getwardbyzone( @RequestParam String zone) { + String apiUrl = "https://gccservices.in/gccrestservices/dropdown/api/wardbyzone?zoneId="+zone; + Map responseMap = new HashMap<>(); + + try { + RestTemplate restTemplate = new RestTemplate(); + String response = restTemplate.getForObject(apiUrl, String.class); + + ObjectMapper objectMapper = new ObjectMapper(); + JsonNode rootArray = objectMapper.readTree(response); + + // ✅ The response is an array, so get the first element + if (rootArray.isArray() && rootArray.size() > 0) { + JsonNode firstObject = rootArray.get(0); + + boolean status = firstObject.path("status").asBoolean(false); + + if (status) { + JsonNode dataArray = firstObject.path("data"); + responseMap.put("status", "success"); + responseMap.put("code", 200); + responseMap.put("message", "Data found"); + responseMap.put("data", objectMapper.convertValue( + dataArray, new TypeReference>>() {})); + return ResponseEntity.ok(responseMap); + } else { + responseMap.put("status", "failure"); + responseMap.put("code", 404); + responseMap.put("message", "No Zones found"); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); + } + } else { + responseMap.put("status", "failure"); + responseMap.put("code", 404); + responseMap.put("message", "Invalid response format"); + return ResponseEntity.status(HttpStatus.NOT_FOUND).body(responseMap); + } + + } catch (Exception ex) { + responseMap.put("status", "error"); + responseMap.put("code", HttpStatus.INTERNAL_SERVER_ERROR.value()); + responseMap.put("message", "Unexpected error occurred"); + responseMap.put("details", ex.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseMap); + } + } + + + @GetMapping("/getstreetdetails") + public Map getstreetdetails( + @RequestParam String startDate, + @RequestParam String endDate, + @RequestParam String variable) { + + Map response = new HashMap<>(); + + try { + DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); + + String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); + String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); + + // 🔹 Call external API + String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpReportAssetList" + + "?assetTypeId=2" + + "&fromDate=" + formattedStartDate + + "&toDate=" + formattedEndDate + + "&loginId=5662" + + "&status=Cleaned" + + "&streetid=" + variable; + + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity apiResponse = restTemplate.getForEntity(apiUrl, String.class); + + List> reportData = new ArrayList<>(); + + if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { + ObjectMapper mapper = new ObjectMapper(); + JsonNode rootNode = mapper.readTree(apiResponse.getBody()); + JsonNode reportNode = rootNode.path("scpreport"); + + if (reportNode.isArray() && reportNode.size() > 0) { + reportData = mapper.convertValue( + reportNode, + new TypeReference>>() {} + ); + } + } + + if (reportData.isEmpty()) { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } else { + // 🔹 Enrich each data item with questions_part + List> enrichedData = scpservice.enrichScpReportWithQuestions(reportData); + + response.put("status", "success"); + response.put("data", enrichedData); + } + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + +// @PostMapping("/saveanswer") +// public ResponseEntity> saveAnswer(@RequestBody List> answers) { +// Map response = new HashMap<>(); +// +// try { +// boolean success = scpservice.saveAnswers(answers); +// if (success) { +// response.put("status", "success"); +// response.put("message", "Feedback submitted successfully!"); +// return ResponseEntity.ok(response); +// } else { +// response.put("status", "error"); +// response.put("message", "Fail to Save."); +// return ResponseEntity.status(500).body(response); +// } +// } catch (Exception e) { +// e.printStackTrace(); +// response.put("status", "error"); +// response.put("message", "Exception: " + e.getMessage()); +// return ResponseEntity.status(500).body(response); +// } +// } + + + @PostMapping("/saveanswer") + public ResponseEntity> saveAnswer(@RequestBody List> answers) { + Map response = new HashMap<>(); + + try { + String result = scpservice.saveAnswers(answers); + + if ("success".equals(result)) { + response.put("status", "success"); + response.put("message", "Feedback submitted successfully!"); + return ResponseEntity.ok(response); + + } else if ("duplicate".equals(result)) { + response.put("status", "duplicate"); + response.put("message", "Already submitted by another one, So refresh the page"); + return ResponseEntity.ok(response); + + } else { + response.put("status", "error"); + response.put("message", "Fail to Save."); + return ResponseEntity.ok(response); + } + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", "Exception: " + e.getMessage()); + return ResponseEntity.status(500).body(response); + } + } + + + + @GetMapping("/getreportdatabyfilters") + public Map getreportdatabyfilters( + @RequestParam String startDate, + @RequestParam String endDate, + @RequestParam String zone, + @RequestParam String ward) { + + Map response = new HashMap<>(); + + try { + + DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd-MM-yyyy"); + + String formattedStartDate = LocalDate.parse(startDate, inputFormat).format(outputFormat); + String formattedEndDate = LocalDate.parse(endDate, inputFormat).format(outputFormat); + + // Build API URL + String apiUrl = "https://gccservices.in/gccofficialapp/api/asset/scpfilterReports" + + "?assetTypeId=2" + + "&fromDate=" + formattedStartDate + + "&toDate=" + formattedEndDate + + "&loginId=5662"; + + if (!zone.isEmpty()) { + apiUrl += "&zone=" + zone; + } + if (!ward.isEmpty()) { + apiUrl += "&ward=" + ward; + } + + System.out.println("apiUrl=" + apiUrl); + + // Call the external API + RestTemplate restTemplate = new RestTemplate(); + ResponseEntity apiResponse = restTemplate.getForEntity(apiUrl, String.class); + + if (apiResponse.getStatusCode().is2xxSuccessful() && apiResponse.getBody() != null) { + + ObjectMapper mapper = new ObjectMapper(); + + // Parse full JSON + JsonNode rootNode = mapper.readTree(apiResponse.getBody()); + + // Extract "scpreport" array + JsonNode reportNode = rootNode.path("scpreport"); + + if (reportNode.isMissingNode() || !reportNode.isArray() || reportNode.size() == 0) { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } else { + // Convert JSON array → List> + List> reportList = mapper.convertValue( + reportNode, + new TypeReference>>() {} + ); + + + // Declare dbMap outside conditional blocks + Map> dbMap = new HashMap<>(); + List> dbList = new ArrayList<>(); + + // Fetch DB data based on filters + if (zone.isEmpty() && ward.isEmpty()) { + dbList = scpservice.getZoneWiseReportData(); + dbMap = dbList.stream().collect(Collectors.toMap( + row -> String.valueOf(row.get("zone")), + row -> row + )); + } else if (ward.isEmpty() && !zone.isEmpty()) { + dbList = scpservice.getWardWiseReportData(zone); + dbMap = dbList.stream().collect(Collectors.toMap( + row -> String.valueOf(row.get("ward")), + row -> row + )); + } else if (!ward.isEmpty() && !zone.isEmpty()) { + dbList = scpservice.getStreetWiseReportData(zone, ward); + dbMap = dbList.stream().collect(Collectors.toMap( + row -> String.valueOf(row.get("streetid")), + row -> row + )); + } + + + // Merge API data with DB data + // Merge API data with DB data + for (int i = 0; i < reportList.size(); i++) { + Map apiRow = reportList.get(i); + String variableValue = String.valueOf(apiRow.get("VARIABLE")); + boolean isLast = (i == reportList.size() - 1); // check if it's the last element + + if (dbMap.containsKey(variableValue)) { + Map dbRow = dbMap.get(variableValue); + apiRow.put("Completed", dbRow.get("Completed")); + apiRow.put("Yes", dbRow.get("YesCount")); + apiRow.put("No", dbRow.get("NoCount")); + apiRow.put("Available", dbRow.get("AvailableCount")); + apiRow.put("Not Available", dbRow.get("NotAvailableCount")); + apiRow.put("Image Not Clear", dbRow.get("ImageNotClearCount")); + apiRow.put("LidGoodYesCount", dbRow.get("LidGoodYesCount")); + apiRow.put("LidGoodNoCount", dbRow.get("LidGoodNoCount")); + } else { + // If last list → use "-" + if (isLast) { + apiRow.put("Completed", "-"); + apiRow.put("Yes", "-"); + apiRow.put("No", "-"); + apiRow.put("Available", "-"); + apiRow.put("Not Available", "-"); + apiRow.put("Image Not Clear", "-"); + apiRow.put("LidGoodYesCount", "-"); + apiRow.put("LidGoodNoCount", "-"); + } else { + // For all others → use 0 + apiRow.put("Completed", 0); + apiRow.put("Yes", 0); + apiRow.put("No", 0); + apiRow.put("Available", 0); + apiRow.put("Not Available", 0); + apiRow.put("Image Not Clear", 0); + apiRow.put("LidGoodYesCount", 0); + apiRow.put("LidGoodNoCount", 0); + } + } + } + + + response.put("status", "success"); + response.put("data", reportList); + if(zone.isEmpty() && ward.isEmpty()) { + response.put("table", "table1"); + } + else if(ward.isEmpty() && !zone.isEmpty()) { + response.put("table", "table2"); + } + else if(!ward.isEmpty() && !zone.isEmpty()) { + response.put("table", "table3"); + } + + } + } else { + response.put("status", "nodata"); + response.put("data", Collections.emptyList()); + } + + } catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + + @GetMapping("/getdetailreportdata") + public Map getDetailreportdatabyfilters( + @RequestParam String startDate, + @RequestParam String endDate) { + + Map response = new HashMap<>(); + + try { + + List> list=scpservice.getdetailreport(startDate,endDate); + + if(list.isEmpty()) { + response.put("status", "nodata"); + response.put("message", "No Data"); + } + else { + response.put("status", "success"); + response.put("data", list); + response.put("message", "Fetched Data Successfully"); + } + } + catch (Exception e) { + e.printStackTrace(); + response.put("status", "error"); + response.put("message", e.getMessage()); + } + + return response; + } + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpMaincontroller.java b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpMaincontroller.java new file mode 100644 index 0000000..3e8a0c1 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/controller/ScpMaincontroller.java @@ -0,0 +1,55 @@ +package in.gov.chennaicorporation.gccoffice.callcenterqaqc.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 in.gov.chennaicorporation.gccoffice.callcenterqaqc.service.QaqcAgentsService; +import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; + +@RequestMapping("/gcc/callcenterqaqcscp") +@Controller("callCenterQaQcScpController") +public class ScpMaincontroller { + + @Autowired + private QaqcAgentsService agentsService; + + @GetMapping("/scpverification") + public String viewDomesticWastepage(Model model) { + String loginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(loginUserId); + + model.addAttribute("LoginUserId", loginUserId); + model.addAttribute("userId",userId); + model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); + model.addAttribute("UserRole", LoginUserInfo.getUserRole()); + + List> agent=agentsService.getAgentName(userId); + model.addAttribute("agent", agent); + + return "modules/callcenterqaqc/scpverification"; + } + + + @GetMapping("/scpreport") + public String viewReportPage(Model model) { + String loginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(loginUserId); + + model.addAttribute("LoginUserId", loginUserId); + model.addAttribute("userId",userId); + model.addAttribute("agent_name", LoginUserInfo.getCurrentUserDetails().getUsername()); + model.addAttribute("UserRole", LoginUserInfo.getUserRole()); + + List> agent=agentsService.getAgentName(userId); + model.addAttribute("agent", agent); + + return "modules/callcenterqaqc/scpreport"; + } + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/DomesticWasteService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/DomesticWasteService.java new file mode 100644 index 0000000..77c7a95 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/DomesticWasteService.java @@ -0,0 +1,308 @@ +package in.gov.chennaicorporation.gccoffice.callcenterqaqc.service; + +import java.sql.PreparedStatement; +import java.sql.Statement; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.GeneratedKeyHolder; +import org.springframework.jdbc.support.KeyHolder; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Service +public class DomesticWasteService { + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Value("${fileBaseUrl}") + private String fileBaseUrl; + + @Autowired + public void setDatasource(@Qualifier("mysqlDomesticWasteDataSource") DataSource datasource) { + this.jdbcTemplate=new JdbcTemplate(datasource); + } + + + + public Map saveMultipleWasteRequests(String user_name, String mobile, String address, + String latitude, String longitude, + String street_name, String street_id, String remarks, + String itemsJson,String userId,String zone, String ward) { + + + int agent_id=Integer.parseInt(userId); + int is_app=3; + String remarks1; + if (remarks == null || remarks.trim().isEmpty()) { + remarks1 = "-"; + } else { + remarks1 = remarks; + } + + try { + + ObjectMapper objectMapper = new ObjectMapper(); + List> items = objectMapper.readValue(itemsJson, new TypeReference<>() {}); + + String sofaSize = null; // declare before lambda + for (Map item : items) { + if ("2".equals(item.get("item_id").toString())) { // Sofa id = 2 + Object sizeObj = item.get("sofa_size"); // match your JS payload key + if (sizeObj != null && !sizeObj.toString().isEmpty()) { + sofaSize = sizeObj.toString(); + } + break; // found sofa, no need to loop further + } + } + + final String finalSofaSize = sofaSize; + + + // Step 1: Insert main request (one time) + String insertMainSql = "INSERT INTO user_request_table " + + "(request_id, user_name, mobile, address, latitude, longitude, street_name, street_id, remarks,agent_id,is_app,zone,division,sofa_type) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)"; + + KeyHolder keyHolder = new GeneratedKeyHolder(); + jdbcTemplate.update(con -> { + PreparedStatement ps = con.prepareStatement(insertMainSql, Statement.RETURN_GENERATED_KEYS); + ps.setString(1, "TEMP"); // placeholder + ps.setString(2, user_name); + ps.setString(3, mobile); + ps.setString(4, address); + ps.setString(5, latitude); + ps.setString(6, longitude); + ps.setString(7, street_name); + ps.setString(8, street_id); + ps.setString(9, remarks1); + ps.setInt(10, agent_id); + ps.setInt(11, is_app); + ps.setString(12, zone); + ps.setString(13, ward); + ps.setString(14, finalSofaSize); + return ps; + }, keyHolder); + + int generatedId = keyHolder.getKey().intValue(); + String requestId = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + generatedId; + + // Update request_id in user_request_table + jdbcTemplate.update("UPDATE user_request_table SET request_id = ? WHERE id = ?", requestId, generatedId); + + + String insertItemSql = "INSERT INTO items (iteam_id, quantity, req_table_id, requedt_id) VALUES (?, ?, ?, ?)"; + + for (Map item : items) { + Object itemIdObj = item.get("item_id"); + Object quantityObj = item.get("quantity"); + + if (itemIdObj == null || quantityObj == null) { + continue; + } + + int itemId = Integer.parseInt(itemIdObj.toString()); + int quantity = Integer.parseInt(quantityObj.toString()); + + jdbcTemplate.update(insertItemSql, itemId, quantity, generatedId, requestId); + } + + return Map.of("status", true,"message", "Request saved successfully","requestId", requestId); + + } + catch (Exception e) { + e.printStackTrace(); + return Map.of("status", false, "message", "Error: " + e.getMessage()); + } + } + + + + + public List> getAllComplaintsList(String startDate, String endDate, String mobile, String requestId) { + StringBuilder sql = new StringBuilder( + "SELECT u.*, sm.status_master AS status_name, DATE(u.cdate) AS created_date " + + "FROM user_request_table u " + + "JOIN status_master sm ON sm.id = u.status_id " + + "WHERE u.is_active = 1 AND u.is_delete = 0 AND sm.is_active = 1 AND sm.is_delete = 0 " + ); + + List params = new ArrayList<>(); + + if (startDate != null && !startDate.isEmpty() && endDate != null && !endDate.isEmpty()) { + sql.append(" AND DATE(u.cdate) BETWEEN ? AND ? "); + params.add(startDate); + params.add(endDate); + } + + if (mobile != null && !mobile.isEmpty()) { + sql.append(" AND u.mobile = ? "); + params.add(mobile); + } + + if (requestId != null && !requestId.isEmpty()) { + sql.append(" AND u.request_id = ? "); + params.add(requestId); + } + + List> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); + + for (Map complaint : result) { + Number reqTableId = (Number) complaint.get("id"); + List> itemList = getItemsByRequestId(reqTableId.intValue()); + complaint.put("items", itemList); + } + + return result; + } + + + + public List> getpendingcomplaints(String startDate, String endDate, String mobile) { + + StringBuilder sql = new StringBuilder("SELECT u.*, sm.status_master AS status_name, DATE(u.cdate) AS created_date" + + " FROM user_request_table u " + + " JOIN status_master sm ON sm.id = u.status" + + " WHERE u.is_active = 1 AND u.is_delete = 0 AND u.status IN (1,3) " + ); + + List params = new ArrayList<>(); + + if (startDate != null && !startDate.isEmpty() && endDate != null && !endDate.isEmpty()) { + sql.append(" AND DATE(u.cdate) BETWEEN ? AND ? "); + params.add(startDate); + params.add(endDate); + } + + if (mobile != null && !mobile.isEmpty()) { + sql.append(" AND u.mobile = ? "); + params.add(mobile); + } + + List> result = jdbcTemplate.queryForList(sql.toString(), params.toArray()); + + for (Map complaint : result) { + Number reqTableId = (Number) complaint.get("id"); + List> itemList = getItemsByRequestId(reqTableId.intValue()); + complaint.put("items", itemList); + } + + return result; + } + + public List> getItemsByRequestId(int reqTableId) { + String itemSql = "SELECT i.iteam_id, im.item_name, i.quantity " + + "FROM items i " + + "LEFT JOIN item_master im ON i.iteam_id = im.id " + + "WHERE i.is_active = 1 AND i.is_delete = 0 AND i.req_table_id = ?"; + return jdbcTemplate.queryForList(itemSql, reqTableId); + } + + + + public List> getDetailsByReqId(String requestId) { + + String sql = "SELECT " + + "u.id, u.request_id, u.user_name, u.mobile, u.address, u.latitude, u.longitude, " + + "u.zone, u.division, u.street_name, u.quantity AS main_quantity, u.remarks, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.image_url) AS image_url, " + + "DATE_FORMAT(u.cdate, '%d-%m-%Y') AS cdate, " + + "u.is_active, u.is_delete, u.street_id, sm.status_master AS status, u.is_app, " + + "DATE_FORMAT(u.close_date, '%d-%m-%Y') AS close_date, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', u.officer_upload_url) AS officer_upload_url, " + + "itm.iteam_id, itm.quantity, im.item_name " + + "FROM user_request_table u " + + "LEFT JOIN items itm ON u.id = itm.req_table_id " + + "LEFT JOIN item_master im ON itm.iteam_id = im.id AND im.is_active = 1 " + + "LEFT JOIN status_master sm ON sm.id = u.status AND sm.is_active = 1 AND sm.is_delete = 0 " + + "WHERE u.request_id = ? AND u.is_active = 1"; + + List> rawList = jdbcTemplate.queryForList(sql, requestId); + + Map> groupedMap = new LinkedHashMap<>(); + + for (Map row : rawList) { + Integer id = (Integer) row.get("id"); + + Map item = null; + if (row.get("item_name") != null) { + item = new LinkedHashMap<>(); + item.put("item_name", row.get("item_name")); + item.put("quantity", row.get("quantity")); + } + + if (groupedMap.containsKey(id)) { + if (item != null) { + ((List>) groupedMap.get(id).get("items")).add(item); + } + } else { + Map newEntry = new LinkedHashMap<>(); + newEntry.put("id", id); + newEntry.put("request_id", row.get("request_id")); + newEntry.put("user_name", row.get("user_name")); + newEntry.put("mobile", row.get("mobile")); + newEntry.put("address", row.get("address")); + newEntry.put("latitude", row.get("latitude")); + newEntry.put("longitude", row.get("longitude")); + newEntry.put("zone", row.get("zone")); + newEntry.put("division", row.get("division")); + newEntry.put("street_name", row.get("street_name")); + newEntry.put("main_quantity", row.get("main_quantity")); + newEntry.put("remarks", row.get("remarks")); + newEntry.put("image_url", row.get("image_url")); + newEntry.put("cdate", row.get("cdate")); + newEntry.put("is_active", row.get("is_active")); + newEntry.put("is_delete", row.get("is_delete")); + newEntry.put("street_id", row.get("street_id")); + newEntry.put("status", row.get("status")); // Now this is human-readable + newEntry.put("is_app", row.get("is_app")); + newEntry.put("close_date", row.get("close_date")); + newEntry.put("officer_upload_url", row.get("officer_upload_url")); + + List> items = new ArrayList<>(); + if (item != null) { + items.add(item); + } + newEntry.put("items", items); + + groupedMap.put(id, newEntry); + } + } + + return new ArrayList<>(groupedMap.values()); + } + + + + public boolean changeStatus(String requestId, String remarks, String userId) { + String sql = "UPDATE user_request_table " + + "SET status = 5, " + + "officer_remark = ?, " + + "cancelled_by = ?, " + + "rejecttype = 'Without Location', " + + "reject_latitude = 0.0, " + + "reject_longitude = 0.0 " + + "WHERE request_id = ?"; + + int result = jdbcTemplate.update(sql, remarks, userId, requestId); + return result > 0; + } + + + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ScpService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ScpService.java new file mode 100644 index 0000000..38dcdd8 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/callcenterqaqc/service/ScpService.java @@ -0,0 +1,299 @@ +package in.gov.chennaicorporation.gccoffice.callcenterqaqc.service; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Service; + +@Service +public class ScpService { + + private JdbcTemplate jdbcTemplate; + + @Autowired + public void setDataSource(@Qualifier("mysqlScpDataSource") DataSource dataSource) { + this.jdbcTemplate = new JdbcTemplate(dataSource); + } + + + // Method to enrich report data with questions_part + public List> enrichScpReportWithQuestions(List> reportData) { + + // Step 1: Fetch all questions + String questionSql = "SELECT id AS question_id, questions AS question, answer_type, isactive, isdelete FROM questions WHERE isactive=1 AND isdelete=0"; + List> questionList = jdbcTemplate.queryForList(questionSql); + + // Step 2: Fetch all answers (master answers) + String answerSql = "SELECT question_id, answer FROM answers WHERE isactive=1 AND isdelete=0"; + List> answerList = jdbcTemplate.queryForList(answerSql); + + // Convert answerList to Map> for easy mapping + Map> answerMasterMap = new HashMap<>(); + for (Map ans : answerList) { + Integer qid = (Integer) ans.get("question_id"); + String answerVal = (String) ans.get("answer"); + answerMasterMap.computeIfAbsent(qid, k -> new ArrayList<>()).add(answerVal); + } + + // Step 3: Fetch all scp_report entries for these scp_ids + List scpIds = reportData.stream() + .map(d -> ((Number) d.get("id")).longValue()) + .collect(Collectors.toList()); + + // Step 4: Get existing scp_ids from scp_report + Set existingScpIds = new HashSet<>(); + if (!scpIds.isEmpty()) { + String inClause = scpIds.stream().map(id -> "?").collect(Collectors.joining(",")); + String sql = "SELECT DISTINCT scp_id FROM scp_report WHERE isactive=1 AND isdelete=0 AND scp_id IN (" + inClause + ")"; + List> existingList = jdbcTemplate.queryForList(sql, scpIds.toArray()); + for (Map row : existingList) { + existingScpIds.add(((Number) row.get("scp_id")).longValue()); + } + } + + // Step 5: Filter out already answered scp_ids + List> filteredReportData = reportData.stream() + .filter(d -> !existingScpIds.contains(((Number) d.get("id")).longValue())) + .collect(Collectors.toList()); + + // Step 6: Attach questions only to the filtered list + for (Map report : filteredReportData) { + Long scpId = ((Number) report.get("id")).longValue(); + List> questionsPart = new ArrayList<>(); + + for (Map question : questionList) { + Integer qid = (Integer) question.get("question_id"); + + Map questionPart = new HashMap<>(); + questionPart.put("question_id", qid); + questionPart.put("question", question.get("question")); + questionPart.put("answer_type", question.get("answer_type")); + questionPart.put("answer_master", answerMasterMap.getOrDefault(qid, Collections.emptyList())); + + // Empty answers since these scp_ids don’t exist yet + Map answersMap = new HashMap<>(); + answersMap.put("scp_id", scpId); + answersMap.put("question_id", qid); + answersMap.put("answer", null); + answersMap.put("agent_id", null); + + questionPart.put("answers", answersMap); + questionsPart.add(questionPart); + } + + report.put("questions_part", questionsPart); + } + + return filteredReportData; + } + + +// public boolean saveAnswers(List> answers) { +// if (answers == null || answers.isEmpty()) return false; +// +// String sql = "INSERT INTO scp_report (scp_id, question_id, answer, agent_id, zone, ward, streetid, street_name, last_feedback_date) " +// + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; +// +// int[][] result = jdbcTemplate.batchUpdate(sql, answers, answers.size(), (ps, answer) -> { +// +// // Convert safely to String or Integer +// String scpIdStr = getSafeString(answer.get("scp_id")); +// String questionIdStr = getSafeString(answer.get("question_id")); +// String answerStr = getSafeString(answer.get("answer")); +// String agentIdStr = getSafeString(answer.get("agent_id")); +// String zone = getSafeString(answer.get("zone")); +// String ward = getSafeString(answer.get("ward")); +// String streetId = getSafeString(answer.get("street_id")); +// String streetName = getSafeString(answer.get("street_name")); +// String lastFeedback = getSafeString(answer.get("lastfeedback")); +// +// // Parse integers only if not null +// Integer scpId = (scpIdStr != null) ? Integer.parseInt(scpIdStr) : null; +// Integer questionId = (questionIdStr != null) ? Integer.parseInt(questionIdStr) : null; +// Integer agentId = (agentIdStr != null) ? Integer.parseInt(agentIdStr) : null; +// +// // Set parameters +// ps.setObject(1, scpId); +// ps.setObject(2, questionId); +// ps.setObject(3, answerStr); +// ps.setObject(4, agentId); +// ps.setObject(5, zone); +// ps.setObject(6, ward); +// ps.setObject(7, streetId); +// ps.setObject(8, streetName); +// ps.setObject(9, lastFeedback); +// }); +// +// return result.length > 0; +// } + + public String saveAnswers(List> answers) { + if (answers == null || answers.isEmpty()) return "error"; + + // Step 1: Extract unique scp_ids from the list + List scpIds = answers.stream() + .map(a -> { + String idStr = getSafeString(a.get("scp_id")); + return (idStr != null) ? Integer.parseInt(idStr) : null; + }) + .filter(Objects::nonNull) + .distinct() + .toList(); + + // Step 2: Check if any of these scp_ids already exist in DB + String checkSql = "SELECT COUNT(*) FROM scp_report WHERE scp_id IN (:ids)"; + Map params = new HashMap<>(); + params.put("ids", scpIds); + + NamedParameterJdbcTemplate namedJdbc = new NamedParameterJdbcTemplate(jdbcTemplate); + Integer count = namedJdbc.queryForObject(checkSql, params, Integer.class); + + if (count != null && count > 0) { + // Duplicate found — stop processing + return "duplicate"; + } + + // Step 3: Insert new answers + String insertSql = "INSERT INTO scp_report (scp_id, question_id, answer, agent_id, zone, ward, streetid, street_name, last_feedback_date) " + + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; + + int[][] result = jdbcTemplate.batchUpdate(insertSql, answers, answers.size(), (ps, answer) -> { + String scpIdStr = getSafeString(answer.get("scp_id")); + String questionIdStr = getSafeString(answer.get("question_id")); + String answerStr = getSafeString(answer.get("answer")); + String agentIdStr = getSafeString(answer.get("agent_id")); + String zone = getSafeString(answer.get("zone")); + String ward = getSafeString(answer.get("ward")); + String streetId = getSafeString(answer.get("street_id")); + String streetName = getSafeString(answer.get("street_name")); + String lastFeedback = getSafeString(answer.get("lastfeedback")); + + Integer scpId = (scpIdStr != null) ? Integer.parseInt(scpIdStr) : null; + Integer questionId = (questionIdStr != null) ? Integer.parseInt(questionIdStr) : null; + Integer agentId = (agentIdStr != null) ? Integer.parseInt(agentIdStr) : null; + + ps.setObject(1, scpId); + ps.setObject(2, questionId); + ps.setObject(3, answerStr); + ps.setObject(4, agentId); + ps.setObject(5, zone); + ps.setObject(6, ward); + ps.setObject(7, streetId); + ps.setObject(8, streetName); + ps.setObject(9, lastFeedback); + }); + + return (result.length > 0) ? "success" : "error"; + } + + + // Helper method + private String getSafeString(Object val) { + if (val == null) return null; + String s = val.toString().trim(); + return s.isEmpty() ? null : s; + } + + + public List> getZoneWiseReportData() { + String sql = "SELECT " + + "sr.zone," + + " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," + + " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," + + " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," + + " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," + + " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," + + " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," + + " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," + + " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" + + " FROM scp_report sr" + + " WHERE sr.isactive = 1 AND sr.isdelete = 0" + + " GROUP BY sr.zone" + + " ORDER BY sr.zone"; + + return jdbcTemplate.queryForList(sql); + } + + public List> getWardWiseReportData(String zone) { + String sql = "SELECT " + + "sr.zone," + + "sr.ward," + + " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," + + " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," + + " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," + + " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," + + " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," + + " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," + + " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," + + " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" + + " FROM scp_report sr" + + " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND sr.zone= ?" + + " GROUP BY sr.zone,sr.ward" + + " ORDER BY sr.zone,sr.ward"; + + return jdbcTemplate.queryForList(sql,zone); + } + + public List> getStreetWiseReportData(String zone,String ward) { + String sql = "SELECT " + + "sr.zone," + + "sr.ward," + + "sr.streetid," + + " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," + + " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," + + " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," + + " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," + + " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," + + " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," + + " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," + + " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" + + " FROM scp_report sr" + + " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND sr.zone=? AND sr.ward=?" + + " GROUP BY sr.streetid, sr.street_name,sr.zone,sr.ward" + + " ORDER BY sr.zone,sr.ward,sr.streetid"; + + return jdbcTemplate.queryForList(sql,zone,ward); + } + + + public List> getdetailreport(String startDate, String endDate) { + + + String sql = "SELECT " + + "sr.zone," + + "sr.ward," + + "sr.street_name," + + " COALESCE(COUNT(DISTINCT sr.scp_id), 0) AS Completed," + + " SUM(CASE WHEN sr.answer = 'Yes' THEN 1 ELSE 0 END) AS YesCount," + + " SUM(CASE WHEN sr.answer = 'No' THEN 1 ELSE 0 END) AS NoCount," + + " SUM(CASE WHEN sr.answer = 'Available' THEN 1 ELSE 0 END) AS AvailableCount," + + " SUM(CASE WHEN sr.answer = 'Not Available' THEN 1 ELSE 0 END) AS NotAvailableCount," + + " SUM(CASE WHEN sr.answer = 'Image Not Clear' THEN 1 ELSE 0 END) AS ImageNotClearCount," + + " SUM(CASE WHEN sr.answer = 'Yes,it is in good condition' THEN 1 ELSE 0 END) AS LidGoodYesCount," + + " SUM(CASE WHEN sr.answer = 'No,it is not in good condition' THEN 1 ELSE 0 END) AS LidGoodNoCount" + + " FROM scp_report sr" + + " WHERE sr.isactive = 1 AND sr.isdelete = 0 AND DATE(sr.created_date) BETWEEN ? AND ?" + + " GROUP BY sr.streetid, sr.street_name,sr.zone,sr.ward" + + " ORDER BY sr.zone,sr.ward,sr.streetid"; + + return jdbcTemplate.queryForList(sql,startDate,endDate); + + } + + + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java index 135039b..641e1a9 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/APIController.java @@ -1,5 +1,6 @@ package in.gov.chennaicorporation.gccoffice.com_petition.controller; +import java.util.Date; import java.util.List; import java.util.Map; @@ -8,6 +9,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -201,4 +203,17 @@ public class APIController { } return "success"; // Return success when completed } + + @GetMapping("/getReportList") + public List> getReportList( + @RequestParam(value = "fromDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date fromDate, + + @RequestParam(value = "toDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date toDate, + + @RequestParam(value = "petitionType", required = false) String petitionType) { + + return petition.getReportList(fromDate, toDate, petitionType); + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/MainController.java index 93da00d..48be276 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/controller/MainController.java @@ -127,4 +127,11 @@ public class MainController { model.addAttribute("LoginUserId",LoginUserId); return BasePath+"complaint_list"; } + + @GetMapping("/report/list") + public String reportList(Model model) { + String LoginUserId = LoginUserInfo.getLoginUserId(); + model.addAttribute("LoginUserId",LoginUserId); + return BasePath+"pending_list"; + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java index 7e2066d..8fb5a15 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/com_petition/service/Petition.java @@ -8,6 +8,9 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -744,4 +747,66 @@ public class Petition { return "success"; } + + //Report List + @Transactional(readOnly = true) + public List> getReportList(Date fromDate, Date toDate, String petitionType) { + try { + StringBuilder sql = new StringBuilder( + "SELECT p.petition_no, p.petitioner_name, pt.name AS petition_type, \r\n" + + "p.petitioner_mobile, p.complaint_nature, zh.off_nm AS officer_name, \r\n" + + "zh.off_id AS officer_id, pm.status \r\n" + + "FROM commissioner_petition.petition_mapping pm \r\n" + + "LEFT JOIN commissioner_petition.petition p \r\n" + + "ON p.petition_id = pm.petition_id \r\n" + + "LEFT JOIN petition_master.officer_master_zh zh \r\n" + + "ON zh.off_id = pm.off_id \r\n" + + "LEFT JOIN petition_master.petition_types pt \r\n" + + "ON pt.petition_type_id = p.petition_type \r\n" + ); + + List params = new ArrayList<>(); + List conditions = new ArrayList<>(); + + if (fromDate != null && toDate != null) { + // Ensure toDate includes full day + Calendar cal = Calendar.getInstance(); + cal.setTime(toDate); + cal.set(Calendar.HOUR_OF_DAY, 23); + cal.set(Calendar.MINUTE, 59); + cal.set(Calendar.SECOND, 59); + cal.set(Calendar.MILLISECOND, 999); + Date toDateEnd = cal.getTime(); + + conditions.add("date(pm.cdate) BETWEEN ? AND ?"); + params.add(fromDate); + params.add(toDateEnd); + } + + if (petitionType != null && !petitionType.trim().isEmpty()) { + conditions.add("pt.petition_type_id = ?"); + params.add(petitionType); + } + + if (!conditions.isEmpty()) { + sql.append("WHERE ").append(String.join(" AND ", conditions)); + } + + List> result = jdbcTemplate.queryForList( + sql.toString(), params.toArray() + ); + + for (Map map : result) { + String petitionNo = (String) map.get("petition_no"); + if (petitionNo != null) { + map.put("petitionNoEncode", Base64Util.encodeBase64(petitionNo)); + } + } + + return result; + } catch (DataAccessException e) { + e.printStackTrace(); + return Collections.emptyList(); + } + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java index 35813d0..feafa90 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/AppConfig.java @@ -17,12 +17,13 @@ public class AppConfig { public String mtm = "http://117.232.67.158:8060"; public String petRegistration = "http://117.232.67.158:8061"; public String garbageCollection = "http://117.232.67.158:8067"; //117.232.67.158 - public String cdwastecollectors = "http://117.232.67.158:8071"; + public String cdwastecollectors = "https://gccservices.in"; public String qaqcurl="https://erp.chennaicorporation.gov.in/pgr/newmobileservice?"; public String attendanceReport = "http://117.232.67.158:8076"; public String dumpregister = "https://gccservices.in"; public String mobileservice="https://gccservices.in"; public String gccappsMysqlPassword = ""; + public String domesticurl="https://gccservices.in/gccofficialapp/api/domesticwaste"; @Bean public RestTemplate restTemplate() { diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java index cf2c382..6052491 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/DataSourceConfig.java @@ -350,6 +350,29 @@ public class DataSourceConfig { dataSource.setPassword(dbpassword); return dataSource; } + + /////////////// Domestic Waste ///////////////////// + @Bean(name = "mysqlDomesticWasteDataSource") + public DataSource mysqlDomesticWasteDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://"+host+"/domestic_waste_management"); + dataSource.setUsername("root"); + dataSource.setPassword(dbpassword); + return dataSource; + } + + /////////////// SCP ///////////////////// + @Bean(name = "mysqlScpDataSource") + public DataSource mysqlScpDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://"+host+"/gcc_1913_siltcatchpit"); + dataSource.setUsername("root"); + dataSource.setPassword(dbpassword); + return dataSource; + } + ////////////////////////////// ORACLE //////////////////////// @Bean(name = "oracleDataSource") public DataSource oracleDataSource() { diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java index 58658e7..e5607f5 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/APIController.java @@ -1,8 +1,11 @@ package in.gov.chennaicorporation.gccoffice.m_petition.controller; +import java.util.Date; import java.util.List; +import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -158,6 +161,20 @@ public class APIController { return petition.saveComplanitStatus(createdBy, mapId, complaintStatus, complaintActionText, actionPage1, petitionId, petitionNo); } + + @GetMapping("/getReportList") + public List> getReportList( + @RequestParam(value = "fromDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date fromDate, + + @RequestParam(value = "toDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date toDate, + + @RequestParam(value = "petitionType", required = false) String petitionType) { + + return petition.getReportList(fromDate, toDate, petitionType); + } + /* // Import Old Data @PostMapping("/upload") diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java index 5030f46..4e92eab 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/controller/MainController.java @@ -127,4 +127,11 @@ public class MainController { model.addAttribute("LoginUserId",LoginUserId); return BasePath+"complaint_list"; } + + @GetMapping("/report/list") + public String reportList(Model model) { + String LoginUserId = LoginUserInfo.getLoginUserId(); + model.addAttribute("LoginUserId",LoginUserId); + return BasePath+"pending_list"; + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java index 1d5b2af..7b7481d 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/m_petition/service/Petition.java @@ -11,6 +11,10 @@ import java.sql.Statement; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.time.LocalTime; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -731,6 +735,69 @@ public class Petition { return "success"; } + + //Report List + @Transactional(readOnly = true) + public List> getReportList(Date fromDate, Date toDate, String petitionType) { + try { + StringBuilder sql = new StringBuilder( + "SELECT p.petition_no, p.petitioner_name, pt.name AS petition_type, \r\n" + + "p.petitioner_mobile, p.complaint_nature, zh.off_nm AS officer_name, \r\n" + + "zh.off_id AS officer_id, pm.status \r\n" + + "FROM mayor_petition.petition_mapping pm \r\n" + + "LEFT JOIN mayor_petition.petition p \r\n" + + "ON p.petition_id = pm.petition_id \r\n" + + "LEFT JOIN petition_master.officer_master_zh zh \r\n" + + "ON zh.off_id = pm.off_id \r\n" + + "LEFT JOIN petition_master.petition_types pt \r\n" + + "ON pt.petition_type_id = p.petition_type \r\n" + ); + + List params = new ArrayList<>(); + List conditions = new ArrayList<>(); + + if (fromDate != null && toDate != null) { + // Ensure toDate includes full day + Calendar cal = Calendar.getInstance(); + cal.setTime(toDate); + cal.set(Calendar.HOUR_OF_DAY, 23); + cal.set(Calendar.MINUTE, 59); + cal.set(Calendar.SECOND, 59); + cal.set(Calendar.MILLISECOND, 999); + Date toDateEnd = cal.getTime(); + + conditions.add("date(pm.cdate) BETWEEN ? AND ?"); + params.add(fromDate); + params.add(toDateEnd); + } + + if (petitionType != null && !petitionType.trim().isEmpty()) { + conditions.add("pt.petition_type_id = ?"); + params.add(petitionType); + } + + if (!conditions.isEmpty()) { + sql.append("WHERE ").append(String.join(" AND ", conditions)); + } + + List> result = jdbcTemplate.queryForList( + sql.toString(), params.toArray() + ); + + for (Map map : result) { + String petitionNo = (String) map.get("petition_no"); + if (petitionNo != null) { + map.put("petitionNoEncode", Base64Util.encodeBase64(petitionNo)); + } + } + + return result; + } catch (DataAccessException e) { + e.printStackTrace(); + return Collections.emptyList(); + } + } + // Import Old data /* public String HtmlDecoder(String tamilTxt) { diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/.DS_Store b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c569d7ef7b4436a25b2d5c259f90659caa1b7aae GIT binary patch literal 6148 zcmeHKJ8r`;3?&;6M!RIps4MgaLXe)I7YJf!Gh(2h-BZt%qxJDK#4rkUNEYMKpq@nY zNzfZiQ$%$C-M@-#MWlrr%8w08v-jo;d&-Cc;n?FtMj7y&G5enx_gOmdF7kED??1cY zG>(HM(5L_vpaN8Y3Q&Q&DUhYLeYx9?+=vQLfwd@L--iM>tcg>ge>yOD3jk~ocEj9z z31G1RuqIA{h`=Dr;FA=j#PjO%oW(g za%=Vf4gN>}KPPcT1*pKP6wv1Ie%RwmSz8yEvszo=N4Vu&;bxdS1%sDkpqFDTtQ_w= cDe{WV@xCTbflf!<=|KJrm@YIb@Mr~o0SBNJzW@LL literal 0 HcmV?d00001 diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java index e7b15b7..177ed42 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/ApiController.java @@ -219,6 +219,7 @@ public class ApiController { @PostMapping("/saveDetails") public ResponseEntity> saveVenderDetails( + @RequestParam (required = false)String latitude, @RequestParam (required = false)String longitude, @RequestParam (required = false)String zone, @@ -227,6 +228,7 @@ public class ApiController { @RequestParam (required = false)String vending_district, @RequestParam (required = false)Integer vending_pincode, @RequestParam Integer vending_category, + @RequestParam Integer tamilvending_category, @RequestParam (required = false)String vending_space, @RequestParam (required = false) Boolean pm_svanidhi_loan, @RequestParam (required = false) Boolean bank_acc_status, @@ -254,12 +256,19 @@ public class ApiController { @RequestParam (required = false)MultipartFile aadhar_front_photo, @RequestParam (required = false)MultipartFile aadhar_back_photo, @RequestParam (required = false)String aadharNo, + @RequestParam (required = false)String tamil_name, + @RequestParam (required = false)String tamil_f_h_name, + @RequestParam (required = false)String tamil_landmark, + @RequestParam (required = false)String tamil_gender, + @RequestParam (required = false)String tamil_present_district, @RequestParam String userId) { //String presentAddress = door_no + ", " + streetname + ", " + areaname; - + String data=tamil_name +"=="+tamil_f_h_name+"=="+tamil_landmark+"=="+tamil_gender+"=="+tamil_present_district; + System.out.println("data="+data); + String doorNoVal = (door_no != null && !door_no.trim().isEmpty()) ? door_no : ""; String streetNameVal = (streetname != null && !streetname.trim().isEmpty()) ? streetname : ""; String areaNameVal = (areaname != null && !areaname.trim().isEmpty()) ? areaname : ""; @@ -314,7 +323,7 @@ public class ApiController { streetVendorPhotoPath, name, f_h_name, mobile_number,dob, gender, social_category, diff_abled, education_status, marital_status, no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode, - rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,userId); + rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,userId,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamilvending_category); if (saveStatus == null || saveStatus.equals("error")) { return ResponseEntity.ok(Map.of( @@ -355,6 +364,7 @@ public class ApiController { @RequestParam (required = false)String vending_district, @RequestParam (required = false)Integer vending_pincode, @RequestParam Integer vending_category, + @RequestParam Integer tamilvending_category, @RequestParam (required = false)String vending_space, @RequestParam (required = false) Boolean pm_svanidhi_loan, @RequestParam (required = false) Boolean bank_acc_status, @@ -387,6 +397,11 @@ public class ApiController { @RequestParam (required = false)String raw_aadhar_front_photo, @RequestParam (required = false)String raw_aadhar_back_photo, @RequestParam (required = false)String raw_ration_card_photo, + @RequestParam (required = false)String tamil_name, + @RequestParam (required = false)String tamil_f_h_name, + @RequestParam (required = false)String tamil_landmark, + @RequestParam (required = false)String tamil_gender, + @RequestParam (required = false)String tamil_present_district, @RequestParam String userId, @RequestParam String vendor_req_id){ @@ -446,7 +461,7 @@ public class ApiController { streetVendorPhotoPath, name, f_h_name, mobile_number,dob, gender, social_category, diff_abled, education_status, marital_status, no_of_fam_mem, are_any_fam_mem_invol_str,presentAddress, present_district, present_pincode, - rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,userId,vendor_req_id); + rationCardPath,aadharFrontPhotoPath, aadharBackPhotoPath,aadharNo,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamilvending_category,userId,vendor_req_id); if(sts.equals("Error")) { return ResponseEntity.ok(Map.of( @@ -474,7 +489,15 @@ public class ApiController { } } - } + + @GetMapping("/vendingDetailsbyZoneWeb") + public List> vendingDetailsbyZoneWeb(@RequestParam String zone) { + + return streetVendorService.vendingDetailsbyZoneWeb(zone); + } + + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java index 228e70a..7b4a80b 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/controller/MainController.java @@ -103,14 +103,15 @@ public class MainController { //System.out.println("vendingCategory===="+vendingCategories); model.addAttribute("vendingCategories", vendingCategories); + List>tamilvendingCategories=streetVendorService.fetchtamilvendingCategory(); + //System.out.println("tamilvendingCategories===="+tamilvendingCategories); + model.addAttribute("tamilvendingCategories", tamilvendingCategories); + //List>zones=streetVendorService.fetchZones(); //System.out.println("zones===="+zones); //model.addAttribute("zones", zones); - - - - + return "modules/vendors/streetVendorRequestForm"; } @@ -139,9 +140,48 @@ public class MainController { List>vendingCategories=streetVendorService.fetchvendingCategory(); model.addAttribute("vendingCategories", vendingCategories); + + List>tamilvendingCategories=streetVendorService.fetchtamilvendingCategory(); + model.addAttribute("tamilvendingCategories", tamilvendingCategories); return "modules/vendors/streetVendorRequestList"; } + @GetMapping("/zonerequests") + public String viewZoneBasedDetails(Model model) + { + String LoginUserId = LoginUserInfo.getLoginUserId(); + int userId = Integer.parseInt(LoginUserId); + model.addAttribute("LoginUserId",LoginUserId); + + String UserRole = LoginUserInfo.getUserRole(); + model.addAttribute("UserRole", UserRole); + + String zone=streetVendorService.getloginUserZone(userId); + model.addAttribute("zone",zone); + //System.out.println("zone="+zone); + + List>communities=streetVendorService.fetchCommunities(); + model.addAttribute("communities", communities); + + + List>maritalStatuses=streetVendorService.fetchMaritalStatus(); + model.addAttribute("maritalStatuses", maritalStatuses); + + + List>educationList=streetVendorService.fetchEducationStatus(); + model.addAttribute("educationList", educationList); + + + List>vendingCategories=streetVendorService.fetchvendingCategory(); + model.addAttribute("vendingCategories", vendingCategories); + + List>tamilvendingCategories=streetVendorService.fetchtamilvendingCategory(); + model.addAttribute("tamilvendingCategories", tamilvendingCategories); + + return "modules/vendors/zonerequests"; + + } + } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java index d38e4bb..5d997e1 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/StreetVendorService.java @@ -25,11 +25,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.env.Environment; import org.springframework.dao.DataAccessException; +import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.http.ResponseEntity; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; @@ -106,6 +108,15 @@ public class StreetVendorService { return jdbcTemplate.queryForList(query); } + public List> fetchtamilvendingCategory() { + String query = "SELECT id,tamil_vending_category_name " + + "FROM tamil_vending_category_master " + + "WHERE is_active=1 AND is_delete=0 "; + + + return jdbcTemplate.queryForList(query); + } + // public List> fetchZones() { // String query = "SELECT id,zone_name " + @@ -202,7 +213,8 @@ public class StreetVendorService { String f_h_name, String mobile_number, String dob, String gender, Integer social_category, Boolean diff_abled, Integer education_status, Integer marital_status, Integer no_of_fam_mem, Boolean are_any_fam_mem_invol_str, String presentAddress, String present_district, Integer present_pincode, String rationCardPath, - String aadharFrontPhotoPath, String aadharBackPhotoPath,String aadharNo,String userId) { + String aadharFrontPhotoPath, String aadharBackPhotoPath,String aadharNo,String userId,String tamil_name,String tamil_f_h_name,String tamil_landmark, + String tamil_gender,String tamil_present_district,@RequestParam Integer tamilvending_category) { int isWeb=1; String latitudeVal = (latitude != null && !latitude.trim().isEmpty()) ? latitude : null; @@ -219,8 +231,8 @@ public class StreetVendorService { + "bank_acc_status, bank_passbook, street_vendor_photo, name, f_h_name, mob_no, " + "dob,gender,social_category, diff_abled, education_status, marital_status,no_of_fam_mem, " + "are_any_fam_mem_invol_str_ven,present_address, present_district, present_pincode, ration_card_photo, aadhar_front_photo, " - + "aadhar_back_photo,aadhar_no,is_web,cby" - + ") VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?)"; + + "aadhar_back_photo,aadhar_no,is_web,cby,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamil_vending_category " + + ") VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?)"; KeyHolder keyHolder = new GeneratedKeyHolder(); @@ -275,6 +287,13 @@ public class StreetVendorService { ps.setString(31, aadharNo); ps.setInt(32, isWeb); ps.setString(33, userId); + ps.setString(34, tamil_name); + ps.setString(35, tamil_f_h_name); + ps.setString(36, tamil_landmark); + ps.setString(37, tamil_gender); + ps.setString(38, tamil_present_district); + if (tamilvending_category != null) ps.setInt(39, tamilvending_category); + else ps.setNull(39, java.sql.Types.INTEGER); return ps; }, keyHolder); //return keyHolder.getKey().intValue(); @@ -408,8 +427,8 @@ public class StreetVendorService { "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.ration_card_photo) AS view_ration_card_photo, " + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.street_vendor_photo) AS view_street_vendor_photo, " + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.aadhar_front_photo) AS view_aadhar_front_photo, " + - "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.aadhar_back_photo) AS view_aadhar_back_photo " + - "FROM vendor_details vd " + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', vd.aadhar_back_photo) AS view_aadhar_back_photo " + + "FROM vendor_details vd " + "LEFT JOIN social_category_master scm on vd.social_category = scm.id " + "LEFT JOIN vending_category_master vcm ON vd.vending_category=vcm.id " + "LEFT JOIN education_master em on vd.education_status = em.id " @@ -427,7 +446,7 @@ public class StreetVendorService { Integer social_category, Boolean diff_abled, Integer education_status, Integer marital_status, Integer no_of_fam_mem, Boolean are_any_fam_mem_invol_str, String presentAddress, String present_district, Integer present_pincode, String rationCardPath, String aadharFrontPhotoPath, String aadharBackPhotoPath, - String aadharNo, String userId, String vendor_req_id) { + String aadharNo,String tamil_name,String tamil_f_h_name, String tamil_landmark,String tamil_gender,String tamil_present_district,Integer tamilvending_category, String userId, String vendor_req_id) { String latitudeVal = (latitude != null && !latitude.trim().isEmpty()) ? latitude : null; @@ -442,7 +461,7 @@ public class StreetVendorService { + "bank_acc_status=?, bank_passbook=?, street_vendor_photo=?, name=?, f_h_name=?, mob_no=?, " + "dob=?,gender=?,social_category=?, diff_abled=?, education_status=?, marital_status=?,no_of_fam_mem=?, " + "are_any_fam_mem_invol_str_ven=?,present_address=?, present_district=?, present_pincode=?, ration_card_photo=?, aadhar_front_photo=?, " - + "aadhar_back_photo=?,aadhar_no=?,updated_date=NOW() " + + "aadhar_back_photo=?,aadhar_no=?,updated_date=NOW(),tamil_name=?,tamil_f_h_name=?,tamil_landmark=?,tamil_gender=?,tamil_present_district=?,tamil_vending_category=?,edit_by=? " + " WHERE vendor_req_id = ? AND is_web=1 AND editable=1"; try { int rows=jdbcTemplate.update(sql, latitudeVal, longitudeVal, zoneVal, wardVal, vendingAddressVal, vending_district, @@ -450,6 +469,7 @@ public class StreetVendorService { streetVendorPhotoPath, name, f_h_name, mobile_number, dobVal, gender, social_category, diff_abled, education_status, marital_status, no_of_fam_mem, are_any_fam_mem_invol_str, presentAddress, present_district, present_pincode, rationCardPath, aadharFrontPhotoPath, aadharBackPhotoPath, aadharNo, + tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamilvending_category,userId, vendor_req_id); if (rows==1) { @@ -462,13 +482,13 @@ public class StreetVendorService { catch (Exception e) { e.printStackTrace(); } - return "error"; + return "Error"; } public String logEntry(String userId, String vendor_req_id) { - String sql="INSERT INTO vendor_details_web_log (name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,cby) " - + " SELECT name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,? FROM vendor_details WHERE vendor_req_id=?"; + String sql="INSERT INTO vendor_details_web_log (name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamil_vending_category,cby) " + + " SELECT name,f_h_name,gender,dob,social_category,diff_abled,mob_no,aadhar_no,present_address,present_district,present_pincode,vending_address,vending_district,vending_pincode,vending_category,vending_space,bank_acc_status,bank_passbook,ration_card_photo,street_vendor_photo,aadhar_front_photo,aadhar_back_photo,zone,ward,pm_svanidhi_loan,vendor_req_id,education_status,marital_status,no_of_fam_mem,are_any_fam_mem_invol_str_ven,latitude,longitude,tamil_name,tamil_f_h_name,tamil_landmark,tamil_gender,tamil_present_district,tamil_vending_category,? FROM vendor_details WHERE vendor_req_id=?"; try { jdbcTemplate.update(sql, userId,vendor_req_id); @@ -480,5 +500,25 @@ public class StreetVendorService { } } + + public String getloginUserZone(int userId) { + String query = "select zone from web_login where gcc_user_id = ?"; + try { + // Use queryForObject to return a single value + return jdbcTemplate.queryForObject(query, String.class, userId); + } catch (EmptyResultDataAccessException e) { + // Log the issue and handle the case when no result is found + System.out.println("No zone found for user ID: " + userId); + return null; // Or return a default value if required + } + } + + + public List> vendingDetailsbyZoneWeb(String zone) { + String sql = "SELECT * " + + "FROM vendor_details " + + "WHERE zone=?"; + return jdbcTemplate.queryForList(sql, zone); + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java index b2bf294..5f463c6 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/vendor/service/createventService.java @@ -16,6 +16,8 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.GeneratedKeyHolder; +import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Service; @Service @@ -29,7 +31,7 @@ private JdbcTemplate jdbcTemplate; } public boolean isFileExists(String originalFilename) { - String sql = "SELECT COUNT(*) FROM vendingcommitte.create_event " + + String sql = "SELECT COUNT(*) FROM create_event " + "WHERE file_url LIKE ?"; String filenamePattern = "%" + originalFilename; // Match filename at the end of the path Integer count = jdbcTemplate.queryForObject(sql, Integer.class, filenamePattern); @@ -37,13 +39,13 @@ private JdbcTemplate jdbcTemplate; } public void insertEvent(String eventName, LocalDate eventDate, String fileUrl) { - String sql = "INSERT INTO vendingcommitte.create_event (event_name, event_date, file_url) VALUES (?, ?, ?)"; + String sql = "INSERT INTO create_event (event_name, event_date, file_url) VALUES (?, ?, ?)"; jdbcTemplate.update(sql, eventName, eventDate, fileUrl); } //SELECT * FROM vendingcommitte.create_event public List> ViewDropdownEvent() { - String sql = "SELECT * FROM create_event"; + String sql = "SELECT * FROM create_event WHERE isactive=1 AND isdelete=0"; return jdbcTemplate.queryForList(sql); } @@ -69,14 +71,18 @@ private JdbcTemplate jdbcTemplate; : (String) payload.get("remarks"); int event_req_id = Integer.parseInt((String) payload.get("event_req_id")); - //System.out.println("values="+vendor_req_id+name+mob_no+business_address+vending_pincode+status+remarks+event_req_id); + String zone = (String) payload.get("zone"); + String ward = (String) payload.get("ward"); + String sql = "INSERT INTO vendor_request_list (request_no,person_name, mobile_no, address, status, remarks, pincode,event_req_id) " + "VALUES (?, ?, ?, ?, ?, ?,?,?)"; try { + KeyHolder keyHolder = new GeneratedKeyHolder(); + int rows = jdbcTemplate.update(connection -> { - PreparedStatement ps = connection.prepareStatement(sql); + PreparedStatement ps = connection.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS); ps.setString(1, vendor_req_id); ps.setString(2, name); ps.setString(3, mob_no); @@ -86,22 +92,52 @@ private JdbcTemplate jdbcTemplate; ps.setString(7, vending_pincode); ps.setInt(8, event_req_id); return ps; - }); - + },keyHolder); if(rows > 0) { - String result=sendWhatsappMsg(mob_no,status,vendor_req_id); - if("200".equalsIgnoreCase(result)) { - response.put("status", "success"); - response.put("message", "Data submitted successfully!"); - + if("Approved".equalsIgnoreCase(status)) { + int generatedDataId = keyHolder.getKey().intValue(); + + String currentYear = String.valueOf(java.time.Year.now().getValue()); + + String uid_no = zone + "_" + ward + "_" + currentYear + "_" + generatedDataId; + + String sqlquery="UPDATE vendor_request_list SET uid_no=? WHERE id=?"; + + int rowupdated = jdbcTemplate.update(sqlquery,uid_no,generatedDataId); + + if(rowupdated > 0) { + + String result=sendWhatsappMsg(mob_no,status,vendor_req_id); + + if("200".equalsIgnoreCase(result)) { + response.put("status", "success"); + response.put("message", "Data submitted successfully!"); + + } + else { + response.put("status", "success"); + response.put("message", "Data Submitted But Whatsapp Message not Sent"); + } + + } } else { - response.put("status", "success"); - response.put("message", "Data Submitted But Whatsapp Message not Sent"); - + String result=sendWhatsappMsg(mob_no,status,vendor_req_id); + + if("200".equalsIgnoreCase(result)) { + response.put("status", "success"); + response.put("message", "Data submitted successfully!"); + + } + else { + response.put("status", "success"); + response.put("message", "Data Submitted But Whatsapp Message not Sent"); + } } + + } else { response.put("status", "Error"); diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java index 691d900..5befa18 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/vtrack/service/VehicleService.java @@ -412,6 +412,55 @@ public class VehicleService { break; + case "14": + System.out.println("TempID is 14 (1943196 - pet_wp_report - IMAGE - STATIC)"); + urlString="https://media.smsgupshup.com/GatewayAPI/rest?" + + "userid="+username + + "&password="+password + + "&send_to="+sendTo + + "&v=1.1&format=json" + + "&msg_type=IMAGE" + + "&method=SENDMEDIAMESSAGE" + //+ "&caption=%2AGCC+The+Chennai+School%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+Students+Aadhar+linked+details+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below." + + "&caption=%2AGCC+PET+LICENSE+%26+VACCINATION%2A%0A%0AToday%27s+%28"+msgDate+"%29+Zone+wise+Pet+license+%26+Vaccination+details+shared+above+for+your+kind+reference." + + "&media_url="+fileURL + + "&isTemplate=true&footer=GCC+-+IT+Cell"; + + + break; + + case "15": + System.out.println("TempID is 15 (1590940 - GCC POS Penalty Monitoring Zone (userd of Com Temp ) - IMAGE - STATIC)"); + urlString="https://media.smsgupshup.com/GatewayAPI/rest?" + + "userid="+username + + "&password="+password + + "&send_to="+sendTo + + "&v=1.1&format=json" + + "&msg_type=IMAGE" + + "&method=SENDMEDIAMESSAGE" + + "&caption=%2AGCC+POS+Penalty+Monitoring%2A%0A%0AToday%27s+%28"+msgDate+"%29++POS+Penalty+Zone+wise+details+%29+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below." + + "&media_url="+fileURL + + "&isTemplate=true&footer=GCC+-+IT+Cell"; + + + break; + + case "16": + System.out.println("TempID is 16 (1590940 - GCC POS Penalty Monitoring Type (userd of Com Temp ) - IMAGE - STATIC)"); + urlString="https://media.smsgupshup.com/GatewayAPI/rest?" + + "userid="+username + + "&password="+password + + "&send_to="+sendTo + + "&v=1.1&format=json" + + "&msg_type=IMAGE" + + "&method=SENDMEDIAMESSAGE" + + "&caption=%2AGCC+POS+Penalty+Monitoring%2A%0A%0AToday%27s+%28"+msgDate+"%29++POS+Penalty+Type+wise+details+%29+shared+above+for+your+reference.%0A%0AFor+more+details%2C+please+click+the+link+below." + + "&media_url="+fileURL + + "&isTemplate=true&footer=GCC+-+IT+Cell"; + + + break; + default: System.out.println("TempID ("+tempid+") is unknown"); } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/APIController.java index c062941..ec0afae 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/APIController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/APIController.java @@ -1,11 +1,15 @@ package in.gov.chennaicorporation.gccoffice.zerohours_petition.controller; +import java.util.Date; import java.util.List; +import java.util.Map; + import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -215,4 +219,15 @@ public class APIController { return petition.saveComplanitStatus(createdBy, mapId, complaintStatus, complaintActionText, actionPage1, petitionId, petitionNo); } + + @GetMapping("/getReportList") + public List> getReportList( + @RequestParam(value = "fromDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date fromDate, + + @RequestParam(value = "toDate", required = false) + @DateTimeFormat(pattern = "yyyy-MM-dd") Date toDate) { + + return petition.getReportList(fromDate, toDate); + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/MainController.java index 7597a7f..7dceaeb 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/controller/MainController.java @@ -128,4 +128,12 @@ public class MainController { model.addAttribute("LoginUserId",LoginUserId); return BasePath+"complaint_list"; } + + //report list + @GetMapping("/report/list") + public String pendingList(Model model) { + String LoginUserId = LoginUserInfo.getLoginUserId(); + model.addAttribute("LoginUserId",LoginUserId); + return BasePath+"pending_list"; + } } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/service/Petition.java b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/service/Petition.java index 7d49cdc..1fa269a 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/service/Petition.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/zerohours_petition/service/Petition.java @@ -6,6 +6,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.sql.PreparedStatement; import java.sql.Statement; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -779,4 +783,54 @@ public class Petition { } return "success"; } + + //Report List + @Transactional(readOnly = true) + public List> getReportList(Date fromDate, Date toDate) { + try { + StringBuilder sql = new StringBuilder( + "SELECT p.petition_no, p.zone, p.ward, p.petitioner_name, " + + "p.petitioner_mobile, p.complaint_nature, zh.off_nm AS officer_name, " + + "zh.off_id AS officer_id, pm.status " + + "FROM zerohours_petition.petition_mapping pm " + + "LEFT JOIN zerohours_petition.petition p " + + "ON p.petition_id = pm.petition_id " + + "LEFT JOIN petition_master.officer_master_zh zh " + + "ON zh.off_id = pm.off_id " + ); + + List params = new ArrayList<>(); + + if (fromDate != null && toDate != null) { + // Ensure toDate includes full day + Calendar cal = Calendar.getInstance(); + cal.setTime(toDate); + cal.set(Calendar.HOUR_OF_DAY, 23); + cal.set(Calendar.MINUTE, 59); + cal.set(Calendar.SECOND, 59); + cal.set(Calendar.MILLISECOND, 999); + Date toDateEnd = cal.getTime(); + + sql.append("WHERE date(pm.cdate) BETWEEN ? AND ? "); + params.add(fromDate); + params.add(toDateEnd); + } + + List> result = jdbcTemplate.queryForList( + sql.toString(), params.toArray() + ); + + for (Map map : result) { + String petitionNo = (String) map.get("petition_no"); + if (petitionNo != null) { + map.put("petitionNoEncode", Base64Util.encodeBase64(petitionNo)); + } + } + + return result; + } catch (DataAccessException e) { + e.printStackTrace(); + return Collections.emptyList(); + } + } } diff --git a/src/main/resources/templates/modules/.DS_Store b/src/main/resources/templates/modules/.DS_Store index 589bb38de988b29b0a2e61e34b14e5d19083c84f..fef2847f7ea554a7d3a19ce5c1dce5fb3ecfb67e 100644 GIT binary patch delta 228 zcmZo^U~Fk%oZ!#9f`Ng7g@HkUfgv|1ePWE=`M?js8kzuom*eiC{A* r7${BNq;EfQveagNgQ@IX@(iR`@+=^CLR-*yueI?r!2TAFDE}Q9q0na$$}apn^`PA RvP?c`EWSC(bOsYXl>o&DI0XOz diff --git a/src/main/resources/templates/modules/callcenterqaqc/domesticwastecancel.html b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecancel.html new file mode 100644 index 0000000..64d4d4d --- /dev/null +++ b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecancel.html @@ -0,0 +1,783 @@ + + + + + + + +
+ + +
+ +
+ +
+ + + +
+
+ + + +
+
+
+
+ Details Filters + +
+
+
+
+ + +
+
+ + +
+
+ + +
+ + + +
+ +
+
+ + + +
+
+
+
+
+
+ + +
+
+
+
+ Complaints Open And Pending List +
+
+
+ + + + + + + + + + + + + + + + + + + +
S.NoDateRequest NumberPublic NamePublic Mobile noAddressStreet NameCurrent StatusAction
+
+
+
+
+
+ +
+ +
+ + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/callcenterqaqc/domesticwastecheckstatus.html b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecheckstatus.html new file mode 100644 index 0000000..fbdc110 --- /dev/null +++ b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecheckstatus.html @@ -0,0 +1,459 @@ + + + + + + + +
+ + +
+ +
+ +
+ + + +
+
+ + + +
+
+
+
+ Enter Registered Mobile Number +
+
+
+ +
+ + +
+ + + +
+ +
+
+ + + +
+
+
+
+
+
+ + +
+
+
+
+ Reports List +
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
S.NoDateRequest NumberPublic NamePublic Mobile noZoneWardItem TypeAddressStreet NameRemarksCurrent Status
+
+
+
+
+
+ +
+ +
+ + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html new file mode 100644 index 0000000..7188463 --- /dev/null +++ b/src/main/resources/templates/modules/callcenterqaqc/domesticwastecomplaints.html @@ -0,0 +1,1579 @@ + + + + + + + + + + + + + +
+ + + +
+ +
+ + +
+ +
+ +
+
+ + + +
+ +
+
+
+

's Sofa Bed Collection Registration

+
+ +
+ + + + +
+ +
1. Personal Details:
+
+
+ + +
+
+
+
+ + +
+ +
+ + +
+ + + +
+ + +
+ +
+ +
2. Complaint Location Details:
+
+ + + + + + +
+ +
+ +
+
+
+ +
+
+
+
+ + + + +
+ +
+ + + +
+
+ + + +
+
+ + + +
+ +
+ + +
+
+ + +
+
+ + + +
+
+
+
+ + + +
+ +
+
+
3. Item Details:
+ + + +
+
+
+ + + +
+
+
+
+
+
+
+ +
+
+ + +
+
+ + +
+ + + + + + + +
+
+ + +
+
+
4. Complaint Details:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name: Mobile Number:
Complaint Location: Street Id:
Zone: Ward:
Latitude: Longitude:
Item Type: Description:
Address:
+ + + + + + + + +
+
+ + +
+
+
+ + + + + + +
+
+ + +
+ + + + + +
+
+
+ + + + +
+ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/callcenterqaqc/overallreport.html b/src/main/resources/templates/modules/callcenterqaqc/overallreport.html index 4eeadf6..0d1fa30 100644 --- a/src/main/resources/templates/modules/callcenterqaqc/overallreport.html +++ b/src/main/resources/templates/modules/callcenterqaqc/overallreport.html @@ -169,12 +169,14 @@ Complaint Type Complaint Group Mode + Department Zone Ward Public Name Address - Public Mobile no + Public Mobile no + Media Link Assign To Official Contact Number Current Status @@ -478,12 +480,25 @@ { data: 'Complaint Type', defaultContent: '-', className: 'text-center' }, { data: 'Complaint Group', defaultContent: '-', className: 'text-center' }, { data: 'Complaint Mode', defaultContent: '-', className: 'text-center' }, + { data: 'Department', defaultContent: '-', className: 'text-center' }, { data: 'Zone', defaultContent: '-', className: 'text-center' }, { data: 'Ward', defaultContent: '-', className: 'text-center' }, { data: 'Complaint Person Name', defaultContent: '-', className: 'text-center' }, { data: 'Address', defaultContent: '-', className: 'text-center' }, { data: 'Complaint Person Number', defaultContent: '-', className: 'text-center' }, + { + data: 'Media Link', + defaultContent: '-', + className: 'text-center', + render: function (data, type, row) { + if (!data || data === "null" || data.trim() === "") { + return '-'; + } + // ✅ Make it a clickable hyperlink opening in a new tab + return `${data}`; + } + }, { data: 'Assign To', defaultContent: '-', className: 'text-center' }, { data: 'Official Contact Number', defaultContent: '-', className: 'text-center',render: function (data, type, row) { return (data === null || data === "null") ? '-' : data; diff --git a/src/main/resources/templates/modules/callcenterqaqc/scpreport.html b/src/main/resources/templates/modules/callcenterqaqc/scpreport.html new file mode 100644 index 0000000..aca82a7 --- /dev/null +++ b/src/main/resources/templates/modules/callcenterqaqc/scpreport.html @@ -0,0 +1,1040 @@ + + + + + + + +
+ + +
+ +
+ +
+ + + +
+
+ + + +
+
+
+
+ Report Filters + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + + +
+ +
+
+ + + +
+
+
+
+
+
+ + +
+
+
+
+ Reports List +
+
+ + + + + + + + + + + +
+
+
+ + + + +
+ + + + +
+ +
+ + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/callcenterqaqc/scpverification.html b/src/main/resources/templates/modules/callcenterqaqc/scpverification.html new file mode 100644 index 0000000..92ece21 --- /dev/null +++ b/src/main/resources/templates/modules/callcenterqaqc/scpverification.html @@ -0,0 +1,1149 @@ + + + + + + + +
+ + +
+ +
+ +
+ + + +
+
+ + + +
+
+
+
+ Report Filters + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+
+ + + +
+
+
+ + +
+ + +
+
+
+
+ + +
+
+
+
+ Reports List +
+
+ + + + + + + +
+
+
+ + + + +
+ + + + +
+ +
+ + + + + + + + + + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/com_petition/pending_list.html b/src/main/resources/templates/modules/com_petition/pending_list.html new file mode 100644 index 0000000..0caec1d --- /dev/null +++ b/src/main/resources/templates/modules/com_petition/pending_list.html @@ -0,0 +1,351 @@ + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+ +
+ + + + + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoPetition No.Counsilor NamePetition Type ContentDepartment OfficerStatus
+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+ + + + + + diff --git a/src/main/resources/templates/modules/m_petition/pending_list.html b/src/main/resources/templates/modules/m_petition/pending_list.html new file mode 100644 index 0000000..20aa39a --- /dev/null +++ b/src/main/resources/templates/modules/m_petition/pending_list.html @@ -0,0 +1,351 @@ + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+ +
+ + + + + + +
+
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoPetition No.Counsilor NamePetition Type ContentDepartment OfficerStatus
+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+ + + + + + diff --git a/src/main/resources/templates/modules/vendors/RequestList.html b/src/main/resources/templates/modules/vendors/RequestList.html index c8e1abe..2e7fb25 100644 --- a/src/main/resources/templates/modules/vendors/RequestList.html +++ b/src/main/resources/templates/modules/vendors/RequestList.html @@ -684,14 +684,16 @@ padding-bottom: 10px; vending_pincode: rowData.vending_pincode, status: status, remarks: remarks, - event_req_id: eventReqId + event_req_id: eventReqId, + zone: rowData.zone, // ✅ added + ward: rowData.ward }; console.log("payload = " + JSON.stringify(payload, null, 2)); $('#pageLoader').show(); // 📨 AJAX call - $.ajax({ + $.ajax({ url: '/gcc/api/streetvendor/savedetailsforvendor', // change this to your actual API endpoint method: 'POST', contentType: 'application/json', diff --git a/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html b/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html index 6afe82d..b0b85d3 100644 --- a/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html +++ b/src/main/resources/templates/modules/vendors/streetVendorRequestForm.html @@ -100,9 +100,9 @@ margin-bottom: 0.5rem; } -input.form-control { +/* input.form-control { padding: 10px; -} +} */ .form-select { padding: 10px; height: 40px; @@ -316,17 +316,31 @@ padding-top: 2%; -
- - +
+
+ + +
+
+ + +
- +
- + + +
+ +
+ +
+
+
@@ -335,7 +349,7 @@ padding-top: 2%;
-
+
+ +
+
@@ -388,27 +415,48 @@ padding-top: 2%;
- +
- + + +
+
+
+
+
+
+ + +
-
- - -
+

Male Female Transgender
+ +
+
+ ஆண் + பெண் + பிற்பாலினர் +
+ +
+
+ + +
+
@@ -576,6 +624,29 @@ padding-top: 2%; src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCi7N6uW5MZaSkd50Kzw7ax2GkMN1vjE-E&callback=myMap&libraries=places"> + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/vendors/streetVendorRequestList.html b/src/main/resources/templates/modules/vendors/streetVendorRequestList.html index 175472e..8362619 100644 --- a/src/main/resources/templates/modules/vendors/streetVendorRequestList.html +++ b/src/main/resources/templates/modules/vendors/streetVendorRequestList.html @@ -357,16 +357,29 @@ input.form-control {
-
- - -
+
+
+ + +
+
+ + +
+
-
+
+ + +
+
+ +
+
@@ -376,7 +389,7 @@ input.form-control {
-
+
+ +
+
-
+
@@ -431,27 +457,48 @@ input.form-control {
- +
- + + +
+
+
+
+
+
+ + +
-
- - -
+

Male Female Transgender
+
+
+ ஆண் + பெண் + பிற்பாலினர் +
+ +
+
+ + +
+
+
@@ -1120,9 +1167,12 @@ input.form-control { $("#zone").val(data.zone); $("#ward").val(data.ward); $("#landmark").val(data.vending_address); + $("#landmark_tamil").val(data.tamil_landmark); $("#vendor_district").val(data.vending_district); + $("#vendor_district_tamil").val(data.tamil_present_district) $("#vendor_pincode").val(data.vending_pincode); $("#businesstype").val(data.vending_category); + $("#tamilbusinesstype").val(data.tamil_vending_category); $("#business_space").val(data.vending_space); if (data.pm_svanidhi_loan == null) { $("input[name='svanidhi']").prop("checked", false); // clear both @@ -1151,7 +1201,9 @@ input.form-control { } $("#name").val(data.name); + $("#name_tamil").val(data.tamil_name); $("#father_name").val(data.f_h_name); + $("#father_name_tamil").val(data.tamil_f_h_name); $("#mobile_no").val(data.mob_no); if (data.gender == null) { $("input[name='gender']").prop("checked", false); // clear all @@ -1159,6 +1211,12 @@ input.form-control { $("input[name='gender'][value='" + data.gender + "']").prop("checked", true); } + if (data.tamil_gender == null) { + $("input[name='gender_tamil']").prop("checked", false); // clear all + } else { + $("input[name='gender_tamil'][value='" + data.tamil_gender + "']").prop("checked", true); + } + $("#dob").val(data.dob); $("#community").val(data.social_category); if (data.diff_abled == null) { @@ -1299,11 +1357,11 @@ input.form-control { let raw_aadhar_back_photo = $('#raw_aadhar_back_photo').text(); let raw_ration_card_photo = $('#raw_ration_card_photo').text(); - console.log("==========raw_bank_passbook========"+raw_bank_passbook); + /* console.log("==========raw_bank_passbook========"+raw_bank_passbook); console.log("==========raw_street_vendor_photo========"+raw_street_vendor_photo); console.log("==========raw_aadhar_front_photo========"+raw_aadhar_front_photo); console.log("==========raw_aadhar_back_photo========"+raw_aadhar_back_photo); - console.log("==========raw_ration_card_photo========"+raw_ration_card_photo); + console.log("==========raw_ration_card_photo========"+raw_ration_card_photo); */ function setIfPresent(formData, key, value) { if (value !== undefined && value !== null && value !== "") { @@ -1418,6 +1476,7 @@ input.form-control { // Set other fields setIfPresent(formData, "vending_district", $('#vendor_district').val()); setIfPresent(formData, "vending_category", $('#businesstype').val()); + setIfPresent(formData, "tamilvending_category", $('#tamilbusinesstype').val()); setIfPresent(formData, "vending_space", $('#business_space').val()); @@ -1464,6 +1523,15 @@ input.form-control { setIfPresent(formData, "raw_ration_card_photo", raw_ration_card_photo); } + + setIfPresent(formData, "tamil_name", $('#name_tamil').val()); + setIfPresent(formData, "tamil_f_h_name", $('#father_name_tamil').val()); + let landmarkvaltamil = $('#landmark_tamil').val().trim(); + setIfPresent(formData, "tamil_landmark", landmarkvaltamil); + setIfPresent(formData, "tamil_present_district", $('#vendor_district_tamil').val()); + let genderValtamil = $("input[name='gender_tamil']:checked").val(); + setIfPresent(formData, "tamil_gender", genderValtamil); + for (let pair of formData.entries()) { console.log(pair[0] + ':', pair[1]); } diff --git a/src/main/resources/templates/modules/vendors/zonerequests.html b/src/main/resources/templates/modules/vendors/zonerequests.html new file mode 100644 index 0000000..d81c096 --- /dev/null +++ b/src/main/resources/templates/modules/vendors/zonerequests.html @@ -0,0 +1,1574 @@ + + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + +
+ + +
+
+
+ +
+
 - Zone Request List

+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoRequest NoNameMobileAddressPostal CodeAction
S.NoRequest NoNameMobileAddressPostal CodeAction
+
+
+
+
+ + + + + + +
+ + +
+
+ + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/zerohours_petition/pending_list.html b/src/main/resources/templates/modules/zerohours_petition/pending_list.html new file mode 100644 index 0000000..837c995 --- /dev/null +++ b/src/main/resources/templates/modules/zerohours_petition/pending_list.html @@ -0,0 +1,290 @@ + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+ +
+ + + + +
+
+ + +
+
+ + +
+
+ + +
+ + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoPetition No.Counsilor WardCounsilor ZoneCounsilor NameContentDepartment OfficerStatus
+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+ + + + + +