Confirm Cancel Bill Operations
Start course
Difficulty
Beginner
Duration
2h 34m
Students
234
Ratings
3.6/5
starstarstarstar-halfstar-border
Description

In this course, we will learn the concepts of microservice and spring framework with a focus on Spring Boot.

Learning Objectives

  • Understanding Spring Boot

Intended Audience

  • Beginner Java developers
  • Java developers interested in learning how to Build and Deploy RESTful Web Services
  • Java Developers who want to develop web applications using the Spring framework
  • Java Developers who want to develop web applications with microservices
  • Java Developers who wish to develop Spring Boot Microservices with Spring Cloud

Prerequisites

  • Basic Java knowledge
Transcript

Hello, dear friends. This is the last video of this project. Are you sad?

In this video, we will create bill list page and we will confirm unconfirmed bills on this page. So, let's begin. First, we need a new method in the AdminController. Path will be BillList, name BillList. Now, we will get all bills from the BillService. Now, set list to the model. Return BillList page. Add a new HTML page and name it BillList. Add libraries and modify the layout. Now, on this page, we need a table.

If you want you can copy from AdminProductList page. Now, change column headers. First one Bill Date, Customer Name and Surname, Total Price. The last column will be Process. Now, let's set values to the table. Now, in Process. We need a condition. If the bill is confirmed, we'll show the confirmed text. Else, we need two buttons. The first one is Confirm.

The second one is CancelTheSale. Okay, done. Open AdminLayout. Change the Bill List page URL. All right, done. Let's try and look at the Bill List page. Run the project and log in as Admin. Go to the Bill List page. And look, we don't have any confirmed bill. Now, we can continue with the Confirm button. First, in the Confirm button, we will use the ConfirmBill action in the AdminController. For Cancel, I will use the Cancel action in the AdminController. Now, go back to the AdminController. I will start with Confirm. GetMapping path will be ConfirmBill with ID. In the method, we will get ID with path variable.

Now, getBillById(), setAdmin_Confirmed(true), saveBill(). Okay, that's enough for now. Let's redirect to the Bill List page. Let's go on with Cancel. We will use GetMapping again with ID. The name will be CancelTheBill. Add PathVariable for ID. First, we will getAll SoldProducts. Now, we need another SoldProduct list to hold selected sold products. For SoldProducts in all soldproducts, If SoldProduct's Bill_id == id, we will add this bill to the selected bill list.

Now, we can delete the bill. After we delete the bill, we must delete the selected sold products and add pieces to the product stock just as we did with the cancelBill in the EmployeeController. If you want, you can copy from the cancelBill in the EmployeeController, but I will write it. Okay, done. And lastly, we will redirect to the Bill List page. Now, we've finished, let's try.

Log in as admin. First, stock amount. Now first, I want to confirm this one. Look, the bill is confirmed. Now, let's cancel this one. Look at the stock again now that the sale has been deleted. The stock has changed. Okay, done. This project is now complete. With this project, we now have a solid understanding of Spring and can apply it to any of our future projects. In the next video, we will begin REST operations with a new project using Spring. So, I'll see you in the following video.

 

About the Author
Students
1985
Courses
64
Learning Paths
4

OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.