├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── bin ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── aniket │ │ │ │ └── portal │ │ │ │ ├── PortalApplication.class │ │ │ │ ├── pojos │ │ │ │ ├── BusSeatPojo.class │ │ │ │ ├── AllocationReqPojo.class │ │ │ │ ├── BusDetailsRespPojo.class │ │ │ │ ├── BusSchedulingReqPojo.class │ │ │ │ ├── CustomerBookingResp.class │ │ │ │ ├── CustomerBusSeatResp.class │ │ │ │ ├── RegistrationReqPojo.class │ │ │ │ ├── RegistrationRespPojo.class │ │ │ │ └── CustomerBookingReqPojo.class │ │ │ │ ├── model │ │ │ │ ├── BusDetailsModel.class │ │ │ │ ├── BusRoutesModel.class │ │ │ │ ├── BusDispatchModel.class │ │ │ │ ├── CustomerDetailsModel.class │ │ │ │ └── SeatAllocationModel.class │ │ │ │ ├── service │ │ │ │ ├── SeatpdfSrvc.class │ │ │ │ ├── SeatBookingSrvc.class │ │ │ │ ├── BusSchedulingSrvc.class │ │ │ │ ├── RegistrationSrvc.class │ │ │ │ ├── FetchBusDetailsSrvc.class │ │ │ │ ├── RegistrationSrvcImpl.class │ │ │ │ ├── SeatBookingSrvcImpl.class │ │ │ │ ├── BusSchedulingSrvcImpl.class │ │ │ │ └── FetchBusDetailsServiceImpl.class │ │ │ │ ├── repository │ │ │ │ ├── BusRouteRepo.class │ │ │ │ ├── BusDetailsRepo.class │ │ │ │ ├── BusDispatchRepo.class │ │ │ │ ├── CustomerDetailsRepo.class │ │ │ │ └── SeatAllocationRepo.class │ │ │ │ ├── controller │ │ │ │ ├── HomeController.class │ │ │ │ ├── RegistrationController.class │ │ │ │ ├── SeatBookingController.class │ │ │ │ ├── BusSchedulingController.class │ │ │ │ └── FetchBusDetailsController.class │ │ │ │ └── scheduler │ │ │ │ └── ConfigureAutoCompletion.class │ │ ├── resources │ │ │ └── application.properties │ │ └── webapp │ │ │ ├── templates │ │ │ ├── completedtrips.jsp │ │ │ ├── scheduledtrips.jsp │ │ │ ├── busseatallocate.jsp │ │ │ ├── busschedule.jsp │ │ │ ├── customerseatbooking.jsp │ │ │ ├── busdetails.jsp │ │ │ ├── index.jsp │ │ │ └── singlebusregistration.jsp │ │ │ ├── css │ │ │ └── stylesheet.css │ │ │ └── js │ │ │ ├── HomeController.js │ │ │ ├── BusSearchController.js │ │ │ └── customerSeatBookingController.js │ └── test │ │ └── java │ │ └── com │ │ └── aniket │ │ └── portal │ │ └── PortalApplicationTests.class ├── .gitignore ├── README.md ├── pom.xml └── mvnw.cmd ├── src ├── test │ └── java │ │ └── com │ │ └── aniket │ │ └── portal │ │ └── PortalApplicationTests.java └── main │ ├── java │ └── com │ │ └── aniket │ │ └── portal │ │ ├── controller │ │ ├── HomeController.java │ │ ├── BusSchedulingController.java │ │ ├── RegistrationController.java │ │ ├── SeatBookingController.java │ │ └── FetchBusDetailsController.java │ │ ├── service │ │ ├── BusSchedulingSrvc.java │ │ ├── RegistrationSrvc.java │ │ ├── FetchBusDetailsSrvc.java │ │ ├── SeatBookingSrvc.java │ │ ├── FetchBusDetailsServiceImpl.java │ │ ├── RegistrationSrvcImpl.java │ │ ├── SeatpdfSrvc.java │ │ ├── BusSchedulingSrvcImpl.java │ │ └── SeatBookingSrvcImpl.java │ │ ├── PortalApplication.java │ │ ├── pojos │ │ ├── BusSeatPojo.java │ │ ├── RegistrationRespPojo.java │ │ ├── CustomerBookingReqPojo.java │ │ ├── CustomerBusSeatResp.java │ │ ├── BusDetailsRespPojo.java │ │ ├── AllocationReqPojo.java │ │ ├── BusSchedulingReqPojo.java │ │ ├── CustomerBookingResp.java │ │ └── RegistrationReqPojo.java │ │ ├── repository │ │ ├── BusDetailsRepo.java │ │ ├── CustomerDetailsRepo.java │ │ ├── BusRouteRepo.java │ │ ├── BusDispatchRepo.java │ │ └── SeatAllocationRepo.java │ │ ├── scheduler │ │ └── ConfigureAutoCompletion.java │ │ └── model │ │ ├── CustomerDetailsModel.java │ │ ├── BusRoutesModel.java │ │ ├── BusDispatchModel.java │ │ ├── SeatAllocationModel.java │ │ └── BusDetailsModel.java │ ├── resources │ └── application.properties │ └── webapp │ ├── templates │ ├── completedtrips.jsp │ ├── scheduledtrips.jsp │ ├── busseatallocate.jsp │ ├── busschedule.jsp │ ├── customerseatbooking.jsp │ ├── busdetails.jsp │ ├── index.jsp │ └── singlebusregistration.jsp │ ├── css │ └── stylesheet.css │ └── js │ ├── HomeController.js │ ├── BusSearchController.js │ └── customerSeatBookingController.js ├── .gitignore ├── pom.xml ├── README.md ├── mvnw.cmd └── mvnw /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /bin/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/PortalApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/PortalApplication.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/BusSeatPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/BusSeatPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/model/BusDetailsModel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/model/BusDetailsModel.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/model/BusRoutesModel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/model/BusRoutesModel.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/SeatpdfSrvc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/SeatpdfSrvc.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/model/BusDispatchModel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/model/BusDispatchModel.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/AllocationReqPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/AllocationReqPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/repository/BusRouteRepo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/repository/BusRouteRepo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/SeatBookingSrvc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/SeatBookingSrvc.class -------------------------------------------------------------------------------- /bin/src/test/java/com/aniket/portal/PortalApplicationTests.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/test/java/com/aniket/portal/PortalApplicationTests.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/controller/HomeController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/controller/HomeController.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/model/CustomerDetailsModel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/model/CustomerDetailsModel.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/model/SeatAllocationModel.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/model/SeatAllocationModel.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/BusDetailsRespPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/BusDetailsRespPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/BusSchedulingReqPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/BusSchedulingReqPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/CustomerBookingResp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/CustomerBookingResp.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/CustomerBusSeatResp.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/CustomerBusSeatResp.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/RegistrationReqPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/RegistrationReqPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/RegistrationRespPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/RegistrationRespPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/repository/BusDetailsRepo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/repository/BusDetailsRepo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/repository/BusDispatchRepo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/repository/BusDispatchRepo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/BusSchedulingSrvc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/BusSchedulingSrvc.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/RegistrationSrvc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/RegistrationSrvc.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/pojos/CustomerBookingReqPojo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/pojos/CustomerBookingReqPojo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/FetchBusDetailsSrvc.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/FetchBusDetailsSrvc.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/RegistrationSrvcImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/RegistrationSrvcImpl.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/SeatBookingSrvcImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/SeatBookingSrvcImpl.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/repository/CustomerDetailsRepo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/repository/CustomerDetailsRepo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/repository/SeatAllocationRepo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/repository/SeatAllocationRepo.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/BusSchedulingSrvcImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/BusSchedulingSrvcImpl.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/controller/RegistrationController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/controller/RegistrationController.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/controller/SeatBookingController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/controller/SeatBookingController.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/scheduler/ConfigureAutoCompletion.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/scheduler/ConfigureAutoCompletion.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/controller/BusSchedulingController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/controller/BusSchedulingController.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/controller/FetchBusDetailsController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/controller/FetchBusDetailsController.class -------------------------------------------------------------------------------- /bin/src/main/java/com/aniket/portal/service/FetchBusDetailsServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ani1100/busSeatAllocationSystem/HEAD/bin/src/main/java/com/aniket/portal/service/FetchBusDetailsServiceImpl.class -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /bin/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /src/test/java/com/aniket/portal/PortalApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class PortalApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | @Controller 7 | public class HomeController { 8 | @RequestMapping("home") 9 | public String home() 10 | { 11 | return "templates/index.jsp"; 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/BusSchedulingSrvc.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import com.aniket.portal.pojos.BusSchedulingReqPojo; 4 | import com.aniket.portal.pojos.RegistrationRespPojo; 5 | 6 | public interface BusSchedulingSrvc { 7 | Boolean schedulebus(BusSchedulingReqPojo schbusreqpojo); 8 | RegistrationRespPojo schedulebusrequest(BusSchedulingReqPojo schbusreqpojo); 9 | 10 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/PortalApplication.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class PortalApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(PortalApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/BusSeatPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | public class BusSeatPojo { 4 | int seatno; 5 | String status; 6 | public int getSeatno() { 7 | return seatno; 8 | } 9 | public void setSeatno(int seatno) { 10 | this.seatno = seatno; 11 | } 12 | public String getStatus() { 13 | return status; 14 | } 15 | public void setStatus(String status) { 16 | this.status = status; 17 | } 18 | 19 | 20 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/RegistrationSrvc.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.io.PrintWriter; 4 | 5 | import com.aniket.portal.pojos.RegistrationReqPojo; 6 | import com.aniket.portal.pojos.RegistrationRespPojo; 7 | 8 | public interface RegistrationSrvc { 9 | public Boolean savebusdetails(RegistrationReqPojo regpojo); 10 | public RegistrationRespPojo registersinglebusdetails(RegistrationReqPojo regpojo); 11 | public RegistrationRespPojo checkusername(String username); 12 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/RegistrationRespPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | public class RegistrationRespPojo { 4 | private String status; 5 | private String message; 6 | public String getStatus() { 7 | return status; 8 | } 9 | public void setStatus(String status) { 10 | this.status = status; 11 | } 12 | public String getMessage() { 13 | return message; 14 | } 15 | public void setMessage(String message) { 16 | this.message = message; 17 | } 18 | @Override 19 | public String toString() { 20 | return "RegistrationRespPojo [status=" + status + ", message=" + message + "]"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/CustomerBookingReqPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | public class CustomerBookingReqPojo { 4 | String startloc; 5 | String endloc; 6 | String depdate; 7 | public String getStartloc() { 8 | return startloc; 9 | } 10 | public void setStartloc(String startloc) { 11 | this.startloc = startloc; 12 | } 13 | public String getEndloc() { 14 | return endloc; 15 | } 16 | public void setEndloc(String endloc) { 17 | this.endloc = endloc; 18 | } 19 | public String getDeptime() { 20 | return depdate; 21 | } 22 | public void setDeptime(String deptime) { 23 | this.depdate = deptime; 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/repository/BusDetailsRepo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.jpa.repository.Query; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import com.aniket.portal.model.BusDetailsModel; 8 | 9 | @Repository 10 | public interface BusDetailsRepo extends JpaRepository { 11 | @Query(value = "select max(id) from bus_dtls_mstr", nativeQuery = true) 12 | Long fetchmaxid(); 13 | 14 | @Query(value = "select * from bus_dtls_mstr where Bus_Number_Plate=?1", nativeQuery = true) 15 | BusDetailsModel fetchuserid(String busid); 16 | 17 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/FetchBusDetailsSrvc.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | 7 | import com.aniket.portal.model.BusDispatchModel; 8 | import com.aniket.portal.pojos.BusDetailsRespPojo; 9 | import com.aniket.portal.pojos.RegistrationRespPojo; 10 | import com.aniket.portal.repository.BusDetailsRepo; 11 | 12 | public interface FetchBusDetailsSrvc { 13 | BusDetailsRespPojo fetchbusdetails(String busid); 14 | Boolean validatebusid(String busid); 15 | List fetchuncompletedtrip(String busid); 16 | List fetchcompletedtrip(String busid); 17 | } 18 | -------------------------------------------------------------------------------- /bin/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | #PostgreSQL 3 | #spring.datasource.url=jdbc:postgresql://localhost:5432/seatallocdb 4 | #spring.datasource.username=postgres 5 | #spring.datasource.password=1234 6 | #spring.jpa.hibernate.ddl-auto=update 7 | #spring.jpa.show-sql=true 8 | #spring.jpa.properties.hibernate.format_sql=true 9 | #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL81Dialect 10 | #spring.jpa.defer-datasource-initialization=true 11 | #spring.sql.init.mode=always 12 | 13 | #---------------------------- 14 | #H2-Console 15 | spring.h2.console.enabled=true 16 | spring.datasource.platform=h2 17 | spring.datasource.url=jdbc:h2:mem:aniket 18 | spring.jpa.defer-datasource-initialization=true -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | #PostgreSQL 3 | #spring.datasource.url=jdbc:postgresql://localhost:5432/seatallocdb 4 | #spring.datasource.username=postgres 5 | #spring.datasource.password=1234 6 | #spring.jpa.hibernate.ddl-auto=update 7 | #spring.jpa.show-sql=true 8 | #spring.jpa.properties.hibernate.format_sql=true 9 | #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL81Dialect 10 | #spring.jpa.defer-datasource-initialization=true 11 | #spring.sql.init.mode=always 12 | 13 | #---------------------------- 14 | #H2-Console 15 | spring.h2.console.enabled=true 16 | spring.datasource.platform=h2 17 | spring.datasource.url=jdbc:h2:mem:aniket 18 | spring.jpa.defer-datasource-initialization=true -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/repository/CustomerDetailsRepo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.data.jpa.repository.Query; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import com.aniket.portal.model.CustomerDetailsModel; 8 | 9 | @Repository 10 | public interface CustomerDetailsRepo extends JpaRepository{ 11 | 12 | @Query(value = "select max(id) from cstmr_dtls_mstr", nativeQuery = true) 13 | Long fetchmaxid(); 14 | 15 | @Query(value = "select * from cstmr_dtls_mstr where Customer_Name=?1 and (Mobileno=?2 or Emailid=?3)", nativeQuery = true) 16 | CustomerDetailsModel fetchexistence(String name,String no,String eid); 17 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/SeatBookingSrvc.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | 7 | import com.aniket.portal.model.BusDispatchModel; 8 | import com.aniket.portal.pojos.AllocationReqPojo; 9 | import com.aniket.portal.pojos.CustomerBookingReqPojo; 10 | import com.aniket.portal.pojos.CustomerBookingResp; 11 | import com.aniket.portal.pojos.CustomerBusSeatResp; 12 | import com.aniket.portal.pojos.RegistrationRespPojo; 13 | 14 | public interface SeatBookingSrvc { 15 | public List customerseatbooking(CustomerBookingReqPojo reqpojo); 16 | public CustomerBusSeatResp fetchbusseatdetails(CustomerBookingResp reqpojo); 17 | public RegistrationRespPojo allocateseats(AllocationReqPojo reqpojo); 18 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/controller/BusSchedulingController.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.controller; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.PostMapping; 5 | import org.springframework.web.bind.annotation.RequestBody; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | import com.aniket.portal.pojos.BusSchedulingReqPojo; 9 | import com.aniket.portal.pojos.RegistrationReqPojo; 10 | import com.aniket.portal.pojos.RegistrationRespPojo; 11 | import com.aniket.portal.service.BusSchedulingSrvc; 12 | @RestController 13 | public class BusSchedulingController { 14 | @Autowired 15 | BusSchedulingSrvc schsrvc; 16 | @PostMapping("/schedulebus") 17 | public RegistrationRespPojo schedulebus(@RequestBody BusSchedulingReqPojo busschrep) 18 | { 19 | return(schsrvc.schedulebusrequest(busschrep)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/CustomerBusSeatResp.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import java.util.List; 4 | 5 | public class CustomerBusSeatResp { 6 | List listseat; 7 | CustomerBookingResp custbook; 8 | String status; 9 | String reason; 10 | public List getListseat() { 11 | return listseat; 12 | } 13 | public void setListseat(List listseat) { 14 | this.listseat = listseat; 15 | } 16 | public CustomerBookingResp getCustbook() { 17 | return custbook; 18 | } 19 | public void setCustbook(CustomerBookingResp custbook) { 20 | this.custbook = custbook; 21 | } 22 | public String getStatus() { 23 | return status; 24 | } 25 | public void setStatus(String status) { 26 | this.status = status; 27 | } 28 | public String getReason() { 29 | return reason; 30 | } 31 | public void setReason(String reason) { 32 | this.reason = reason; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/scheduler/ConfigureAutoCompletion.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.scheduler; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.scheduling.annotation.EnableScheduling; 9 | import org.springframework.scheduling.annotation.Scheduled; 10 | 11 | import com.aniket.portal.repository.BusDispatchRepo; 12 | 13 | @Configuration 14 | @EnableScheduling 15 | public class ConfigureAutoCompletion { 16 | @Autowired 17 | BusDispatchRepo disrepo; 18 | 19 | @Scheduled(fixedDelay = 60000) 20 | public void autocompletionstart() throws InterruptedException { 21 | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 22 | Date date = new Date(); 23 | disrepo.autocompletion(formatter.format(date)); 24 | disrepo.autostart(formatter.format(date)); 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/BusDetailsRespPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import java.util.List; 4 | 5 | import com.aniket.portal.model.BusDetailsModel; 6 | import com.aniket.portal.model.BusDispatchModel; 7 | 8 | public class BusDetailsRespPojo { 9 | List locationname; 10 | BusDetailsModel busdtls; 11 | String status; 12 | String reason; 13 | public List getLocationname() { 14 | return locationname; 15 | } 16 | public void setLocationname(List locationname) { 17 | this.locationname = locationname; 18 | } 19 | public BusDetailsModel getBusdtls() { 20 | return busdtls; 21 | } 22 | public void setBusdtls(BusDetailsModel busdtls) { 23 | this.busdtls = busdtls; 24 | } 25 | public String getStatus() { 26 | return status; 27 | } 28 | public void setStatus(String status) { 29 | this.status = status; 30 | } 31 | public String getReason() { 32 | return reason; 33 | } 34 | public void setReason(String reason) { 35 | this.reason = reason; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/AllocationReqPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import java.util.List; 4 | 5 | import com.aniket.portal.model.CustomerDetailsModel; 6 | 7 | public class AllocationReqPojo { 8 | CustomerDetailsModel custdtls; 9 | CustomerBusSeatResp busseatresp; 10 | List seatnos; 11 | public CustomerDetailsModel getCustdtls() { 12 | return custdtls; 13 | } 14 | public void setCustdtls(CustomerDetailsModel custdtls) { 15 | this.custdtls = custdtls; 16 | } 17 | public CustomerBusSeatResp getBusseatresp() { 18 | return busseatresp; 19 | } 20 | public void setBusseatresp(CustomerBusSeatResp busseatresp) { 21 | this.busseatresp = busseatresp; 22 | } 23 | public List getSeatnos() { 24 | return seatnos; 25 | } 26 | public void setSeatnos(List seatnos) { 27 | this.seatnos = seatnos; 28 | } 29 | @Override 30 | public String toString() { 31 | return "AllocationReqPojo [custdtls=" + custdtls + ", busseatresp=" + busseatresp + ", seatnos=" + seatnos 32 | + "]"; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /bin/src/main/webapp/templates/completedtrips.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Start PointEnd PointDeparture DateDeparture TimeArrival DateArrival TimeSeat Pdf
{{m.startpoint}}{{m.endpoint}}{{m.depdate}}{{m.deptime}}{{m.arrdate}}{{m.arrtime}}Seat Pdf
30 |
31 |
32 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/repository/BusRouteRepo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.repository; 2 | 3 | import java.util.List; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.stereotype.Repository; 7 | import com.aniket.portal.model.BusRoutesModel; 8 | 9 | @Repository 10 | public interface BusRouteRepo extends JpaRepository { 11 | @Query(value = "select max(id) from bus_route_mstr", nativeQuery = true) 12 | Long fetchmaxid(); 13 | 14 | @Query(value = "delete from bus_route_mstr where Bus_Dtls_Id=?1", nativeQuery = true) 15 | void deletefailedcase(Long id1); 16 | 17 | @Query(value = "select Location_Name from bus_route_mstr where Bus_Dtls_Id=?1 order by Order_Id", nativeQuery = true) 18 | List fetchlocationlist(Long id1); 19 | 20 | @Query(value = "select * from bus_route_mstr where Bus_Dtls_Id=?1 and LOCATION_NAME=?2", nativeQuery = true) 21 | BusRoutesModel fetchbusbyloc(Long id,String loc1); 22 | 23 | @Query(value = "select * from bus_route_mstr where Bus_Dtls_Id=?1 and Order_Id=?2", nativeQuery = true) 24 | BusRoutesModel fetchbusbyorderid(Long id,int ord); 25 | 26 | } -------------------------------------------------------------------------------- /src/main/webapp/templates/completedtrips.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Start PointEnd PointDeparture DateDeparture TimeArrival DateArrival TimeSeat Pdf
{{m.startpoint}}{{m.endpoint}}{{m.depdate}}{{m.deptime}}{{m.arrdate}}{{m.arrtime}}Seat Pdf
30 |
31 |
32 |
-------------------------------------------------------------------------------- /src/main/webapp/templates/scheduledtrips.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Start PointEnd PointDeparture DateDeparture TimeArrival DateArrival TimeSeat Pdf
{{m.startpoint}}{{m.endpoint}}{{m.depdate}}{{m.deptime}}{{m.arrdate}}{{m.arrtime}}View Pdf
30 |
31 |
32 |
-------------------------------------------------------------------------------- /bin/src/main/webapp/templates/scheduledtrips.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Start PointEnd PointDeparture DateDeparture TimeArrival DateArrival TimeSeat Pdf
{{m.startpoint}}{{m.endpoint}}{{m.depdate}}{{m.deptime}}{{m.arrdate}}{{m.arrtime}}View Pdf
30 |
31 |
32 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/model/CustomerDetailsModel.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.model; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | @Entity 9 | @Table(name = "cstmr_dtls_mstr") 10 | public class CustomerDetailsModel { 11 | @Id 12 | @Column(name = "id", updatable = false, nullable = false) 13 | private Long id; 14 | 15 | @Column(name = "Customer_Name", nullable = false) 16 | private String cstmrname; 17 | 18 | @Column(name = "Mobileno", nullable = false) 19 | private String mobileno; 20 | 21 | @Column(name = "Emailid") 22 | private String emailid; 23 | 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public String getCstmrname() { 34 | return cstmrname; 35 | } 36 | 37 | public void setCstmrname(String cstmrname) { 38 | this.cstmrname = cstmrname; 39 | } 40 | 41 | public String getMobileno() { 42 | return mobileno; 43 | } 44 | 45 | public void setMobileno(String mobileno) { 46 | this.mobileno = mobileno; 47 | } 48 | 49 | public String getEmailid() { 50 | return emailid; 51 | } 52 | 53 | public void setEmailid(String emailid) { 54 | this.emailid = emailid; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/model/BusRoutesModel.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.model; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | 9 | @Entity 10 | @Table(name = "bus_route_mstr") 11 | public class BusRoutesModel { 12 | @Id 13 | @Column(name = "id", updatable = false, nullable = false) 14 | private Long id; 15 | 16 | @Column(name = "Bus_Dtls_Id", nullable = false) 17 | private Long busdtlsid; 18 | 19 | @Column(name = "Location_Name", nullable = false) 20 | private String locationname; 21 | 22 | @Column(name = "Order_Id", nullable = false) 23 | private int orderid; 24 | 25 | public Long getId() { 26 | return id; 27 | } 28 | 29 | public void setId(Long id) { 30 | this.id = id; 31 | } 32 | 33 | public Long getBusdtlsid() { 34 | return busdtlsid; 35 | } 36 | 37 | public void setBusdtlsid(Long busdtlsid) { 38 | this.busdtlsid = busdtlsid; 39 | } 40 | 41 | public String getLocationname() { 42 | return locationname; 43 | } 44 | 45 | public void setLocationname(String locationname) { 46 | this.locationname = locationname; 47 | } 48 | 49 | public int getOrderid() { 50 | return orderid; 51 | } 52 | 53 | public void setOrderid(int orderid) { 54 | this.orderid = orderid; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/BusSchedulingReqPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import java.util.List; 4 | 5 | import com.aniket.portal.model.BusDetailsModel; 6 | 7 | public class BusSchedulingReqPojo { 8 | BusDetailsModel busdetails; 9 | String deptime; 10 | String arrtime; 11 | int flag; 12 | List locationname; 13 | public BusDetailsModel getBusdetails() { 14 | return busdetails; 15 | } 16 | public void setBusdetails(BusDetailsModel busdetails) { 17 | this.busdetails = busdetails; 18 | } 19 | public String getDeptime() { 20 | return deptime; 21 | } 22 | public void setDeptime(String deptime) { 23 | this.deptime = deptime; 24 | } 25 | public String getArrtime() { 26 | return arrtime; 27 | } 28 | public void setArrtime(String arrtime) { 29 | this.arrtime = arrtime; 30 | } 31 | public int getFlag() { 32 | return flag; 33 | } 34 | public List getLocationname() { 35 | return locationname; 36 | } 37 | public void setLocationname(List locationname) { 38 | this.locationname = locationname; 39 | } 40 | public void setFlag(int flag) { 41 | this.flag = flag; 42 | } 43 | @Override 44 | public String toString() { 45 | return "BusSchedulingReqPojo [busdetails=" + busdetails + ", deptime=" + deptime + ", arrtime=" + arrtime 46 | + ", flag=" + flag + "]"; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | # Bus Seat Allocation System 2 | This is a ready to use software system.
3 | The Software system is an online seat booking as well as bus reservation system where buses can be registered, trips can be scheduled and booking details for a scheduled trip can be downloaded in the form of pdf. Also, customers can book seats according to their preference.
4 |
Technologies Used :
5 | Backend -> Java, SpringBoot, PostreSQL
6 | Frontend -> AngularJS, HTML, CSS , Bootstrap, Javascript

7 | Three buses are already registered for demo purpose.
8 | BUS ID's -
9 | ABC1 - (Jammmu -> Katra -> Amritsar)
10 | ABC2 - (Jammmu -> Katra -> Amritsar)
11 | ABC3 - (Kolkata -> Digha)
12 | Bus details can be viewed by searching bus id's. New buses can also be registered from Bus Registration Screen.
13 | Have already scheduled trips for ABC1 and ABC2 on 1st January,2025 from Jammu to Amritsar. New Trips can also be scheduled for every bus and also booking details for scheduled trips can be downloaded in the form of pdfs.
14 | Customer can book seats according to their preference from Customer Seat Booking screen. Enter departure location as "Jammu", arrival location as "Amritsar" and departure date as "1st January,2025" and book seats as you want to.
15 | Try to experiment as you want to. Everthing is validated !!. 16 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/controller/RegistrationController.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.controller; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.http.HttpServletResponse; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestParam; 13 | import org.springframework.web.bind.annotation.RestController; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | import com.aniket.portal.pojos.RegistrationReqPojo; 17 | import com.aniket.portal.pojos.RegistrationRespPojo; 18 | import com.aniket.portal.service.RegistrationSrvc; 19 | 20 | @RestController 21 | public class RegistrationController { 22 | @Autowired 23 | RegistrationSrvc regsrvc; 24 | @PostMapping("/singleregisterbus") 25 | public RegistrationRespPojo singleregisterbus(@RequestBody RegistrationReqPojo regpojo) 26 | { 27 | RegistrationRespPojo resppojo=regsrvc.registersinglebusdetails(regpojo); 28 | return resppojo; 29 | } 30 | @PostMapping("/checkusername") 31 | public RegistrationRespPojo checkusername(@RequestBody String username) 32 | { 33 | RegistrationRespPojo resppojo=regsrvc.checkusername(username); 34 | return resppojo; 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/controller/SeatBookingController.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.PostMapping; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import com.aniket.portal.model.BusDispatchModel; 11 | import com.aniket.portal.pojos.AllocationReqPojo; 12 | import com.aniket.portal.pojos.CustomerBookingReqPojo; 13 | import com.aniket.portal.pojos.CustomerBookingResp; 14 | import com.aniket.portal.pojos.CustomerBusSeatResp; 15 | import com.aniket.portal.pojos.RegistrationRespPojo; 16 | import com.aniket.portal.service.SeatBookingSrvc; 17 | 18 | 19 | @RestController 20 | public class SeatBookingController { 21 | @Autowired 22 | SeatBookingSrvc seatbooksrvc; 23 | @PostMapping("/customerseatbooking") 24 | public List customerseatbooking(@RequestBody CustomerBookingReqPojo reqpojo) 25 | { 26 | return(seatbooksrvc.customerseatbooking(reqpojo)); 27 | } 28 | @PostMapping("/fetchbusseatdetails") 29 | public CustomerBusSeatResp fetchbusseatdetails(@RequestBody CustomerBookingResp reqpojo) 30 | { 31 | return(seatbooksrvc.fetchbusseatdetails(reqpojo)); 32 | } 33 | @PostMapping("/allocateseats") 34 | public RegistrationRespPojo allocateseats(@RequestBody AllocationReqPojo reqpojo) 35 | { 36 | return(seatbooksrvc.allocateseats(reqpojo)); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/main/webapp/css/stylesheet.css: -------------------------------------------------------------------------------- 1 | .dtls1 2 | { 3 | background-color:#0066b2;; 4 | float:left; 5 | margin-right:1%; 6 | margin-left:2%; 7 | width:16%; 8 | clear:both; 9 | text-align:center; 10 | color:white; 11 | height:81px; 12 | font-size:20px; 13 | padding:10px; 14 | } 15 | .dtls2 16 | { 17 | margin-left:1%; 18 | margin-right:1%; 19 | float:left; 20 | width:60%; 21 | } 22 | .dtls3 23 | { 24 | background-color:#0071c5; 25 | float:left; 26 | padding:20px; 27 | margin-left:5%; 28 | margin-right:5%; 29 | border:2px ridge black; 30 | text-align:center; 31 | } 32 | .dtls4 33 | { 34 | background-color:#0071c5; 35 | float:left; 36 | padding:20px; 37 | margin-left:1%; 38 | margin-right:1%; 39 | border:2px ridge black; 40 | text-align:center; 41 | } 42 | .clear1 43 | { 44 | clear:both; 45 | } 46 | .verticaltabs 47 | { 48 | font-size:24px; 49 | background-color:00BFFF; 50 | padding:10px; 51 | margin:0px; 52 | color:white; 53 | } 54 | .verticaldtls 55 | { 56 | font-size:24px; 57 | background-color:#1877F2; 58 | padding:10px; 59 | color:white; 60 | display:inline-block; 61 | padding-left:20px; 62 | } 63 | .busstr 64 | { 65 | width:20px; 66 | height:20px; 67 | float:left; 68 | margin:1px; 69 | } 70 | .custbook1 71 | { 72 | background-color:#6CB4EE; 73 | float:left; 74 | padding:20px; 75 | margin-left:5%; 76 | margin-right:5%; 77 | text-align:center; 78 | border:2px ridge black; 79 | } 80 | .custbook2 81 | { 82 | width:50px; 83 | height:50px; 84 | float:left; 85 | margin:1px; 86 | } 87 | .custbook3 88 | { 89 | float:left; 90 | padding:20px; 91 | margin-left:2%; 92 | } -------------------------------------------------------------------------------- /bin/src/main/webapp/css/stylesheet.css: -------------------------------------------------------------------------------- 1 | .dtls1 2 | { 3 | background-color:#0066b2;; 4 | float:left; 5 | margin-right:1%; 6 | margin-left:2%; 7 | width:16%; 8 | clear:both; 9 | text-align:center; 10 | color:white; 11 | height:81px; 12 | font-size:20px; 13 | padding:10px; 14 | } 15 | .dtls2 16 | { 17 | margin-left:1%; 18 | margin-right:1%; 19 | float:left; 20 | width:60%; 21 | } 22 | .dtls3 23 | { 24 | background-color:#0071c5; 25 | float:left; 26 | padding:20px; 27 | margin-left:5%; 28 | margin-right:5%; 29 | border:2px ridge black; 30 | text-align:center; 31 | } 32 | .dtls4 33 | { 34 | background-color:#0071c5; 35 | float:left; 36 | padding:20px; 37 | margin-left:1%; 38 | margin-right:1%; 39 | border:2px ridge black; 40 | text-align:center; 41 | } 42 | .clear1 43 | { 44 | clear:both; 45 | } 46 | .verticaltabs 47 | { 48 | font-size:24px; 49 | background-color:00BFFF; 50 | padding:10px; 51 | margin:0px; 52 | color:white; 53 | } 54 | .verticaldtls 55 | { 56 | font-size:24px; 57 | background-color:#1877F2; 58 | padding:10px; 59 | color:white; 60 | display:inline-block; 61 | padding-left:20px; 62 | } 63 | .busstr 64 | { 65 | width:20px; 66 | height:20px; 67 | float:left; 68 | margin:1px; 69 | } 70 | .custbook1 71 | { 72 | background-color:#6CB4EE; 73 | float:left; 74 | padding:20px; 75 | margin-left:5%; 76 | margin-right:5%; 77 | text-align:center; 78 | border:2px ridge black; 79 | } 80 | .custbook2 81 | { 82 | width:50px; 83 | height:50px; 84 | float:left; 85 | margin:1px; 86 | } 87 | .custbook3 88 | { 89 | float:left; 90 | padding:20px; 91 | margin-left:2%; 92 | } -------------------------------------------------------------------------------- /src/main/webapp/templates/busseatallocate.jsp: -------------------------------------------------------------------------------- 1 |
2 |
 
3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 |
18 |
19 | 20 | 21 |
22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 |   37 | 38 |
39 |
40 |
41 |
 
42 |
-------------------------------------------------------------------------------- /bin/src/main/webapp/templates/busseatallocate.jsp: -------------------------------------------------------------------------------- 1 |
2 |
 
3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 |
18 |
19 | 20 | 21 |
22 |
23 | 24 | 25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | 33 |
34 |
35 | 36 |   37 | 38 |
39 |
40 |
41 |
 
42 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/controller/FetchBusDetailsController.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.controller; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.HttpEntity; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.aniket.portal.model.BusDispatchModel; 15 | import com.aniket.portal.pojos.BusDetailsRespPojo; 16 | import com.aniket.portal.pojos.RegistrationReqPojo; 17 | import com.aniket.portal.pojos.RegistrationRespPojo; 18 | import com.aniket.portal.service.FetchBusDetailsSrvc; 19 | import com.aniket.portal.service.SeatpdfSrvc; 20 | 21 | @RestController 22 | public class FetchBusDetailsController { 23 | @Autowired 24 | FetchBusDetailsSrvc dtlssrvc; 25 | @Autowired 26 | SeatpdfSrvc pdfsrvc; 27 | 28 | @PostMapping("/fetchbusdetails") 29 | public BusDetailsRespPojo fetchbusdetails(@RequestBody String busid) 30 | { 31 | return(dtlssrvc.fetchbusdetails(busid)); 32 | } 33 | 34 | @PostMapping("/fetchuncompletedtrips") 35 | public List fetchuncompletedtrips(@RequestBody String busid) 36 | { 37 | return(dtlssrvc.fetchuncompletedtrip(busid)); 38 | } 39 | 40 | @PostMapping("/fetchcompletedtrips") 41 | public List fetchcompletedtrips(@RequestBody String busid) 42 | { 43 | return(dtlssrvc.fetchcompletedtrip(busid)); 44 | } 45 | 46 | @GetMapping("fetchpdf/{busschid}") 47 | public HttpEntity fetchpdf(@RequestBody @PathVariable("busschid") Long busschid) 48 | { 49 | return(pdfsrvc.pdfgenerator(busschid)); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/model/BusDispatchModel.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.model; 2 | 3 | import java.util.Date; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.Entity; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | import javax.persistence.Temporal; 10 | import javax.persistence.TemporalType; 11 | 12 | @Entity 13 | @Table(name = "bus_dispatch_mstr") 14 | public class BusDispatchModel { 15 | @Id 16 | @Column(name = "id", updatable = false, nullable = false) 17 | private Long id; 18 | 19 | @Column(name = "Bus_Dtls_Id", nullable = false) 20 | private Long busdtlsid; 21 | 22 | @Column(name = "Flag", nullable = false) 23 | private int flag; 24 | 25 | @Column(name = "Departure_Time", nullable = false) 26 | private String deptime; 27 | 28 | @Column(name = "Arrival_Time", nullable = false) 29 | private String arrivaltime; 30 | 31 | @Column(name = "Trip_Completed", nullable = false) 32 | private String tripcompleted; 33 | 34 | public Long getId() { 35 | return id; 36 | } 37 | 38 | public void setId(Long id) { 39 | this.id = id; 40 | } 41 | 42 | public Long getBusdtlsid() { 43 | return busdtlsid; 44 | } 45 | 46 | public void setBusdtlsid(Long busdtlsid) { 47 | this.busdtlsid = busdtlsid; 48 | } 49 | 50 | public int getFlag() { 51 | return flag; 52 | } 53 | 54 | public void setFlag(int flag) { 55 | this.flag = flag; 56 | } 57 | 58 | public String getDeptime() { 59 | return deptime; 60 | } 61 | 62 | public void setDeptime(String deptime) { 63 | this.deptime = deptime; 64 | } 65 | 66 | public String getArrivaltime() { 67 | return arrivaltime; 68 | } 69 | 70 | public void setArrivaltime(String arrivaltime) { 71 | this.arrivaltime = arrivaltime; 72 | } 73 | 74 | public String getTripcompleted() { 75 | return tripcompleted; 76 | } 77 | 78 | public void setTripcompleted(String tripcompleted) { 79 | this.tripcompleted = tripcompleted; 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /src/main/webapp/templates/busschedule.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 |
5 | 6 | 7 | 8 | 9 | 15 | 21 | 27 | 28 | 29 | 30 | 36 | 42 | 48 | 49 |
10 |
11 | 12 | 13 |
14 |
16 |
17 | 18 | 19 |
20 |
22 |
23 | 24 | 25 |
26 |
31 |
32 | 33 | 34 |
35 |
37 |
38 | 39 | 40 |
41 |
43 |
44 | 45 | 46 |
47 |
50 |
51 |
52 | 53 |   54 | 55 |
56 |
57 |
58 |
59 |

60 |
-------------------------------------------------------------------------------- /bin/src/main/webapp/templates/busschedule.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 |
5 | 6 | 7 | 8 | 9 | 15 | 21 | 27 | 28 | 29 | 30 | 36 | 42 | 48 | 49 |
10 |
11 | 12 | 13 |
14 |
16 |
17 | 18 | 19 |
20 |
22 |
23 | 24 | 25 |
26 |
31 |
32 | 33 | 34 |
35 |
37 |
38 | 39 | 40 |
41 |
43 |
44 | 45 | 46 |
47 |
50 |
51 |
52 | 53 |   54 | 55 |
56 |
57 |
58 |
59 |

60 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/model/SeatAllocationModel.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.model; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | @Entity 9 | @Table(name = "seat_allocation_mstr") 10 | public class SeatAllocationModel { 11 | @Id 12 | @Column(name = "id", updatable = false, nullable = false) 13 | private Long id; 14 | 15 | @Column(name = "Bus_Dtls_Id", nullable = false) 16 | private Long busdtlsid; 17 | 18 | @Column(name = "Bus_Sch_Id", nullable = false) 19 | private Long busschid; 20 | 21 | @Column(name = "Seat_No", nullable = false) 22 | private int seatno; 23 | 24 | @Column(name = "Location_Order_id", nullable = false) 25 | private int locationorderid; 26 | 27 | @Column(name = "Allocation", nullable = false,updatable=true) 28 | private String allocation; 29 | 30 | @Column(name = "Cstmr_Dtls_Id",updatable=true) 31 | private Long cstmrdtlsid; 32 | 33 | public Long getId() { 34 | return id; 35 | } 36 | 37 | public void setId(Long id) { 38 | this.id = id; 39 | } 40 | 41 | public Long getBusdtlsid() { 42 | return busdtlsid; 43 | } 44 | 45 | public void setBusdtlsid(Long busdtlsid) { 46 | this.busdtlsid = busdtlsid; 47 | } 48 | 49 | public int getSeatno() { 50 | return seatno; 51 | } 52 | 53 | public void setSeatno(int seatno) { 54 | this.seatno = seatno; 55 | } 56 | 57 | 58 | 59 | public int getLocationorderid() { 60 | return locationorderid; 61 | } 62 | 63 | public void setLocationorderid(int locationorderid) { 64 | this.locationorderid = locationorderid; 65 | } 66 | 67 | public String getAllocation() { 68 | return allocation; 69 | } 70 | 71 | public void setAllocation(String allocation) { 72 | this.allocation = allocation; 73 | } 74 | 75 | public Long getCstmrdtlsid() { 76 | return cstmrdtlsid; 77 | } 78 | 79 | public void setCstmrdtlsid(Long cstmrdtlsid) { 80 | this.cstmrdtlsid = cstmrdtlsid; 81 | } 82 | 83 | public Long getBusschid() { 84 | return busschid; 85 | } 86 | 87 | public void setBusschid(Long busschid) { 88 | this.busschid = busschid; 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/CustomerBookingResp.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import com.aniket.portal.model.BusDetailsModel; 4 | import com.aniket.portal.model.BusDispatchModel; 5 | 6 | public class CustomerBookingResp { 7 | BusDetailsModel busdetails; 8 | BusDispatchModel scheduledbus; 9 | Boolean expansion; 10 | String startpoint; 11 | String endpoint; 12 | String deptime; 13 | String arrtime; 14 | String custstartloc; 15 | String custendloc; 16 | String custdeptime; 17 | public BusDetailsModel getBusdetails() { 18 | return busdetails; 19 | } 20 | public void setBusdetails(BusDetailsModel busdetails) { 21 | this.busdetails = busdetails; 22 | } 23 | public BusDispatchModel getScheduledbus() { 24 | return scheduledbus; 25 | } 26 | public void setScheduledbus(BusDispatchModel scheduledbus) { 27 | this.scheduledbus = scheduledbus; 28 | } 29 | public Boolean getExpansion() { 30 | return expansion; 31 | } 32 | public void setExpansion(Boolean expansion) { 33 | this.expansion = expansion; 34 | } 35 | public String getStartpoint() { 36 | return startpoint; 37 | } 38 | public void setStartpoint(String startpoint) { 39 | this.startpoint = startpoint; 40 | } 41 | public String getEndpoint() { 42 | return endpoint; 43 | } 44 | public void setEndpoint(String endpoint) { 45 | this.endpoint = endpoint; 46 | } 47 | public String getDeptime() { 48 | return deptime; 49 | } 50 | public void setDeptime(String deptime) { 51 | this.deptime = deptime; 52 | } 53 | public String getArrtime() { 54 | return arrtime; 55 | } 56 | public void setArrtime(String arrtime) { 57 | this.arrtime = arrtime; 58 | } 59 | public String getCuststartloc() { 60 | return custstartloc; 61 | } 62 | public void setCuststartloc(String custstartloc) { 63 | this.custstartloc = custstartloc; 64 | } 65 | public String getCustendloc() { 66 | return custendloc; 67 | } 68 | public void setCustendloc(String custendloc) { 69 | this.custendloc = custendloc; 70 | } 71 | public String getCustdeptime() { 72 | return custdeptime; 73 | } 74 | public void setCustdeptime(String custdeptime) { 75 | this.custdeptime = custdeptime; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /bin/src/main/webapp/js/HomeController.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | var myApp = angular.module('myApp'); 3 | myApp.controller('HomeController',HomeController); 4 | 5 | function HomeController($scope,$http){ 6 | $scope.bussearch=false; 7 | $scope.fetchbusdetails=function() 8 | { 9 | if($scope.searchbus==null||$scope.searchbus=="") 10 | { 11 | $scope.bussearch=false; 12 | return; 13 | } 14 | $http({ 15 | method : "POST", 16 | url : "fetchbusdetails", 17 | data: $scope.searchbus 18 | }).then(function mySuccess(response) { 19 | if(response.data.status=="Failed") 20 | { 21 | $scope.bussearch=false; 22 | } 23 | else 24 | { 25 | $scope.busdtlsinfo=response.data; 26 | $scope.places=[response.data.busdtls.endpoint1,response.data.busdtls.endpoint2]; 27 | $scope.backseatstr=[]; 28 | $scope.rowseatstr=[]; 29 | var ct=0; 30 | for(var i=ct;i<$scope.busdtlsinfo.busdtls.lastseat;i+=1) 31 | { 32 | ct+=1; 33 | var temp={"status":"N","color":"ivory"}; 34 | $scope.backseatstr.push(temp); 35 | } 36 | var ct1=0; 37 | var empty=1; 38 | if(ct>=1) 39 | { 40 | ct1=-1; 41 | empty=$scope.busdtlsinfo.busdtls.lastseat-$scope.busdtlsinfo.busdtls.seatleftside-$scope.busdtlsinfo.busdtls.seatrightside; 42 | } 43 | for(var j=$scope.busdtlsinfo.busdtls.rows+ct1;j>0;j-=1) 44 | { 45 | var rowlis=[]; 46 | for(var k=0;k<$scope.busdtlsinfo.busdtls.seatleftside;k+=1) 47 | { 48 | var temp={"status":"N","color":"ivory"}; 49 | rowlis.push(temp); 50 | } 51 | ct=ct+$scope.busdtlsinfo.busdtls.seatleftside; 52 | for(var k=0;k=1) 39 | { 40 | ct1=-1; 41 | empty=$scope.busdtlsinfo.busdtls.lastseat-$scope.busdtlsinfo.busdtls.seatleftside-$scope.busdtlsinfo.busdtls.seatrightside; 42 | } 43 | for(var j=$scope.busdtlsinfo.busdtls.rows+ct1;j>0;j-=1) 44 | { 45 | var rowlis=[]; 46 | for(var k=0;k<$scope.busdtlsinfo.busdtls.seatleftside;k+=1) 47 | { 48 | var temp={"status":"N","color":"ivory"}; 49 | rowlis.push(temp); 50 | } 51 | ct=ct+$scope.busdtlsinfo.busdtls.seatleftside; 52 | for(var k=0;k 2 |
3 |

Customer Seat Booking



4 |
5 | 6 | 7 | 8 | 9 | 15 | 21 | 27 | 28 | 29 |
10 |
11 | 12 | 13 |
14 |
16 |
17 | 18 | 19 |
20 |
22 |
23 | 24 | 25 |
26 |
30 |
31 |
32 | 33 |   34 | 35 |
36 |
37 |
38 |
39 |
40 |

Available Buses

41 |
42 |
43 |

No bus available at this moment

44 |

45 |
46 |
47 |
48 |

{{m.busdetails.busname}} | {{m.startpoint}} -> {{m.endpoint}} | {{m.deptime}} - {{m.arrtime}}    

49 |
50 | 51 |
52 |
53 |

54 |
55 |
56 | -------------------------------------------------------------------------------- /bin/src/main/webapp/templates/customerseatbooking.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Customer Seat Booking



4 |
5 | 6 | 7 | 8 | 9 | 15 | 21 | 27 | 28 | 29 |
10 |
11 | 12 | 13 |
14 |
16 |
17 | 18 | 19 |
20 |
22 |
23 | 24 | 25 |
26 |
30 |
31 |
32 | 33 |   34 | 35 |
36 |
37 |
38 |
39 |
40 |

Available Buses

41 |
42 |
43 |

No bus available at this moment

44 |

45 |
46 |
47 |
48 |

{{m.busdetails.busname}} | {{m.startpoint}} -> {{m.endpoint}} | {{m.deptime}} - {{m.arrtime}}    

49 |
50 | 51 |
52 |
53 |

54 |
55 |
56 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/repository/BusDispatchRepo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.repository; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Modifying; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.stereotype.Repository; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import com.aniket.portal.model.BusDispatchModel; 13 | 14 | @Repository 15 | public interface BusDispatchRepo extends JpaRepository { 16 | 17 | @Query(value = "select max(id) from bus_dispatch_mstr", nativeQuery = true) 18 | Long fetchmaxid(); 19 | 20 | @Query(value = "select * from bus_dispatch_mstr where Bus_Dtls_Id=?1 and Trip_Completed = 'Y' order by DEPARTURE_TIME", nativeQuery = true) 21 | List fetchcompletedtrip(Long id); 22 | 23 | @Query(value = "select * from bus_dispatch_mstr where Bus_Dtls_Id=?1 and Trip_Completed <> 'Y' order by DEPARTURE_TIME", nativeQuery = true) 24 | List fetchdispatch(Long id); 25 | 26 | @Query(value = "select * from BUS_DISPATCH_MSTR a where a.DEPARTURE_TIME like ?1 and a.DEPARTURE_TIME > ?2", nativeQuery = true) 27 | List fetchbus(String date1,String time1); 28 | 29 | @Query(value = "select * from BUS_DISPATCH_MSTR a where a.Arrival_Time < ?1 and a.Bus_Dtls_Id=?3 and a.Flag=?2 order by a.Arrival_Time DESC", nativeQuery = true) 30 | List fetchbusbydep(String deptime,int flag,Long busid); 31 | 32 | @Query(value = "select * from BUS_DISPATCH_MSTR a where a.DEPARTURE_TIME > ?1 and a.Bus_Dtls_Id=?3 and a.Flag=?2 order by a.DEPARTURE_TIME ASC", nativeQuery = true) 33 | List fetchbusbyarr(String arrtime,int flag,Long busid); 34 | 35 | @Query(value = "select * from BUS_DISPATCH_MSTR a where Bus_Dtls_Id=?3 and ((a.DEPARTURE_TIME >= ?1 and a.Arrival_Time<=?2) or (a.DEPARTURE_TIME <= ?1 and a.Arrival_Time>=?2) or (a.Arrival_Time >= ?2 and a.DEPARTURE_TIME<=?2) or (a.Arrival_Time >= ?1 and a.DEPARTURE_TIME<= ?1))", nativeQuery = true) 36 | List fetchdistinctsch(String deptime,String arrtime,Long busid); 37 | 38 | @Transactional 39 | @Modifying 40 | @Query(value = "update bus_dispatch_mstr set Trip_Completed='Y' where Arrival_Time<=?1 and Trip_Completed='H'", nativeQuery = true) 41 | void autocompletion(String dt); 42 | 43 | @Transactional 44 | @Modifying 45 | @Query(value = "update bus_dispatch_mstr set Trip_Completed='H' where DEPARTURE_TIME<=?1 and Trip_Completed='N'", nativeQuery = true) 46 | void autostart(String dt); 47 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/FetchBusDetailsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.aniket.portal.model.BusDetailsModel; 9 | import com.aniket.portal.model.BusDispatchModel; 10 | import com.aniket.portal.model.BusRoutesModel; 11 | import com.aniket.portal.pojos.BusDetailsRespPojo; 12 | import com.aniket.portal.pojos.RegistrationRespPojo; 13 | import com.aniket.portal.repository.BusDetailsRepo; 14 | import com.aniket.portal.repository.BusDispatchRepo; 15 | import com.aniket.portal.repository.BusRouteRepo; 16 | 17 | @Service 18 | public class FetchBusDetailsServiceImpl implements FetchBusDetailsSrvc { 19 | 20 | @Autowired 21 | BusDetailsRepo dtlsrepo; 22 | @Autowired 23 | BusRouteRepo routerepo; 24 | @Autowired 25 | BusDispatchRepo dispatchrepo; 26 | @Override 27 | public BusDetailsRespPojo fetchbusdetails(String busid) { 28 | BusDetailsRespPojo resppojo1=new BusDetailsRespPojo(); 29 | try 30 | { 31 | Boolean result=validatebusid(busid); 32 | if(result==true) 33 | { 34 | Long bid = dtlsrepo.fetchuserid(busid).getId(); 35 | BusDetailsModel obj1 = dtlsrepo.findById(bid).orElse(null); 36 | List obj2 =routerepo.fetchlocationlist(bid); 37 | resppojo1.setBusdtls(obj1); 38 | resppojo1.setLocationname(obj2); 39 | resppojo1.setStatus("Success"); 40 | resppojo1.setReason("Data fetched Successfully"); 41 | } 42 | else 43 | { 44 | resppojo1.setStatus("Failed"); 45 | resppojo1.setReason("User Name Not Found"); 46 | } 47 | } 48 | catch(Exception e) 49 | { 50 | resppojo1.setStatus("Failed"); 51 | resppojo1.setReason("Please Try Again Later"); 52 | } 53 | return resppojo1; 54 | } 55 | @Override 56 | public Boolean validatebusid(String busid) { 57 | // TODO Auto-generated method stub 58 | BusDetailsModel obj1=dtlsrepo.fetchuserid(busid); 59 | if(obj1==null) 60 | { 61 | return false; 62 | } 63 | else 64 | { 65 | return true; 66 | } 67 | } 68 | @Override 69 | public List fetchuncompletedtrip(String busid) { 70 | // TODO Auto-generated method stub 71 | Long bid = dtlsrepo.fetchuserid(busid).getId(); 72 | List obj3=dispatchrepo.fetchdispatch(bid); 73 | return obj3; 74 | } 75 | @Override 76 | public List fetchcompletedtrip(String busid) { 77 | // TODO Auto-generated method stub 78 | Long bid = dtlsrepo.fetchuserid(busid).getId(); 79 | List obj3=dispatchrepo.fetchcompletedtrip(bid); 80 | return obj3; 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /src/main/webapp/templates/busdetails.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 | 6 |
7 |
 
8 |
9 |
10 | {{busdtlsinfo.busdtls.busnumberplate}}
11 | {{busdtlsinfo.busdtls.busname}} 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Owner NameMobile NoEmail IDEndpoint1Endpoint2
{{busdtlsinfo.busdtls.ownername}}{{busdtlsinfo.busdtls.mobileno}}{{busdtlsinfo.busdtls.emailid}}{{busdtlsinfo.busdtls.endpoint1}}{{busdtlsinfo.busdtls.endpoint2}}
35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 | 47 |
48 |

 

49 | 50 |
51 | 52 | 53 | 54 |
55 |
56 |
57 |
58 | 59 |
60 |
61 | 62 |
63 |
64 | 65 |
66 |
67 |
68 | 69 |
-------------------------------------------------------------------------------- /bin/src/main/webapp/templates/busdetails.jsp: -------------------------------------------------------------------------------- 1 |
2 |
3 |

No Details Found.Please Try Again Later.

4 |
5 | 6 |
7 |
 
8 |
9 |
10 | {{busdtlsinfo.busdtls.busnumberplate}}
11 | {{busdtlsinfo.busdtls.busname}} 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
Owner NameMobile NoEmail IDEndpoint1Endpoint2
{{busdtlsinfo.busdtls.ownername}}{{busdtlsinfo.busdtls.mobileno}}{{busdtlsinfo.busdtls.emailid}}{{busdtlsinfo.busdtls.endpoint1}}{{busdtlsinfo.busdtls.endpoint2}}
35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 | 47 |
48 |

 

49 | 50 |
51 | 52 | 53 | 54 |
55 |
56 |
57 |
58 | 59 |
60 |
61 | 62 |
63 |
64 | 65 |
66 |
67 |
68 | 69 |
-------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/repository/SeatAllocationRepo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.repository; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Modifying; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.stereotype.Repository; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import com.aniket.portal.model.BusDispatchModel; 12 | import com.aniket.portal.model.SeatAllocationModel; 13 | 14 | 15 | @Repository 16 | public interface SeatAllocationRepo extends JpaRepository { 17 | @Query(value = "select max(id) from seat_allocation_mstr", nativeQuery = true) 18 | Long fetchmaxid(); 19 | 20 | @Query(value = "select distinct Seat_No from seat_allocation_mstr where Bus_Sch_Id=?1 and Location_Order_id>=?2 and Location_Order_id fetchallocatedseats1(Long schid,int ord1,int ord2); 22 | 23 | @Query(value = "select distinct Seat_No from seat_allocation_mstr where Bus_Sch_Id=?1 and Location_Order_id>?2 and Location_Order_id<=?3 and Allocation='Y'", nativeQuery = true) 24 | List fetchallocatedseats2(Long schid,int ord1,int ord2); 25 | 26 | @Transactional 27 | @Modifying 28 | @Query(value = "update seat_allocation_mstr set Allocation = 'Y',Cstmr_Dtls_Id=?5 where Bus_Sch_Id=?1 and Seat_No=?2 and Location_Order_id>=?3 and Location_Order_id?3 and Location_Order_id<=?4", nativeQuery = true) 34 | void saveseat2(Long schid,int seatno,int ord1,int ord2,Long id1); 35 | 36 | @Query(value = "select distinct Seat_No from seat_allocation_mstr where Bus_Sch_Id=?1 and Location_Order_id>=?2 and Location_Order_id fetchseatavailbility1(Long schid,int ord1,int ord2,int seatno); 38 | 39 | @Query(value = "select distinct Seat_No from seat_allocation_mstr where Bus_Sch_Id=?1 and Location_Order_id>?2 and Location_Order_id<=?3 and Allocation='Y' and Seat_No=?4", nativeQuery = true) 40 | List fetchseatavailbility2(Long schid,int ord1,int ord2,int seatno); 41 | 42 | @Query(value = "select * from seat_allocation_mstr where Bus_Sch_Id=?1 order by id", nativeQuery = true) 43 | List fetchbybusschid(Long schid); 44 | 45 | @Query(value = "select * from seat_allocation_mstr where Bus_Sch_Id=?1 and Seat_No=?2 order by id", nativeQuery = true) 46 | List fetchbybusschidseat(Long schid,int seatno); 47 | 48 | 49 | 50 | } 51 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.3 9 | 10 | 11 | com.aniket 12 | portal 13 | 0.0.1-SNAPSHOT 14 | portal 15 | Demo project for Spring Boot 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | org.apache.tomcat 33 | tomcat-jasper 34 | 9.0.58 35 | 36 | 37 | 38 | com.h2database 39 | h2 40 | runtime 41 | 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-starter-mail 46 | 47 | 48 | 49 | org.apache.commons 50 | commons-csv 51 | 1.9.0 52 | 53 | 54 | org.apache.velocity 55 | velocity 56 | 1.7 57 | 58 | 59 | 60 | com.itextpdf.tool 61 | xmlworker 62 | 5.5.10 63 | 64 | 65 | com.itextpdf 66 | itextpdf 67 | 5.0.6 68 | 69 | 70 | com.itextpdf 71 | itextpdf 72 | 5.5.11 73 | 74 | 75 | org.postgresql 76 | postgresql 77 | runtime 78 | 79 | 80 | org.springframework.boot 81 | spring-boot-starter-jdbc 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-starter-data-jpa 86 | 87 | 88 | org.apache.tomcat 89 | tomcat-jasper 90 | 9.0.52 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | org.springframework.boot 99 | spring-boot-maven-plugin 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /bin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.7.3 9 | 10 | 11 | com.aniket 12 | portal 13 | 0.0.1-SNAPSHOT 14 | portal 15 | Demo project for Spring Boot 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | org.apache.tomcat 33 | tomcat-jasper 34 | 9.0.58 35 | 36 | 37 | 38 | com.h2database 39 | h2 40 | runtime 41 | 42 | 43 | 44 | org.springframework.boot 45 | spring-boot-starter-mail 46 | 47 | 48 | 49 | org.apache.commons 50 | commons-csv 51 | 1.9.0 52 | 53 | 54 | org.apache.velocity 55 | velocity 56 | 1.7 57 | 58 | 59 | 60 | com.itextpdf.tool 61 | xmlworker 62 | 5.5.10 63 | 64 | 65 | com.itextpdf 66 | itextpdf 67 | 5.0.6 68 | 69 | 70 | com.itextpdf 71 | itextpdf 72 | 5.5.11 73 | 74 | 75 | org.postgresql 76 | postgresql 77 | runtime 78 | 79 | 80 | org.springframework.boot 81 | spring-boot-starter-jdbc 82 | 83 | 84 | org.springframework.boot 85 | spring-boot-starter-data-jpa 86 | 87 | 88 | org.apache.tomcat 89 | tomcat-jasper 90 | 9.0.52 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | org.springframework.boot 99 | spring-boot-maven-plugin 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /src/main/webapp/templates/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 |
26 | 27 |
28 |
29 | 30 | 31 |
32 |
33 | 34 |
35 | 36 |
37 |
38 |
39 | 40 |
41 |
42 | 43 |
44 |
45 | 46 |
47 |
48 |
49 | 50 | 63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /bin/src/main/webapp/templates/index.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 | 23 | 24 |
25 |
26 | 27 |
28 |
29 | 30 | 31 |
32 |
33 | 34 |
35 | 36 |
37 |
38 |
39 | 40 |
41 |
42 | 43 |
44 |
45 | 46 |
47 |
48 |
49 | 50 | 63 |
64 | 65 | 66 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/pojos/RegistrationReqPojo.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.pojos; 2 | 3 | import java.util.List; 4 | 5 | public class RegistrationReqPojo { 6 | private int seats; 7 | private int rows; 8 | private int seatleftside; 9 | private int seatrightside; 10 | private int seatlastseat; 11 | private String busname; 12 | private String ownername; 13 | private String mobileno; 14 | private String emailid; 15 | private String endpoint1; 16 | private String endpoint2; 17 | private String busnumberplate; 18 | private List lisstoppages; 19 | private int esthr; 20 | private int estmin; 21 | public int getSeats() { 22 | return seats; 23 | } 24 | public void setSeats(int seats) { 25 | this.seats = seats; 26 | } 27 | public int getRows() { 28 | return rows; 29 | } 30 | public void setRows(int rows) { 31 | this.rows = rows; 32 | } 33 | public int getSeatleftside() { 34 | return seatleftside; 35 | } 36 | public void setSeatleftside(int seatleftside) { 37 | this.seatleftside = seatleftside; 38 | } 39 | public int getSeatrightside() { 40 | return seatrightside; 41 | } 42 | public void setSeatrightside(int seatrightside) { 43 | this.seatrightside = seatrightside; 44 | } 45 | public int getSeatlastseat() { 46 | return seatlastseat; 47 | } 48 | public void setSeatlastseat(int seatlastseat) { 49 | this.seatlastseat = seatlastseat; 50 | } 51 | public String getBusname() { 52 | return busname; 53 | } 54 | public void setBusname(String busname) { 55 | this.busname = busname; 56 | } 57 | public String getOwnername() { 58 | return ownername; 59 | } 60 | public void setOwnername(String ownername) { 61 | this.ownername = ownername; 62 | } 63 | public String getMobileno() { 64 | return mobileno; 65 | } 66 | public void setMobileno(String mobileno) { 67 | this.mobileno = mobileno; 68 | } 69 | public String getEmailid() { 70 | return emailid; 71 | } 72 | public void setEmailid(String emailid) { 73 | this.emailid = emailid; 74 | } 75 | public String getEndpoint1() { 76 | return endpoint1; 77 | } 78 | public void setEndpoint1(String endpoint1) { 79 | this.endpoint1 = endpoint1; 80 | } 81 | public String getEndpoint2() { 82 | return endpoint2; 83 | } 84 | public void setEndpoint2(String endpoint2) { 85 | this.endpoint2 = endpoint2; 86 | } 87 | public String getBusnumberplate() { 88 | return busnumberplate; 89 | } 90 | public void setBusnumberplate(String busnumberplate) { 91 | this.busnumberplate = busnumberplate; 92 | } 93 | public List getLisstoppages() { 94 | return lisstoppages; 95 | } 96 | public void setLisstoppages(List lisstoppages) { 97 | this.lisstoppages = lisstoppages; 98 | } 99 | 100 | public int getEsthr() { 101 | return esthr; 102 | } 103 | public void setEsthr(int esthr) { 104 | this.esthr = esthr; 105 | } 106 | public int getEstmin() { 107 | return estmin; 108 | } 109 | public void setEstmin(int estmin) { 110 | this.estmin = estmin; 111 | } 112 | @Override 113 | public String toString() { 114 | return "RegistrationReqPojo [seats=" + seats + ", rows=" + rows + ", seatleftside=" + seatleftside 115 | + ", seatrightside=" + seatrightside + ", seatlastseat=" + seatlastseat + ", busname=" + busname 116 | + ", ownername=" + ownername + ", mobileno=" + mobileno + ", emailid=" + emailid + ", endpoint1=" 117 | + endpoint1 + ", endpoint2=" + endpoint2 + ", busnumberplate=" + busnumberplate 118 | + ", lisstoppages=" + lisstoppages + "]"; 119 | } 120 | 121 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/RegistrationSrvcImpl.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.io.PrintWriter; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.aniket.portal.model.BusDetailsModel; 9 | import com.aniket.portal.model.BusRoutesModel; 10 | import com.aniket.portal.pojos.RegistrationReqPojo; 11 | import com.aniket.portal.pojos.RegistrationRespPojo; 12 | import com.aniket.portal.repository.BusDetailsRepo; 13 | import com.aniket.portal.repository.BusRouteRepo; 14 | 15 | @Service 16 | public class RegistrationSrvcImpl implements RegistrationSrvc { 17 | 18 | @Autowired 19 | BusDetailsRepo regrepo; 20 | @Autowired 21 | BusRouteRepo routerepo; 22 | @Override 23 | public Boolean savebusdetails(RegistrationReqPojo regpojo) { 24 | Long id1=0L; 25 | try 26 | { 27 | BusDetailsModel regobj1=new BusDetailsModel(); 28 | regobj1.setBusname(regpojo.getBusname()); 29 | regobj1.setOwnername(regpojo.getOwnername()); 30 | regobj1.setBusnumberplate(regpojo.getBusnumberplate()); 31 | regobj1.setEmailid(regpojo.getEmailid()); 32 | regobj1.setMobileno(regpojo.getMobileno()); 33 | regobj1.setEndpoint1(regpojo.getEndpoint1()); 34 | regobj1.setEndpoint2(regpojo.getEndpoint2()); 35 | regobj1.setRows(regpojo.getRows()); 36 | regobj1.setLastseat(regpojo.getSeatlastseat()); 37 | regobj1.setSeatleftside(regpojo.getSeatleftside()); 38 | regobj1.setSeatrightside(regpojo.getSeatrightside()); 39 | regobj1.setSeats(regpojo.getSeats()); 40 | regobj1.setEsthr(regpojo.getEsthr()); 41 | regobj1.setEstmin(regpojo.getEstmin()); 42 | if(regrepo.count()==0) 43 | { 44 | id1=1L; 45 | } 46 | else 47 | { 48 | id1=regrepo.fetchmaxid()+1; 49 | } 50 | regobj1.setId(id1); 51 | regrepo.save(regobj1); 52 | int size1=regpojo.getLisstoppages().size(); 53 | for(int i=0;i 4 | ## Technologies Used 5 | * SpringBoot 6 | * Java 7 | * PostgreSQL 8 | * AngularJS 9 | * Git 10 | * HTML 11 | * CSS 12 | * Javascript 13 | * Bootstrap 14 | ## Features 15 | * Bus can be registered with their bus structure and stoppage details. 16 | * Bus can have multiple stoppages. 17 | * Registered bus can view their details. 18 | * Registered bus can schedule future trips. 19 | * Registered bus can download pdf for future/completed/on-going trips which contains booking deatils for every seat. 20 | * Customer can book seats on selected date. On entering a date with their departure and arrival points, a list of buses scheduled will be available and the customer can choose bus and seats according to their preference. 21 | * System is validated for smooth functioning. 22 | ## Preview 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
Your image titleYour image titleYour image title
Your image titleYour image titleYour image title
Your image titleYour image titleYour image title
40 | 41 | ## How To Use 42 | ##### Software needed to run the application 43 | Eclipse or Spring Tool Suite(STS). 44 | ##### How to Extract Files 45 | Files can be extracted in two ways. 46 | 1. Download ZIP File 47 | * Download ZIP File from Code -> Download ZIP 48 | * After download is completed, extract files 49 | * Start Eclipse/Spring Boot by choosing a workplace. Import project (Import -> Maven ->Existing Maven Projects ->Choose Root Directory) and click on finish. Project will be imported. 50 | * Click on portal -> src/main/java -> .com.aniket.portal -> Right click on PortalApplication.java -> Run as Java Application (Or search for PortalApplication.java and run that as java application) 51 | * Application will be launched on localhost. [http://localhost:8080/home] 52 | 2. Clone Git Repository 53 | * Use URL - https://github.com/ani1100/busSeatAllocationSystem.git for cloning. 54 | * Start Eclipse/Spring Boot by choosing a workplace. Go to GIT Perspective -> Clone a Git Repository -> Paste the URL for cloning -> Click on Next -> Click on Finish on next pop up. 55 | * After this, a local git repository will be created. Right Click on busSeatAllocationSystem -> Select import projects -> Click on Finish. Project will be imported. 56 | * Go to Java Perspective , Click on portal -> src/main/java -> .com.aniket.portal -> Right click on PortalApplication.java -> Run as Java Application (Or search for PortalApplication.java and run that as java application) 57 | * Application will be launched on localhost. [http://localhost:8080/home] 58 | ## Database 59 | For sample purpose, h2 database(local database) is integrated with the application so that application can run for any user.
60 | If user want to change the database, they can make relevant changes in "application.properties" file.
61 | Also, some data is pre-populated for sample purpose which can be deleted from "data.sql" file.
62 | ## Sample data 63 | * All are below information are for sample purpose. 64 | * Three bus have already been registered. (BUSID - ABC1 , ABC2 , ABC3) 65 | * Trips is also been scheduled for BUSID - ABC1 and ABC2 on 1st January,2025 from Jammu to Amritsar (Stoppages - Jammu -> Katra -> Amritsar). 66 | * Some seats are already booked for representation purpose.
67 | This is enough for sample purpose. 68 | ## Application Navigation 69 | * Bus details can be viewed by searching BUSID's. 70 | * New bus can be registered from Bus Registration Tab. 71 | * Customer can book seats from Customer Seat Booking Tab. Try entering Start Location as "Jammu" and End Location as "Amritsar" and Departure Date as "1st January,2025" to see the results. Choose bus and book seats. 72 | * New Trips can be scheduled for registered bus. (Search a bus and click on bus scheduling) 73 | * Booking details for scheduled trips/completed trips can be downloaded in the form of pdfs.(Search a bus and click on scheduled trips and then,click on View pdf) 74 | * Try to experiment as you want to. Everthing is validated for the best performance of the user!!. 75 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/SeatpdfSrvc.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.HttpEntity; 8 | import org.springframework.http.HttpHeaders; 9 | import org.springframework.http.MediaType; 10 | import org.springframework.stereotype.Service; 11 | 12 | import com.aniket.portal.model.BusDetailsModel; 13 | import com.aniket.portal.model.BusDispatchModel; 14 | import com.aniket.portal.model.CustomerDetailsModel; 15 | import com.aniket.portal.model.SeatAllocationModel; 16 | import com.aniket.portal.repository.BusDetailsRepo; 17 | import com.aniket.portal.repository.BusDispatchRepo; 18 | import com.aniket.portal.repository.BusRouteRepo; 19 | import com.aniket.portal.repository.CustomerDetailsRepo; 20 | import com.aniket.portal.repository.SeatAllocationRepo; 21 | import com.itextpdf.text.Document; 22 | import com.itextpdf.text.Element; 23 | import com.itextpdf.text.Font; 24 | import com.itextpdf.text.Font.FontFamily; 25 | import com.itextpdf.text.PageSize; 26 | import com.itextpdf.text.Paragraph; 27 | import com.itextpdf.text.pdf.PdfWriter; 28 | 29 | 30 | @Service 31 | public class SeatpdfSrvc { 32 | @Autowired 33 | SeatAllocationRepo seatrepo; 34 | @Autowired 35 | BusDispatchRepo disrepo; 36 | @Autowired 37 | BusDetailsRepo dtlsrepo; 38 | @Autowired 39 | BusRouteRepo routerepo; 40 | @Autowired 41 | CustomerDetailsRepo cstrepo; 42 | 43 | @SuppressWarnings({ "deprecation", "static-access" }) 44 | public ByteArrayOutputStream pdfcontent(Long busschid) 45 | { 46 | ByteArrayOutputStream baos=new ByteArrayOutputStream(); 47 | try 48 | { 49 | Font regular = new Font(FontFamily.HELVETICA, 12); 50 | Font bold = new Font(FontFamily.HELVETICA, 12, Font.BOLD); 51 | Document document=new Document(); 52 | document.setPageSize(PageSize.LETTER); 53 | document.addAuthor("Aniket"); 54 | PdfWriter.getInstance(document, baos); 55 | document.addTitle("SeatPdfView"); 56 | document.open(); 57 | BusDispatchModel disobj=disrepo.getById(busschid); 58 | Long busobjid=disrepo.getById(busschid).getBusdtlsid(); 59 | BusDetailsModel busdtlsobj=dtlsrepo.getById(busobjid); 60 | Paragraph p2=new Paragraph(busdtlsobj.getBusnumberplate()); 61 | p2.setAlignment(Element.ALIGN_CENTER); 62 | document.add(p2); 63 | p2.clear(); 64 | if(disobj.getFlag()==0) 65 | { 66 | p2.add(busdtlsobj.getEndpoint1().concat(" -> ").concat(busdtlsobj.getEndpoint2())); 67 | } 68 | else 69 | { 70 | p2.add(busdtlsobj.getEndpoint2().concat(" -> ").concat(busdtlsobj.getEndpoint1())); 71 | } 72 | document.add(p2); 73 | for(Integer i=1;i<=busdtlsobj.getSeats();i++) 74 | { 75 | Paragraph p1=new Paragraph("Seat ".concat(i.toString()).concat(":"), bold); 76 | document.add(p1); 77 | List seatdtlslis=seatrepo.fetchbybusschidseat(busschid, i); 78 | String occupy="N"; 79 | Long cstid=-1L; 80 | int ordid=-1; 81 | for(SeatAllocationModel seatdtlsobj:seatdtlslis) 82 | { 83 | String occ=seatdtlsobj.getAllocation(); 84 | if(occ.equals("Y")) 85 | { 86 | if(occupy.equals("N")) 87 | { 88 | occupy="Y"; 89 | cstid=seatdtlsobj.getCstmrdtlsid(); 90 | ordid=seatdtlsobj.getLocationorderid(); 91 | } 92 | else 93 | { 94 | if(seatdtlsobj.getCstmrdtlsid()==cstid) 95 | { 96 | continue; 97 | } 98 | else 99 | { 100 | CustomerDetailsModel cstobj=cstrepo.getById(cstid); 101 | String loc1=routerepo.fetchbusbyorderid(busobjid,ordid).getLocationname(); 102 | String loc2=routerepo.fetchbusbyorderid(busobjid,seatdtlsobj.getLocationorderid()).getLocationname(); 103 | String temp=loc1.concat(" - ").concat(loc2).concat(" -> ").concat(cstobj.getCstmrname()).concat(" (Mobile No : ").concat(cstobj.getMobileno()).concat(")"); 104 | Paragraph p3=new Paragraph(temp); 105 | document.add(p3); 106 | cstid=seatdtlsobj.getCstmrdtlsid(); 107 | ordid=seatdtlsobj.getLocationorderid(); 108 | } 109 | } 110 | } 111 | else 112 | { 113 | if(occupy.equals("Y")) 114 | { 115 | CustomerDetailsModel cstobj=cstrepo.getById(cstid); 116 | String loc1=routerepo.fetchbusbyorderid(busobjid,ordid).getLocationname(); 117 | String loc2=routerepo.fetchbusbyorderid(busobjid,seatdtlsobj.getLocationorderid()).getLocationname(); 118 | String temp=loc1.concat(" - ").concat(loc2).concat(" -> ").concat(cstobj.getCstmrname()).concat(" (Mobile No : ").concat(cstobj.getMobileno()).concat(")");Paragraph p3=new Paragraph(temp); 119 | document.add(p3); 120 | occupy="N"; 121 | cstid=seatdtlsobj.getCstmrdtlsid(); 122 | ordid=seatdtlsobj.getLocationorderid(); 123 | } 124 | else 125 | { 126 | continue; 127 | } 128 | } 129 | } 130 | } 131 | document.close(); 132 | return baos; 133 | } 134 | catch(Exception e) 135 | { 136 | return null; 137 | } 138 | } 139 | public HttpEntity pdfgenerator(Long busschid) 140 | { 141 | ByteArrayOutputStream bt=new ByteArrayOutputStream(); 142 | bt=pdfcontent(busschid); 143 | HttpHeaders header=new HttpHeaders(); 144 | header.setContentType(MediaType.APPLICATION_PDF); 145 | Long busobjid=disrepo.getById(busschid).getBusdtlsid(); 146 | BusDetailsModel busdtlsobj=dtlsrepo.getById(busobjid); 147 | String fileName=busdtlsobj.getBusnumberplate().concat("_").concat(busschid.toString()).concat(".pdf"); 148 | header.set(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename="+fileName.replace(" ","_")); 149 | header.setContentLength(bt.toByteArray().length); 150 | return new HttpEntity(bt.toByteArray(),header); 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/main/webapp/templates/singlebusregistration.jsp: -------------------------------------------------------------------------------- 1 |
2 |

Bus Registration

3 |
4 |
5 | 6 |

Basic Details


7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 | 31 |

Bus Details


32 |
33 |
34 | 35 | 36 |
37 |
38 | 39 | 40 |
41 |
42 | 43 | 44 |
45 |
46 | 47 | 48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 | 56 |

Trip Details


57 |
58 |
59 | 60 | 61 |
62 |
63 | 64 | 65 |
66 |
67 | 68 | 69 |
70 |
71 | 72 | 73 |
74 |
75 | 76 | 77 |
78 |
79 |
80 | 81 |

Stoppages Details


82 |
83 |
84 | 85 | 86 |
87 |
88 |

Please fill No of Stoppages First

89 |
90 |
91 |
92 |
93 | 94 |   95 | 96 |
97 |
98 |
-------------------------------------------------------------------------------- /bin/src/main/webapp/templates/singlebusregistration.jsp: -------------------------------------------------------------------------------- 1 |
2 |

Bus Registration

3 |
4 |
5 | 6 |

Basic Details


7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 |
17 | 18 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 |
28 |
29 |
30 | 31 |

Bus Details


32 |
33 |
34 | 35 | 36 |
37 |
38 | 39 | 40 |
41 |
42 | 43 | 44 |
45 |
46 | 47 | 48 |
49 |
50 | 51 | 52 |
53 |
54 |
55 | 56 |

Trip Details


57 |
58 |
59 | 60 | 61 |
62 |
63 | 64 | 65 |
66 |
67 | 68 | 69 |
70 |
71 | 72 | 73 |
74 |
75 | 76 | 77 |
78 |
79 |
80 | 81 |

Stoppages Details


82 |
83 |
84 | 85 | 86 |
87 |
88 |

Please fill No of Stoppages First

89 |
90 |
91 |
92 |
93 | 94 |   95 | 96 |
97 |
98 |
-------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /bin/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/BusSchedulingSrvcImpl.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | import java.util.List; 6 | import java.util.*; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.aniket.portal.model.BusDispatchModel; 11 | import com.aniket.portal.model.SeatAllocationModel; 12 | import com.aniket.portal.pojos.BusSchedulingReqPojo; 13 | import com.aniket.portal.pojos.RegistrationRespPojo; 14 | import com.aniket.portal.repository.BusDispatchRepo; 15 | import com.aniket.portal.repository.SeatAllocationRepo; 16 | 17 | @Service 18 | public class BusSchedulingSrvcImpl implements BusSchedulingSrvc { 19 | 20 | @Autowired 21 | BusDispatchRepo dispatchrepo; 22 | @Autowired 23 | SeatAllocationRepo seatallrepo; 24 | @Override 25 | public Boolean schedulebus(BusSchedulingReqPojo schbusreqpojo) { 26 | try 27 | { 28 | BusDispatchModel dispatchobj1=new BusDispatchModel(); 29 | dispatchobj1.setArrivaltime(schbusreqpojo.getArrtime()); 30 | dispatchobj1.setDeptime(schbusreqpojo.getDeptime()); 31 | dispatchobj1.setBusdtlsid(schbusreqpojo.getBusdetails().getId()); 32 | dispatchobj1.setFlag(schbusreqpojo.getFlag()); 33 | dispatchobj1.setTripcompleted("N"); 34 | Long id1; 35 | if(dispatchrepo.count()==0) 36 | { 37 | dispatchobj1.setId(1L); 38 | id1=1L; 39 | } 40 | else 41 | { 42 | id1=dispatchrepo.fetchmaxid()+1; 43 | dispatchobj1.setId(id1); 44 | } 45 | dispatchrepo.save(dispatchobj1); 46 | int nseats=schbusreqpojo.getBusdetails().getSeats(); 47 | List loc; 48 | int start; 49 | int flag1; 50 | if(schbusreqpojo.getFlag()==0) 51 | { 52 | loc=schbusreqpojo.getLocationname(); 53 | start=1; 54 | flag1=1; 55 | } 56 | else 57 | { 58 | loc=schbusreqpojo.getLocationname(); 59 | Collections.reverse(loc); 60 | start=loc.size(); 61 | flag1=-1; 62 | } 63 | for(int i=1;i<=nseats;i++) 64 | { 65 | int startid=start; 66 | for(String locobj:loc) 67 | { 68 | SeatAllocationModel seatobj=new SeatAllocationModel(); 69 | seatobj.setBusdtlsid(schbusreqpojo.getBusdetails().getId()); 70 | seatobj.setBusschid(id1); 71 | seatobj.setAllocation("N"); 72 | seatobj.setLocationorderid(startid); 73 | seatobj.setSeatno(i); 74 | if(seatallrepo.count()==0) 75 | { 76 | seatobj.setId(1L); 77 | } 78 | else 79 | { 80 | seatobj.setId(seatallrepo.fetchmaxid()+1); 81 | } 82 | seatallrepo.save(seatobj); 83 | startid+=flag1; 84 | } 85 | 86 | } 87 | return true; 88 | } 89 | catch(Exception e) 90 | { 91 | System.out.println(e); 92 | return false; 93 | } 94 | } 95 | @Override 96 | public RegistrationRespPojo schedulebusrequest(BusSchedulingReqPojo schbusreqpojo) { 97 | RegistrationRespPojo resppojo1=new RegistrationRespPojo(); 98 | try 99 | { 100 | Listlisobj= dispatchrepo.fetchdistinctsch(schbusreqpojo.getDeptime(),schbusreqpojo.getArrtime(),schbusreqpojo.getBusdetails().getId()); 101 | if(lisobj.size()==0) 102 | { 103 | int flag1=0; 104 | int flagquery1; 105 | int flagquery2; 106 | if(schbusreqpojo.getFlag()==0) 107 | { 108 | flagquery1=1; 109 | flagquery2=0; 110 | } 111 | else 112 | { 113 | flagquery1=0; 114 | flagquery2=1; 115 | } 116 | SimpleDateFormat formatter1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 117 | Date datear=formatter1.parse(schbusreqpojo.getArrtime()); 118 | Date datedp=formatter1.parse(schbusreqpojo.getDeptime()); 119 | List objdeplis=dispatchrepo.fetchbusbydep(schbusreqpojo.getDeptime(),flagquery1,schbusreqpojo.getBusdetails().getId()); 120 | if(objdeplis.size()>0) 121 | { 122 | BusDispatchModel objdep1=objdeplis.get(0); 123 | Calendar caldep = Calendar.getInstance(); 124 | caldep.setTime(datedp); 125 | caldep.add(Calendar.HOUR_OF_DAY, -2); 126 | Date date = caldep.getTime(); 127 | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 128 | String date1 = format1.format(date); 129 | String date2=format1.format(formatter1.parse(objdep1.getArrivaltime())); 130 | if(date2.compareTo(date1)>0) 131 | { 132 | flag1=1; 133 | } 134 | } 135 | objdeplis=dispatchrepo.fetchbusbydep(schbusreqpojo.getDeptime(),flagquery2,schbusreqpojo.getBusdetails().getId()); 136 | if(objdeplis.size()>0) 137 | { 138 | BusDispatchModel objdep1=objdeplis.get(0); 139 | Calendar caldep = Calendar.getInstance(); 140 | caldep.setTime(datedp); 141 | caldep.add(Calendar.HOUR_OF_DAY, -2); 142 | caldep.add(Calendar.HOUR_OF_DAY, -schbusreqpojo.getBusdetails().getEsthr()); 143 | caldep.add(Calendar.MINUTE,-schbusreqpojo.getBusdetails().getEstmin()); 144 | Date date = caldep.getTime(); 145 | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 146 | String date1 = format1.format(date); 147 | String date2=format1.format(formatter1.parse(objdep1.getArrivaltime())); 148 | if(date2.compareTo(date1)>0) 149 | { 150 | flag1=1; 151 | } 152 | } 153 | objdeplis=dispatchrepo.fetchbusbyarr(schbusreqpojo.getArrtime(),flagquery2,schbusreqpojo.getBusdetails().getId()); 154 | if(objdeplis.size()>0) 155 | { 156 | BusDispatchModel objdep1=objdeplis.get(0); 157 | Calendar caldep = Calendar.getInstance(); 158 | caldep.setTime(datear); 159 | caldep.add(Calendar.HOUR_OF_DAY, 2); 160 | caldep.add(Calendar.HOUR_OF_DAY, schbusreqpojo.getBusdetails().getEsthr()); 161 | caldep.add(Calendar.MINUTE,schbusreqpojo.getBusdetails().getEstmin()); 162 | Date date = caldep.getTime(); 163 | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 164 | String date1 = format1.format(date); 165 | String date2=format1.format(formatter1.parse(objdep1.getDeptime())); 166 | if(date2.compareTo(date1)<0) 167 | { 168 | flag1=1; 169 | } 170 | } 171 | objdeplis=dispatchrepo.fetchbusbyarr(schbusreqpojo.getArrtime(),flagquery1,schbusreqpojo.getBusdetails().getId()); 172 | if(objdeplis.size()>0) 173 | { 174 | BusDispatchModel objdep1=objdeplis.get(0); 175 | Calendar caldep = Calendar.getInstance(); 176 | caldep.setTime(datear); 177 | caldep.add(Calendar.HOUR_OF_DAY, 2); 178 | Date date = caldep.getTime(); 179 | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 180 | String date1 = format1.format(date); 181 | String date2=format1.format(formatter1.parse(objdep1.getDeptime())); 182 | if(date2.compareTo(date1)<0) 183 | { 184 | flag1=1; 185 | } 186 | } 187 | if(flag1==1) 188 | { 189 | resppojo1.setStatus("Failed"); 190 | resppojo1.setMessage("Buffer Time Overlapping"); 191 | 192 | } 193 | else 194 | { 195 | Boolean result = schedulebus(schbusreqpojo); 196 | if(result==true) 197 | { 198 | resppojo1.setStatus("Success"); 199 | resppojo1.setMessage("Bus scheduled successfully"); 200 | } 201 | else 202 | { 203 | resppojo1.setStatus("Failed"); 204 | resppojo1.setMessage("Bus Scheduling Failed.Please try again later"); 205 | } 206 | } 207 | } 208 | else 209 | { 210 | resppojo1.setStatus("Failed"); 211 | resppojo1.setMessage("Bus Already Scheduled for this time"); 212 | } 213 | } 214 | catch(Exception e) 215 | { 216 | resppojo1.setStatus("Failed"); 217 | resppojo1.setMessage("Exception Occured"); 218 | System.out.println(e); 219 | } 220 | return resppojo1; 221 | } 222 | 223 | 224 | 225 | } -------------------------------------------------------------------------------- /src/main/webapp/js/BusSearchController.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | var myApp = angular.module('myApp'); 3 | myApp.controller('BusSearchController',BusSearchController); 4 | 5 | function BusSearchController($scope,$http){ 6 | 7 | $scope.schtrips=function() 8 | { 9 | $http({ 10 | method : "POST", 11 | url : "fetchuncompletedtrips", 12 | data: $scope.busdtlsinfo.busdtls.busnumberplate 13 | }).then(function mySuccess(response) { 14 | $scope.busdtlsinfo.scheduledtrip=response.data; 15 | console.log(response.data); 16 | $scope.viewschtrips = []; 17 | for(var i=0;i<$scope.busdtlsinfo.scheduledtrip.length;i+=1) 18 | { 19 | var obj={}; 20 | if($scope.busdtlsinfo.scheduledtrip[i].flag==0) 21 | { 22 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint1; 23 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint2; 24 | } 25 | else 26 | { 27 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint2; 28 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint1; 29 | } 30 | var objd= $scope.busdtlsinfo.scheduledtrip[i].arrivaltime.split(" ")[0].split("-"); 31 | obj.arrdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 32 | obj.arrtime= $scope.busdtlsinfo.scheduledtrip[i].arrivaltime.split(" ")[1]; 33 | objd= $scope.busdtlsinfo.scheduledtrip[i].deptime.split(" ")[0].split("-"); 34 | obj.depdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 35 | obj.deptime= $scope.busdtlsinfo.scheduledtrip[i].deptime.split(" ")[1]; 36 | obj.buschid= $scope.busdtlsinfo.scheduledtrip[i].id; 37 | $scope.viewschtrips.push(obj); 38 | console.log(obj); 39 | } 40 | }, function myError(response) { 41 | console.log(response); 42 | }); 43 | } 44 | $scope.completedtrips=function() 45 | { 46 | $http({ 47 | method : "POST", 48 | url : "fetchcompletedtrips", 49 | data: $scope.busdtlsinfo.busdtls.busnumberplate 50 | }).then(function mySuccess(response) { 51 | $scope.busdtlsinfo.completedtrip=response.data; 52 | $scope.comptrips = []; 53 | for(var i=0;i<$scope.busdtlsinfo.completedtrip.length;i+=1) 54 | { 55 | var obj={}; 56 | if($scope.busdtlsinfo.completedtrip[i].flag==0) 57 | { 58 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint1; 59 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint2; 60 | } 61 | else 62 | { 63 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint2; 64 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint1; 65 | } 66 | var objd= $scope.busdtlsinfo.completedtrip[i].arrivaltime.split(" ")[0].split("-"); 67 | obj.arrdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 68 | obj.arrtime= $scope.busdtlsinfo.completedtrip[i].arrivaltime.split(" ")[1]; 69 | objd= $scope.busdtlsinfo.completedtrip[i].deptime.split(" ")[0].split("-"); 70 | obj.depdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 71 | obj.deptime= $scope.busdtlsinfo.completedtrip[i].deptime.split(" ")[1]; 72 | $scope.comptrips.push(obj); 73 | console.log(obj); 74 | } 75 | }, function myError(response) { 76 | console.log(response); 77 | }); 78 | } 79 | $scope.change1=function(obj) 80 | { 81 | if(obj=="start") 82 | { 83 | if($scope.busdtlsinfo.startpoint==$scope.places[0]) 84 | { 85 | $scope.busdtlsinfo.flag=0; 86 | $scope.busdtlsinfo.endpoint=$scope.places[1]; 87 | } 88 | else 89 | { 90 | $scope.busdtlsinfo.endpoint=$scope.places[0]; 91 | $scope.busdtlsinfo.flag=1; 92 | } 93 | } 94 | else 95 | { 96 | if($scope.busdtlsinfo.endpoint==$scope.places[0]) 97 | { 98 | $scope.busdtlsinfo.flag=1; 99 | $scope.busdtlsinfo.startpoint=$scope.places[1]; 100 | } 101 | else 102 | { 103 | $scope.busdtlsinfo.flag=0; 104 | $scope.busdtlsinfo.startpoint=$scope.places[0]; 105 | } 106 | } 107 | } 108 | 109 | $scope.resetbus=function() 110 | { 111 | $scope.busdtlsinfo.startpoint=null; 112 | $scope.busdtlsinfo.endpoint=null; 113 | $scope.busdtlsinfo.depdate=null; 114 | $scope.busdtlsinfo.deptime=null; 115 | $scope.busdtlsinfo.arrdate=null; 116 | $scope.busdtlsinfo.arrtime=null; 117 | } 118 | $scope.schedulebus=function() 119 | { 120 | if(($scope.busdtlsinfo.arrtime==null)||($scope.busdtlsinfo.arrdate==null)||($scope.busdtlsinfo.deptime==null)||($scope.busdtlsinfo.depdate==null)||($scope.busdtlsinfo.endpoint==null)||($scope.busdtlsinfo.startpoint==null)) 121 | { 122 | $scope.alert("Please Fill in all the details"); 123 | return; 124 | } 125 | else 126 | { 127 | var d = new Date($scope.busdtlsinfo.arrdate); 128 | var month = '' + (d.getMonth() + 1); 129 | var day = '' + d.getDate(); 130 | var year = d.getFullYear(); 131 | if (month.length < 2) { 132 | month = '0' + month;} 133 | if (day.length < 2) { 134 | day = '0' + day;} 135 | var arrd=[year, month, day].join('-'); 136 | d = new Date($scope.busdtlsinfo.depdate); 137 | month = '' + (d.getMonth() + 1); 138 | day = '' + d.getDate(); 139 | year = d.getFullYear(); 140 | if (month.length < 2) { 141 | month = '0' + month;} 142 | if (day.length < 2) { 143 | day = '0' + day;} 144 | } 145 | var depd=[year, month, day].join('-'); 146 | d = new Date(); 147 | year = d.getFullYear().toString(); 148 | month = (d.getMonth()+1).toString(); 149 | if(month.length==1) 150 | { 151 | month="0".concat(month); 152 | } 153 | day = d.getDate().toString(); 154 | if(day.length==1) 155 | { 156 | day="0".concat(day); 157 | } 158 | var hour1= d.getHours().toString(); 159 | if(hour1.length==1) 160 | { 161 | hour1="0".concat(hour1); 162 | } 163 | var min1= d.getMinutes().toString(); 164 | if(min1.length==1) 165 | { 166 | min1="0".concat(min1); 167 | } 168 | var sec1= d.getSeconds().toString(); 169 | if(sec1.length==1) 170 | { 171 | sec1="0".concat(sec1); 172 | } 173 | var sysdate=year.concat("-").concat(month).concat("-").concat(day); 174 | var systime=hour1.concat(":").concat(min1).concat(":").concat(sec1); 175 | var sysdatetime=sysdate.concat(" ").concat(systime);//System Date 176 | var arrt=document.getElementById("arrtime").value.concat(":").concat("00"); 177 | var dept=document.getElementById("deptime").value.concat(":").concat("00"); 178 | $scope.busdtlsinfo.arrddate=arrd.concat(" ").concat(arrt);//Arrival Date 179 | $scope.busdtlsinfo.depddate=depd.concat(" ").concat(dept);//Departure Date 180 | var arr = $scope.busdtlsinfo.depddate.split(/-|\s|:/);// split string and create array. 181 | var estminutes=$scope.busdtlsinfo.busdtls.esthr*60 + $scope.busdtlsinfo.busdtls.estmin; 182 | var minminutes=estminutes-Math.floor(estminutes/4); 183 | var maxminutes=estminutes+Math.floor(estminutes/4); 184 | var dt = new Date(arr[0], arr[1] -1, arr[2], arr[3], arr[4], arr[5]); 185 | dt.setMinutes(dt.getMinutes() + minminutes); 186 | year = dt.getFullYear().toString(); 187 | month = (dt.getMonth()+1).toString(); 188 | if(month.length==1) 189 | { 190 | month="0".concat(month); 191 | } 192 | day = dt.getDate().toString(); 193 | if(day.length==1) 194 | { 195 | day="0".concat(day); 196 | } 197 | hour1= dt.getHours().toString(); 198 | if(hour1.length==1) 199 | { 200 | hour1="0".concat(hour1); 201 | } 202 | min1= dt.getMinutes().toString(); 203 | if(min1.length==1) 204 | { 205 | min1="0".concat(min1); 206 | } 207 | sec1= dt.getSeconds().toString(); 208 | if(sec1.length==1) 209 | { 210 | sec1="0".concat(sec1); 211 | } 212 | var estdtmin=year.concat("-").concat(month).concat("-").concat(day); 213 | var esttimemin=hour1.concat(":").concat(min1).concat(":").concat(sec1); 214 | var estdatetimemin=estdtmin.concat(" ").concat(esttimemin); //Minimum Scheduling Time 215 | dt = new Date(arr[0], arr[1] -1, arr[2], arr[3], arr[4], arr[5]); 216 | dt.setMinutes(dt.getMinutes() + maxminutes); 217 | year = dt.getFullYear().toString(); 218 | month = (dt.getMonth()+1).toString(); 219 | if(month.length==1) 220 | { 221 | month="0".concat(month); 222 | } 223 | day = dt.getDate().toString(); 224 | if(day.length==1) 225 | { 226 | day="0".concat(day); 227 | } 228 | hour1= dt.getHours().toString(); 229 | if(hour1.length==1) 230 | { 231 | hour1="0".concat(hour1); 232 | } 233 | min1= dt.getMinutes().toString(); 234 | if(min1.length==1) 235 | { 236 | min1="0".concat(min1); 237 | } 238 | sec1= dt.getSeconds().toString(); 239 | if(sec1.length==1) 240 | { 241 | sec1="0".concat(sec1); 242 | } 243 | var estdtmax=year.concat("-").concat(month).concat("-").concat(day); 244 | var esttimemax=hour1.concat(":").concat(min1).concat(":").concat(sec1); 245 | var estdatetimemax=estdtmax.concat(" ").concat(esttimemax); //Maximum Scheduling Time 246 | if(sysdatetime.localeCompare($scope.busdtlsinfo.depddate)==1) 247 | { 248 | $scope.alert("Start Date should be greater than System Date"); 249 | } 250 | else if($scope.busdtlsinfo.depddate.localeCompare($scope.busdtlsinfo.arrddate)==1) 251 | { 252 | $scope.alert("Start Date cannot be greater than End Date"); 253 | } 254 | else if(estdatetimemin.localeCompare($scope.busdtlsinfo.arrddate)==1) 255 | { 256 | $scope.alert("Arrival Time is too less. Cannot schedule bus"); 257 | } 258 | else if($scope.busdtlsinfo.arrddate.localeCompare(estdatetimemax)==1) 259 | { 260 | $scope.alert("Arrival Time is too high. Cannot schedule bus"); 261 | } 262 | else 263 | { 264 | var obj={"busdetails":$scope.busdtlsinfo.busdtls,"deptime":$scope.busdtlsinfo.depddate,"arrtime":$scope.busdtlsinfo.arrddate,"flag":$scope.busdtlsinfo.flag,"locationname":$scope.busdtlsinfo.locationname}; 265 | console.log(obj); 266 | $http({ 267 | method : "POST", 268 | url : "schedulebus", 269 | data: obj 270 | }).then(function mySuccess(response) { 271 | if(response.data.status=="Failed") 272 | { 273 | $scope.alert(response.data.message); 274 | } 275 | else 276 | { 277 | $scope.alert(response.data.message); 278 | $scope.resetbus(); 279 | } 280 | }, function myError(response) { 281 | $scope.alert("Something went wrong.Please Try Again Later") 282 | console.log(response); 283 | }); 284 | } 285 | } 286 | 287 | } -------------------------------------------------------------------------------- /bin/src/main/webapp/js/BusSearchController.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | var myApp = angular.module('myApp'); 3 | myApp.controller('BusSearchController',BusSearchController); 4 | 5 | function BusSearchController($scope,$http){ 6 | 7 | $scope.schtrips=function() 8 | { 9 | $http({ 10 | method : "POST", 11 | url : "fetchuncompletedtrips", 12 | data: $scope.busdtlsinfo.busdtls.busnumberplate 13 | }).then(function mySuccess(response) { 14 | $scope.busdtlsinfo.scheduledtrip=response.data; 15 | console.log(response.data); 16 | $scope.viewschtrips = []; 17 | for(var i=0;i<$scope.busdtlsinfo.scheduledtrip.length;i+=1) 18 | { 19 | var obj={}; 20 | if($scope.busdtlsinfo.scheduledtrip[i].flag==0) 21 | { 22 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint1; 23 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint2; 24 | } 25 | else 26 | { 27 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint2; 28 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint1; 29 | } 30 | var objd= $scope.busdtlsinfo.scheduledtrip[i].arrivaltime.split(" ")[0].split("-"); 31 | obj.arrdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 32 | obj.arrtime= $scope.busdtlsinfo.scheduledtrip[i].arrivaltime.split(" ")[1]; 33 | objd= $scope.busdtlsinfo.scheduledtrip[i].deptime.split(" ")[0].split("-"); 34 | obj.depdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 35 | obj.deptime= $scope.busdtlsinfo.scheduledtrip[i].deptime.split(" ")[1]; 36 | obj.buschid= $scope.busdtlsinfo.scheduledtrip[i].id; 37 | $scope.viewschtrips.push(obj); 38 | console.log(obj); 39 | } 40 | }, function myError(response) { 41 | console.log(response); 42 | }); 43 | } 44 | $scope.completedtrips=function() 45 | { 46 | $http({ 47 | method : "POST", 48 | url : "fetchcompletedtrips", 49 | data: $scope.busdtlsinfo.busdtls.busnumberplate 50 | }).then(function mySuccess(response) { 51 | $scope.busdtlsinfo.completedtrip=response.data; 52 | $scope.comptrips = []; 53 | for(var i=0;i<$scope.busdtlsinfo.completedtrip.length;i+=1) 54 | { 55 | var obj={}; 56 | if($scope.busdtlsinfo.completedtrip[i].flag==0) 57 | { 58 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint1; 59 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint2; 60 | } 61 | else 62 | { 63 | obj.startpoint=$scope.busdtlsinfo.busdtls.endpoint2; 64 | obj.endpoint=$scope.busdtlsinfo.busdtls.endpoint1; 65 | } 66 | var objd= $scope.busdtlsinfo.completedtrip[i].arrivaltime.split(" ")[0].split("-"); 67 | obj.arrdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 68 | obj.arrtime= $scope.busdtlsinfo.completedtrip[i].arrivaltime.split(" ")[1]; 69 | objd= $scope.busdtlsinfo.completedtrip[i].deptime.split(" ")[0].split("-"); 70 | obj.depdate= objd[2].concat("/").concat(objd[1]).concat("/").concat(objd[0]); 71 | obj.deptime= $scope.busdtlsinfo.completedtrip[i].deptime.split(" ")[1]; 72 | $scope.comptrips.push(obj); 73 | console.log(obj); 74 | } 75 | }, function myError(response) { 76 | console.log(response); 77 | }); 78 | } 79 | $scope.change1=function(obj) 80 | { 81 | if(obj=="start") 82 | { 83 | if($scope.busdtlsinfo.startpoint==$scope.places[0]) 84 | { 85 | $scope.busdtlsinfo.flag=0; 86 | $scope.busdtlsinfo.endpoint=$scope.places[1]; 87 | } 88 | else 89 | { 90 | $scope.busdtlsinfo.endpoint=$scope.places[0]; 91 | $scope.busdtlsinfo.flag=1; 92 | } 93 | } 94 | else 95 | { 96 | if($scope.busdtlsinfo.endpoint==$scope.places[0]) 97 | { 98 | $scope.busdtlsinfo.flag=1; 99 | $scope.busdtlsinfo.startpoint=$scope.places[1]; 100 | } 101 | else 102 | { 103 | $scope.busdtlsinfo.flag=0; 104 | $scope.busdtlsinfo.startpoint=$scope.places[0]; 105 | } 106 | } 107 | } 108 | 109 | $scope.resetbus=function() 110 | { 111 | $scope.busdtlsinfo.startpoint=null; 112 | $scope.busdtlsinfo.endpoint=null; 113 | $scope.busdtlsinfo.depdate=null; 114 | $scope.busdtlsinfo.deptime=null; 115 | $scope.busdtlsinfo.arrdate=null; 116 | $scope.busdtlsinfo.arrtime=null; 117 | } 118 | $scope.schedulebus=function() 119 | { 120 | if(($scope.busdtlsinfo.arrtime==null)||($scope.busdtlsinfo.arrdate==null)||($scope.busdtlsinfo.deptime==null)||($scope.busdtlsinfo.depdate==null)||($scope.busdtlsinfo.endpoint==null)||($scope.busdtlsinfo.startpoint==null)) 121 | { 122 | $scope.alert("Please Fill in all the details"); 123 | return; 124 | } 125 | else 126 | { 127 | var d = new Date($scope.busdtlsinfo.arrdate); 128 | var month = '' + (d.getMonth() + 1); 129 | var day = '' + d.getDate(); 130 | var year = d.getFullYear(); 131 | if (month.length < 2) { 132 | month = '0' + month;} 133 | if (day.length < 2) { 134 | day = '0' + day;} 135 | var arrd=[year, month, day].join('-'); 136 | d = new Date($scope.busdtlsinfo.depdate); 137 | month = '' + (d.getMonth() + 1); 138 | day = '' + d.getDate(); 139 | year = d.getFullYear(); 140 | if (month.length < 2) { 141 | month = '0' + month;} 142 | if (day.length < 2) { 143 | day = '0' + day;} 144 | } 145 | var depd=[year, month, day].join('-'); 146 | d = new Date(); 147 | year = d.getFullYear().toString(); 148 | month = (d.getMonth()+1).toString(); 149 | if(month.length==1) 150 | { 151 | month="0".concat(month); 152 | } 153 | day = d.getDate().toString(); 154 | if(day.length==1) 155 | { 156 | day="0".concat(day); 157 | } 158 | var hour1= d.getHours().toString(); 159 | if(hour1.length==1) 160 | { 161 | hour1="0".concat(hour1); 162 | } 163 | var min1= d.getMinutes().toString(); 164 | if(min1.length==1) 165 | { 166 | min1="0".concat(min1); 167 | } 168 | var sec1= d.getSeconds().toString(); 169 | if(sec1.length==1) 170 | { 171 | sec1="0".concat(sec1); 172 | } 173 | var sysdate=year.concat("-").concat(month).concat("-").concat(day); 174 | var systime=hour1.concat(":").concat(min1).concat(":").concat(sec1); 175 | var sysdatetime=sysdate.concat(" ").concat(systime);//System Date 176 | var arrt=document.getElementById("arrtime").value.concat(":").concat("00"); 177 | var dept=document.getElementById("deptime").value.concat(":").concat("00"); 178 | $scope.busdtlsinfo.arrddate=arrd.concat(" ").concat(arrt);//Arrival Date 179 | $scope.busdtlsinfo.depddate=depd.concat(" ").concat(dept);//Departure Date 180 | var arr = $scope.busdtlsinfo.depddate.split(/-|\s|:/);// split string and create array. 181 | var estminutes=$scope.busdtlsinfo.busdtls.esthr*60 + $scope.busdtlsinfo.busdtls.estmin; 182 | var minminutes=estminutes-Math.floor(estminutes/4); 183 | var maxminutes=estminutes+Math.floor(estminutes/4); 184 | var dt = new Date(arr[0], arr[1] -1, arr[2], arr[3], arr[4], arr[5]); 185 | dt.setMinutes(dt.getMinutes() + minminutes); 186 | year = dt.getFullYear().toString(); 187 | month = (dt.getMonth()+1).toString(); 188 | if(month.length==1) 189 | { 190 | month="0".concat(month); 191 | } 192 | day = dt.getDate().toString(); 193 | if(day.length==1) 194 | { 195 | day="0".concat(day); 196 | } 197 | hour1= dt.getHours().toString(); 198 | if(hour1.length==1) 199 | { 200 | hour1="0".concat(hour1); 201 | } 202 | min1= dt.getMinutes().toString(); 203 | if(min1.length==1) 204 | { 205 | min1="0".concat(min1); 206 | } 207 | sec1= dt.getSeconds().toString(); 208 | if(sec1.length==1) 209 | { 210 | sec1="0".concat(sec1); 211 | } 212 | var estdtmin=year.concat("-").concat(month).concat("-").concat(day); 213 | var esttimemin=hour1.concat(":").concat(min1).concat(":").concat(sec1); 214 | var estdatetimemin=estdtmin.concat(" ").concat(esttimemin); //Minimum Scheduling Time 215 | dt = new Date(arr[0], arr[1] -1, arr[2], arr[3], arr[4], arr[5]); 216 | dt.setMinutes(dt.getMinutes() + maxminutes); 217 | year = dt.getFullYear().toString(); 218 | month = (dt.getMonth()+1).toString(); 219 | if(month.length==1) 220 | { 221 | month="0".concat(month); 222 | } 223 | day = dt.getDate().toString(); 224 | if(day.length==1) 225 | { 226 | day="0".concat(day); 227 | } 228 | hour1= dt.getHours().toString(); 229 | if(hour1.length==1) 230 | { 231 | hour1="0".concat(hour1); 232 | } 233 | min1= dt.getMinutes().toString(); 234 | if(min1.length==1) 235 | { 236 | min1="0".concat(min1); 237 | } 238 | sec1= dt.getSeconds().toString(); 239 | if(sec1.length==1) 240 | { 241 | sec1="0".concat(sec1); 242 | } 243 | var estdtmax=year.concat("-").concat(month).concat("-").concat(day); 244 | var esttimemax=hour1.concat(":").concat(min1).concat(":").concat(sec1); 245 | var estdatetimemax=estdtmax.concat(" ").concat(esttimemax); //Maximum Scheduling Time 246 | if(sysdatetime.localeCompare($scope.busdtlsinfo.depddate)==1) 247 | { 248 | $scope.alert("Start Date should be greater than System Date"); 249 | } 250 | else if($scope.busdtlsinfo.depddate.localeCompare($scope.busdtlsinfo.arrddate)==1) 251 | { 252 | $scope.alert("Start Date cannot be greater than End Date"); 253 | } 254 | else if(estdatetimemin.localeCompare($scope.busdtlsinfo.arrddate)==1) 255 | { 256 | $scope.alert("Arrival Time is too less. Cannot schedule bus"); 257 | } 258 | else if($scope.busdtlsinfo.arrddate.localeCompare(estdatetimemax)==1) 259 | { 260 | $scope.alert("Arrival Time is too high. Cannot schedule bus"); 261 | } 262 | else 263 | { 264 | var obj={"busdetails":$scope.busdtlsinfo.busdtls,"deptime":$scope.busdtlsinfo.depddate,"arrtime":$scope.busdtlsinfo.arrddate,"flag":$scope.busdtlsinfo.flag,"locationname":$scope.busdtlsinfo.locationname}; 265 | console.log(obj); 266 | $http({ 267 | method : "POST", 268 | url : "schedulebus", 269 | data: obj 270 | }).then(function mySuccess(response) { 271 | if(response.data.status=="Failed") 272 | { 273 | $scope.alert(response.data.message); 274 | } 275 | else 276 | { 277 | $scope.alert(response.data.message); 278 | $scope.resetbus(); 279 | } 280 | }, function myError(response) { 281 | $scope.alert("Something went wrong.Please Try Again Later") 282 | console.log(response); 283 | }); 284 | } 285 | } 286 | 287 | } -------------------------------------------------------------------------------- /src/main/java/com/aniket/portal/service/SeatBookingSrvcImpl.java: -------------------------------------------------------------------------------- 1 | package com.aniket.portal.service; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.Comparator; 6 | import java.util.stream.Collectors; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.aniket.portal.model.BusDetailsModel; 12 | import com.aniket.portal.model.BusDispatchModel; 13 | import com.aniket.portal.model.BusRoutesModel; 14 | import com.aniket.portal.model.CustomerDetailsModel; 15 | import com.aniket.portal.model.SeatAllocationModel; 16 | import com.aniket.portal.pojos.AllocationReqPojo; 17 | import com.aniket.portal.pojos.BusSeatPojo; 18 | import com.aniket.portal.pojos.CustomerBookingReqPojo; 19 | import com.aniket.portal.pojos.CustomerBookingResp; 20 | import com.aniket.portal.pojos.CustomerBusSeatResp; 21 | import com.aniket.portal.pojos.RegistrationRespPojo; 22 | import com.aniket.portal.repository.BusDetailsRepo; 23 | import com.aniket.portal.repository.BusDispatchRepo; 24 | import com.aniket.portal.repository.BusRouteRepo; 25 | import com.aniket.portal.repository.CustomerDetailsRepo; 26 | import com.aniket.portal.repository.SeatAllocationRepo; 27 | 28 | @Service 29 | public class SeatBookingSrvcImpl implements SeatBookingSrvc{ 30 | 31 | @Autowired 32 | BusDispatchRepo busdispatchrepo; 33 | 34 | @Autowired 35 | SeatAllocationRepo seatallrepo; 36 | 37 | @Autowired 38 | BusRouteRepo routerepo; 39 | 40 | @Autowired 41 | BusDetailsRepo dtlsrepo; 42 | 43 | @Autowired 44 | CustomerDetailsRepo custrepo; 45 | 46 | @Override 47 | public List customerseatbooking(CustomerBookingReqPojo reqpojo) { 48 | List buslist=new ArrayList(); 49 | String deptime=reqpojo.getDeptime(); 50 | String depdate=deptime.split(" ")[0].concat("%"); 51 | List buslistday=busdispatchrepo.fetchbus(depdate,deptime); 52 | for(BusDispatchModel busobj:buslistday) 53 | { 54 | try 55 | { 56 | CustomerBookingResp busresp=new CustomerBookingResp(); 57 | BusRoutesModel obj1=routerepo.fetchbusbyloc(busobj.getBusdtlsid(), reqpojo.getStartloc()); 58 | BusRoutesModel obj2=routerepo.fetchbusbyloc(busobj.getBusdtlsid(), reqpojo.getEndloc()); 59 | if(obj1==null||obj2==null) 60 | { 61 | continue; 62 | } 63 | if(busobj.getFlag()==0 && obj2.getOrderid()>obj1.getOrderid()) 64 | { 65 | BusDetailsModel busdtls1=dtlsrepo.findById(busobj.getBusdtlsid()).orElse(null); 66 | if(dtlsrepo.findById(busobj.getBusdtlsid())!=null) 67 | { 68 | busresp.setBusdetails(busdtls1); 69 | } 70 | else 71 | { 72 | continue; 73 | } 74 | busresp.setScheduledbus(busobj); 75 | busresp.setExpansion(false); 76 | busresp.setStartpoint(busdtls1.getEndpoint1()); 77 | busresp.setEndpoint(busdtls1.getEndpoint2()); 78 | busresp.setDeptime(busobj.getDeptime().split(" ")[1]); 79 | busresp.setArrtime(busobj.getArrivaltime().split(" ")[1]); 80 | busresp.setCustendloc(reqpojo.getEndloc()); 81 | busresp.setCuststartloc(reqpojo.getStartloc()); 82 | busresp.setCustdeptime(reqpojo.getDeptime()); 83 | buslist.add(busresp); 84 | } 85 | else if(busobj.getFlag()==1 && obj1.getOrderid()>obj2.getOrderid()) 86 | { 87 | BusDetailsModel busdtls1=dtlsrepo.findById(busobj.getBusdtlsid()).orElse(null); 88 | if(dtlsrepo.findById(busobj.getBusdtlsid())!=null) 89 | { 90 | busresp.setBusdetails(busdtls1); 91 | } 92 | else 93 | { 94 | continue; 95 | } 96 | busresp.setScheduledbus(busobj); 97 | busresp.setExpansion(false); 98 | busresp.setStartpoint(busdtls1.getEndpoint2()); 99 | busresp.setEndpoint(busdtls1.getEndpoint1()); 100 | busresp.setDeptime(busobj.getDeptime().split(" ")[1]); 101 | busresp.setArrtime(busobj.getArrivaltime().split(" ")[1]); 102 | busresp.setCustendloc(reqpojo.getEndloc()); 103 | busresp.setCuststartloc(reqpojo.getStartloc()); 104 | busresp.setCustdeptime(reqpojo.getDeptime()); 105 | buslist.add(busresp); 106 | } 107 | } 108 | catch(Exception e) 109 | { 110 | System.out.println(e); 111 | } 112 | } 113 | List listpojo1=buslist.stream().sorted(Comparator.comparing(CustomerBookingResp::getDeptime).thenComparing(CustomerBookingResp::getArrtime)).collect(Collectors.toList()); //Sorted UI display 114 | return listpojo1; 115 | } 116 | @SuppressWarnings("deprecation") 117 | @Override 118 | public CustomerBusSeatResp fetchbusseatdetails(CustomerBookingResp reqpojo) { 119 | // TODO Auto-generated method stub 120 | CustomerBusSeatResp resp=new CustomerBusSeatResp(); 121 | try 122 | { 123 | if(busdispatchrepo.getById(reqpojo.getScheduledbus().getId()).getTripcompleted().equals("N")) 124 | { 125 | List allocateseats=new ArrayList(); 126 | List seatlist= new ArrayList(); 127 | int ord1=routerepo.fetchbusbyloc(reqpojo.getBusdetails().getId(),reqpojo.getCuststartloc()).getOrderid(); 128 | int ord2=routerepo.fetchbusbyloc(reqpojo.getBusdetails().getId(),reqpojo.getCustendloc()).getOrderid(); 129 | if(ord1>ord2)//Reversed 130 | { 131 | int temp=ord1; 132 | ord2=ord1; 133 | ord1=temp; 134 | } 135 | if(reqpojo.getScheduledbus().getFlag()==0) 136 | { 137 | allocateseats= seatallrepo.fetchallocatedseats1(reqpojo.getScheduledbus().getId(), ord1, ord2); 138 | } 139 | else 140 | { 141 | allocateseats= seatallrepo.fetchallocatedseats2(reqpojo.getScheduledbus().getId(), ord1, ord2); 142 | } 143 | for(int i=reqpojo.getBusdetails().getSeats();i>=1;i=i-1) 144 | { 145 | BusSeatPojo seatpojo=new BusSeatPojo(); 146 | if(allocateseats.contains(i)==true) 147 | { 148 | seatpojo.setSeatno(i); 149 | seatpojo.setStatus("Y"); 150 | } 151 | else 152 | { 153 | seatpojo.setSeatno(i); 154 | seatpojo.setStatus("N"); 155 | } 156 | seatlist.add(seatpojo); 157 | } 158 | resp.setCustbook(reqpojo); 159 | resp.setListseat(seatlist); 160 | resp.setStatus("Success"); 161 | resp.setReason("Fetched Details"); 162 | return resp; 163 | } 164 | else 165 | { 166 | resp.setStatus("Failed"); 167 | resp.setReason("Bus has departed"); 168 | return resp; 169 | } 170 | } 171 | catch(Exception e) 172 | { 173 | resp.setStatus("Failed"); 174 | resp.setReason("Error in fetching data"); 175 | return resp; 176 | } 177 | } 178 | 179 | @SuppressWarnings("deprecation") 180 | @Override 181 | public RegistrationRespPojo allocateseats(AllocationReqPojo reqpojo) { 182 | // TODO Auto-generated method stub 183 | RegistrationRespPojo resppojo=new RegistrationRespPojo(); 184 | try 185 | { 186 | if(busdispatchrepo.getById(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getId()).getTripcompleted().equals("N")) 187 | { 188 | int ord1=routerepo.fetchbusbyloc(reqpojo.getBusseatresp().getCustbook().getBusdetails().getId(),reqpojo.getBusseatresp().getCustbook().getCuststartloc()).getOrderid(); 189 | int ord2=routerepo.fetchbusbyloc(reqpojo.getBusseatresp().getCustbook().getBusdetails().getId(),reqpojo.getBusseatresp().getCustbook().getCustendloc()).getOrderid(); 190 | if(ord1>ord2) 191 | { 192 | int temp=ord1; 193 | ord2=ord1; 194 | ord1=temp; 195 | } 196 | List lisresp=new ArrayList(); 197 | List lis=new ArrayList(); 198 | for(Integer seat:reqpojo.getSeatnos()) 199 | { 200 | lisresp.add(seat.toString()); 201 | if(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getFlag()==0) 202 | { 203 | if(seatallrepo.fetchseatavailbility1(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getId(),ord1,ord2,seat).size()>0) 204 | { 205 | lis.add(seat.toString()); 206 | } 207 | } 208 | else 209 | { 210 | if(seatallrepo.fetchseatavailbility2(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getId(),ord1,ord2,seat).size()>0) 211 | { 212 | lis.add(seat.toString()); 213 | } 214 | } 215 | } 216 | if(lis.size()>0) 217 | { 218 | resppojo.setStatus("Failed"); 219 | resppojo.setMessage("Seat No - ".concat(String.join(",",lis)).concat(" already occupied. Booking Failed.")); 220 | return resppojo; 221 | } 222 | CustomerDetailsModel cstdtls=new CustomerDetailsModel(); 223 | CustomerDetailsModel custobj=custrepo.fetchexistence(reqpojo.getCustdtls().getCstmrname(),reqpojo.getCustdtls().getMobileno(),reqpojo.getCustdtls().getEmailid()); 224 | Long id1; 225 | if(custobj==null) 226 | { 227 | cstdtls.setCstmrname(reqpojo.getCustdtls().getCstmrname()); 228 | cstdtls.setEmailid(reqpojo.getCustdtls().getEmailid()); 229 | cstdtls.setMobileno(reqpojo.getCustdtls().getMobileno()); 230 | if(custrepo.count()==0) 231 | { 232 | id1=1L; 233 | cstdtls.setId(id1); 234 | custrepo.save(cstdtls); 235 | } 236 | else 237 | { 238 | id1=custrepo.fetchmaxid()+1; 239 | cstdtls.setId(id1); 240 | custrepo.save(cstdtls); 241 | } 242 | } 243 | else 244 | { 245 | id1=custobj.getId(); 246 | } 247 | for(Integer seat:reqpojo.getSeatnos()) 248 | { 249 | if(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getFlag()==0) 250 | { 251 | seatallrepo.saveseat1(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getId(), seat, ord1, ord2, id1); 252 | } 253 | else 254 | { 255 | seatallrepo.saveseat2(reqpojo.getBusseatresp().getCustbook().getScheduledbus().getId(), seat, ord1, ord2, id1); 256 | } 257 | } 258 | resppojo.setStatus("Success"); 259 | resppojo.setMessage("Seat No - ".concat(String.join(",",lisresp)).concat(" booked")); 260 | return resppojo; 261 | } 262 | else 263 | { 264 | resppojo.setStatus("Failed"); 265 | resppojo.setMessage("Bus has departed"); 266 | return resppojo; 267 | } 268 | 269 | } 270 | catch(Exception e) 271 | { 272 | resppojo.setStatus("Failed"); 273 | resppojo.setMessage("Error in saving data"); 274 | return resppojo; 275 | } 276 | 277 | } 278 | } -------------------------------------------------------------------------------- /src/main/webapp/js/customerSeatBookingController.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | var myApp = angular.module('myApp'); 3 | myApp.controller('customerSeatBookingController',customerSeatBookingController); 4 | 5 | function customerSeatBookingController($scope,$http){ 6 | $scope.customerseatbooking={}; 7 | $scope.available=false; 8 | 9 | $scope.custsubmit=function() 10 | { 11 | if(($scope.customerseatbooking.startloc==null||$scope.customerseatbooking.startloc=="")||($scope.customerseatbooking.endloc==null||$scope.customerseatbooking.endloc=="")||($scope.customerseatbooking.depdate==null)) 12 | { 13 | $scope.alert("Please Fill in all the details"); 14 | $scope.available=false; 15 | return; 16 | } 17 | var d=new Date(); 18 | var year1 = d.getFullYear().toString(); 19 | var month1 = (d.getMonth()+1).toString(); 20 | if(month1.length==1) 21 | { 22 | month1="0".concat(month1); 23 | } 24 | var day1 = d.getDate().toString(); 25 | if(day1.length==1) 26 | { 27 | day1="0".concat(day1); 28 | } 29 | var sdate=year1.concat("-").concat(month1).concat("-").concat(day1); 30 | var d1=$scope.customerseatbooking.depdate; 31 | year1 = d1.getFullYear().toString(); 32 | month1 = (d1.getMonth()+1).toString(); 33 | if(month1.length==1) 34 | { 35 | month1="0".concat(month1); 36 | } 37 | day1 = d1.getDate().toString(); 38 | if(day1.length==1) 39 | { 40 | day1="0".concat(day1); 41 | } 42 | var entdate=year1.concat("-").concat(month1).concat("-").concat(day1); 43 | if(entdate=65 && val.charCodeAt(i)<=90)||(val.charCodeAt(i)>=97 && val.charCodeAt(i)<=122)) 111 | { 112 | if(i==0) 113 | { 114 | str=str.concat(val.charAt(i).toUpperCase()); 115 | } 116 | else 117 | { 118 | str=str.concat(val.charAt(i).toLowerCase()); 119 | } 120 | } 121 | else 122 | { 123 | $scope.alert("Invalid Location"); 124 | $scope.customerseatbooking.startloc=null; 125 | $scope.available=false; 126 | return; 127 | } 128 | } 129 | $scope.customerseatbooking.startloc=str; 130 | } 131 | } 132 | else if(obj=="endloc") 133 | { 134 | if(val!=null && val!="") 135 | { 136 | var str=""; 137 | for (let i = 0; i < val.length; i++) 138 | { 139 | if((val.charCodeAt(i)>=65 && val.charCodeAt(i)<=90)||(val.charCodeAt(i)>=97 && val.charCodeAt(i)<=122)) 140 | { 141 | if(i==0) 142 | { 143 | str=str.concat(val.charAt(i).toUpperCase()); 144 | } 145 | else 146 | { 147 | str=str.concat(val.charAt(i).toLowerCase()); 148 | } 149 | } 150 | else 151 | { 152 | $scope.alert("Invalid Location Name"); 153 | $scope.customerseatbooking.endloc=null; 154 | $scope.available=false; 155 | return; 156 | } 157 | } 158 | $scope.customerseatbooking.endloc=str; 159 | } 160 | } 161 | else if(obj=="depdate") 162 | { 163 | var d = new Date(); 164 | var year1 = d.getFullYear().toString(); 165 | var month1 = (d.getMonth()+1).toString(); 166 | if(month1.length==1) 167 | { 168 | month1="0".concat(month1); 169 | } 170 | var day1 = d.getDate().toString(); 171 | if(day1.length==1) 172 | { 173 | day1="0".concat(day1); 174 | } 175 | var sysdate=year1.concat("-").concat(month1).concat("-").concat(day1); 176 | var d1=$scope.customerseatbooking.depdate; 177 | year1 = d1.getFullYear().toString(); 178 | month1 = (d1.getMonth()+1).toString(); 179 | if(month1.length==1) 180 | { 181 | month1="0".concat(month1); 182 | } 183 | day1 = d1.getDate().toString(); 184 | if(day1.length==1) 185 | { 186 | day1="0".concat(day1); 187 | } 188 | var entereddate=year1.concat("-").concat(month1).concat("-").concat(day1); 189 | if(entereddate=1) 235 | { 236 | ct1=-1; 237 | empty=response.data.custbook.busdetails.lastseat-response.data.custbook.busdetails.seatleftside-response.data.custbook.busdetails.seatrightside; 238 | } 239 | for(var j=response.data.custbook.busdetails.rows+ct1;j>0;j-=1) 240 | { 241 | var rowlis=[]; 242 | for(var k=0;k element === obj2.seatno); 301 | if(val1!=null) 302 | { 303 | var index1=obj.resp.seatnos.indexOf(obj2.seatno); 304 | obj.resp.seatnos.splice(index1, 1); 305 | obj2.color="white"; 306 | } 307 | else 308 | { 309 | obj.resp.seatnos.push(obj2.seatno); 310 | obj2.color="red"; 311 | } 312 | obj.selseats=obj.resp.seatnos.join(", "); 313 | } 314 | 315 | $scope.validatecust=function(obj,val) 316 | { 317 | if(obj=="name") 318 | { 319 | if(val.resp.custdtls.cstmrname!=null && val.resp.custdtls.cstmrname!="") 320 | { 321 | for (let i = 0; i < val.resp.custdtls.cstmrname.length; i++) 322 | { 323 | if((val.resp.custdtls.cstmrname.charCodeAt(i)>=65 && val.resp.custdtls.cstmrname.charCodeAt(i)<=90)||(val.resp.custdtls.cstmrname.charCodeAt(i)>=97 && val.resp.custdtls.cstmrname.charCodeAt(i)<=122)||(val.charCodeAt(i)==32)) 324 | { 325 | continue; 326 | } 327 | else 328 | { 329 | $scope.alert("Invalid Customer Name"); 330 | val.resp.custdtls.cstmrname=null; 331 | break; 332 | } 333 | } 334 | } 335 | } 336 | else if(obj=="email") 337 | { 338 | if(val.resp.custdtls.emailid!=null) 339 | { 340 | 341 | } 342 | else 343 | { 344 | $scope.alert("Invalid EmailID"); 345 | val.resp.custdtls.emailid=null; 346 | } 347 | } 348 | else if(obj=="number") 349 | { 350 | if(val.resp.custdtls.mobileno!=null) 351 | { 352 | var str1= String(val.resp.custdtls.mobileno); 353 | if(str1.length==10) 354 | { 355 | for (let i = 0; i < str1.length; i++) 356 | { 357 | if((str1.charCodeAt(i)>=48 && str1.charCodeAt(i)<=57)) 358 | { 359 | continue; 360 | } 361 | else 362 | { 363 | $scope.alert("Invalid Mobile No"); 364 | val.resp.custdtls.mobileno=null; 365 | break; 366 | } 367 | } 368 | } 369 | else 370 | { 371 | $scope.alert("Invalid Mobile No"); 372 | val.resp.custdtls.mobileno=null; 373 | } 374 | } 375 | else 376 | { 377 | $scope.alert("Invalid Mobile No"); 378 | val.resp.custdtls.mobileno=null; 379 | } 380 | } 381 | } 382 | 383 | } -------------------------------------------------------------------------------- /bin/src/main/webapp/js/customerSeatBookingController.js: -------------------------------------------------------------------------------- 1 | "use strict" 2 | var myApp = angular.module('myApp'); 3 | myApp.controller('customerSeatBookingController',customerSeatBookingController); 4 | 5 | function customerSeatBookingController($scope,$http){ 6 | $scope.customerseatbooking={}; 7 | $scope.available=false; 8 | 9 | $scope.custsubmit=function() 10 | { 11 | if(($scope.customerseatbooking.startloc==null||$scope.customerseatbooking.startloc=="")||($scope.customerseatbooking.endloc==null||$scope.customerseatbooking.endloc=="")||($scope.customerseatbooking.depdate==null)) 12 | { 13 | $scope.alert("Please Fill in all the details"); 14 | $scope.available=false; 15 | return; 16 | } 17 | var d=new Date(); 18 | var year1 = d.getFullYear().toString(); 19 | var month1 = (d.getMonth()+1).toString(); 20 | if(month1.length==1) 21 | { 22 | month1="0".concat(month1); 23 | } 24 | var day1 = d.getDate().toString(); 25 | if(day1.length==1) 26 | { 27 | day1="0".concat(day1); 28 | } 29 | var sdate=year1.concat("-").concat(month1).concat("-").concat(day1); 30 | var d1=$scope.customerseatbooking.depdate; 31 | year1 = d1.getFullYear().toString(); 32 | month1 = (d1.getMonth()+1).toString(); 33 | if(month1.length==1) 34 | { 35 | month1="0".concat(month1); 36 | } 37 | day1 = d1.getDate().toString(); 38 | if(day1.length==1) 39 | { 40 | day1="0".concat(day1); 41 | } 42 | var entdate=year1.concat("-").concat(month1).concat("-").concat(day1); 43 | if(entdate=65 && val.charCodeAt(i)<=90)||(val.charCodeAt(i)>=97 && val.charCodeAt(i)<=122)) 111 | { 112 | if(i==0) 113 | { 114 | str=str.concat(val.charAt(i).toUpperCase()); 115 | } 116 | else 117 | { 118 | str=str.concat(val.charAt(i).toLowerCase()); 119 | } 120 | } 121 | else 122 | { 123 | $scope.alert("Invalid Location"); 124 | $scope.customerseatbooking.startloc=null; 125 | $scope.available=false; 126 | return; 127 | } 128 | } 129 | $scope.customerseatbooking.startloc=str; 130 | } 131 | } 132 | else if(obj=="endloc") 133 | { 134 | if(val!=null && val!="") 135 | { 136 | var str=""; 137 | for (let i = 0; i < val.length; i++) 138 | { 139 | if((val.charCodeAt(i)>=65 && val.charCodeAt(i)<=90)||(val.charCodeAt(i)>=97 && val.charCodeAt(i)<=122)) 140 | { 141 | if(i==0) 142 | { 143 | str=str.concat(val.charAt(i).toUpperCase()); 144 | } 145 | else 146 | { 147 | str=str.concat(val.charAt(i).toLowerCase()); 148 | } 149 | } 150 | else 151 | { 152 | $scope.alert("Invalid Location Name"); 153 | $scope.customerseatbooking.endloc=null; 154 | $scope.available=false; 155 | return; 156 | } 157 | } 158 | $scope.customerseatbooking.endloc=str; 159 | } 160 | } 161 | else if(obj=="depdate") 162 | { 163 | var d = new Date(); 164 | var year1 = d.getFullYear().toString(); 165 | var month1 = (d.getMonth()+1).toString(); 166 | if(month1.length==1) 167 | { 168 | month1="0".concat(month1); 169 | } 170 | var day1 = d.getDate().toString(); 171 | if(day1.length==1) 172 | { 173 | day1="0".concat(day1); 174 | } 175 | var sysdate=year1.concat("-").concat(month1).concat("-").concat(day1); 176 | var d1=$scope.customerseatbooking.depdate; 177 | year1 = d1.getFullYear().toString(); 178 | month1 = (d1.getMonth()+1).toString(); 179 | if(month1.length==1) 180 | { 181 | month1="0".concat(month1); 182 | } 183 | day1 = d1.getDate().toString(); 184 | if(day1.length==1) 185 | { 186 | day1="0".concat(day1); 187 | } 188 | var entereddate=year1.concat("-").concat(month1).concat("-").concat(day1); 189 | if(entereddate=1) 235 | { 236 | ct1=-1; 237 | empty=response.data.custbook.busdetails.lastseat-response.data.custbook.busdetails.seatleftside-response.data.custbook.busdetails.seatrightside; 238 | } 239 | for(var j=response.data.custbook.busdetails.rows+ct1;j>0;j-=1) 240 | { 241 | var rowlis=[]; 242 | for(var k=0;k element === obj2.seatno); 301 | if(val1!=null) 302 | { 303 | var index1=obj.resp.seatnos.indexOf(obj2.seatno); 304 | obj.resp.seatnos.splice(index1, 1); 305 | obj2.color="white"; 306 | } 307 | else 308 | { 309 | obj.resp.seatnos.push(obj2.seatno); 310 | obj2.color="red"; 311 | } 312 | obj.selseats=obj.resp.seatnos.join(", "); 313 | } 314 | 315 | $scope.validatecust=function(obj,val) 316 | { 317 | if(obj=="name") 318 | { 319 | if(val.resp.custdtls.cstmrname!=null && val.resp.custdtls.cstmrname!="") 320 | { 321 | for (let i = 0; i < val.resp.custdtls.cstmrname.length; i++) 322 | { 323 | if((val.resp.custdtls.cstmrname.charCodeAt(i)>=65 && val.resp.custdtls.cstmrname.charCodeAt(i)<=90)||(val.resp.custdtls.cstmrname.charCodeAt(i)>=97 && val.resp.custdtls.cstmrname.charCodeAt(i)<=122)||(val.charCodeAt(i)==32)) 324 | { 325 | continue; 326 | } 327 | else 328 | { 329 | $scope.alert("Invalid Customer Name"); 330 | val.resp.custdtls.cstmrname=null; 331 | break; 332 | } 333 | } 334 | } 335 | } 336 | else if(obj=="email") 337 | { 338 | if(val.resp.custdtls.emailid!=null) 339 | { 340 | 341 | } 342 | else 343 | { 344 | $scope.alert("Invalid EmailID"); 345 | val.resp.custdtls.emailid=null; 346 | } 347 | } 348 | else if(obj=="number") 349 | { 350 | if(val.resp.custdtls.mobileno!=null) 351 | { 352 | var str1= String(val.resp.custdtls.mobileno); 353 | if(str1.length==10) 354 | { 355 | for (let i = 0; i < str1.length; i++) 356 | { 357 | if((str1.charCodeAt(i)>=48 && str1.charCodeAt(i)<=57)) 358 | { 359 | continue; 360 | } 361 | else 362 | { 363 | $scope.alert("Invalid Mobile No"); 364 | val.resp.custdtls.mobileno=null; 365 | break; 366 | } 367 | } 368 | } 369 | else 370 | { 371 | $scope.alert("Invalid Mobile No"); 372 | val.resp.custdtls.mobileno=null; 373 | } 374 | } 375 | else 376 | { 377 | $scope.alert("Invalid Mobile No"); 378 | val.resp.custdtls.mobileno=null; 379 | } 380 | } 381 | } 382 | 383 | } -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # https://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | --------------------------------------------------------------------------------