Browse Source

Initial commit

master
Dizho 2 years ago
parent
commit
b2511fbda4
  1. BIN
      cd_waste_docs/cdwaste_aadhar/10_Race.jpg
  2. BIN
      cd_waste_docs/cdwaste_aadhar/11_Sample1.jpg
  3. BIN
      cd_waste_docs/cdwaste_aadhar/12_pexels-mike-jones-9461451.jpg
  4. BIN
      cd_waste_docs/cdwaste_aadhar/1_images.jpeg
  5. BIN
      cd_waste_docs/cdwaste_aadhar/2_images.jpeg
  6. BIN
      cd_waste_docs/cdwaste_aadhar/3_Race.jpg
  7. BIN
      cd_waste_docs/cdwaste_aadhar/4_Race.jpg
  8. BIN
      cd_waste_docs/cdwaste_aadhar/5_Race.jpg
  9. BIN
      cd_waste_docs/cdwaste_aadhar/6_Race.jpg
  10. BIN
      cd_waste_docs/cdwaste_aadhar/7_Race.jpg
  11. BIN
      cd_waste_docs/cdwaste_aadhar/8_Sample1.jpg
  12. BIN
      cd_waste_docs/cdwaste_aadhar/9_Sample1.jpg
  13. BIN
      cd_waste_docs/cdwaste_leasedoc/12_pexels-cottonbro-10034377.jpg
  14. BIN
      cd_waste_docs/cdwaste_leasedoc/1_images.jpeg
  15. BIN
      cd_waste_docs/cdwaste_leasedoc/2_images.jpeg
  16. BIN
      cd_waste_docs/cdwaste_rcbookdoc/10_Sample1.jpg
  17. BIN
      cd_waste_docs/cdwaste_rcbookdoc/11_Sample1.jpg
  18. BIN
      cd_waste_docs/cdwaste_rcbookdoc/12_pexels-mike-jones-9461451.jpg
  19. BIN
      cd_waste_docs/cdwaste_rcbookdoc/1_images.jpeg
  20. BIN
      cd_waste_docs/cdwaste_rcbookdoc/2_images.jpeg
  21. BIN
      cd_waste_docs/cdwaste_rcbookdoc/3_Sample1.jpg
  22. BIN
      cd_waste_docs/cdwaste_rcbookdoc/4_Sample1.jpg
  23. BIN
      cd_waste_docs/cdwaste_rcbookdoc/5_Sample1.jpg
  24. BIN
      cd_waste_docs/cdwaste_rcbookdoc/6_Sample1.jpg
  25. BIN
      cd_waste_docs/cdwaste_rcbookdoc/7_Sample1.jpg
  26. BIN
      cd_waste_docs/cdwaste_rcbookdoc/8_Sample1.jpg
  27. BIN
      cd_waste_docs/cdwaste_rcbookdoc/9_Sample1.jpg
  28. BIN
      cd_waste_docs/cdwaste_userphoto/10_Sample1.jpg
  29. BIN
      cd_waste_docs/cdwaste_userphoto/11_Sample1.jpg
  30. BIN
      cd_waste_docs/cdwaste_userphoto/12_pexels-mike-jones-9461451.jpg
  31. BIN
      cd_waste_docs/cdwaste_userphoto/1_images.jpeg
  32. BIN
      cd_waste_docs/cdwaste_userphoto/2_images.jpeg
  33. BIN
      cd_waste_docs/cdwaste_userphoto/3_Sample1.jpg
  34. BIN
      cd_waste_docs/cdwaste_userphoto/4_Sample1.jpg
  35. BIN
      cd_waste_docs/cdwaste_userphoto/5_Sample1.jpg
  36. BIN
      cd_waste_docs/cdwaste_userphoto/6_Sample1.jpg
  37. BIN
      cd_waste_docs/cdwaste_userphoto/7_Sample1.jpg
  38. BIN
      cd_waste_docs/cdwaste_userphoto/8_Sample1.jpg
  39. BIN
      cd_waste_docs/cdwaste_userphoto/9_Sample1.jpg
  40. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM (1).jpeg
  41. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM.jpeg
  42. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.08 PM.jpeg
  43. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/aa.jpg
  44. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/booking.png
  45. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/calendar.png
  46. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/id-card.png
  47. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/ima.jpg
  48. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/lockers.png
  49. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/man.png
  50. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/schedule.png
  51. BIN
      cdwastecollectordocuments/cdwaste_adhaar_copy/shower.png
  52. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-08-24 at 12.49.58 PM.jpeg
  53. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-12 at 9.54.20 PM.jpeg
  54. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM (1).jpeg
  55. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM.jpeg
  56. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/booking.png
  57. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/calendar.png
  58. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/ima.jpg
  59. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/lockers.png
  60. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/plus.png
  61. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/portable-toilet.png
  62. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/received-card.png
  63. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/search.png
  64. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/shower.png
  65. BIN
      cdwastecollectordocuments/cdwaste_rcbook_copy/wardrobe.png
  66. 48
      pom.xml
  67. 61
      src/main/java/com/volunteersregistration/config/AppConfigur.java
  68. 11
      src/main/java/com/volunteersregistration/config/AppConstants.java
  69. 24
      src/main/java/com/volunteersregistration/config/DataSourceConfig.java
  70. 50
      src/main/java/com/volunteersregistration/config/QRCodeGenerator.java
  71. 42
      src/main/java/com/volunteersregistration/config/UserSession.java
  72. 43
      src/main/java/com/volunteersregistration/config/WebConfig.java
  73. 136
      src/main/java/com/volunteersregistration/controller/ApiController.java
  74. 121
      src/main/java/com/volunteersregistration/controller/VolunteerController.java
  75. 65
      src/main/java/com/volunteersregistration/entity/Category.java
  76. 43
      src/main/java/com/volunteersregistration/entity/LoginDetail.java
  77. 51
      src/main/java/com/volunteersregistration/entity/SubCategory.java
  78. 402
      src/main/java/com/volunteersregistration/entity/VolunteerInformation.java
  79. 19
      src/main/java/com/volunteersregistration/repository/CompanyInfoRepo.java
  80. 12
      src/main/java/com/volunteersregistration/repository/LoginDetailRepo.java
  81. 19
      src/main/java/com/volunteersregistration/repository/NgoInfoRepo.java
  82. 17
      src/main/java/com/volunteersregistration/repository/VolunteerRegistrationRepo.java
  83. 90
      src/main/java/com/volunteersregistration/service/Registrationservice.java
  84. 30
      src/main/java/com/volunteersregistration/service/VolunteerRegistrationService.java
  85. 521
      src/main/java/com/volunteersregistration/wasteCollector/controller/ApiController.java
  86. 173
      src/main/java/com/volunteersregistration/wasteCollector/controller/MainController.java
  87. 73
      src/main/java/com/volunteersregistration/wasteCollector/entity/Amount.java
  88. 59
      src/main/java/com/volunteersregistration/wasteCollector/entity/Cdlicense.java
  89. 119
      src/main/java/com/volunteersregistration/wasteCollector/entity/Orderslogs.java
  90. 112
      src/main/java/com/volunteersregistration/wasteCollector/entity/Payments.java
  91. 281
      src/main/java/com/volunteersregistration/wasteCollector/entity/WasteRegistration.java
  92. 17
      src/main/java/com/volunteersregistration/wasteCollector/repository/CdlicenseRepository.java
  93. 12
      src/main/java/com/volunteersregistration/wasteCollector/repository/OderLogsRepo.java
  94. 11
      src/main/java/com/volunteersregistration/wasteCollector/repository/PaymentsRepo.java
  95. 123
      src/main/java/com/volunteersregistration/wasteCollector/repository/WasteRegistrationRepo.java
  96. 164
      src/main/java/com/volunteersregistration/wasteCollector/service/WasteRegistrationService.java
  97. 35
      src/main/resources/application-dev.properties
  98. 36
      src/main/resources/application-prod.properties
  99. 14
      src/main/resources/application.properties
  100. 65
      src/main/resources/static/assets/_js/main/app.js

BIN
cd_waste_docs/cdwaste_aadhar/10_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/11_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_aadhar/12_pexels-mike-jones-9461451.jpg

After

Width: 4000  |  Height: 6000  |  Size: 2.1 MiB

BIN
cd_waste_docs/cdwaste_aadhar/1_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_aadhar/2_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_aadhar/3_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/4_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/5_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/6_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/7_Race.jpg

After

Width: 728  |  Height: 469  |  Size: 79 KiB

BIN
cd_waste_docs/cdwaste_aadhar/8_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_aadhar/9_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_leasedoc/12_pexels-cottonbro-10034377.jpg

After

Width: 2618  |  Height: 3927  |  Size: 740 KiB

BIN
cd_waste_docs/cdwaste_leasedoc/1_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_leasedoc/2_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/10_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/11_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/12_pexels-mike-jones-9461451.jpg

After

Width: 4000  |  Height: 6000  |  Size: 2.1 MiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/1_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/2_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/3_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/4_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/5_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/6_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/7_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/8_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_rcbookdoc/9_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/10_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/11_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/12_pexels-mike-jones-9461451.jpg

After

Width: 4000  |  Height: 6000  |  Size: 2.1 MiB

BIN
cd_waste_docs/cdwaste_userphoto/1_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_userphoto/2_images.jpeg

After

Width: 276  |  Height: 183  |  Size: 8.8 KiB

BIN
cd_waste_docs/cdwaste_userphoto/3_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/4_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/5_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/6_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/7_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/8_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cd_waste_docs/cdwaste_userphoto/9_Sample1.jpg

After

Width: 1792  |  Height: 1792  |  Size: 500 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM (1).jpeg

Before

Width: 1280  |  Height: 720  |  Size: 119 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM.jpeg

Before

Width: 1280  |  Height: 720  |  Size: 179 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/WhatsApp Image 2024-09-16 at 5.41.08 PM.jpeg

Before

Width: 1280  |  Height: 720  |  Size: 129 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/aa.jpg

Before

Width: 200  |  Height: 180  |  Size: 22 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/booking.png

Before

Width: 512  |  Height: 512  |  Size: 35 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/calendar.png

Before

Width: 512  |  Height: 512  |  Size: 22 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/id-card.png

Before

Width: 512  |  Height: 512  |  Size: 14 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/ima.jpg

Before

Width: 320  |  Height: 180  |  Size: 15 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/lockers.png

Before

Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/man.png

Before

Width: 512  |  Height: 512  |  Size: 33 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/schedule.png

Before

Width: 512  |  Height: 512  |  Size: 28 KiB

BIN
cdwastecollectordocuments/cdwaste_adhaar_copy/shower.png

Before

Width: 512  |  Height: 512  |  Size: 40 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-08-24 at 12.49.58 PM.jpeg

Before

Width: 738  |  Height: 1600  |  Size: 141 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-12 at 9.54.20 PM.jpeg

Before

Width: 1080  |  Height: 1187  |  Size: 150 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM (1).jpeg

Before

Width: 1280  |  Height: 720  |  Size: 119 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/WhatsApp Image 2024-09-16 at 5.41.07 PM.jpeg

Before

Width: 1280  |  Height: 720  |  Size: 179 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/booking.png

Before

Width: 512  |  Height: 512  |  Size: 35 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/calendar.png

Before

Width: 512  |  Height: 512  |  Size: 22 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/ima.jpg

Before

Width: 320  |  Height: 180  |  Size: 15 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/lockers.png

Before

Width: 512  |  Height: 512  |  Size: 12 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/plus.png

Before

Width: 512  |  Height: 512  |  Size: 25 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/portable-toilet.png

Before

Width: 512  |  Height: 512  |  Size: 18 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/received-card.png

Before

Width: 512  |  Height: 512  |  Size: 13 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/search.png

Before

Width: 512  |  Height: 512  |  Size: 30 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/shower.png

Before

Width: 512  |  Height: 512  |  Size: 40 KiB

BIN
cdwastecollectordocuments/cdwaste_rcbook_copy/wardrobe.png

Before

Width: 512  |  Height: 512  |  Size: 20 KiB

48
pom.xml

@ -1,30 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version> <version>3.3.3</version>
<relativePath/> <!-- lookup parent from repository -->
<relativePath /> <!-- lookup parent from repository -->
</parent> </parent>
<groupId>com</groupId> <groupId>com</groupId>
<artifactId>volunteersregistration</artifactId> <artifactId>volunteersregistration</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>volunteersregistration</name> <name>volunteersregistration</name>
<description>volunteers registration</description> <description>volunteers registration</description>
<url/>
<url />
<licenses> <licenses>
<license/>
<license />
</licenses> </licenses>
<developers> <developers>
<developer/>
<developer />
</developers> </developers>
<scm> <scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
<connection />
<developerConnection />
<tag />
<url />
</scm> </scm>
<properties> <properties>
<java.version>17</java.version> <java.version>17</java.version>
@ -54,6 +55,35 @@
<artifactId>mysql-connector-j</artifactId> <artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- ZXing core library for generating QR codes -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.4.1</version>
</dependency>
<!-- ZXing for writing the QR code to an image -->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.4.1</version>
</dependency>
<!-- Apache Commons Codec for Base64 encoding -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>com.razorpay</groupId>
<artifactId>razorpay-java</artifactId>
<version>1.4.3</version>
</dependency>
<!--<dependency> <!--<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>

61
src/main/java/com/volunteersregistration/config/AppConfigur.java

@ -0,0 +1,61 @@
package com.volunteersregistration.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "app")
public class AppConfigur {
private String title;
private String baseUrl;
private String getOtpUrl;
private String erpUrl;
@Value("${payment.razorpay.my_key_id}")
private String keyId;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBaseUrl() {
return baseUrl;
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public String getGetOtpUrl() {
return getOtpUrl;
}
public void setGetOtpUrl(String getOtpUrl) {
this.getOtpUrl = getOtpUrl;
}
public String getErpUrl() {
return erpUrl;
}
public void setErpUrl(String erpUrl) {
this.erpUrl = erpUrl;
}
public String getKeyId() {
return keyId;
}
public void setKeyId(String keyId) {
this.keyId = keyId;
}
}

11
src/main/java/com/volunteersregistration/config/AppConstants.java

@ -0,0 +1,11 @@
package com.volunteersregistration.config;
public final class AppConstants {
// public static String key_id="rzp_live_ySI5Ns54Y7qOcJ";
// public static String key_secret="Nwf1TjhUtaskof8vePkRR8Sb";
//uncomment for testing payment
public static String key_id="rzp_test_tDkHFEqWXmuEi8";
public static String key_secret="cBQUjMcKZ4J6vmOKSyNZ92py";
}

24
src/main/java/com/volunteersregistration/config/DataSourceConfig.java

@ -1,24 +0,0 @@
package com.volunteersregistration.config;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
@EnableTransactionManagement
public class DataSourceConfig {
//////////////////////////////(For C & D Waste Collectors Registration ) ////////////////////////
@Bean(name = "volunteers")
public DataSource mysql1913CDwasteDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/volunteer");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}
}

50
src/main/java/com/volunteersregistration/config/QRCodeGenerator.java

@ -0,0 +1,50 @@
package com.volunteersregistration.config;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
public class QRCodeGenerator {
public static String generateQRCode(String baseUrl, String refNum) throws WriterException, IOException {
int width = 100; // width of the QR code image
int height = 100; // height of the QR code image
String format = "png"; // format of the QR code image
String charset = "UTF-8"; // character set used to encode the data
// The URL to be embedded in the QR code
String data = baseUrl + "/viewidcard?register_id=" + refNum;
// create the QR code writer and hints
QRCodeWriter qrCodeWriter = new QRCodeWriter();
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, charset);
// generate the QR code matrix
BitMatrix matrix = qrCodeWriter.encode(data, BarcodeFormat.QR_CODE, width, height, hints);
// create the QR code image as a byte array
ByteArrayOutputStream baos = new ByteArrayOutputStream();
MatrixToImageWriter.writeToStream(matrix, format, baos);
byte[] imageBytes = baos.toByteArray();
// encode the image data in base64 format
// Return the QR code image as a Base64 string with the correct data URI prefix
return "data:image/png;base64," + Base64.getEncoder().encodeToString(imageBytes);
// Fixed return statement
}
}

42
src/main/java/com/volunteersregistration/config/UserSession.java

@ -0,0 +1,42 @@
package com.volunteersregistration.config;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.context.annotation.ScopedProxyMode;
@Component
@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
public class UserSession {
private Integer userId;
private long mobNo;
private String userType;
private String dispayName;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public long getMobNo() {
return mobNo;
}
public void setMobNo(long mobNo) {
this.mobNo = mobNo;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getDispayName() {
return dispayName;
}
public void setDispayName(String dispayName) {
this.dispayName = dispayName;
}
}

43
src/main/java/com/volunteersregistration/config/WebConfig.java

@ -0,0 +1,43 @@
package com.volunteersregistration.config;
import java.io.File;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Value("${file.upload.directory}")
private String uploadDirectory;
@Value("${file.aadhar.fullpath}")
private String aadharFullPath;
@Value("${file.leasedoc.fullpath}")
private String leaseDocFullPath;
@Value("${file.rcbookdoc.fullpath}")
private String rcbookDocFullPath;
@Value("${file.userphoto.fullpath}")
private String userPhotoFullPath;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/cd_waste_docs/cdwaste_aadhar/**")
.addResourceLocations("file:" + uploadDirectory + "/cdwaste_aadhar/");
registry.addResourceHandler("/cd_waste_docs/cdwaste_leasedoc/**")
.addResourceLocations("file:" + uploadDirectory + "/cdwaste_leasedoc/");
registry.addResourceHandler("/cd_waste_docs/cdwaste_rcbookdoc/**")
.addResourceLocations("file:" + uploadDirectory + "/cdwaste_rcbookdoc/");
registry.addResourceHandler("/cd_waste_docs/cdwaste_userphoto/**")
.addResourceLocations("file:" + uploadDirectory + "/cdwaste_userphoto/");
}
}

136
src/main/java/com/volunteersregistration/controller/ApiController.java

@ -1,75 +1,139 @@
package com.volunteersregistration.controller; package com.volunteersregistration.controller;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.volunteersregistration.service.Registrationservice;
import com.volunteersregistration.config.AppConfigur;
import com.volunteersregistration.config.UserSession;
import com.volunteersregistration.entity.LoginDetail;
import com.volunteersregistration.repository.LoginDetailRepo;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random;
@RestController
@RequestMapping("/gcc/api/registration")
@RestController("volunteerapicontroller")
@RequestMapping("/volunteer/api/registration")
public class ApiController { public class ApiController {
@Autowired
private HttpSession session;
@Autowired @Autowired
private Environment environment; private Environment environment;
@Autowired
private LoginDetailRepo logindetailrepo;
@Autowired
private UserSession usersession;
@Autowired
private AppConfigur appConfig;
private final Registrationservice registrationService;
//for login
@GetMapping(value = "/login")
public String login(HttpServletRequest request, @RequestParam String uname, @RequestParam String upass) {
LoginDetail ld = logindetailrepo.checkUser(Long.parseLong(uname), upass);
if (ld != null) {
session.setAttribute("userId", ld.getId()); // Store user in session
session.setAttribute("mobNo", ld.getMobileno());
session.setAttribute("userType", ld.getUsertype());
public ApiController(Registrationservice registrationService) {
this.registrationService = registrationService;
return ld.getUsertype(); // Return user type to redirect appropriately
} else {
return "Error"; // Return error if login fails
}
} }
@GetMapping(value = "/sendOTP")
public String sendOtp(HttpServletRequest request, @RequestParam String mobile,@RequestParam String purpose) {
String MobileNo=mobile;
System.out.print("\n MobileNo---:"+mobile);
Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
System.out.print("\n otp---:"+otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
@PostMapping("/register")
public ResponseEntity<List<Map<String, Object>>> registerCollector(
@RequestParam("name") String name,
@RequestParam("mobileNo") String mobileNo,
@RequestParam("address") String address,
@RequestParam("adhaar") MultipartFile adhaarFile,
@RequestParam("vehicleRcBook") MultipartFile vehicleRcBookFile) {
String generatedToken = "Welcome to GCC "+otp+" is your OTP for gcc QR System";
// String key="qxg4mklD";
String key="pfTEYN6H";
String urlString= appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407168250479102852";
// String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168250479102852";
System.out.print("\n urlString---: "+urlString);
String bodyMessage = "";
try { try {
// Save files to specified folders
String adhaarFolder = environment.getProperty("cdwaste_adhaar_foldername");
String vehicleRcFolder = environment.getProperty("cdwaste_rc_foldername");
RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class);
bodyMessage=Response;
System.out.println("\n bodyMessage"+bodyMessage);
System.out.println("OTP sent successfully!");
// Create directories if they do not exist
Files.createDirectories(Paths.get(adhaarFolder));
Files.createDirectories(Paths.get(vehicleRcFolder));
} catch (Exception e) {
System.out.print("ERROR---: "+e);
bodyMessage = "Error";
}
HttpSession session = request.getSession();
session.setAttribute("otp", otp);
return bodyMessage;
// Define file paths
Path adhaarPath = Paths.get(adhaarFolder, adhaarFile.getOriginalFilename());
Path vehicleRcPath = Paths.get(vehicleRcFolder, vehicleRcBookFile.getOriginalFilename());
}
// Save files
adhaarFile.transferTo(adhaarPath);
vehicleRcBookFile.transferTo(vehicleRcPath);
@GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession();
try {
Integer session_otp = (Integer) session.getAttribute("otp");
System.out.println("session_otp---:" + session_otp);
Integer entered_otp = Integer.parseInt(otp);
// Now call the service to save the registration data
List<Map<String, Object>> result = registrationService.saveRegistration(name, mobileNo, address, adhaarFile, vehicleRcBookFile);
if (result.isEmpty()) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(Map.of("status", "error", "message", "Error registering collector!")));
if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct");
session.setAttribute("verifiedotp", "success");
return "Success";
} else {
System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("verifiedotp", "error");
return "Error";
} }
return ResponseEntity.ok(result);
} catch (IOException e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(Collections.singletonList(Map.of("status", "error", "message", "Error uploading files: " + e.getMessage())));
} catch (NumberFormatException e) {
System.out.println("Invalid OTP format: " + otp);
return "Error";
} catch (Exception e) {
System.out.println("Error verifying OTP: " + e.getMessage());
return "Error";
} }
} }
} }

121
src/main/java/com/volunteersregistration/controller/VolunteerController.java

@ -1,29 +1,124 @@
package com.volunteersregistration.controller; package com.volunteersregistration.controller;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import com.volunteersregistration.config.UserSession;
import com.volunteersregistration.service.VolunteerRegistrationService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
@Controller @Controller
@RequestMapping("/volunteer") @RequestMapping("/volunteer")
public class VolunteerController { public class VolunteerController {
@GetMapping(value={"/","","/index"})
public String register(@RequestParam(required = false) String ref, Model model){
System.out.println("indesx page....."+ ref);
model.addAttribute("ref",ref);
return "index";
@Autowired
private HttpSession session;
@Autowired
private UserSession usersession;
@Autowired
public VolunteerRegistrationService volunteerRegistrationService;
@GetMapping(value = { "/", "", "/index" })
public String register(@RequestParam(required = false) String ref, Model model) {
System.out.println("indesx page....." + ref);
model.addAttribute("ref", ref);
return "index";
}
// Check session and redirect to login if user is not logged in
private boolean isLoggedIn() {
return session.getAttribute("userId") != null; // Check if userId is in session store the user type if the user type not quals to kyn n s pls logout
}
@GetMapping(value = {"/kynreport"})
public String kynreport(Model model, HttpServletRequest request) {
if (!isLoggedIn()) {
return "redirect:/volunteer/kynreportlogin"; // Redirect to login if not logged in
}
return "kynreport"; // Render page if logged in
} }
@GetMapping(value={"/wastecollectors"})
public String wastecollectors(Model model){
return "wastecollectors";
@GetMapping(value = {"/allreports"})
public String allreports(Model model, HttpServletRequest request) {
if (!isLoggedIn()) {
return "redirect:/volunteer/kynreportlogin"; // Redirect to login if not logged in
}
return "allreports"; // Render page if logged in
}
@PostMapping(value = {"/allreports"})
public String allreports(
@RequestParam("fromDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate,
@RequestParam("toDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate,
@RequestParam("category") int category,
Model model) {
if (!isLoggedIn()) {
return "redirect:/volunteer/kynreportlogin";
}
LocalDateTime fromDateTime = fromDate.atStartOfDay();
LocalDateTime toDateTime = toDate.atTime(23, 59, 59);
String fromDateString = fromDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
String toDateString = toDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
List<Map<String, Object>> alldata = volunteerRegistrationService.getAllReport(fromDateString, toDateString, category);
model.addAttribute("alldata", alldata);
model.addAttribute("category", category);
model.addAttribute("fromdate", fromDate);
model.addAttribute("todate", toDate);
return "allreports";
}
@PostMapping(value = {"/kynreport"})
public String kynreport(
@RequestParam("fromDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate fromDate,
@RequestParam("toDate") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate toDate,
@RequestParam("category") int category,
Model model) {
if (!isLoggedIn()) {
return "redirect:/volunteer/kynreportlogin";
}
LocalDateTime fromDateTime = fromDate.atStartOfDay();
LocalDateTime toDateTime = toDate.atTime(23, 59, 59);
String fromDateString = fromDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
String toDateString = toDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
List<Map<String, Object>> reportData = volunteerRegistrationService.getKynReport(fromDateString, toDateString, category);
model.addAttribute("fromdate", fromDate);
model.addAttribute("todate", toDate);
model.addAttribute("reportData", reportData);
model.addAttribute("category", category);
return "kynreport";
}
@GetMapping(value = {"/kynreportlogin"})
public String kynreportlogin(Model model) {
return "kynreportlogin";
} }
} }

65
src/main/java/com/volunteersregistration/entity/Category.java

@ -1,65 +0,0 @@
//package com.volunteersregistration.entity;
//
//import com.fasterxml.jackson.annotation.JsonIgnore;
//import jakarta.persistence.*;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Entity
//public class Category {
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private int cat_id;
//
// @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "category", orphanRemoval = true)
// private List<SubCategory> subCategory = new ArrayList<>();
//
// private String name;
// private String catCode;
//
// // Add helper methods to synchronize both sides of the relationship
// public void addSubCategory(SubCategory subCategory) {
// this.subCategory.add(subCategory);
// subCategory.setCategory(this); // Synchronize relationship
// }
//
// public void removeSubCategory(SubCategory subCategory) {
// this.subCategory.remove(subCategory);
// subCategory.setCategory(null); // Break the relationship
// }
//
// // Getters and Setters
// public int getCat_id() {
// return cat_id;
// }
//
// public void setCat_id(int cat_id) {
// this.cat_id = cat_id;
// }
//
// public List<SubCategory> getSubCategory() {
// return subCategory;
// }
//
// public void setSubCategory(List<SubCategory> subCategory) {
// this.subCategory = subCategory;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCatCode() {
// return catCode;
// }
//
// public void setCatCode(String catCode) {
// this.catCode = catCode;
// }
//}

43
src/main/java/com/volunteersregistration/entity/LoginDetail.java

@ -0,0 +1,43 @@
package com.volunteersregistration.entity;
import jakarta.annotation.Generated;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class LoginDetail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private long mobileno;
private String pin;
private String usertype;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public long getMobileno() {
return mobileno;
}
public void setMobileno(long mobileno) {
this.mobileno = mobileno;
}
public String getPin() {
return pin;
}
public void setPin(String pin) {
this.pin = pin;
}
public String getUsertype() {
return usertype;
}
public void setUsertype(String usertype) {
this.usertype = usertype;
}
}

51
src/main/java/com/volunteersregistration/entity/SubCategory.java

@ -1,51 +0,0 @@
//package com.volunteersregistration.entity;
//
//import com.fasterxml.jackson.annotation.JsonIgnore;
//import jakarta.persistence.*;
//
//@Entity
//public class SubCategory {
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private int sub_id;
//
// private String desc;
// private String subCatCode;
//
// @ManyToOne(fetch = FetchType.LAZY)
// @JoinColumn(name = "cat_id") // Specify the join column for clarity
// private Category category;
//
// // Getters and Setters
// public int getSub_id() {
// return sub_id;
// }
//
// public void setSub_id(int sub_id) {
// this.sub_id = sub_id;
// }
//
// public String getDesc() {
// return desc;
// }
//
// public void setDesc(String desc) {
// this.desc = desc;
// }
//
// public String getSubCatCode() {
// return subCatCode;
// }
//
// public void setSubCatCode(String subCatCode) {
// this.subCatCode = subCatCode;
// }
//
// public Category getCategory() {
// return category;
// }
//
// public void setCategory(Category category) {
// this.category = category;
// }
//}

402
src/main/java/com/volunteersregistration/entity/VolunteerInformation.java

@ -9,204 +9,211 @@ import java.util.List;
@Entity @Entity
public class VolunteerInformation { public class VolunteerInformation {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int volunteer_id;
private String name;
private String email;
private LocalDate dob;
private String gender;
private long mobile_no;
private long landline_no;
private String district;
private String address;
private int pin_code;
private String degree;
private String college_name;
private boolean vol_nss;
private boolean vol_ncc;
private String occupation;
private String designation;
private String ngo_associated;
private boolean previous_volunteered;
private boolean isactive;
private LocalDateTime cdate;
private String category;
private String subCategory;
private String referBy;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int volunteer_id;
private String name;
private String email;
private LocalDate dob;
private String gender;
private long mobile_no;
private long landline_no;
private String district;
private String address;
private int pin_code;
private String degree;
private String college_name;
private boolean vol_nss;
private boolean vol_ncc;
private String occupation;
private String designation;
private String ngo_associated;
private boolean previous_volunteered;
private boolean isactive;
private LocalDateTime cdate;
private String category;
private String subCategory;
private String referBy;
// @OneToMany // @OneToMany
// private List<SubCategory> subCategories; // private List<SubCategory> subCategories;
@Column(length = 1000)
private String preferred_area;
private String preferred_zones;
@Column(length = 1000)
private String preferred_area;
private String preferred_zones;
@Transient
private String preferredAreas[];
@Transient
private String preferredAreas[];
private String aadhar;
private String bloodgroup;
public int getVolunteer_id() {
return volunteer_id;
}
public int getVolunteer_id() {
return volunteer_id;
}
public void setVolunteer_id(int volunteer_id) {
this.volunteer_id = volunteer_id;
}
public void setVolunteer_id(int volunteer_id) {
this.volunteer_id = volunteer_id;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void setEmail(String email) {
this.email = email;
}
public LocalDate getDob() {
return dob;
}
public LocalDate getDob() {
return dob;
}
public void setDob(LocalDate dob) {
this.dob = dob;
}
public void setDob(LocalDate dob) {
this.dob = dob;
}
public String getGender() {
return gender;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public long getMobile_no() {
return mobile_no;
}
public long getMobile_no() {
return mobile_no;
}
public void setMobile_no(long mobile_no) {
this.mobile_no = mobile_no;
}
public void setMobile_no(long mobile_no) {
this.mobile_no = mobile_no;
}
public long getLandline_no() {
return landline_no;
}
public long getLandline_no() {
return landline_no;
}
public void setLandline_no(long landline_no) {
this.landline_no = landline_no;
}
public void setLandline_no(long landline_no) {
this.landline_no = landline_no;
}
public String getDistrict() {
return district;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getAddress() {
return address;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public void setAddress(String address) {
this.address = address;
}
public int getPin_code() {
return pin_code;
}
public int getPin_code() {
return pin_code;
}
public void setPin_code(int pin_code) {
this.pin_code = pin_code;
}
public void setPin_code(int pin_code) {
this.pin_code = pin_code;
}
public String getDegree() {
return degree;
}
public String getDegree() {
return degree;
}
public void setDegree(String degree) {
this.degree = degree;
}
public void setDegree(String degree) {
this.degree = degree;
}
public String getCollege_name() {
return college_name;
}
public String getCollege_name() {
return college_name;
}
public void setCollege_name(String college_name) {
this.college_name = college_name;
}
public void setCollege_name(String college_name) {
this.college_name = college_name;
}
public boolean isVol_nss() {
return vol_nss;
}
public boolean isVol_nss() {
return vol_nss;
}
public void setVol_nss(boolean vol_nss) {
this.vol_nss = vol_nss;
}
public void setVol_nss(boolean vol_nss) {
this.vol_nss = vol_nss;
}
public boolean isVol_ncc() {
return vol_ncc;
}
public boolean isVol_ncc() {
return vol_ncc;
}
public void setVol_ncc(boolean vol_ncc) {
this.vol_ncc = vol_ncc;
}
public void setVol_ncc(boolean vol_ncc) {
this.vol_ncc = vol_ncc;
}
public String getOccupation() {
return occupation;
}
public String getOccupation() {
return occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation;
}
public String getDesignation() {
return designation;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public String getNgo_associated() {
return ngo_associated;
}
public String getNgo_associated() {
return ngo_associated;
}
public void setNgo_associated(String ngo_associated) {
this.ngo_associated = ngo_associated;
}
public void setNgo_associated(String ngo_associated) {
this.ngo_associated = ngo_associated;
}
public boolean isPrevious_volunteered() {
return previous_volunteered;
}
public boolean isPrevious_volunteered() {
return previous_volunteered;
}
public void setPrevious_volunteered(boolean previous_volunteered) {
this.previous_volunteered = previous_volunteered;
}
public void setPrevious_volunteered(boolean previous_volunteered) {
this.previous_volunteered = previous_volunteered;
}
public boolean isIsactive() {
return isactive;
}
public boolean isIsactive() {
return isactive;
}
public void setIsactive(boolean isactive) {
this.isactive = isactive;
}
public void setIsactive(boolean isactive) {
this.isactive = isactive;
}
public LocalDateTime getCdate() {
return cdate;
}
public LocalDateTime getCdate() {
return cdate;
}
public void setCdate(LocalDateTime cdate) {
this.cdate = cdate;
}
public void setCdate(LocalDateTime cdate) {
this.cdate = cdate;
}
// public List<SubCategory> getSubCategories() { // public List<SubCategory> getSubCategories() {
// return subCategories; // return subCategories;
@ -216,51 +223,68 @@ public class VolunteerInformation {
// this.subCategories = subCategories; // this.subCategories = subCategories;
// } // }
public String getPreferred_area() {
return preferred_area;
}
public String getPreferred_area() {
return preferred_area;
}
public void setPreferred_area(String preferred_area) {
this.preferred_area = preferred_area;
}
public String getPreferred_zones() {
return preferred_zones;
}
public void setPreferred_zones(String preferred_zones) {
this.preferred_zones = preferred_zones;
}
public String[] getPreferredAreas() {
return preferredAreas;
}
public void setPreferred_area(String preferred_area) {
this.preferred_area = preferred_area;
}
public void setPreferredAreas(String[] preferredAreas) {
this.preferredAreas = preferredAreas;
}
public String getPreferred_zones() {
return preferred_zones;
}
public String getCategory() {
return category;
}
public void setPreferred_zones(String preferred_zones) {
this.preferred_zones = preferred_zones;
}
public void setCategory(String category) {
this.category = category;
}
public String[] getPreferredAreas() {
return preferredAreas;
}
public String getSubCategory() {
return subCategory;
}
public void setPreferredAreas(String[] preferredAreas) {
this.preferredAreas = preferredAreas;
}
public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}
public String getCategory() {
return category;
}
public String getReferBy() {
return referBy;
}
public void setCategory(String category) {
this.category = category;
}
public void setReferBy(String referBy) {
this.referBy = referBy;
}
public String getSubCategory() {
return subCategory;
}
public String getAadhar() {
return aadhar;
}
public void setSubCategory(String subCategory) {
this.subCategory = subCategory;
}
public void setAadhar(String aadhar) {
this.aadhar = aadhar;
}
public String getReferBy() {
return referBy;
}
public String getBloodgroup() {
return bloodgroup;
}
public void setReferBy(String referBy) {
this.referBy = referBy;
}
public void setBloodgroup(String bloodgroup) {
this.bloodgroup = bloodgroup;
}
} }

19
src/main/java/com/volunteersregistration/repository/CompanyInfoRepo.java

@ -1,9 +1,26 @@
package com.volunteersregistration.repository; package com.volunteersregistration.repository;
import com.volunteersregistration.entity.CorporateInformation; import com.volunteersregistration.entity.CorporateInformation;
import com.volunteersregistration.entity.VolunteerInformation;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface CompanyInfoRepo extends JpaRepository<CorporateInformation,Integer> {
public interface CompanyInfoRepo extends JpaRepository<CorporateInformation, Integer> {
@Query(value = "SELECT * FROM corporate_information c " + "WHERE c.refer_by = :referBy "
+ "AND DATE(c.cdate) >= :fromDate " + "AND DATE(c.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByReferByAndDateRange(@Param("referBy") String referBy,
@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value = "SELECT * FROM corporate_information c " + "WHERE DATE(c.cdate) >= :fromDate "
+ "AND DATE(c.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByDateRange(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
} }

12
src/main/java/com/volunteersregistration/repository/LoginDetailRepo.java

@ -0,0 +1,12 @@
package com.volunteersregistration.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.volunteersregistration.entity.LoginDetail;
public interface LoginDetailRepo extends JpaRepository<LoginDetail, Integer> {
@Query(value = "SELECT * FROM login_detail WHERE mobileno= :mobileno and pin=:pin",nativeQuery = true)
LoginDetail checkUser(long mobileno,String pin);
}

19
src/main/java/com/volunteersregistration/repository/NgoInfoRepo.java

@ -1,10 +1,27 @@
package com.volunteersregistration.repository; package com.volunteersregistration.repository;
import com.volunteersregistration.entity.NgoInformation; import com.volunteersregistration.entity.NgoInformation;
import com.volunteersregistration.entity.VolunteerInformation;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface NgoInfoRepo extends JpaRepository<NgoInformation,Integer> {
public interface NgoInfoRepo extends JpaRepository<NgoInformation, Integer> {
@Query(value = "SELECT * FROM ngo_information n " + "WHERE n.refer_by = :referBy "
+ "AND DATE(n.cdate) >= :fromDate " + "AND DATE(n.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByReferByAndDateRange(@Param("referBy") String referBy,
@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value = "SELECT * FROM ngo_information n " + "WHERE DATE(n.cdate) >= :fromDate "
+ "AND DATE(n.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByDateRange(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
} }

17
src/main/java/com/volunteersregistration/repository/VolunteerRegistrationRepo.java

@ -1,9 +1,26 @@
package com.volunteersregistration.repository; package com.volunteersregistration.repository;
import com.volunteersregistration.entity.VolunteerInformation; import com.volunteersregistration.entity.VolunteerInformation;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface VolunteerRegistrationRepo extends JpaRepository<VolunteerInformation, Integer> { public interface VolunteerRegistrationRepo extends JpaRepository<VolunteerInformation, Integer> {
@Query(value = "SELECT * FROM volunteer_information v " + "WHERE v.refer_by = :referBy "
+ "AND DATE(v.cdate) >= :fromDate " + "AND DATE(v.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByReferByAndDateRange(@Param("referBy") String referBy,
@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value = "SELECT * FROM volunteer_information v " + "WHERE DATE(v.cdate) >= :fromDate "
+ "AND DATE(v.cdate) < :toDate", nativeQuery = true)
List<Map<String, Object>> findByDateRange(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
} }

90
src/main/java/com/volunteersregistration/service/Registrationservice.java

@ -1,90 +0,0 @@
package com.volunteersregistration.service;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@Service
public class Registrationservice {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private Environment environment;
@Autowired
public void setDataSource(@Qualifier("volunteers") DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public List<Map<String, Object>> saveRegistration(String name, String mobileNo, String address, MultipartFile adhaarFile, MultipartFile vehicleRcBookFile) throws IOException {
// Define directory paths from application.properties
String adhaarDir = environment.getProperty("cdwaste_adhaar_foldername");
String rcBookDir = environment.getProperty("cdwaste_rc_foldername");
// Ensure directories exist
File adhaarFolder = new File(adhaarDir);
File rcBookFolder = new File(rcBookDir);
if (!adhaarFolder.exists()) {
adhaarFolder.mkdirs();
}
if (!rcBookFolder.exists()) {
rcBookFolder.mkdirs();
}
// Generate unique file names to avoid overwriting existing files
String adhaarFileName = adhaarFile.getOriginalFilename();
String rcBookFileName = vehicleRcBookFile.getOriginalFilename();
// Paths where files will be stored
String adhaarFilePath = adhaarFolder.getAbsolutePath() + File.separator + adhaarFileName;
String rcBookFilePath = rcBookFolder.getAbsolutePath() + File.separator + rcBookFileName;
// Save the files to the specified directories
adhaarFile.transferTo(new File(adhaarFilePath));
vehicleRcBookFile.transferTo(new File(rcBookFilePath));
// File URLs to be saved in the database (adjust as per your URL structure)
String adhaarUrl = "/uploads/" + adhaarFileName;
String rcBookUrl = "/uploads/" + rcBookFileName;
// SQL INSERT query (saving URLs)
String sqlQuery = "INSERT INTO registration (name, mobile_no, address, adhaar, vehicle_rc_book) VALUES (?, ?, ?, ?, ?)";
int rowsAffected = jdbcTemplate.update(sqlQuery, name, mobileNo, address, adhaarUrl, rcBookUrl);
// Prepare the response
List<Map<String, Object>> response = new ArrayList<>();
Map<String, Object> result = new HashMap<>();
if (rowsAffected > 0) {
result.put("status", "success");
result.put("message", "Collector registered successfully!");
} else {
result.put("status", "error");
result.put("message", "No rows affected. Registration failed!");
}
response.add(result);
return response;
}
}

30
src/main/java/com/volunteersregistration/service/VolunteerRegistrationService.java

@ -9,7 +9,11 @@ import com.volunteersregistration.repository.VolunteerRegistrationRepo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
@Service @Service
@ -125,4 +129,30 @@ public class VolunteerRegistrationService {
} }
return "error"; return "error";
} }
public List<Map<String, Object>> getKynReport(String fromDate, String toDate, int category) {
if (category == 0) {
return volunteerRegistrationRepo.findByReferByAndDateRange("kyn", fromDate, toDate);
} else if (category == 1) {
return companyInfoRepo.findByReferByAndDateRange("kyn", fromDate, toDate);
} else if (category == 2) {
return ngoInfoRepo.findByReferByAndDateRange("kyn", fromDate, toDate);
}
return new ArrayList<>();
}
public List<Map<String, Object>> getAllReport(String fromDate, String toDate, int category) {
if (category == 3) {
return volunteerRegistrationRepo.findByDateRange(fromDate, toDate);
} else if (category == 4) {
return companyInfoRepo.findByDateRange(fromDate, toDate);
} else if (category == 5) {
return ngoInfoRepo.findByDateRange(fromDate, toDate);
}
return new ArrayList<>();
}
} }

521
src/main/java/com/volunteersregistration/wasteCollector/controller/ApiController.java

@ -0,0 +1,521 @@
package com.volunteersregistration.wasteCollector.controller;
import java.io.IOException;
import java.security.SecureRandom;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Random;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.zxing.WriterException;
import com.razorpay.Order;
import com.razorpay.RazorpayClient;
import com.razorpay.RazorpayException;
import com.volunteersregistration.config.AppConfigur;
import com.volunteersregistration.config.AppConstants;
import com.volunteersregistration.config.QRCodeGenerator;
import com.volunteersregistration.config.UserSession;
import com.volunteersregistration.entity.LoginDetail;
import com.volunteersregistration.repository.LoginDetailRepo;
import com.volunteersregistration.wasteCollector.entity.Cdlicense;
import com.volunteersregistration.wasteCollector.entity.Orderslogs;
import com.volunteersregistration.wasteCollector.entity.Payments;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration.Application_status;
import com.volunteersregistration.wasteCollector.repository.CdlicenseRepository;
import com.volunteersregistration.wasteCollector.repository.OderLogsRepo;
import com.volunteersregistration.wasteCollector.repository.PaymentsRepo;
//import com.volunteersregistration.service.WasteRegistrationService;
import com.volunteersregistration.wasteCollector.repository.WasteRegistrationRepo;
import com.volunteersregistration.wasteCollector.service.WasteRegistrationService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
@RestController
@RequestMapping("/volunteer/wastecollectors/api")
public class ApiController {
@Autowired
private HttpSession session;
@Autowired
private Environment environment;
@Autowired
private LoginDetailRepo logindetailrepo;
@Autowired
private UserSession usersession;
@Autowired
private AppConfigur appConfig;
@Autowired
private WasteRegistrationRepo wasteregistrationrepo;
@Autowired
private WasteRegistrationService registrationService;
@Autowired
private OderLogsRepo oderlogrepo;
@Autowired
private PaymentsRepo paymentsrepo;
@Autowired
private CdlicenseRepository cdlicenserepo;
// public ApiController(WasteRegistrationService registrationService,WasteRegistrationRepo wasteregistrationrepo) {
// this.registrationService = registrationService;
// this.wasteregistrationrepo = wasteregistrationrepo;
// }
//
@PostMapping("/register")
public ResponseEntity<String> registerWasteCollector(
@RequestParam("name") String name,
@RequestParam("mobileNo") String mobileNo,
@RequestParam("address") String address,
@RequestParam("adhaar") MultipartFile adhaarFile,
@RequestParam("vehicletype") String vehicletype,
@RequestParam(value = "leasedocFile", required = false) MultipartFile leasedocFile,
@RequestParam("userphoto") MultipartFile userPhotoFile,
@RequestParam(value = "rcbook") MultipartFile rcbookFile,
@RequestParam("vehicle_num") String vehicle_num
) {
try {
// Check if vehicle_num already exists
Optional<WasteRegistration> existingVehicle = wasteregistrationrepo.findByVehicleNum(vehicle_num);
if (existingVehicle.isPresent()) {
WasteRegistration registrations = existingVehicle.get();
Application_status applicationStatus = registrations.getApplicationstatus();
Long registerId = registrations.getRegister_id();
// Check the application status and return an appropriate message
if (applicationStatus == Application_status.PENDING) {
return ResponseEntity.ok("pending");
} else if (applicationStatus == Application_status.APPROVED) {
return ResponseEntity.ok("approved");
}
}
SecureRandom secureRandom = new SecureRandom();
// Get the current date and time
LocalDateTime now = LocalDateTime.now();
// Format the date to extract year, month, day, and seconds
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMddss"); // Year (2 digits), Month, Day, Seconds
String dateTimePart = now.format(formatter); // Example: "24102345" for 2024-10-23 and 45 seconds
// Generate a random 2-digit number to fill the remaining digits
int randomPart = secureRandom.nextInt(9000) + 1000;// Generates a 4-digit number between 0 and 99
// Combine the dateTimePart and randomPart to form the 10-digit number
String randomNumber = dateTimePart + String.format("%02d",randomPart);
// Create WasteRegistration object
WasteRegistration registration = new WasteRegistration();
registration.setName(name);
registration.setMobileNo(mobileNo);
registration.setAddress(address);
registration.setVehicletype(vehicletype);
registration.setVehicle_num(vehicle_num);
registration.setReference_num(randomNumber);
// Set current date and time for cdate
registration.setCdate(LocalDateTime.now());
// Call service method to save the form data
registrationService.saveWasteRegistration(registration, adhaarFile, leasedocFile, userPhotoFile,rcbookFile);
String register_id=String.valueOf(registration.getRegister_id());
return ResponseEntity.ok(register_id);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error registering waste collector: " + e.getMessage());
}
}
//for login
@GetMapping(value = "/login")
public String login(HttpServletRequest request, @RequestParam String uname, @RequestParam String upass) {
LoginDetail ld = logindetailrepo.checkUser(Long.parseLong(uname), upass);
if (ld != null) {
session.setAttribute("userId", ld.getId()); // Store user in session
session.setAttribute("mobNo", ld.getMobileno());
session.setAttribute("userType", ld.getUsertype());
return ld.getUsertype(); // Return user type to redirect appropriately
} else {
return "Error"; // Return error if login fails
}
}
@GetMapping(value = "/sendOTP")
public String sendOtp(HttpServletRequest request, @RequestParam String mobile) {
// Create an ObjectMapper instance
ObjectMapper objectMapper = new ObjectMapper();
// Check if mobile number is already registered
List<WasteRegistration> registrations = wasteregistrationrepo.findByMobileNo(mobile);
// Create a response map
Map<String, Object> response = new HashMap<>();
if (registrations.isEmpty()) {
// If mobile number is not registered
response.put("status", "NOT_REGISTERED");
response.put("mobile", mobile); // Return the mobile number
try {
return objectMapper.writeValueAsString(response); // Use the instance to convert map to JSON string
} catch (Exception e) {
// Handle JSON conversion error
return "{\"status\": \"ERROR\", \"message\": \"Could not convert response to JSON.\"}";
}
}
String MobileNo=mobile;
System.out.print("\n MobileNo---:"+mobile);
Random rand = new Random();
int otp = rand.nextInt(90000) + 10000;
System.out.print("\n otp---:"+otp);
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MMM-yyyy%20HH:mm");
LocalDateTime now = LocalDateTime.now();
System.out.println(dtf.format(now));
//String generatedToken = "Welcome to GCC! Your OTP for C%26D waste collectors Registration process is "+otp;
//String generatedToken = "Welcome to GCC "+otp+" is your OTP for gcc QR System";
String generatedToken = "Welcome to GCC! Your OTP for C and D waste collectors Registration process is " + otp;
// String key="qxg4mklD";
String key="pfTEYN6H";
String urlString= appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407172967243483268";
//String urlString = "https://tmegov.onex-aura.com/api/sms?from=GCCCRP&key=pfTEYN6H&sender=GCCCRP&to=9360777472&body=Welcome%20to%20GCC!%20Your%20OTP%20for%20C%26D%20waste%20collectors%20Registration%20process%20is%20"+otp+"&entityid=1401572690000011081&templateid=1407172959127552127";
//String urlString= appConfig.getGetOtpUrl()+"from=GCCCRP&key="+key+"&sender=GCCCRP&to="+MobileNo+"&body="+generatedToken+"&entityid=1401572690000011081&templateid=1407168250479102852";
// String urlString=appConfig.getGetOtpUrl()+"user=GCCtrans&authkey=92kOC1RBGBIws&sender=GCCCRP&mobile="+MobileNo+"&text="+generatedToken+"&rpt=1&summary=1&output=json&entityid=1401572690000011081&templateid=1407168250479102852";
System.out.print("\n urlString---: "+urlString);
String bodyMessage = "";
try {
RestTemplate restTemplate = new RestTemplate();
String Response = restTemplate.getForObject(urlString, String.class);
bodyMessage=Response;
System.out.println("\n bodyMessage"+bodyMessage);
System.out.println("OTP sent successfully!");
} catch (Exception e) {
System.out.print("ERROR---: "+e);
bodyMessage = "Error";
}
HttpSession session = request.getSession();
session.setAttribute("otp", otp);
return bodyMessage;
}
@GetMapping(value = "/verifyOTP")
public String verifyOtp(HttpServletRequest request, @RequestParam String otp) {
HttpSession session = request.getSession();
try {
Integer session_otp = (Integer) session.getAttribute("otp");
System.out.println("session_otp---:" + session_otp);
Integer entered_otp = Integer.parseInt(otp);
if (session_otp != null && session_otp.equals(entered_otp)) {
System.out.println("Entered OTP Correct");
session.setAttribute("verifiedotp", "success");
return "Success";
} else {
System.out.println("Incorrect OTP. Please enter correct OTPs.");
session.setAttribute("verifiedotp", "error");
return "Error";
}
} catch (NumberFormatException e) {
System.out.println("Invalid OTP format: " + otp);
return "Error";
} catch (Exception e) {
System.out.println("Error verifying OTP: " + e.getMessage());
return "Error";
}
}
@GetMapping(value = "/findIdByMobileNo")
public String findIdByMobileNo(@RequestParam String mobileNumber)
{
List<String> registerIds = wasteregistrationrepo.getIdByMobileno(mobileNumber);
if (!registerIds.isEmpty()) {
return registerIds.get(0); // Return the first register_id
} else {
return null; // Handle cases where no register_id is found
}
}
@PostMapping("/accept")
public ResponseEntity<Map<String, String>> acceptuserById(@RequestParam("registerId") Long registerId) {
int rowsAffected = registrationService.updateUseraccept(registerId);
// Fetch the WasteRegistration entity by registerId to get cdate
WasteRegistration waste = wasteregistrationrepo.findByRegisterId(registerId);
if (waste == null) {
Map<String, String> errorResponse = new HashMap<>();
errorResponse.put("status", "error");
errorResponse.put("message", "No WasteRegistration found for RegisterId: " + registerId);
return ResponseEntity.ok(errorResponse);
}
// Get the creation date (cdate) from the retrieved WasteRegistration
LocalDateTime cdate = waste.getCdate();
// Extract the year from cdate for firstnum
int firstnum = cdate.getYear();
Cdlicense cdlicense= new Cdlicense();
cdlicense.setCdate(LocalDateTime.now());
cdlicense.setRegister_id(registerId);
String formattedRegisterId = String.format("%05d", registerId);
cdlicense.setLicense_num(firstnum + "/" + formattedRegisterId);
cdlicenserepo.save(cdlicense);
Map<String, String> response = new HashMap<>();
if (rowsAffected > 0) {
response.put("status", "success");
response.put("message", "Approved RegisterId: " + registerId + " Successfully!");
} else {
response.put("status", "error");
response.put("message", "No records were updated.");
}
return ResponseEntity.ok(response);
}
@PostMapping("/reject")
public ResponseEntity<Map<String, String>> rejectuserById(@RequestParam("registerId") Long registerId,@RequestParam("reason")String reason) {
int rowsAffected = registrationService.updateUserreject(reason,registerId);
Map<String, String> response = new HashMap<>();
if (rowsAffected > 0) {
response.put("status", "success");
response.put("message", "Rejected RegisterId: " + registerId + " Successfully!");
} else {
response.put("status", "error");
response.put("message", "No records were updated.");
}
return ResponseEntity.ok(response);
}
@GetMapping("/generateQRCode")
public ResponseEntity<String> generateQRCodeForUser(@RequestParam("registerId") String registerId) {
try {
// Base URL and full URL construction
// String baseUrl = "https://gccservices.chennaicorporation.gov.in/volunteer/wastecollectors";
String baseUrl ="http://localhost:8071/volunteer/wastecollectors";
String refNum=wasteregistrationrepo.getreferencenumbyid(registerId);
String fullUrl = baseUrl + "/viewidcard?register_id=" + refNum; // Full URL
// Log the generated full URL for debugging
System.out.println("Generated Full URL for QR Code: " + baseUrl);
// Generate the QR code with the full URL
String qrCodeImage = QRCodeGenerator.generateQRCode(baseUrl, refNum);
String dataUri = qrCodeImage; // Encode QR code image as Base64
// Return the QR code image as a Base64 string
return ResponseEntity.ok(dataUri);
} catch (WriterException | IOException e) {
e.printStackTrace();
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error generating QR code");
}
}
@GetMapping("/getuserbyid")
@ResponseBody
public ResponseEntity<List<Map<String, Object>>> getUserDetails(@RequestParam("registerId") Long registerId) {
// Assuming a service method to fetch the data by register_id
List<Map<String, Object>> userDetails = registrationService.getUserDetailsById(registerId);
System.out.println(userDetails);
return ResponseEntity.ok(userDetails);
}
@GetMapping("/getuserdetails")
@ResponseBody
public ResponseEntity<List<Map<String, Object>>> getUserDetails() {
// Assuming a service method to fetch the data by register_id
List<Map<String, Object>> userDetails = registrationService.getUserDetails();
System.out.println(userDetails);
return ResponseEntity.ok(userDetails);
}
@GetMapping("/approvedlist")
@ResponseBody
public ResponseEntity<List<Map<String, Object>>> viewapprovedList() {
// Assuming a service method to fetch the data by register_id
List<Map<String, Object>> approvedDetails = registrationService.viewapprovedList();
System.out.println(approvedDetails);
return ResponseEntity.ok(approvedDetails);
}
@GetMapping("/rejectedlist")
@ResponseBody
public ResponseEntity<List<Map<String, Object>>> viewRejectedList() {
// Assuming a service method to fetch the data by register_id
List<Map<String, Object>> rejectedDetails = registrationService.viewRejectedList();
System.out.println(rejectedDetails);
return ResponseEntity.ok(rejectedDetails);
}
@PostMapping("/create_order")
@ResponseBody
public String createOrder(@RequestBody Map<String,Object> data,HttpServletRequest request) throws RazorpayException {
System.out.println("key ID :-----"+appConfig.getKeyId());
long reg_id= Long.parseLong(data.get("id")+"");
Optional<WasteRegistration> byId = wasteregistrationrepo.findById(reg_id);
if(byId.isPresent()) {
WasteRegistration waste = byId.get();
if(waste.getApplicationstatus() == WasteRegistration.Application_status.PENDING) {
int amount=registrationService.getamount();
System.out.println(" amount :-----"+amount);
//To enable testing mode in appConstants if required for testing & development
var client = new RazorpayClient(AppConstants.key_id,AppConstants.key_secret);
JSONObject options = new JSONObject();
options.put("amount", amount*100);
options.put("currency", "INR");
// options.put("receipt","Pet_ID/"+pet_id);
Order od=client.orders.create( options);
Orderslogs or = new Orderslogs();
or.setOrder_id(od.get("id"));
or.setOrder_info(od.toString());
//or.setUniqueid(pet_id);
or.setUpdated_date(LocalDateTime.now());
or.setReceipt_id(String.valueOf(reg_id));
or.setWasteRegistration(waste);
Orderslogs order = oderlogrepo.save(or);
System.out.println(od);
request.setAttribute("orderId", order.getId());
return od.toString();
}
}
return "error";
}
@PostMapping("/Confirm")
public ResponseEntity<?> updateOrder(@RequestBody Map<String,Object> data,HttpServletRequest request){
System.out.println("confirm:--------------------:"+data.get("payment_id").toString());
long reg_id= Long.parseLong(data.get("id")+"");
System.out.println("reg_id--------------------------:"+reg_id);
Optional<WasteRegistration> byId = wasteregistrationrepo.findById(reg_id);
int orderId = 0;
Orderslogs order= null;
try {
orderId = (int)request.getAttribute("orderId");
System.out.println("orderId:-----------"+orderId);
}catch(Exception e) {
orderId =1;
}
if(byId.isPresent()) {
System.out.println("update........................."+byId.get().getRegister_id());
WasteRegistration waste = byId.get();
Optional<Orderslogs> byId2 = oderlogrepo.findById(orderId);
Orderslogs orderid =byId2.get();
int amount=registrationService.getamount();
String pay_id= data.get("payment_id").toString();
String order_id=data.get("order_id").toString();
String status=data.get("status").toString();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
LocalDateTime now = LocalDateTime.now();
System.out.println(data);
Payments pay = new Payments();
pay.setAmountReceived(amount);
pay.setTransactionId(pay_id);
pay.setCdate(now);
pay.setPaymentStatus(status);
// pay.setWasteRegistration(waste);
// pay.setOrderslogs(orderid);
pay.setWaste_registration_id(reg_id);
Thread payThred= new Thread(() -> {
paymentsrepo.save(pay);
});
payThred.start();
waste.setPaymentstatus(WasteRegistration.Payment_status.COMPLETED);
wasteregistrationrepo.save(waste);
return ResponseEntity.ok(Map.of("msg","updated"));
}
return ResponseEntity.ok(Map.of("error","not_updated"));
}
@GetMapping("/getrefno")
public ResponseEntity<String> getreferencenumbyid(@RequestParam("register_id") String register_id) {
String refnum=registrationService.getreferencenumbyid(register_id);
return ResponseEntity.ok(refnum);
}
}

173
src/main/java/com/volunteersregistration/wasteCollector/controller/MainController.java

@ -0,0 +1,173 @@
package com.volunteersregistration.wasteCollector.controller;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.volunteersregistration.config.UserSession;
import com.volunteersregistration.service.VolunteerRegistrationService;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration.Application_status;
import com.volunteersregistration.wasteCollector.repository.CdlicenseRepository;
import com.volunteersregistration.wasteCollector.repository.WasteRegistrationRepo;
import com.volunteersregistration.wasteCollector.service.WasteRegistrationService;
import jakarta.servlet.http.HttpSession;
@Controller
@RequestMapping("/volunteer/wastecollectors")
public class MainController {
@Autowired
private HttpSession session;
@Autowired
public VolunteerRegistrationService volunteerRegistrationService;
@Autowired
private WasteRegistrationRepo registrationRepo;
@Autowired
private WasteRegistrationService registrationService;
@Autowired
private CdlicenseRepository cdlicenserepo;
@GetMapping(value = { "/", "", "/index" })
public String index(Model model) {
return "modules/wastecollectors/index";
}
// Register pages of C & D Waste Pages
@GetMapping("/register")
public String wastecollectorsregister(Model model) {
return "modules/wastecollectors/register";
}
// Status pages of C & D Waste Pages
@GetMapping("/status")
public String wastecollectorsstatus(Model model) {
return "modules/wastecollectors/otp";
}
// User pages of C & D Waste Pages
@GetMapping("/userdetail")
public String wastecollectorsnew(Model model, @RequestParam("register_id") String reference_num) {
WasteRegistration refnum=registrationRepo.findByReferenceNum(reference_num);
if (refnum == null) {
// If not found, add a message to the model and return a specific view
model.addAttribute("message", "Sorry, your details not found...");
return "modules/wastecollectors/noidcard"; // A different page to show the message
}
String mobile_num=registrationRepo.getmobilenumByRefnum(reference_num);
List<Map<String,Object>> userdetails=registrationRepo.getlistbymobileno(mobile_num);
int amount=registrationService.getamount();
model.addAttribute("userdetails", userdetails);
model.addAttribute("amount", amount);
return "modules/wastecollectors/userdetail";
}
@GetMapping("/viewreceipt")
public String viewreceipt(Model model,@RequestParam("register_id") String reference_num)
{
WasteRegistration refnum=registrationRepo.findByReferenceNum(reference_num);
if (refnum == null) {
// If not found, add a message to the model and return a specific view
model.addAttribute("message", "Sorry, your details not found...");
return "modules/wastecollectors/noidcard"; // A different page to show the message
}
String register_id=registrationRepo.getregisterIdbyref(reference_num);
List<Map<String, Object>> payment = registrationRepo.viewPaymentDetails(register_id);
// Check if payment exists and if the payment status is PAID
if (payment == null || payment.isEmpty() || !payment.get(0).get("payment_status").toString().equalsIgnoreCase("PAID")) {
// If payment is not completed, show a message
model.addAttribute("message", "Sorry, your payment has not been completed.");
return "modules/wastecollectors/noidcard";
}
List<Map<String, Object>> user=registrationRepo.viewUserDetails(reference_num);
model.addAttribute("user", user);
model.addAttribute("payment", payment);
return "modules/wastecollectors/receipt";
}
@GetMapping("/viewidcard")
public String viewidcard(Model model, @RequestParam("register_id") String reference_num) {
WasteRegistration refnum=registrationRepo.findByReferenceNum(reference_num);
if (refnum == null) {
// If not found, add a message to the model and return a specific view
model.addAttribute("message", "Sorry, your details not found...");
return "modules/wastecollectors/noidcard"; // A different page to show the message
}
// Fetch the register_id based on reference_num
String register_id = registrationRepo.getregisterIdbyref(reference_num);
// Fetch payment details
List<Map<String, Object>> payment = registrationRepo.viewPaymentDetails(register_id);
// Check if payment exists and if the payment status is PAID
if (payment == null || payment.isEmpty() || !payment.get(0).get("payment_status").toString().equalsIgnoreCase("PAID")) {
// If payment is not completed, show a message
model.addAttribute("message", "Sorry, your payment has not been completed.");
return "modules/wastecollectors/noidcard";
}
// Fetch the application status
WasteRegistration registration = registrationRepo.findByReferenceNum(reference_num);
// Check if the application status is APPROVED
if (registration == null || registration.getApplicationstatus() != WasteRegistration.Application_status.APPROVED) {
// If the application is not approved, show a message
model.addAttribute("message", "Sorry, your application may be in process.");
return "modules/wastecollectors/noidcard";
}
// Proceed if both conditions (APPROVED and PAID) are satisfied
List<Map<String, Object>> identity = registrationService.viewIdDetails(register_id);
model.addAttribute("identity", identity);
String licensenum = cdlicenserepo.findlicensenumber(register_id);
model.addAttribute("licensenum", licensenum);
return "modules/wastecollectors/idcard";
}
//List<Map<String,Object>> userdetails=registrationRepo.getAllById(register_id);
}

73
src/main/java/com/volunteersregistration/wasteCollector/entity/Amount.java

@ -0,0 +1,73 @@
package com.volunteersregistration.wasteCollector.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.PrePersist;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import java.util.Date;
@Entity
@Table(name = "cd_amount")
public class Amount {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private double amount;
@Temporal(TemporalType.TIMESTAMP) // Set this field to store as TIMESTAMP
private Date cdate;
private int isactive = 1;
private int isdelete = 0;
// Getters and Setters
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public Date getCdate() {
return cdate;
}
public void setCdate(Date cdate) {
this.cdate = cdate;
}
public int getIsactive() {
return isactive;
}
public void setIsactive(int isactive) {
this.isactive = isactive;
}
public int getIsdelete() {
return isdelete;
}
public void setIsdelete(int isdelete) {
this.isdelete = isdelete;
}
}

59
src/main/java/com/volunteersregistration/wasteCollector/entity/Cdlicense.java

@ -0,0 +1,59 @@
package com.volunteersregistration.wasteCollector.entity;
import java.time.LocalDateTime;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
@Entity
@Table(name = "cdlicense")
public class Cdlicense
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String license_num;
private LocalDateTime cdate;
@Column(name = "register_id")
private long register_id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLicense_num() {
return license_num;
}
public void setLicense_num(String license_num) {
this.license_num = license_num;
}
public LocalDateTime getCdate() {
return cdate;
}
public void setCdate(LocalDateTime cdate) {
this.cdate = cdate;
}
public long getRegister_id() {
return register_id;
}
public void setRegister_id(long register_id) {
this.register_id = register_id;
}
}

119
src/main/java/com/volunteersregistration/wasteCollector/entity/Orderslogs.java

@ -0,0 +1,119 @@
package com.volunteersregistration.wasteCollector.entity;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
@Entity
@Table(name="order_logs")
public class Orderslogs {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String order_id;
//private int uniqueid;
private String order_info;
public String getOrder_info() {
return order_info;
}
public void setOrder_info(String order_info) {
this.order_info = order_info;
}
private String payment_status;
private String receipt_id;
private LocalDateTime updated_date;
@ManyToOne
@JoinColumn(name = "waste_registration_id")
private WasteRegistration wasteRegistration; // ManyToOne relationship to WasteRegistration
/*
* @OneToOne(mappedBy = "orderslogs", cascade = CascadeType.ALL) private
* Payments payment;
*/
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
// public int getUniqueid() {
// return uniqueid;
// }
//
// public void setUniqueid(int uniqueid) {
// this.uniqueid = uniqueid;
// }
public String getPayment_status() {
return payment_status;
}
public void setPayment_status(String payment_status) {
this.payment_status = payment_status;
}
public String getReceipt_id() {
return receipt_id;
}
public void setReceipt_id(String receipt_id) {
this.receipt_id = receipt_id;
}
public LocalDateTime getUpdated_date() {
return updated_date;
}
public void setUpdated_date(LocalDateTime updated_date) {
this.updated_date = updated_date;
}
public WasteRegistration getWasteRegistration() {
return wasteRegistration;
}
public void setWasteRegistration(WasteRegistration wasteRegistration) {
this.wasteRegistration = wasteRegistration;
}
/*
* public Payments getPayment() { return payment; }
*
* public void setPayment(Payments payment) { this.payment = payment; }
*/
}

112
src/main/java/com/volunteersregistration/wasteCollector/entity/Payments.java

@ -0,0 +1,112 @@
package com.volunteersregistration.wasteCollector.entity;
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
@Entity
@Table(name = "payments")
public class Payments {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long payment_id;
@Column(name = "amount_received") // map to the correct column name
private double amountReceived;
@Column(name = "transaction_id") // map to the correct column name
private String transactionId;
@Column(name = "payment_status") // map to the correct column name
private String paymentStatus;
@Column(name = "cdate") // map to the correct column name
private LocalDateTime cdate;
private long waste_registration_id;
public Long getPayment_id() {
return payment_id;
}
public void setPayment_id(Long payment_id) {
this.payment_id = payment_id;
}
public double getAmountReceived() {
return amountReceived;
}
public void setAmountReceived(double amountReceived) {
this.amountReceived = amountReceived;
}
public String getTransactionId() {
return transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
public String getPaymentStatus() {
return paymentStatus;
}
public void setPaymentStatus(String paymentStatus) {
this.paymentStatus = paymentStatus;
}
public LocalDateTime getCdate() {
return cdate;
}
public void setCdate(LocalDateTime cdate) {
this.cdate = cdate;
}
public long getWaste_registration_id() {
return waste_registration_id;
}
public void setWaste_registration_id(long waste_registration_id) {
this.waste_registration_id = waste_registration_id;
}
// public WasteRegistration getWasteRegistration() {
// return wasteRegistration;
// }
//
// public void setWasteRegistration(WasteRegistration wasteRegistration) {
// this.wasteRegistration = wasteRegistration;
// }
//
// public Orderslogs getOrderslogs() {
// return orderslogs;
// }
//
// public void setOrderslogs(Orderslogs orderslogs) {
// this.orderslogs = orderslogs;
// }
//
}

281
src/main/java/com/volunteersregistration/wasteCollector/entity/WasteRegistration.java

@ -0,0 +1,281 @@
package com.volunteersregistration.wasteCollector.entity;
import java.time.LocalDateTime;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
@Entity
@Table(name = "waste_collectors_registration")
public class WasteRegistration {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long register_id;
public enum Application_status {
PENDING,APPROVED,REJECTED
}
public enum Payment_status{
PENDING,COMPLETED
}
private String name;
@Column(name="vehicle_num")
private String vehicle_num;
@Column(name = "mobile_no")
private String mobileNo;
private String address;
private String acceptedby;
private LocalDateTime accepteddate;
private String reason;
private String adhaarurl;
private String leasedocurl;
private String userPhotourl;
private String rcbookurl;
@Transient
private MultipartFile adhaar;
@Transient
private MultipartFile leasedoc;
@Transient
private MultipartFile rcbook;
@Transient
private MultipartFile userPhoto;
private LocalDateTime cdate;
private String vehicletype;
@Column(name="reference_num")
private String reference_num;
public String getReference_num() {
return reference_num;
}
public void setReference_num(String reference_num) {
this.reference_num = reference_num;
}
@Column(name="application_status")
@Enumerated(EnumType.STRING)
private Application_status applicationstatus = Application_status.PENDING;
@Column(name="payment_status")
@Enumerated(EnumType.STRING)
private Payment_status paymentstatus=Payment_status.PENDING;
public Payment_status getPaymentstatus() {
return paymentstatus;
}
public void setPaymentstatus(Payment_status paymentstatus) {
this.paymentstatus = paymentstatus;
}
@Column(name = "isactive",nullable = false)
private int isActive=1;
@Column(name = "isdelete",nullable = false)
private int isDelete=0;
public Long getRegister_id() {
return register_id;
}
public void setRegister_id(Long register_id) {
this.register_id = register_id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVehicle_num() {
return vehicle_num;
}
public void setVehicle_num(String vehicle_num) {
this.vehicle_num = vehicle_num;
}
public String getMobileNo() {
return mobileNo;
}
public void setMobileNo(String mobileNo) {
this.mobileNo = mobileNo;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getAcceptedby() {
return acceptedby;
}
public void setAcceptedby(String acceptedby) {
this.acceptedby = acceptedby;
}
public LocalDateTime getAccepteddate() {
return accepteddate;
}
public void setAccepteddate(LocalDateTime accepteddate) {
this.accepteddate = accepteddate;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getAdhaarurl() {
return adhaarurl;
}
public void setAdhaarurl(String adhaarurl) {
this.adhaarurl = adhaarurl;
}
public String getLeasedocurl() {
return leasedocurl;
}
public void setLeasedocurl(String leasedocurl) {
this.leasedocurl = leasedocurl;
}
public String getUserPhotourl() {
return userPhotourl;
}
public void setUserPhotourl(String userPhotourl) {
this.userPhotourl = userPhotourl;
}
public String getRcbookurl() {
return rcbookurl;
}
public void setRcbookurl(String rcbookurl) {
this.rcbookurl = rcbookurl;
}
public MultipartFile getAdhaar() {
return adhaar;
}
public void setAdhaar(MultipartFile adhaar) {
this.adhaar = adhaar;
}
public MultipartFile getLeasedoc() {
return leasedoc;
}
public void setLeasedoc(MultipartFile leasedoc) {
this.leasedoc = leasedoc;
}
public MultipartFile getRcbook() {
return rcbook;
}
public void setRcbook(MultipartFile rcbook) {
this.rcbook = rcbook;
}
public MultipartFile getUserPhoto() {
return userPhoto;
}
public void setUserPhoto(MultipartFile userPhoto) {
this.userPhoto = userPhoto;
}
public LocalDateTime getCdate() {
return cdate;
}
public void setCdate(LocalDateTime cdate) {
this.cdate = cdate;
}
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype;
}
public Application_status getApplicationstatus() {
return applicationstatus;
}
public void setApplicationstatus(Application_status applicationstatus) {
this.applicationstatus = applicationstatus;
}
public int getIsActive() {
return isActive;
}
public void setIsActive(int isActive) {
this.isActive = isActive;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
}

17
src/main/java/com/volunteersregistration/wasteCollector/repository/CdlicenseRepository.java

@ -0,0 +1,17 @@
package com.volunteersregistration.wasteCollector.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.volunteersregistration.wasteCollector.entity.Cdlicense;
@Repository
public interface CdlicenseRepository extends JpaRepository<Cdlicense, Long>
{
@Query(value="SELECT license_num\r\n"
+ "FROM cdlicense\r\n"
+ "where register_id=:register_id", nativeQuery = true)
String findlicensenumber(@Param("register_id") String register_id);
}

12
src/main/java/com/volunteersregistration/wasteCollector/repository/OderLogsRepo.java

@ -0,0 +1,12 @@
package com.volunteersregistration.wasteCollector.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.volunteersregistration.wasteCollector.entity.Orderslogs;
@Repository
public interface OderLogsRepo extends JpaRepository<Orderslogs,Integer>
{
}

11
src/main/java/com/volunteersregistration/wasteCollector/repository/PaymentsRepo.java

@ -0,0 +1,11 @@
package com.volunteersregistration.wasteCollector.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.volunteersregistration.wasteCollector.entity.Payments;
@Repository
public interface PaymentsRepo extends JpaRepository<Payments, Long> {
}

123
src/main/java/com/volunteersregistration/wasteCollector/repository/WasteRegistrationRepo.java

@ -0,0 +1,123 @@
package com.volunteersregistration.wasteCollector.repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration;
@Repository
public interface WasteRegistrationRepo extends JpaRepository<WasteRegistration, Long> {
@Query(value = "SELECT * FROM waste_collectors_registration WHERE vehicle_num = :vehicle_num", nativeQuery = true)
Optional<WasteRegistration> findByVehicleNum(@Param("vehicle_num") String vehicle_num);
@Query(value = "SELECT * FROM waste_collectors_registration WHERE reference_num = :reference_num", nativeQuery = true)
WasteRegistration findByReferenceNum(@Param("reference_num") String reference_num);
List<WasteRegistration> findByMobileNo(String mobileNo); // Use mobileNo here
@Query("SELECT w FROM WasteRegistration w WHERE w.register_id = :registerId")
WasteRegistration findByRegisterId(@Param("registerId") Long registerId);
@Transactional
@Query(value = "select register_id FROM waste_collectors_registration where mobile_no=:mobileNumber", nativeQuery = true)
List<String> getIdByMobileno(@Param("mobileNumber") String mobileNumber);
@Transactional
@Query(value = "select *\r\n"
+ "FROM waste_collectors_registration\r\n"
+ "where register_id=:register_id", nativeQuery = true)
List<Map<String,Object>> getAllById(@Param("register_id") String register_id);
@Query(value = "SELECT * FROM waste_collectors_registration where application_status='PENDING'", nativeQuery = true)
List<Map<String, Object>> viewPendingList();
@Query(value = "SELECT *, " +
"CONCAT(:baseUrl, adhaarurl) as adhaarurl, " +
"CONCAT(:baseUrl, user_photourl) as user_photourl, " +
"CONCAT(:baseUrl, rcbookurl) as rcbookurl, " +
"CONCAT(:baseUrl, leasedocurl) as leasedocurl " +
"FROM waste_collectors_registration " +
"WHERE register_id = :registerId",
nativeQuery = true)
List<Map<String, Object>> findUserDetailsById(@Param("registerId") Long registerId, @Param("baseUrl") String baseUrl);
@Modifying
@Transactional
@Query(value = "UPDATE waste_collectors_registration SET application_status='APPROVED',acceptedby='OFFICER', accepteddate=NOW(),reason='Valid_Documents"
+ "' WHERE register_id=:register_id", nativeQuery = true)
int updateUseraccept(@Param("register_id") Long register_id);
@Modifying
@Transactional
@Query(value = "UPDATE waste_collectors_registration SET application_status='REJECTED',acceptedby='OFFICER', accepteddate=NOW(),reason=:reason WHERE register_id=:register_id", nativeQuery = true)
int updateUserreject(@Param("reason") String reason,@Param("register_id") Long register_id);
@Query(value = "SELECT amount \r\n"
+ "FROM cd_amount\r\n"
+ "where isactive='1' and isdelete='0'", nativeQuery = true)
int getamount();
@Query(value="SELECT register_id,name,address,mobile_no,vehicletype,cdate,accepteddate,vehicle_num \r\n"
+ "FROM waste_collectors_registration\r\n"
+ "where reference_num=:reference_num", nativeQuery = true)
List<Map<String, Object>> viewUserDetails(@Param("reference_num") String reference_num);
@Query(value="SELECT transaction_id,amount_received,cdate,payment_status \r\n"
+ "FROM payments\r\n"
+ "where waste_registration_id=:register_id", nativeQuery = true)
List<Map<String, Object>> viewPaymentDetails(@Param("register_id") String register_id);
//DataTable for User Details view Button
@Query(value = "SELECT name, mobile_no, address,register_id FROM waste_collectors_registration where application_status='PENDING' and payment_status='COMPLETED'", nativeQuery = true)
List<Map<String, Object>> findUserDetails();
@Query(value = "SELECT name, vehicle_num,vehicletype,register_id,CONCAT(:baseUrl,user_photourl) as user_photourl FROM waste_collectors_registration where register_id=:register_id ", nativeQuery = true)
List<Map<String, Object>> viewIdDetails(@Param("register_id") String register_id,String baseUrl);
@Query(value = "SELECT register_id, name, mobile_no, acceptedby, accepteddate, address, vehicletype , vehicle_num FROM waste_collectors_registration WHERE application_status = 'APPROVED'", nativeQuery = true)
List<Map<String, Object>> approvedDetails();
@Query(value = "SELECT register_id, name, mobile_no, acceptedby, accepteddate, address, vehicletype , vehicle_num, reason FROM waste_collectors_registration WHERE application_status = 'REJECTED'", nativeQuery = true)
List<Map<String, Object>> rejectedDetails();
@Query(value="select mobile_no\r\n"
+ "from waste_collectors_registration\r\n"
+ "where reference_num=:reference_num",nativeQuery = true)
String getmobilenumByRefnum(String reference_num);
@Query(value="select register_id,name,address,mobile_no,vehicle_num,cdate,application_status,payment_status,reason,accepteddate,reference_num\r\n"
+ "from waste_collectors_registration\r\n"
+ "where mobile_no=:mobile_no",nativeQuery = true)
List<Map<String, Object>> getlistbymobileno(@Param("mobile_no") String mobile_no);
@Query(value="select reference_num\r\n"
+ "from waste_collectors_registration\r\n"
+ "where register_id=:register_id",nativeQuery = true)
String getreferencenumbyid(@Param("register_id") String register_id);
@Query(value="select register_id\r\n"
+ "from waste_collectors_registration\r\n"
+ "where reference_num=:reference_num",nativeQuery = true)
String getregisterIdbyref(@Param("reference_num") String reference_num);
}

164
src/main/java/com/volunteersregistration/wasteCollector/service/WasteRegistrationService.java

@ -0,0 +1,164 @@
package com.volunteersregistration.wasteCollector.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.volunteersregistration.wasteCollector.entity.WasteRegistration;
//import com.volunteersregistration.entity.WasteRegistration;
//import com.volunteersregistration.repository.WasteRegistrationRepo;
import com.volunteersregistration.wasteCollector.repository.WasteRegistrationRepo;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Service
public class WasteRegistrationService{
@Autowired
private WasteRegistrationRepo registrationRepo;
@Value("${file.aadhar.upload.directory}")
private String aadharUploadDirectory;
@Value("${file.leasedoc.upload.directory}")
private String leaseDocUploadDirectory;
@Value("${file.rcbookdoc.upload.directory}")
private String rcbookDocUploadDirectory;
@Value("${file.userphoto.upload.directory}")
private String userPhotoUploadDirectory;
@Value("${file.aadhar.fullpath}")
private String aadharFullPath;
@Value("${file.leasedoc.fullpath}")
private String leaseDocFullPath;
@Value("${file.rcbookdoc.fullpath}")
private String rcbookDocFullPath;
@Value("${file.userphoto.fullpath}")
private String userPhotoFullPath;
@Autowired
private Environment environment;
@Value("${app.baseUrl}")
private String baseUrl;
public WasteRegistration saveWasteRegistration(WasteRegistration registration, MultipartFile aadhaar, MultipartFile leasedoc, MultipartFile userPhoto,MultipartFile rcbook) {
// Save the user registration first
WasteRegistration savedRegistration = registrationRepo.save(registration);
// Save Aadhaar file if present
if (aadhaar != null && !aadhaar.isEmpty()) {
String fileName = savedRegistration.getRegister_id() + "_" + aadhaar.getOriginalFilename();
String filePath = aadharUploadDirectory + "/" + fileName;
saveFile(aadhaar, filePath);
savedRegistration.setAdhaarurl(aadharFullPath + "cdwaste_aadhar/" + fileName);
}
// Save Vehicle Document if present
if (leasedoc != null && !leasedoc.isEmpty()) {
String fileName = savedRegistration.getRegister_id() + "_" + leasedoc.getOriginalFilename();
String filePath = leaseDocUploadDirectory + "/" + fileName;
saveFile(leasedoc, filePath);
savedRegistration.setLeasedocurl(leaseDocFullPath+ "cdwaste_leasedoc/"+fileName);
}
if (rcbook != null && !rcbook.isEmpty()) {
String fileName = savedRegistration.getRegister_id() + "_" + rcbook.getOriginalFilename();
String filePath = rcbookDocUploadDirectory + "/" + fileName;
saveFile(rcbook, filePath);
savedRegistration.setRcbookurl(rcbookDocFullPath+ "cdwaste_rcbookdoc/"+fileName);
}
// Save User Photo if present
if (userPhoto != null && !userPhoto.isEmpty()) {
String fileName = savedRegistration.getRegister_id() + "_" + userPhoto.getOriginalFilename();
String filePath = userPhotoUploadDirectory + "/" + fileName;
saveFile(userPhoto, filePath);
savedRegistration.setUserPhotourl(userPhotoFullPath + "cdwaste_userphoto/" + fileName);
}
// Save the updated WasteRegistration with file paths
return registrationRepo.save(savedRegistration);
}
private void saveFile(MultipartFile file, String filePath) {
File targetFile = new File(filePath);
// Create directories if they don't exist
targetFile.getParentFile().mkdirs();
try (FileOutputStream fos = new FileOutputStream(targetFile)) {
fos.write(file.getBytes());
} catch (IOException e) {
throw new RuntimeException("Error saving file: " + filePath, e);
}
}
public List<Map<String,Object>> viewPendingList() {
// Call repository to get the filtered list based on the parameters
return registrationRepo.viewPendingList();
}
public List<Map<String, Object>> getUserDetails() {
return registrationRepo.findUserDetails();
}
public List<Map<String, Object>> getUserDetailsById(Long registerId) {
System.out.println("baseUrl:---"+baseUrl);
return registrationRepo.findUserDetailsById(registerId,baseUrl);
}
public int updateUseraccept(Long registerId) {
return registrationRepo.updateUseraccept(registerId);
}
public int updateUserreject(String reason,Long registerId) {
return registrationRepo.updateUserreject(reason,registerId);
}
public int getamount()
{
return registrationRepo.getamount();
}
public List<Map<String, Object>> viewIdDetails(String registerId)
{
return registrationRepo.viewIdDetails(registerId,baseUrl);
}
public List<Map<String, Object>> viewapprovedList() {
return registrationRepo.approvedDetails();
}
public List<Map<String, Object>> viewRejectedList() {
return registrationRepo.rejectedDetails();
}
public String getreferencenumbyid(String register_id)
{
return registrationRepo.getreferencenumbyid(register_id);
}
}

35
src/main/resources/application-dev.properties

@ -0,0 +1,35 @@
spring.application.name=volunteersregistration
spring.datasource.url=jdbc:mysql://localhost:3306/volunteer
spring.datasource.username=root
spring.datasource.password=Anto
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server.port=8071
server.servlet.session.timeout=1m
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=100MB
app.baseUrl=http://localhost:8071
app.getOtpUrl=https://tmegov.onex-aura.com/api/sms?
app.title=GREATER CHENNAI CORPORATION - volunteers
app.erpUrl=https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?
file.upload.directory=${user.dir}/cd_waste_docs
file.aadhar.upload.directory=${user.dir}/cd_waste_docs/cdwaste_aadhar
file.leasedoc.upload.directory=${user.dir}/cd_waste_docs/cdwaste_leasedoc
file.rcbookdoc.upload.directory=${user.dir}/cd_waste_docs/cdwaste_rcbookdoc
file.userphoto.upload.directory=${user.dir}/cd_waste_docs/cdwaste_userphoto
file.fullpath=/
file.aadhar.fullpath=/cd_waste_docs/
file.leasedoc.fullpath=/cd_waste_docs/
file.rcbookdoc.fullpath=/cd_waste_docs/
file.userphoto.fullpath=/cd_waste_docs/
#testing key
payment.razorpay.my_key_id=rzp_test_tDkHFEqWXmuEi8

36
src/main/resources/application-prod.properties

@ -0,0 +1,36 @@
spring.application.name=volunteersregistration
spring.datasource.url=jdbc:mysql://localhost:3306/volunteer
spring.datasource.username=root
spring.datasource.password=gccroot
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server.port=8071
server.servlet.session.timeout=1m
spring.servlet.multipart.max-file-size=30MB
spring.servlet.multipart.max-request-size=120MB
app.baseUrl=https://gccservices.chennaicorporation.gov.in/volunteer
app.getOtpUrl=https://tmegov.onex-aura.com/api/sms?
app.title=GREATER CHENNAI CORPORATION - volunteers
app.erpUrl=https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?
file.upload.directory=${user.dir}/cd_waste_docs
file.aadhar.upload.directory=${user.dir}/cd_waste_docs/cdwaste_aadhar
file.leasedoc.upload.directory=${user.dir}/cd_waste_docs/cdwaste_leasedoc
file.rcbookdoc.upload.directory=${user.dir}/cd_waste_docs/cdwaste_rcbookdoc
file.userphoto.upload.directory=${user.dir}/cd_waste_docs/cdwaste_userphoto
file.fullpath=/
file.aadhar.fullpath=/cd_waste_docs/
file.leasedoc.fullpath=/cd_waste_docs/
file.rcbookdoc.fullpath=/cd_waste_docs/
file.userphoto.fullpath=/cd_waste_docs/
#live key
payment.razorpay.my_key_id=rzp_live_ySI5Ns54Y7qOcJ

14
src/main/resources/application.properties

@ -1,13 +1 @@
spring.application.name=volunteersregistration
spring.datasource.url=jdbc:mysql://localhost:3306/volunteer
spring.datasource.username=root
spring.datasource.password=root
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
server.port=8071
#//////// For C&D Waste Collector Project//////////////////
cdwaste_adhaar_foldername=cdwastecollectordocuments/cdwaste_adhaar_copy
cdwaste_rc_foldername=cdwastecollectordocuments/cdwaste_rcbook_copy
spring.profiles.active=dev

65
src/main/resources/static/assets/_js/main/app.js

@ -0,0 +1,65 @@
/*
* Document : app.js
* Author : pixelcave
* Description: Main entry point
*
*/
// Import required modules
import Template from './modules/template';
// App extends Template
export default class App extends Template {
/*
* Auto called when creating a new instance
*
*/
constructor() {
super();
}
/*
* Here you can override or extend any function you want from Template class
* if you would like to change/extend/remove the default functionality.
*
* This way it will be easier for you to update the module files if a new update
* is released since all your changes will be in here overriding the original ones.
*
* Let's have a look at the _uiInit() function, the one that runs the first time
* we create an instance of Template class or App class which extends it. This function
* inits all vital functionality but you can change it to fit your own needs.
*
*/
/*
* EXAMPLE #1 - Removing default functionality by making it empty
*
*/
// _uiInit() {}
/*
* EXAMPLE #2 - Extending default functionality with additional code
*
*/
// _uiInit() {
// // Call original function
// super._uiInit();
//
// // Your extra JS code afterwards
// }
/*
* EXAMPLE #3 - Replacing default functionality by writing your own code
*
*/
// _uiInit() {
// // Your own JS code without ever calling the original function's code
// }
}
// Create a new instance of App
window.Dashmix = new App();

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save