KEMBAR78
Efficient | PDF | Java (Software Platform) | Java (Programming Language)
0% found this document useful (0 votes)
17 views62 pages

Efficient

Uploaded by

727823tucs033
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views62 pages

Efficient

Uploaded by

727823tucs033
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 62

SRI KRISHNA COLLEGE OF TECHNOLOGY

(An Autonomous Institution)


Approved by AICTE | Affiliated to Anna University Chennai|
Accredited by NBA - AICTE| Accredited by NAAC with ‘A’
Grade KOVAIPUDUR, COIMBATORE 641042

COURSE NAME: WEB FRAMEWORK USING RESTAPI

COURSE CODE: 23IT402

EFFICIENT SMART
WASTE
MANAGEMENT

A PROJECT REPORT

Submitted by

CHIRANJITH DHARMA S - 727823TUCS033

In partial fulfilment for the award of the degree of

BACHELOR OF ENGINEERING

IN

COMPUTER SCIENCE AND ENGINEERING

MARCH 2025
SRI KRISHNA COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Approved by AICTE | Affiliated to Anna University Chennai|
Accredited by NBA - AICTE| Accredited by NAAC with ‘A’ Grade
KOVAIPUDUR, COIMBATORE 641042

BONAFIDE CERTIFICATE

Certified that this project report EFFICIENT SMART WASTE


MANAGEMENT is the bonafide work of CHIRANJITH DHARMA S
727823TUCS033 who carried out the project work under my supervision.

SIGNATURE SIGNATURE

Dr. R. GNANAKUMARI Dr. M. UDHAYAMOORTHI

SUPERVISOR HEAD OF THE DEPARTMENT

Assistant Professor, Professor,

Department of Computer Science and Department of Computer Science and


Engineering, Engineering,
Sri Krishna College of Technology, Sri Krishna College of Technology,
Coimbatore-641042 Coimbatore-641042

Certified that the candidate was examined by me in the Project Work Viva
Voce

examination held on at Sri Krishna College of Technology, Coimbatore-

641042.

INTERNAL EXAMINER EXTERNAL EXAMINER


ACKNOWLEDGEMENT

First and foremost we thank the Almighty for being our light and for showering
his gracious blessings throughout the course of this project.

We express our gratitude to our beloved Principal, Dr. M.G. Sumithra, for
providing all facilities.

We are grateful to our beloved Dean, Computing Sciences Dr.T. Senthilnathan,


for her tireless and relentless support.

With the grateful heart, our sincere thanks to our Head of the Department Dr. M.
UDHAYAMOORTHI, Department of Computer Science and Engineering for the
motivation and all support to complete the project work.

We thank Dr. R. GNANAKUMARI, Assistant Professor, Department of


Computer Science and Engineering, for her motivation and support.

We are thankful to all the Teaching and Non-Teaching Staff of Department of


Computer Science and Engineering and to all those who have directly and
indirectly extended their help to us in completing this project work successfully.

We extend our sincere thanks to our family members and our beloved friends,
who had been strongly supporting us in all our endeavour
ABSTRACT

This project introduces a Smart Waste Efficient Management System,


developed using Spring Boot and MySQL, designed to optimize urban waste
collection and enhance operational efficiency. The system intelligently
monitors waste bin fill levels, manages waste collection history, and tracks
vehicles in real time to ensure effective route planning and resource utilization.
Key features include automated waste bin status updates, optimized vehicle
dispatching, real-time location tracking, and historical data analysis for
predictive waste collection scheduling.

The backend, powered by Spring Boot, ensures reliable RESTful API


endpoints and efficient business logic processing, while MySQL serves as the
database for structured storage and fast retrieval of waste bin, vehicle, and
collection records. Additionally, the system integrates machine learning-driven
route optimization to minimize fuel consumption and reduce operational costs.
Predictive analytics help forecast high-waste-generation areas, allowing for
proactive resource allocation.

By leveraging IoT sensors, geospatial data, and intelligent analytics, this


solution enhances waste management efficiency, reduces unnecessary
collection trips, and promotes sustainability. The system is designed to
support smart city initiatives, ensuring cleaner urban environments with data-
driven decision-making and automated waste collection strategies.

.
TABLE OF CONTENT

CHAPTER.NO TITLE PAGE NO

1 INTRODUCTION 1

2 SYSTEM SPECIFICATIONS 2

3 PROPOSED SYSTEM 3

4 METHODOLOGIES 4

5 IMPLEMENTATION AND RESULT 8

6 CONCLUSION AND FUTURE SCOPE 23

6.1 CONCLUSION 23

6.2 FUTURE SCOPE 23

7 REFERENCES 24
LIST OF FIGURES

Figure No TITLE Page No

1. Flow Diagram 5

2. ER Diagram 6

3. Class Diagram 6

4. Sequence Diagram 7

LIST OF ENDPOINTS

CONTROLLER METHODS PAGE NO

POST 8
GET 8
User
PUT 9
DELETE 9
POST 9

Route GET 10
PUT 10
POST 11
GET 12
Vehicle
PUT 13
DELETE 14
POST 20
GET 21
WasteBin
PUT 22
DELETE 23
CHAPTER 1
INTRODUCTION
The Smart Waste Efficient Management System is designed to optimize urban waste collection
by leveraging real-time monitoring, automated scheduling, and intelligent route optimization.
This system aims to enhance waste disposal efficiency, reduce operational costs, and minimize
environmental impact. It integrates IoT-enabled smart bins, GPS-tracked waste collection
vehicles, and data-driven decision-making to streamline waste management processes.

The platform ensures timely waste collection, prevents overflowing bins, and improves
resource allocation by analyzing historical waste collection patterns. The project serves as a
guideline for developers, stakeholders, and municipal authorities, providing a structured
approach to design, implementation, and deployment of an advanced waste management
solution suitable for smart city initiatives.

PROBLEM STATEMENT
Efficient waste collection remains a major challenge in urban areas, leading to
overflowing bins, inefficient route planning, and increased operational costs. Traditional waste
management systems lack real-time monitoring, resulting in delayed collection, excessive fuel
consumption, and poor resource allocation. Additionally, the absence of historical data analysis
prevents proactive decision-making, causing inefficiencies in scheduling and fleet utilization.

This project addresses these challenges by introducing a smart waste management system that
integrates IoT-enabled waste bins, real-time vehicle tracking, and AI-driven route optimization.
By leveraging automated bin status updates, predictive analytics, and optimized collection
schedules, the system enhances waste disposal efficiency, reduces environmental impact, and
improves overall urban cleanliness.

OVERVIEW
The Smart Waste Efficient Management System is an advanced waste collection platform
designed to monitor waste bin levels, optimize collection routes, and track waste disposal
vehicles in real-time. The system leverages IoT-enabled bins, GPS tracking, and AI-driven
analytics to enhance operational efficiency and reduce environmental impact. Waste management
authorities can analyze collection history, predict high-waste areas, and optimize fleet utilization
for cost-effective and timely waste disposal.
The system features a robust backend for managing waste collection schedules, vehicle
assignments, and historical data analytics, ensuring seamless coordination between waste bins,
collection vehicles, and municipal authorities. By integrating automated waste monitoring,
predictive analytics, and intelligent route planning, the project aims to improve urban cleanliness,
minimize operational inefficiencies, and support sustainable smart city initiatives.

OBJECTIVE
• Develop an intelligent waste management system for efficient monitoring and collection of
waste.
• Implement real-time waste bin tracking to prevent overflow and ensure timely collection.
• Optimize waste collection routes using AI-driven analytics to reduce fuel consumption and
operationalcosts.
• Enable GPS-based vehicle tracking for efficient fleet management and resource allocation.
• Maintain historical waste collection data to support predictive analytics and proactive decision-
making.
• Enhance urban cleanliness and sustainability by minimizing environmental impact through
data- driven waste disposal.
CHAPTER 2

SYSTEM SPECIFICATION
In this chapter, we are going to see the software that we have used to build the website. This
chapter gives you a small description about the software used in the project.

1. TECHNOLOGIES USED

 Backend: Spring Boot (Java), REST API


Spring Boot is a widely used framework that simplifies Java-based web
application development. It provides built-in support for RESTful APIs, making it an ideal
choice for developing scalable and maintainable backend services.
 Database :MySQL

MySQL is a robust and widely used relational database management system


(RDBMS). It ensures efficient data storage, retrieval, and management, making it ideal for
handling structured student inquiry data.

 Programming Language: Java 17

Java 17 is the latest long-term support (LTS) version of Java, offering


performance improvements, enhanced security, and new features like sealed classes and
pattern matching, making it a reliable choice for enterprise applications.

 Runtime Environment: JVM, JRE

The Java Virtual Machine (JVM) executes Java bytecode, ensuring platform
independence and performance optimization. The Java Runtime Environment (JRE)
includes libraries and components necessary to run Java applications, making it essential for
executing the system’s backend services.

 Development Environment: VS Code

Visual Studio Code (VS Code) is a lightweight but powerful source code editor
that supports Java development with extensions for debugging, syntax highlighting, and
integrated terminal functionality. It enhances developer productivity through an intuitive
interface and extensive plugin support.
CHAPTER 3

PROPOSED

SYSTEM
The proposed Smart Waste Efficient Management System aims to provide an automated, data-
driven solution for urban waste collection, optimizing bin monitoring, vehicle tracking, and
route planning. The system ensures timely waste collection, minimizes operational
inefficiencies, and supports sustainable waste disposal practices. It offers a centralized platform
for managing waste bin levels, vehicle dispatching, and historical waste data analysis to
enhance decision-making and resource allocation.

FEATURES OF THE PROPOSED SYSTEM

 Smart Bin Monitoring: Real-time waste level tracking using IoT sensors.
 Route Optimization: AI-driven collection route planning to minimize fuel consumption.
 Vehicle Tracking: GPS-based tracking for real-time fleet management.
 Historical Data Analysis: Predictive analytics for waste generation trends and
optimized scheduling.
 Automated Alerts: Notifications for full bins, missed collections, and vehicle status
updates.
 Admin Dashboard: Centralized platform for monitoring waste collection status and
system insights.

ADVANTAGES OF THE SYSTEM

 Automated Waste Monitoring: Prevents bin overflow and ensures timely collection..
 Optimized Resource Utilization: AI-driven route planning reduces fuel costs and
labor inefficiencies..
 Improved Urban Cleanliness: Real-time tracking and predictive analytics enhance
waste management.
 Reduced Environmental Impact: Minimizes unnecessary trips, lowering carbon
emissions.
 Data-Driven Decision Making: Historical data analysis helps optimize collection
schedules.
 . Scalable Architecture: Adaptable for integration into smart city infrastructure.
CHAPTER 4
METHODOLOGIES

1. UserManagement

The system allows users to register, log in, and manage their accounts. Role-based
access control ensures that only authorized personnel can perform specific
operations.WasteBinMonitoring
The system tracks waste bin fill levels and updates the database in real-time.
Sensors or manual updates trigger alerts when bins need collection.
2. Collection Management
Waste collection activities are recorded, and assigned personnel can update
collection statuses. This ensures proper documentation of waste disposal.
3. Anomaly Detection
The system analyzes waste collection patterns and flags irregular activities, such as
missed pickups or unauthorized dumping, for further review.
4. Data Management & Reporting
The platform maintains structured data on waste bins, collection schedules, and
assigned personnel. Reports can be generated to analyze trends and optimize
operations.
Flow Diagram:

4.1 Flow Diagram


ER (Entity Relationship) Diagram :

4.2 ER Diagram
Class Diagram :

4.3 Class Diagram

Sequence Diagram:
4.4 Sequence Diagram

Use Case Diagram :

4.5 Use Case Diagram

4.3 Class Diagram


CHAPTER 5
IMPLEMENTATION AND RESULT

This chapter provides an overview of the output produced by developing the backend of
our Smart Waste Efficient Management System. The API (Application Programming Interface)
endpoints were created using Spring Boot and can be tested and viewed through tools such as
Swagger-UI and Thunderclient. These endpoints allow smooth interaction between users and the
system and cover essential CRUD operations using HTTP methods like GET, POST, PUT, and
DELETE.

5.1 CODING :

Entities :

User.java
package com.example.demo.entities;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.List;

import javax.persistence.*;

import lombok.Data;

import lombok.NoArgsConstructor;
import
lombok.AllArgsConstructor;

@Entit

@Data

@NoArgsConstructo

@AllArgsConstructo

r public class User {

@Id
//@GeneratedValue(strategy = GenerationType.IDENTITY)

private Long id;


private String username;
private String

email; private String

role;

// Mapping to WasteBins

@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)

@JsonIgnore

private List<WasteBin> wasteBins;

// Mapping to Routes
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch =

FetchType.LAZY) @JsonIgnore

private List<Route> routes;

Route.java
package

com.example.demo.entities; import

java.util.List;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.Data;

import lombok.NoArgsConstructor;

import

lombok.AllArgsConstructor;

@Entity

@Data

@NoArgsConstructor

@AllArgsConstructo

r public class Route {


@Id

private Long id;


private String routeName;

private String path;

@ManyToOne

@JoinColumn(name = "user_id")

@JsonIgnore

private User user;

@OneToMany(mappedBy = "route")

@JsonIgnore // This will exclude 'vehicles' from

serialization private List<Vehicle> vehicles;

Vehicle.java
package

com.example.demo.entities; import

javax.persistence.Entity;

import

javax.persistence.GeneratedValue;

import

javax.persistence.GenerationType;

import javax.persistence.Id;
import javax.persistence.JoinColumn;

import

javax.persistence.ManyToOne;

import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.*;

@Entity
@Table(name = "vehicles")
@Data
@NoArgsConstructor
@AllArgsConstructo
r

@Builder

public class Vehicle

{ @Id

@GeneratedValue(strategy = GenerationType.IDENTITY)

private Long id;

private String status;


private String currentLocation;

private Integer capacity;

@ManyToOne

@JoinColumn(name = "route_id")

@JsonIgnore

private Route route;

WasteBin.java
package

com.example.demo.entities; import

javax.persistence.*;

import

com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.Data;

import lombok.NoArgsConstructor;

import

lombok.AllArgsConstructor;

@Entity

@Data
@NoArgsConstructo
r

@AllArgsConstructor

public class WasteBin


{ @Id

// @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String
location;

private int fillLevel;

private boolean isMalfunctioning;

@ManyToOne

@JoinColumn(name = "user_id")

@JsonIgnore

private User user;

Repository :

UserRepository.java
package com.example.demo.repositories;

import com.example.demo.entities.User;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;
import

org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface UserRepository extends JpaRepository<User, Long>

{ User findByUsername(String username);

void deleteById(Long id);


Optional<User> findById(Long id);

Page<User> findAll(Pageable pageable);

RouteRepository.java
Package com.example.demo.repositories;
import org.springframework.data.jpa.repository.JpaRepository;

import com.example.demo.entities.Route;

public interface RouteRepository extends JpaRepository<Route,Long>{

}
VehicleRepository.java
package com.example.springapp.repositories;
import com.example.springapp.entities.Grocery;
import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;
import

org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.data.jpa.repository.Query;

import org.springframework.stereotype.Repository;

@Repository

public interface GroceryRepository extends JpaRepository<Grocery, Long>

{ @Query("SELECT g FROM Grocery g WHERE g.name LIKE %:name%")

Page<Grocery> findByNameContaining(String name, Pageable pageable);

WasteBinRepository.java
package com.example.demo.repositories;

import com.example.demo.entities.WasteBin;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;

import

org.springframework.data.jpa.repository.JpaRepository;

import org.springframework.data.jpa.repository.Query;

import org.springframework.data.repository.query.Param;

import java.util.List;

public interface WasteBinRepository extends JpaRepository<WasteBin, Long> {

@Query("SELECT w FROM WasteBin w WHERE LOWER(w.location) LIKE LOWER(CONCAT('%',


:location, '%'))")

List<WasteBin> findByLocationContaining(@Param("location") String location);


Page<WasteBin> findAll(Pageable pageable);
@Query("SELECT w FROM WasteBin w WHERE w.isMalfunctioning =

true") List<WasteBin> findMalfunctioningWasteBins();

Service :

UserService.java
package com.example.demo.service;

import com.example.demo.entities.User;

import com.example.demo.repositories.UserRepository;
import

org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

import java.util.Optional;

@Service

public class UserService {

@Autowired

private UserRepository userRepository;


public User saveUser(User user) {

return userRepository.save(user);

}
public List<User> getAllUsers()

{ return userRepository.findAll();

}
public Page<User> getUsers(Pageable pageable)

{ return userRepository.findAll(pageable);

}
public Optional<User> getUserById(Long id)

{ return userRepository.findById(id);

}
public void deleteUserById(Long id) {

userRepository.deleteById(id);

public void deleteAllUsers() {

userRepository.deleteAll();

public User createUser(User user) {

return userRepository.save(user);

}
public User updateUser(Long id, User user) {

user.setId(id);

return userRepository.save(user);

}
public void deleteUser(Long id) {

userRepository.deleteById(id);

RouteService.java
package com.example.demo.service;

import

com.example.demo.entities.Route;

import com.example.demo.repositories.RouteRepository;

import

org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class RouteService {

@Autowired

private RouteRepository routeRepository;

public Route saveRoute(Route route) {

return routeRepository.save(route);

}
public List<Route> getAllRoutes() {

return routeRepository.findAll();

public Page<Route> getRoutes(Pageable pageable)

{ return routeRepository.findAll(pageable);

}
public Optional<Route> getRouteById(Long id)

{ return routeRepository.findById(id);

}
public void deleteRouteById(Long id) {

routeRepository.deleteById(id);

}
public void deleteAllRoutes() {

routeRepository.deleteAll();

VehicleService.java
package com.example.demo.service;

import

com.example.demo.entities.Vehicle;

import com.example.demo.repositories.VehicleRepository;

import lombok.RequiredArgsConstructor;
import
org.springframework.stereotype.Service;
import java.util.List;

import java.util.Optional;

@Service

@RequiredArgsConstructor

public class VehicleService

private final VehicleRepository vehicleRepository;


public List<Vehicle> getAllVehicles() {

return vehicleRepository.findAll();

}
public Optional<Vehicle> getVehicleById(Long id) {

return vehicleRepository.findById(id);

}
public Vehicle saveVehicle(Vehicle vehicle) {

return vehicleRepository.save(vehicle);

}
public void deleteVehicle(Long id)

{ vehicleRepository.deleteById(id

);

WasteBinService.java
package com.example.demo.service;

import com.example.demo.entities.WasteBin;
import com.example.demo.repositories.WasteBinRepository;

import

org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;

import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;

@Service
public class WasteBinService {

@Autowired

private WasteBinRepository wasteBinRepository;

public List<WasteBin> getAllWasteBins() {

return wasteBinRepository.findAll();

public Page<WasteBin> getWasteBins(Pageable pageable) {

return wasteBinRepository.findAll(pageable);

public Optional<WasteBin> findWasteBinById(Long id) {

return wasteBinRepository.findById(id);

//jpql
public List<WasteBin> findMalfunctioningWasteBins() {

return

wasteBinRepository.findMalfunctioningWasteBins();

//jpql
public List<WasteBin> searchWasteBinsByLocation(String location) {

return wasteBinRepository.findByLocationContaining(location);

public WasteBin saveWasteBin(WasteBin wasteBin) {

return wasteBinRepository.save(wasteBin);

}
public void deleteWasteBinById(Long id)

{ wasteBinRepository.deleteById(id);

public void deleteAllWasteBins()

{ wasteBinRepository.deleteAll(

);

Controller :

UserController.java
package com.example.demo.controller;

import com.example.demo.entities.User;

import com.example.demo.service.UserService;
import

org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import org.springframework.http.ResponseEntity;

import

org.springframework.web.bind.annotation.*;

import java.util.List;

import java.util.Optional;

@RestController
@RequestMapping("/users")

public class UserController {

@Autowired
private UserService userService;

@PostMapping
public ResponseEntity<User> createUser(@RequestBody User user) {

User savedUser = userService.saveUser(user);

return ResponseEntity.ok(savedUser);

@PutMapping("/{id}")

public ResponseEntity<User> updateUser(@PathVariable Long id, @RequestBody User user)

{ user.setId(id);
User updatedUser = userService.saveUser(user);

return ResponseEntity.ok(updatedUser);

@GetMapping
public ResponseEntity<List<User>> getAllUsers()

{ List<User> users = userService.getAllUsers();

return ResponseEntity.ok(users);

@GetMapping("/{id}")
public ResponseEntity<User> getUserById(@PathVariable Long id)

{ Optional<User> user = userService.getUserById(id);

return user.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());

@GetMapping("/paginated")
public ResponseEntity<Page<User>> getUsersPaginated(

@RequestParam(defaultValue = "0") int page,

@RequestParam(defaultValue = "10") int size) {

Pageable pageable = PageRequest.of(page, size);

Page<User> users = userService.getUsers(pageable);

return ResponseEntity.ok(users);

}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteUser(@PathVariable Long id)

{ userService.deleteUserById(id);

return ResponseEntity.noContent().build();

@DeleteMapping("/deleteAll")
public ResponseEntity<Void> deleteAllUsers() {

userService.deleteAllUsers();

return ResponseEntity.noContent().build();

VehicleController.java
package com.example.demo.controller;

import com.example.demo.entities.Vehicle;
import
com.example.demo.service.VehicleService;

import lombok.RequiredArgsConstructor;

import org.springframework.http.ResponseEntity;

import

org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/vehicles")

@RequiredArgsConstructor

public class VehicleController {

private final VehicleService vehicleService;

@GetMapping
public ResponseEntity<List<Vehicle>> getAllVehicles() {

return

ResponseEntity.ok(vehicleService.getAllVehicles());

@GetMapping("/{id}")

public ResponseEntity<Vehicle> getVehicleById(@PathVariable Long id) {

return vehicleService.getVehicleById(id)
.map(ResponseEntity::ok).orElse(ResponseEntity.notFound().build());

@PutMapping("/{id}")

public ResponseEntity<Vehicle> updateVehicle(@PathVariable Long id, @RequestBody Vehicle


updatedVehicle) {

return vehicleService.getVehicleById(id)
.map(existingVehicle -> {

existingVehicle.setStatus(updatedVehicle.getStatus());

existingVehicle.setCurrentLocation(updatedVehicle.getCurrentLocation());

existingVehicle.setCapacity(updatedVehicle.getCapacity());

return ResponseEntity.ok(vehicleService.saveVehicle(existingVehicle));

})

.orElse(ResponseEntity.notFound().build());

@PostMapping
public ResponseEntity<Vehicle> createVehicle(@RequestBody Vehicle vehicle) {

return ResponseEntity.ok(vehicleService.saveVehicle(vehicle));

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteVehicle(@PathVariable Long id)

{ vehicleService.deleteVehicle(id);

return ResponseEntity.noContent().build();

}
RouteController.java

package com.example.demo.controller;

import com.example.demo.entities.Route;

import

com.example.demo.service.RouteService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.PageRequest;

import org.springframework.data.domain.Pageable;

import org.springframework.data.domain.Sort;

import org.springframework.http.ResponseEntity;

import

org.springframework.web.bind.annotation.*;

import java.util.List;

import java.util.logging.Logger;

@RestController
@RequestMapping("/route")

public class RouteController {

private static final Logger logger = Logger.getLogger(RouteController.class.getName());

@Autowired

private RouteService routeService;

@PostMapping
public ResponseEntity<Route> createRoute(@RequestBody Route route)

{ Route savedRoute = routeService.saveRoute(route);

return ResponseEntity.ok(savedRoute);

@PutMapping("/{id}")
public ResponseEntity<Route> updateRoute(@PathVariable Long id, @RequestBody Route route) {

route.setId(id);
Route updatedRoute = routeService.saveRoute(route);

return ResponseEntity.ok(updatedRoute);

@GetMapping("/paginated")

public ResponseEntity<Page<Route>> getAllRoutesPaginated(


@RequestParam(defaultValue = "0") int page,

@RequestParam(defaultValue = "10") int size,

@RequestParam(defaultValue = "id,desc") String sort)

{ String[] sortParams = sort.split(",");

String sortField = sortParams[0];

Sort.Direction direction = (sortParams.length > 1 && sortParams[1].equalsIgnoreCase("asc"))

? Sort.Direction.ASC

: Sort.Direction.DESC;
Pageable pageable = PageRequest.of(page, size, Sort.by(direction,

sortField)); Page<Route> routes = routeService.getRoutes(pageable);

return ResponseEntity.ok(routes);

@GetMapping
public ResponseEntity<List<Route>> getAllRoutes()

{ List<Route> routes = routeService.getAllRoutes();

return ResponseEntity.ok(routes);

@GetMapping("/{id}")

public ResponseEntity<Route> getRouteById(@PathVariable Long id) {

return routeService.getAllRoutes().stream()

.filter(route -> route.getId().equals(id))

.findFirst()
.map(ResponseEntity::ok)

.orElse(ResponseEntity.notFound().build());

@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteRoute(@PathVariable Long id) {

logger.info("Deleting Route with id: " + id);

routeService.deleteRouteById(id);

return ResponseEntity.noContent().build();

@DeleteMapping("/deleteAll")

public ResponseEntity<Void> deleteAllRoutes() {


logger.info("Deleting all Routes");

routeService.deleteAllRoutes();

return ResponseEntity.noContent().build();

WasteBinController.java
package com.example.demo.controller;

import

com.example.demo.entities.WasteBin;

import com.example.demo.service.WasteBinService;

import

org.springframework.beans.factory.annotation.Autowired;

import org.springframework.data.domain.Page;

import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import org.springframework.http.ResponseEntity;

import

org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Optional;

@RestController
@RequestMapping("/wastebins")

public class WasteBinController {

@Autowired

private WasteBinService wasteBinService;

@PostMapping

public ResponseEntity<WasteBin> createWasteBin(@RequestBody WasteBin wasteBin) {


WasteBin savedWasteBin = wasteBinService.saveWasteBin(wasteBin);

return ResponseEntity.ok(savedWasteBin);

@PutMapping("/{id}")

public ResponseEntity<WasteBin>
updateWasteBin(@PathVariable Long id, @RequestBody WasteBin wasteBinDetails) {

return wasteBinService.findWasteBinById(id)

.map(wasteBin -> {

wasteBin.setLocation(wasteBinDetails.getLocation());

wasteBin.setFillLevel(wasteBinDetails.getFillLevel());

wasteBin.setMalfunctioning(wasteBinDetails.isMalfunctioning());

WasteBin updatedWasteBin = wasteBinService.saveWasteBin(wasteBin);

return ResponseEntity.ok(updatedWasteBin);

})

.orElse(ResponseEntity.notFound().build());

@GetMapping

public ResponseEntity<List<WasteBin>> getAllWasteBins() {

List<WasteBin> wasteBins = wasteBinService.getAllWasteBins();

return ResponseEntity.ok(wasteBins);

}
@GetMapping("/{id}")

public ResponseEntity<WasteBin> getWasteBinById(@PathVariable Long id) {

return wasteBinService.findWasteBinById(id).map(ResponseEntity::ok).orElse(ResponseEntity.notFound
).build());

@GetMapping("/paginated")
public ResponseEntity<Page<WasteBin>> getWasteBinsPaginated(

@RequestParam(defaultValue = "0") int page,

@RequestParam(defaultValue = "10") int size) {

Pageable pageable = PageRequest.of(page, size);


Page<WasteBin> wasteBins = wasteBinService.getWasteBins(pageable);

return ResponseEntity.ok(wasteBins);

@GetMapping("/malfunctioning")
public ResponseEntity<List<WasteBin>> getMalfunctioningWasteBins() {

List<WasteBin> malfunctioningBins = wasteBinService.findMalfunctioningWasteBins();

return ResponseEntity.ok(malfunctioningBins);

@GetMapping("/search")

public ResponseEntity<List<WasteBin>> searchWasteBinsByLocation(@RequestParam String


location) {

List<WasteBin> bins = wasteBinService.searchWasteBinsByLocation(location);

return ResponseEntity.ok(bins);

@DeleteMapping("/{id}")

public ResponseEntity<Void> deleteWasteBin(@PathVariable Long id)

{ wasteBinService.deleteWasteBinById(id);

return ResponseEntity.noContent().build();

@DeleteMapping("/deleteAll")
public ResponseEntity<Void> deleteAllWasteBins()

{ wasteBinService.deleteAllWasteBins();

return ResponseEntity.noContent().build();

5.2.1 User Controller ( POST )

API Endpoints : /api/users


Request Body :

Response Body:
5.2.2 User Controller ( GET )

API Endpoints : /api/users/{id}

Request Body :

Response Body:

5.2.3 User Controller ( PUT )


API Endpoints : /api/users/{id}

Request Body :
Response Body:
5.2.4 User Controller ( DELETE )
API Endpoints : /api/users/{id}

Request Body :

Response Body:
5.2.5 UserController(Get/paginated)

API Endpoints : api/users/paginated

Request Body :

Response Body:
5.2.6 UserController(Delete All)

API Endpoints : api/users/deleteAll

Request Body :

Response Body:
5.3.1
RouteController(POST)

API Endpoints : api/route

RequestBody:

ResponseBody:
5.3.2 Route Controller ( Put )

API Endpoints : api/route/{id}

Request Body :

Response Body:
5.3.3 Route Controller (GET )

API Endpoints : api/route

Request Body :

Response Body :
5.3.4 Route Controller ( Getbyid )

API Endpoints : api/route/{id}

Request Body :

Response Body :

5.3.5 Route Controller ( GET/paginated )

API Endpoints : api/route/paginated

Request Body :

Response Body:
5.3.6 RouteController ( deletebyid)

API Endpoints : api/route/{id}

Request Body :

Response Body:

5.3.7 RouteController ( DELETE ALL)


API Endpoints : api/route/deleteAll

Request Body :

Response Body:

5.4.1 VehicleController(POST)

API Endpoints : api/vehicle/

Request Body:

Response Body:
5.4.2 VehicleController(Put by
id) API
Endpoints:api/vehicle/{id}

RequestBody:
ResponseBody:

5.4.3 Vehicle Controller(Get

) API endpoints: api/vehicle

RequestBody:

ResponseBody:
5.4.4 VehicleController (get by

id) API Endpoints:

api/vehicle/{id} RequestBody:

Response Body:

5.4.5 VehicleController(delete by
id) API Endpoints:api/vehicle/{id}

RequestBody:
ResponseBody:

5.5.1 WasteBinController(POST
) API Endpoints:api/wastebins/

RequestBody:

ResponseBody:

5.5.2 WasteBinController(Put by

id) API Endpoints:

api/wastebins/{id} RequestBody:
ResponseBody:

5.5.3 WasteBinController(get
) API
Endpoints:api/wastebins/

RequestBody:

ResponseBody:
5.5.4 WasteBinController(get by
id) API
Endpoints:api/wastebins/{id}

RequestBody:

ResponseBody:

5.5.5 WasteBinController(get by

location) API Endpoints:

api/wastebins/search RequestBody:

ResponseBody:
5.5.6 WasteBinController(get by
malfunctioning) API
Endpoints:api/wastebins/malfunctioning

RequestBody:

ResponseBody:

5.5.7 WasteBinController(get

/paginated) API Endpoints:

api/wastebins/paginated RequestBody:
ResponseBody:

5.5.8 WasteBinController(delete by
id) API Endpoints:api/wastebins/{id}
RequestBody:

ResponseBody:

5.5.9 WasteBinController(delete
all) API Endpoints: api/wastebins/

RequestBody:
ResponseBody:
CHAPTER 6

CONCLUSION

The Smart Waste Efficient Management System is a comprehensive solution designed to enhance

waste collection efficiency, route optimization, and real-time monitoring in urban environments.

The system integrates key features such as IoT-enabled waste bin tracking, AI-driven route

optimization, vehicle monitoring, and automated waste collection scheduling, ensuring a

streamlined and data-driven approach to waste management.

By automating bin status updates and optimizing collection routes, the platform reduces

operational costs, minimizes fuel consumption, and improves overall waste disposal efficiency.

The real-time tracking and predictive analytics empower waste management authorities to make

informed decisions, leading to a cleaner and more sustainable urban environment.

Furthermore, the system provides insightful analytics on waste generation patterns, allowing

administrators to forecast high-waste areas and adjust collection strategies accordingly. The

integration of GPS-based vehicle tracking, automated alerts, and an interactive admin dashboard

ensures seamless coordination between waste collection teams, enhancing operational reliability

and environmental sustainability.

FUTURE SCOPE

 1. User Interface Development

A web or mobile-based UI can be implemented to provide an interactive platform for users to

monitor bin status, manage waste collection, and generate reports easily.

 2. Route Optimization Algorithm


A smart route-planning algorithm can be integrated to help optimize waste collection routes,

reducing travel time, fuel consumption, and operational costs.

 3.Notification and Alert System

The system can be improved with automated notifications, alerting waste collectors and

administrators about full bins, missed pickups, or detected anomalies.

 4. Advanced Anomaly Detection

Enhancing the anomaly detection system can help identify more patterns, such as delays in

collection, repeated missed pickups, or inconsistencies in disposal records.

 5. Scalability and Performance Enhancements

The system can be optimized for larger deployments, ensuring better database performance,

handling more bins, and supporting future integrations with external systems.

REFERENCES

 https://www.smartwastemanagement.com/

 https://www.wastemanagement.gov/

 https://www.urbancleancity.com

 https://www.smartbintracker.com

 https://www.recyclingandreuse.com

You might also like