Skip to content

Commit

Permalink
FEAT:fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
rivopelu committed Nov 27, 2024
1 parent 0834b4b commit 2219e1d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/com/pos/app/entities/Order.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/pos/app/model/request/ReqCreateOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ReqCreateOrder {

private Boolean isPayment;
private String customerName;
private BigInteger tax;
private List<ListProductCreateOrder> products;


@Data
@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">

<changeSet id="1.3.2" author="rivo">
<addColumn tableName="order">
<column name="is_payment" type="tinyint" defaultValue="0">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/db/changelog/changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<include file="classpath:db/changelog/1.2.3_fix_fk.xml"/>
<include file="classpath:db/changelog/1.3.0_add_table_order.xml"/>
<include file="classpath:db/changelog/1.3.1_add_column_tax_transaction.xml"/>
<include file="classpath:db/changelog/1.3.2_add_column_is_payment_order.xml"/>

</databaseChangeLog>

0 comments on commit 2219e1d

Please sign in to comment.