From 2219e1dc21a7025e8d2250aaa5c419323e2f8eb8 Mon Sep 17 00:00:00 2001 From: rivo Date: Wed, 27 Nov 2024 17:15:12 +0800 Subject: [PATCH] FEAT:fixing --- src/main/java/com/pos/app/entities/Order.java | 3 +++ .../com/pos/app/model/request/ReqCreateOrder.java | 2 ++ .../com/pos/app/service/impl/OrderServiceImpl.java | 2 +- .../1.3.2_add_column_is_payment_order.xml | 14 ++++++++++++++ .../resources/db/changelog/changelog-master.xml | 1 + 5 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/db/changelog/1.3.2_add_column_is_payment_order.xml diff --git a/src/main/java/com/pos/app/entities/Order.java b/src/main/java/com/pos/app/entities/Order.java index 8152eef..670a1fd 100644 --- a/src/main/java/com/pos/app/entities/Order.java +++ b/src/main/java/com/pos/app/entities/Order.java @@ -40,6 +40,9 @@ public class Order { @Enumerated(EnumType.STRING) private OrderStatusEnum status; + @Column(name = "is_payment") + private Boolean isPayment; + @PrePersist public void prePersist() { if (this.id == null) { diff --git a/src/main/java/com/pos/app/model/request/ReqCreateOrder.java b/src/main/java/com/pos/app/model/request/ReqCreateOrder.java index ab64e6f..468473d 100644 --- a/src/main/java/com/pos/app/model/request/ReqCreateOrder.java +++ b/src/main/java/com/pos/app/model/request/ReqCreateOrder.java @@ -21,10 +21,12 @@ @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) public class ReqCreateOrder { + private Boolean isPayment; private String customerName; private BigInteger tax; private List products; + @Data @NoArgsConstructor @AllArgsConstructor diff --git a/src/main/java/com/pos/app/service/impl/OrderServiceImpl.java b/src/main/java/com/pos/app/service/impl/OrderServiceImpl.java index 5ed50f4..16bf782 100644 --- a/src/main/java/com/pos/app/service/impl/OrderServiceImpl.java +++ b/src/main/java/com/pos/app/service/impl/OrderServiceImpl.java @@ -59,6 +59,7 @@ public ResponseEnum createOrder(ReqCreateOrder req) { Order orderBuild = Order.builder() .customerName(req.getCustomerName()) .status(OrderStatusEnum.CREATED) + .isPayment(req.getIsPayment()) .orderCode(String.valueOf(new Date().getTime())) .createdBy(accountService.getCurrentAccountId()) .build(); @@ -67,7 +68,6 @@ public ResponseEnum createOrder(ReqCreateOrder req) { for (Product product : existProduct) { BigInteger qty = productQty.get(index); - System.out.println(productQty.get(index)); index++; BigInteger total = product.getPrice().multiply(qty); totalPrice = totalPrice.add(total); diff --git a/src/main/resources/db/changelog/1.3.2_add_column_is_payment_order.xml b/src/main/resources/db/changelog/1.3.2_add_column_is_payment_order.xml new file mode 100644 index 0000000..8ed6e8b --- /dev/null +++ b/src/main/resources/db/changelog/1.3.2_add_column_is_payment_order.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog/changelog-master.xml b/src/main/resources/db/changelog/changelog-master.xml index 7875cba..ad7ff87 100644 --- a/src/main/resources/db/changelog/changelog-master.xml +++ b/src/main/resources/db/changelog/changelog-master.xml @@ -15,5 +15,6 @@ + \ No newline at end of file