Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions The Mavericks_SY_59/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Theme : Digital Society

Topic : Parking Allotment System

Details : This project is trying to digitalize the Parking Allotment System in Shopping complexes, Airports, etc. In Our Application User needs to enter the Vehicle number and phone and the nearest empty parking space is shown along with the path to reach there is available which will reduce the manpower working in the parking areas. Also, giving feature of Calculation of bill Amount for a vehicle while exiting and viewing the status of all levels of parking to admin.

Video link: https://drive.google.com/file/d/19Fh9MCOMe-FGKd-XdcBUaDEJP2WYPiSh/view?usp=share_link

Report link : https://drive.google.com/drive/folders/1dLtF9dUBP0TCshhAGIxuUeiH_l82CzZh?usp=share_link

Team Members:
1) Name :Nandini Wani,Year :SY,Branch: Comp
2) Name :Sonia Dessai,Year :SY,Branch: Comp
129 changes: 129 additions & 0 deletions The Mavericks_SY_59/src/main/java/com/buffer/DataImport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package com.buffer;

import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.Scanner;

class DataImport {
//inserting data
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL="jdbc:mysql://localhost/vozilopark";
static final String user="root";
static final String pass="DarkLord@05";
public Connection con;
DataImport(){
try {
System.out.println("Checking for driver");
Class.forName(JDBC_DRIVER);
System.out.println("Driver ok");
System.out.println("Connecting database");
con=DriverManager.getConnection(DB_URL,user,pass);
System.out.println("Connected");
}
catch(ClassNotFoundException e) {
System.out.println("Class Not Found");
}
catch(SQLException se) {
System.out.println("SQL Exception");
}
}

public void insertdata(Connection xyz,Method abc,Heap bcd) throws SQLException {
PreparedStatement pstmt=null;
String query,query1;
query="select * from parking";
pstmt=xyz.prepareStatement(query);
ResultSet rs1=pstmt.executeQuery(query);
while(rs1.next()) {
String no=rs1.getString("parkingno");
int f=rs1.getInt("fill");
Parking newnode=abc.search(no);
if(f==1) {
newnode.fill=true;
abc.Put(no,newnode);
query1="select * from vehicle where parkingno = '"+no+"'";
PreparedStatement x=xyz.prepareStatement(query1);
ResultSet rs2=x.executeQuery(query1);
Vehicle newnode1=new Vehicle();
while(rs2.next()) {
newnode1.Vehicle_No=rs2.getString("Vehicleno");
newnode1.Phone_No=rs2.getString("phoneno");
newnode1.ParkingNo=rs2.getString("parkingno");
LocalDate localDate = rs2.getDate("EntryDate").toLocalDate();
newnode1.Date=localDate;
CharSequence s1=rs2.getString("Entrytime");
LocalTime localtime=LocalTime.parse(s1);
newnode1.Entry=localtime;
abc.entry(no, newnode1);
}
}
else {
bcd.insert(newnode);

}
}

}

public long delete(Connection xyz,Method abc,Heap bcd,String number) throws SQLException {
System.out.println("Delete Executed");
PreparedStatement pstmt=null;
String query,query1;
bcd.insert(abc.search(number));
Vehicle car=abc.exit(number);
car.exit();
long a=car.payment();
query="delete from vehicle where parkingno=?";
pstmt=xyz.prepareStatement(query);
pstmt.setString(1,number);
pstmt.executeUpdate();
query1="update parking set fill=0 where parkingno=?";
pstmt=xyz.prepareStatement(query1);
pstmt.setString(1,number);
pstmt.executeUpdate();
for(int i = 0; i < 48; i ++) {
if(MainServlet.h.heap[i] != null)System.out.println(MainServlet.h.heap[i].parkingNo);
}
return a;
}

public String getnearest(Connection xyz,Method abc,Heap bcd,String vehno,String phnum) throws SQLException {

//heap
Parking allocted=bcd.heap[1];
String s2=allocted.parkingNo;


Vehicle cust=new Vehicle();
cust.userdetails(allocted.parkingNo,vehno,phnum);
abc.Put(allocted.parkingNo, allocted);
abc.entry(allocted.parkingNo,cust);
bcd.delete();

PreparedStatement pstmt=null;
String query;
query="insert into vehicle values( '"+cust.Vehicle_No+"','"+cust.ParkingNo+"','"
+cust.Phone_No+"','"+cust.Date.toString()+"','"+cust.Entry.toString()+"')";
pstmt=xyz.prepareStatement(query);
pstmt.executeUpdate();

String query1="update parking set fill=1 where parkingno= '"+s2+"'";
pstmt=xyz.prepareStatement(query1);
pstmt.executeUpdate();

return s2;
}

}





50 changes: 50 additions & 0 deletions The Mavericks_SY_59/src/main/java/com/buffer/ExitServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.buffer;

import java.io.IOException;
import java.sql.SQLException;

import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

/**
* Servlet implementation class ExitServlet
*/
@WebServlet("/ExitServlet")
public class ExitServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* Default constructor.
*/
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


// DataImport dm = new DataImport();
// Method vozilopark=new Method();
// Heap h=new Heap(48);
long amount = 0;
String vehicleNo = request.getParameter("exitvehicle");
System.out.println(vehicleNo);
// try {
// MainServlet.dm.insertdata(MainServlet.dm.con,MainServlet.vozilopark,MainServlet.h);
// } catch (SQLException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
try {
amount = MainServlet.dm.delete(MainServlet.dm.con,MainServlet.vozilopark ,MainServlet.h,vehicleNo);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

request.setAttribute("amount", amount);
RequestDispatcher rd = request.getRequestDispatcher("/bill.jsp");
rd.forward(request, response);

}
}
Loading