| 22352 |
ashik.ali |
1 |
package com.spice.profitmandi.dao.entity.user;
|
|
|
2 |
|
| 32556 |
amit.gupta |
3 |
import in.shop2020.model.v1.user.CartStatus;
|
| 22352 |
ashik.ali |
4 |
import org.hibernate.annotations.UpdateTimestamp;
|
|
|
5 |
|
| 32556 |
amit.gupta |
6 |
import javax.persistence.*;
|
|
|
7 |
import java.time.LocalDateTime;
|
| 36376 |
aman |
8 |
import com.spice.profitmandi.dao.cart.v2.CartLifecycleStatus;
|
|
|
9 |
import com.spice.profitmandi.dao.cart.v2.SaleType;
|
| 22352 |
ashik.ali |
10 |
|
|
|
11 |
/**
|
|
|
12 |
* This class basically contains cart details
|
|
|
13 |
*
|
|
|
14 |
* @author ashikali
|
|
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
@Entity
|
| 31860 |
tejbeer |
18 |
@Table(name="user.cart")
|
| 22352 |
ashik.ali |
19 |
|
|
|
20 |
public class Cart {
|
|
|
21 |
|
|
|
22 |
@Id
|
|
|
23 |
@Column(name="id", unique=true, updatable=false)
|
|
|
24 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
25 |
private int id;
|
|
|
26 |
|
|
|
27 |
@Column(name = "wallet_amount")
|
| 28653 |
amit.gupta |
28 |
private double walletAmount;
|
| 22352 |
ashik.ali |
29 |
|
|
|
30 |
@Column(name = "total_price")
|
| 28653 |
amit.gupta |
31 |
private double totalPrice;
|
| 22352 |
ashik.ali |
32 |
|
|
|
33 |
@Column(name = "cart_status")
|
|
|
34 |
private CartStatus cartStatus;
|
|
|
35 |
|
|
|
36 |
@Column(name = "address_id")
|
| 32556 |
amit.gupta |
37 |
private Integer addressId;
|
| 22352 |
ashik.ali |
38 |
|
|
|
39 |
@Column(name="checked_out_on", updatable = false)
|
|
|
40 |
private LocalDateTime checkoutTimestamp = LocalDateTime.now();
|
|
|
41 |
|
|
|
42 |
@Column(name="created_on", updatable = false)
|
|
|
43 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
44 |
|
|
|
45 |
@Column(name="updated_on")
|
|
|
46 |
@UpdateTimestamp
|
|
|
47 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
48 |
|
| 36376 |
aman |
49 |
@Version
|
|
|
50 |
@Column(name = "version")
|
|
|
51 |
private Long version = 0L;
|
|
|
52 |
|
|
|
53 |
@Enumerated(EnumType.STRING)
|
|
|
54 |
@Column(name = "lifecycle_status")
|
|
|
55 |
private CartLifecycleStatus lifecycleStatus = CartLifecycleStatus.ACTIVE;
|
|
|
56 |
|
|
|
57 |
@Column(name = "last_activity_at")
|
|
|
58 |
private LocalDateTime lastActivityAt = LocalDateTime.now();
|
|
|
59 |
|
|
|
60 |
@Enumerated(EnumType.STRING)
|
|
|
61 |
@Column(name = "sale_type")
|
|
|
62 |
private SaleType saleType = SaleType.PARTNER_PROCUREMENT;
|
|
|
63 |
|
|
|
64 |
/** Populated for TERTIARY_SALE drafts; null for procurement carts. */
|
|
|
65 |
@Column(name = "customer_id")
|
|
|
66 |
private Integer customerId;
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
* Denormalised retailer/fofo-store id so we can list a partner's
|
|
|
70 |
* tertiary drafts with a single indexed query. Procurement carts keep
|
|
|
71 |
* this in sync too.
|
|
|
72 |
*/
|
|
|
73 |
@Column(name = "retailer_id")
|
|
|
74 |
private int retailerId;
|
|
|
75 |
|
|
|
76 |
|
| 22352 |
ashik.ali |
77 |
public int getId() {
|
|
|
78 |
return id;
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public void setId(int id) {
|
|
|
82 |
this.id = id;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
| 28653 |
amit.gupta |
87 |
public double getWalletAmount() {
|
| 22352 |
ashik.ali |
88 |
return walletAmount;
|
|
|
89 |
}
|
|
|
90 |
|
| 28653 |
amit.gupta |
91 |
public void setWalletAmount(double walletAmount) {
|
| 22352 |
ashik.ali |
92 |
this.walletAmount = walletAmount;
|
|
|
93 |
}
|
|
|
94 |
|
| 28653 |
amit.gupta |
95 |
public double getTotalPrice() {
|
| 22352 |
ashik.ali |
96 |
return totalPrice;
|
|
|
97 |
}
|
|
|
98 |
|
| 28653 |
amit.gupta |
99 |
public void setTotalPrice(double totalPrice) {
|
| 22352 |
ashik.ali |
100 |
this.totalPrice = totalPrice;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public CartStatus getCartStatus() {
|
|
|
104 |
return cartStatus;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public void setCartStatus(CartStatus cartStatus) {
|
|
|
108 |
this.cartStatus = cartStatus;
|
|
|
109 |
}
|
|
|
110 |
|
| 32556 |
amit.gupta |
111 |
public Integer getAddressId() {
|
| 22352 |
ashik.ali |
112 |
return addressId;
|
|
|
113 |
}
|
|
|
114 |
|
| 32556 |
amit.gupta |
115 |
public void setAddressId(Integer addressId) {
|
| 22352 |
ashik.ali |
116 |
this.addressId = addressId;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
public LocalDateTime getCheckoutTimestamp() {
|
|
|
120 |
return checkoutTimestamp;
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
public void setCheckoutTimestamp(LocalDateTime checkoutTimestamp) {
|
|
|
124 |
this.checkoutTimestamp = checkoutTimestamp;
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
public LocalDateTime getCreateTimestamp() {
|
|
|
128 |
return createTimestamp;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
132 |
this.createTimestamp = createTimestamp;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
136 |
return updateTimestamp;
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
140 |
this.updateTimestamp = updateTimestamp;
|
|
|
141 |
}
|
|
|
142 |
|
| 36376 |
aman |
143 |
public Long getVersion() { return version; }
|
|
|
144 |
public void setVersion(Long version) { this.version = version; }
|
|
|
145 |
|
|
|
146 |
public CartLifecycleStatus getLifecycleStatus() { return lifecycleStatus; }
|
|
|
147 |
public void setLifecycleStatus(CartLifecycleStatus lifecycleStatus) { this.lifecycleStatus = lifecycleStatus; }
|
|
|
148 |
|
|
|
149 |
public LocalDateTime getLastActivityAt() { return lastActivityAt; }
|
|
|
150 |
public void setLastActivityAt(LocalDateTime lastActivityAt) { this.lastActivityAt = lastActivityAt; }
|
|
|
151 |
|
|
|
152 |
public SaleType getSaleType() { return saleType; }
|
|
|
153 |
public void setSaleType(SaleType saleType) { this.saleType = saleType; }
|
|
|
154 |
|
|
|
155 |
public Integer getCustomerId() { return customerId; }
|
|
|
156 |
public void setCustomerId(Integer customerId) { this.customerId = customerId; }
|
|
|
157 |
|
|
|
158 |
public int getRetailerId() { return retailerId; }
|
|
|
159 |
public void setRetailerId(int retailerId) { this.retailerId = retailerId; }
|
|
|
160 |
|
| 22352 |
ashik.ali |
161 |
@Override
|
|
|
162 |
public int hashCode() {
|
|
|
163 |
final int prime = 31;
|
|
|
164 |
int result = 1;
|
|
|
165 |
result = prime * result + id;
|
|
|
166 |
return result;
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
@Override
|
|
|
170 |
public boolean equals(Object obj) {
|
|
|
171 |
if (this == obj)
|
|
|
172 |
return true;
|
|
|
173 |
if (obj == null)
|
|
|
174 |
return false;
|
|
|
175 |
if (getClass() != obj.getClass())
|
|
|
176 |
return false;
|
|
|
177 |
Cart other = (Cart) obj;
|
|
|
178 |
if (id != other.id)
|
|
|
179 |
return false;
|
|
|
180 |
return true;
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
@Override
|
|
|
184 |
public String toString() {
|
|
|
185 |
return "Cart [id=" + id + ", walletAmount=" + walletAmount + ", totalPrice=" + totalPrice + ", cartStatus="
|
|
|
186 |
+ cartStatus + ", addressId=" + addressId + ", checkoutTimestamp=" + checkoutTimestamp
|
|
|
187 |
+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
}
|