diff --git a/src/main/.DS_Store b/src/main/.DS_Store index bb81540..b615922 100644 Binary files a/src/main/.DS_Store and b/src/main/.DS_Store differ diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java new file mode 100644 index 0000000..030571a --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java @@ -0,0 +1,107 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; + +@RequestMapping("/api/petregistration") +@RestController("petRegistrationRest") +public class APIController { + private final RestTemplate restTemplate; + private final AppConfig appConfig; + String bodyMessage = ""; + + @Autowired + public APIController(RestTemplate restTemplate, AppConfig appConfig) { + this.restTemplate = restTemplate; + this.appConfig = appConfig; + } + + @GetMapping(value = "/getpetimg") + public String getPetImage(@RequestParam String mobno,@RequestParam String uniqueid) { + String baseURL = appConfig.petRegistration+"/api/getpetimg"; + UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseURL) + .queryParam("mobno", mobno) + .queryParam("uniqueid", uniqueid ); + + ResponseEntity response = restTemplate.getForEntity(uriComponentsBuilder.toUriString(),String.class); + bodyMessage = response.getBody().trim(); + return bodyMessage; + } + + @GetMapping(value = "/getvaccineimg") + public String getVaccineImage(@RequestParam String mobno,@RequestParam String uniqueid) { + String baseURL = appConfig.petRegistration+"/api/getvacimg"; + UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseURL) + .queryParam("mobno", mobno) + .queryParam("uniqueid", uniqueid ); + + ResponseEntity response = restTemplate.getForEntity(uriComponentsBuilder.toUriString(),String.class); + bodyMessage = response.getBody().trim(); + return bodyMessage; + } + + @GetMapping(value = "/getapplicantimg") + public String getApplicantImage(@RequestParam String mobno,@RequestParam String uniqueid) { + String baseURL = appConfig.petRegistration+"/api/getapplicantimg"; + UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseURL) + .queryParam("mobno", mobno) + .queryParam("uniqueid", uniqueid ); + + ResponseEntity response = restTemplate.getForEntity(uriComponentsBuilder.toUriString(),String.class); + bodyMessage = response.getBody().trim(); + return bodyMessage; + } + + @GetMapping(value = "/getaddressproofimg") + public String getAddressProofImage(@RequestParam String mobno,@RequestParam String uniqueid) { + String baseURL = appConfig.petRegistration+"/api/getaddproofimg"; + UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(baseURL) + .queryParam("mobno", mobno) + .queryParam("uniqueid", uniqueid ); + + ResponseEntity response = restTemplate.getForEntity(uriComponentsBuilder.toUriString(),String.class); + bodyMessage = response.getBody().trim(); + return bodyMessage; + } + + // Example Delete after Code complete + @GetMapping(value = "/getFeedbackAssetdetails") + public String getFeedbackAssetdetails(@RequestParam String fbId) { + String feedbackId = fbId; + ResponseEntity response = restTemplate.getForEntity(appConfig.qrAssetFeedback+"/api/feedback/{feedbackId}",String.class,feedbackId); + bodyMessage = response.getBody().trim(); + return bodyMessage; + } + + + @PostMapping(value = "/category/checkbyname") + public int checkByName(@RequestParam("catName") String catName) { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + + MultiValueMap params = new LinkedMultiValueMap<>(); + params.add("catName", catName); + + HttpEntity> request = new HttpEntity<>(params, headers); + + ResponseEntity response = restTemplate.postForEntity(appConfig.qrAssetFeedback + "/api/category/checkbyname", request, Integer.class); + + return response.getBody(); + } + +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java new file mode 100644 index 0000000..6283774 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java @@ -0,0 +1,168 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.controller; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Lookup; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; +import in.gov.chennaicorporation.gccoffice.petregistration.data.PetCountInfo; +import in.gov.chennaicorporation.gccoffice.petregistration.data.RequestList; +import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; + +@RequestMapping("/petregistration") +@Controller("petregistration") +public class MainController { + private final RestTemplate restTemplate; + private final LoginUserInfo loginUserInfo; + private final AppConfig appConfig; + + @Autowired + public MainController(RestTemplate restTemplate,LoginUserInfo loginUserInfo, AppConfig appConfig) { + this.restTemplate = restTemplate; + this.loginUserInfo = loginUserInfo; + this.appConfig = appConfig; + } + + @Lookup + public static String[] getDates() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.MONTH, -1); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + + String formattedDate = dateFormat.format(calendar.getTime()); + + String currentDate = dateFormat.format(new Date()); + System.out.println("formattedDate : "+formattedDate); + return new String[] { formattedDate, currentDate }; + } + + + @GetMapping({"", "/", "/index", "/dashboard"}) + public String main(Model model,@RequestParam(required=false) String zone) { + String userId = LoginUserInfo.getLoginUserId(); + String baseUrl = appConfig.petRegistration + "/api/admin/dashboard"; + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl).queryParam("zone",zone); + PetCountInfo dash = restTemplate.getForObject(builder.toUriString(),PetCountInfo.class); + if (userId != null && !userId.isEmpty()) { + System.out.println("String UserID: " + userId); + } + model.addAttribute("dash",dash); + return "modules/petregistration/index"; + } + + @GetMapping("/requestlist") + public String viewRequest(Model model, + @RequestParam(required=false) String fromDate, + @RequestParam(required =false) String toDate, + @RequestParam(required=false) String zone) { + + if(fromDate==null && toDate==null) { + String[] dates = getDates(); + fromDate=dates[0]; + toDate=dates[1]; + model.addAttribute(fromDate); + model.addAttribute(toDate); + } + + String baseUrl = appConfig.petRegistration + "/api/admin/licenserequest"; + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl) + .queryParam("zone",zone) + .queryParam("fromDate",fromDate) + .queryParam("toDate",toDate); + + RequestList[] requestList = restTemplate.getForObject(builder.toUriString(), RequestList[].class); + model.addAttribute("petlist",requestList); + + return "modules/petregistration/request-list"; + } + + @GetMapping("/acceptedlist") + public String viewAccepted(Model model, + @RequestParam(required=false) String fromDate, + @RequestParam(required =false) String toDate, + @RequestParam(required=false) String zone) { + + if(fromDate==null && toDate==null) { + String[] dates = getDates(); + fromDate=dates[0]; + toDate=dates[1]; + model.addAttribute(fromDate); + model.addAttribute(toDate); + } + + String baseUrl = appConfig.petRegistration + "/api/admin/acceptedlist"; + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl) + .queryParam("zone",zone) + .queryParam("fromDate",fromDate) + .queryParam("toDate",toDate); + + RequestList[] requestList = restTemplate.getForObject(builder.toUriString(), RequestList[].class); + model.addAttribute("petlist",requestList); + + return "modules/petregistration/accepted-list"; + } + + @GetMapping("/rejectedlist") + public String viewRejected(Model model, + @RequestParam(required=false) String fromDate, + @RequestParam(required =false) String toDate, + @RequestParam(required=false) String zone) { + + if(fromDate==null && toDate==null) { + String[] dates = getDates(); + fromDate=dates[0]; + toDate=dates[1]; + model.addAttribute(fromDate); + model.addAttribute(toDate); + } + + String baseUrl = appConfig.petRegistration + "/api/admin/rejectedlist"; + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl) + .queryParam("zone",zone) + .queryParam("fromDate",fromDate) + .queryParam("toDate",toDate); + + RequestList[] requestList = restTemplate.getForObject(builder.toUriString(), RequestList[].class); + model.addAttribute("petlist",requestList); + + return "modules/petregistration/accepted-list"; + } + + @GetMapping("/licenseissued") + public String viewLicenseIssued(Model model, + @RequestParam(required=false) String fromDate, + @RequestParam(required =false) String toDate, + @RequestParam(required=false) String zone) { + + if(fromDate==null && toDate==null) { + String[] dates = getDates(); + fromDate=dates[0]; + toDate=dates[1]; + model.addAttribute(fromDate); + model.addAttribute(toDate); + } + + String baseUrl = appConfig.petRegistration + "/api/admin/licenseIssued"; + UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(baseUrl) + .queryParam("zone",zone) + .queryParam("fromDate",fromDate) + .queryParam("toDate",toDate); + + RequestList[] requestList = restTemplate.getForObject(builder.toUriString(), RequestList[].class); + model.addAttribute("petlist",requestList); + + return "modules/petregistration/accepted-list"; + } +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/PetCountInfo.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/PetCountInfo.java new file mode 100644 index 0000000..0714a0d --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/PetCountInfo.java @@ -0,0 +1,46 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.data; + +import java.util.Map; + +public class PetCountInfo { + + private Map dog; + private Map cat; + private int userCount; + private int licCount; + + // Getters and setters + + public Map getDog() { + return dog; + } + + public void setDog(Map dog) { + this.dog = dog; + } + + public Map getCat() { + return cat; + } + + public void setCat(Map cat) { + this.cat = cat; + } + + public int getUserCount() { + return userCount; + } + + public void setUserCount(int userCount) { + this.userCount = userCount; + } + + public int getLicCount() { + return licCount; + } + + public void setLicCount(int licCount) { + this.licCount = licCount; + } +} + diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/RequestList.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/RequestList.java new file mode 100644 index 0000000..09cf9ce --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/RequestList.java @@ -0,0 +1,150 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.data; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RequestList { + private int uniqueid; + private long mobilenum; + private String petname; + private String species; + private String breed; + private String gender; + private String registerdate; + private int status; + private String rejectreason; + private String zone; + private String statusdate; + private String updatedby; + + + // Constructor + public RequestList() { + + } + + @JsonCreator + public RequestList(@JsonProperty("uniqueid") int uniqueid, + @JsonProperty("mobilenum") long mobilenum, + @JsonProperty("petname") String petname, + @JsonProperty("species") String species, + @JsonProperty("breed") String breed, + @JsonProperty("gender") String gender, + @JsonProperty("registerdate") String registerdate, + @JsonProperty("status") int status, + @JsonProperty("rejectreason") String rejectreason, + @JsonProperty("zone") String zone, + @JsonProperty("statusdate") String statusdate, + @JsonProperty("updatedby") String updatedby) { + + this.uniqueid = uniqueid; + this.mobilenum = mobilenum; + this.petname = petname; + this.species = species; + this.breed = breed; + this.gender = gender; + this.registerdate = registerdate; + this.status = status; + this.rejectreason = rejectreason; + this.zone = zone; + this.statusdate = statusdate; + this.updatedby = updatedby; + } + + // Getters and setters for each field + public int getUniqueid() { + return uniqueid; + } + + public void setUniqueid(int uniqueid) { + this.uniqueid = uniqueid; + } + + public long getMobilenum() { + return mobilenum; + } + + public void setMobilenum(long mobilenum) { + this.mobilenum = mobilenum; + } + + public String getPetname() { + return petname; + } + + public void setPetname(String petname) { + this.petname = petname; + } + + public String getSpecies() { + return species; + } + + public void setSpecies(String species) { + this.species = species; + } + + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getRegisterdate() { + return registerdate; + } + + public void setRegisterdate(String registerdate) { + this.registerdate = registerdate; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getRejectreason() { + return rejectreason; + } + + public void setRejectreason(String rejectreason) { + this.rejectreason = rejectreason; + } + + public String getZone() { + return zone; + } + + public void setZone(String zone) { + this.zone = zone; + } + + public String getStatusdate() { + return statusdate; + } + + public void setStatusdate(String statusdate) { + this.statusdate = statusdate; + } + + public String getUpdatedby() { + return updatedby; + } + + public void setUpdatedby(String updatedby) { + this.updatedby = updatedby; + } +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/ResponseWrapper.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/ResponseWrapper.java new file mode 100644 index 0000000..35e697e --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/ResponseWrapper.java @@ -0,0 +1,15 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.data; + +import java.util.List; + +public class ResponseWrapper { + private List data; + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } +} \ No newline at end of file diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/package-info.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/package-info.java new file mode 100644 index 0000000..71394d6 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/data/package-info.java @@ -0,0 +1 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.data; \ No newline at end of file diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/package-info.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/package-info.java new file mode 100644 index 0000000..02b3ead --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/package-info.java @@ -0,0 +1 @@ +package in.gov.chennaicorporation.gccoffice.petregistration; \ No newline at end of file diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/service/API.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/service/API.java new file mode 100644 index 0000000..7b0e873 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/service/API.java @@ -0,0 +1,5 @@ +package in.gov.chennaicorporation.gccoffice.petregistration.service; + +public class API { + +} diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store index cc3ce48..40d0542 100644 Binary files a/src/main/resources/.DS_Store and b/src/main/resources/.DS_Store differ diff --git a/src/main/resources/templates/.DS_Store b/src/main/resources/templates/.DS_Store index 30c2e5c..7f99f14 100644 Binary files a/src/main/resources/templates/.DS_Store and b/src/main/resources/templates/.DS_Store differ diff --git a/src/main/resources/templates/modules/.DS_Store b/src/main/resources/templates/modules/.DS_Store index 1d40cf2..f85495b 100644 Binary files a/src/main/resources/templates/modules/.DS_Store and b/src/main/resources/templates/modules/.DS_Store differ diff --git a/src/main/resources/templates/modules/petregistration/.DS_Store b/src/main/resources/templates/modules/petregistration/.DS_Store new file mode 100644 index 0000000..aa32ac3 Binary files /dev/null and b/src/main/resources/templates/modules/petregistration/.DS_Store differ diff --git a/src/main/resources/templates/modules/petregistration/accepted-list.html b/src/main/resources/templates/modules/petregistration/accepted-list.html new file mode 100644 index 0000000..5c3ae23 --- /dev/null +++ b/src/main/resources/templates/modules/petregistration/accepted-list.html @@ -0,0 +1,638 @@ + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
0 + + + + + + + + +

+ + Accepted + +

+
+ + + +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
+
+
+
+
+
+ + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/petregistration/index.html b/src/main/resources/templates/modules/petregistration/index.html new file mode 100644 index 0000000..19bb5b2 --- /dev/null +++ b/src/main/resources/templates/modules/petregistration/index.html @@ -0,0 +1,845 @@ + + + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + + + + + + +
+
+
+
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/petregistration/license-issued.html b/src/main/resources/templates/modules/petregistration/license-issued.html new file mode 100644 index 0000000..4a5d54c --- /dev/null +++ b/src/main/resources/templates/modules/petregistration/license-issued.html @@ -0,0 +1,536 @@ + + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoTypeIssued ByUpDated DatePet PhotoRabies certiLicense InfoOwner Info
0 + + + + +

+ Info +

+
+ +
S.NoTypeIssued ByUpDated DatePet PhotoRabies certiLicense InfoOwner Info
+
+
+ + + + + + + + +
+
+
+ +
+
+ +
+
+
+ + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/petregistration/rejected.html b/src/main/resources/templates/modules/petregistration/rejected.html new file mode 100644 index 0000000..4d60216 --- /dev/null +++ b/src/main/resources/templates/modules/petregistration/rejected.html @@ -0,0 +1,607 @@ + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + + +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
0 + + + + + + + + +

+ + Rejected + +

+
+ +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
+
+
+ + +
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/petregistration/request-list.html b/src/main/resources/templates/modules/petregistration/request-list.html new file mode 100644 index 0000000..0571080 --- /dev/null +++ b/src/main/resources/templates/modules/petregistration/request-list.html @@ -0,0 +1,687 @@ + + + + + + + + + +
+ +
+ + +
+ +
+ +
+
+ + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
0 + + + + + + + + +

+ + pending + +

+ + +
+ +
S.NoNameTypeBreedsexpet photoRabies certiApplication photoAddress ProofStatusAction
+
+
+ +
+ +
+
+
+
+ +
+
+ +
+ + + + + + + + + + + +
+ + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/qrfeedback/.DS_Store b/src/main/resources/templates/modules/qrfeedback/.DS_Store new file mode 100644 index 0000000..04190cc Binary files /dev/null and b/src/main/resources/templates/modules/qrfeedback/.DS_Store differ