From 5ff732f0dc9d5652d9178aa2d056282cbf0cb478 Mon Sep 17 00:00:00 2001 From: Huynh Nguyen Date: Tue, 29 Oct 2024 21:50:20 +0700 Subject: [PATCH] [PBS-85][NguyenHCP] feat: update cancelReason to request --- pom.xml | 7 ++++--- .../dto/request/Order/OrderUpdateRequest.java | 1 + .../swp/PodBookingSystem/service/OrderDetailService.java | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 93593e6e..c996b9c5 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,8 @@ 0.2.0 swp-pod-booking-system-server https://sonarcloud.io - ${project.build.directory}/site/jacoco/jacoco.xml + ${project.build.directory}/site/jacoco/jacoco.xml + @@ -137,8 +138,8 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - 22 - 22 + ${java.version} + ${java.version} org.projectlombok diff --git a/src/main/java/com/swp/PodBookingSystem/dto/request/Order/OrderUpdateRequest.java b/src/main/java/com/swp/PodBookingSystem/dto/request/Order/OrderUpdateRequest.java index 7685ba23..2ca7200b 100644 --- a/src/main/java/com/swp/PodBookingSystem/dto/request/Order/OrderUpdateRequest.java +++ b/src/main/java/com/swp/PodBookingSystem/dto/request/Order/OrderUpdateRequest.java @@ -17,6 +17,7 @@ public class OrderUpdateRequest { String id; OrderStatus status; + String cancelReason; Account orderHandler; List orderDetails; } diff --git a/src/main/java/com/swp/PodBookingSystem/service/OrderDetailService.java b/src/main/java/com/swp/PodBookingSystem/service/OrderDetailService.java index dd513160..b9afe8ce 100644 --- a/src/main/java/com/swp/PodBookingSystem/service/OrderDetailService.java +++ b/src/main/java/com/swp/PodBookingSystem/service/OrderDetailService.java @@ -394,6 +394,9 @@ public void updateOrderDetail(OrderUpdateRequest request) { Account orderHandler = accountService.getAccountById(request.getOrderHandler().getId()); od.setOrderHandler(orderHandler); } + if (request.getCancelReason() != null) { + od.setCancelReason(request.getCancelReason()); + } if (request.getOrderDetails() != null && !request.getOrderDetails().isEmpty()) { for (OrderDetailUpdateRoomRequest odr : request.getOrderDetails()) { if (odr.getId().equals(od.getId())) {