Subversion Repositories SmartDukaan

Rev

Rev 25726 | Rev 27579 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21714 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
21596 ashik.ali 2
 
3
import java.io.Serializable;
25726 amit.gupta 4
import java.time.LocalDate;
21596 ashik.ali 5
import java.time.LocalDateTime;
22243 ashik.ali 6
import java.time.format.DateTimeFormatter;
21596 ashik.ali 7
 
8
import javax.persistence.Column;
22009 ashik.ali 9
import javax.persistence.Convert;
21596 ashik.ali 10
import javax.persistence.Entity;
11
import javax.persistence.GeneratedValue;
12
import javax.persistence.GenerationType;
13
import javax.persistence.Id;
14
import javax.persistence.Table;
25083 amit.gupta 15
import javax.persistence.Transient;
21596 ashik.ali 16
 
22009 ashik.ali 17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
18
 
21596 ashik.ali 19
@Entity
20
@Table(name="fofo.fofo_order", schema = "fofo")
21
public class FofoOrder implements Serializable{
22
 
23
	private static final long serialVersionUID = 1L;
24
 
25
	@Id
26
	@Column(name = "id")
27
	@GeneratedValue(strategy = GenerationType.IDENTITY)
28
	private int id;
29
 
30
	@Column(name = "fofo_id")
31
	private int fofoId;
32
 
33
	@Column(name = "customer_id")
34
	private int customerId;
35
 
21710 ashik.ali 36
	@Column(name = "customer_address_id")
37
	private int customerAddressId;
38
 
23369 ashik.ali 39
	@Column(name = "customer_gst_number")
40
	private String customerGstNumber;
41
 
21596 ashik.ali 42
	@Column(name = "total_amount")
43
	private float totalAmount;
44
 
21609 ashik.ali 45
	@Column(name = "invoice_number", length = 50)
21596 ashik.ali 46
	private String invoiceNumber;
47
 
22859 ashik.ali 48
	@Column(name = "cashback")
49
	private float cashback;
50
 
22009 ashik.ali 51
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21596 ashik.ali 52
	@Column(name = "create_timestamp")
23202 ashik.ali 53
	private LocalDateTime createTimestamp = LocalDateTime.now();	
21596 ashik.ali 54
 
24264 amit.gupta 55
	@Convert(converter = LocalDateTimeAttributeConverter.class)
56
	@Column(name = "cancelled_timestamp")
57
	private LocalDateTime cancelledTimestamp;	
58
 
25083 amit.gupta 59
 
26817 amit.gupta 60
	//@Convert(converter = LocalDateTimeAttributeConverter.class)
61
	//@Column(name = "billing_timestamp")
25083 amit.gupta 62
	@Transient
26817 amit.gupta 63
	private LocalDateTime billingTimestamp;	
64
 
65
 
66
	@Transient
25083 amit.gupta 67
	private FofoOrderItem orderItem;
68
 
25726 amit.gupta 69
 
70
	@Transient
71
	private LocalDate dateOfBirth;
72
 
73
	public LocalDate getDateOfBirth() {
74
		return dateOfBirth;
75
	}
76
	public void setDateOfBirth(LocalDate dateOfBirth) {
77
		this.dateOfBirth = dateOfBirth;
78
	}
25083 amit.gupta 79
	public FofoOrderItem getOrderItem() {
80
		return orderItem;
81
	}
82
	public void setOrderItem(FofoOrderItem orderItem) {
83
		this.orderItem = orderItem;
84
	}
24264 amit.gupta 85
	public LocalDateTime getCancelledTimestamp() {
86
		return cancelledTimestamp;
87
	}
88
	public void setCancelledTimestamp(LocalDateTime cancelledTimestamp) {
89
		this.cancelledTimestamp = cancelledTimestamp;
90
	}
21984 kshitij.so 91
	public int getId() {
92
		return id;
93
	}
94
	public void setId(int id) {
95
		this.id = id;
96
	}
97
	public int getFofoId() {
98
		return fofoId;
99
	}
100
	public void setFofoId(int fofoId) {
101
		this.fofoId = fofoId;
102
	}
103
	public int getCustomerId() {
104
		return customerId;
105
	}
106
	public void setCustomerId(int customerId) {
107
		this.customerId = customerId;
108
	}
109
	public int getCustomerAddressId() {
110
		return customerAddressId;
111
	}
112
	public void setCustomerAddressId(int customerAddressId) {
113
		this.customerAddressId = customerAddressId;
114
	}
23369 ashik.ali 115
	public String getCustomerGstNumber() {
116
		return customerGstNumber;
117
	}
118
	public void setCustomerGstNumber(String customerGstNumber) {
119
		this.customerGstNumber = customerGstNumber;
120
	}
21984 kshitij.so 121
	public float getTotalAmount() {
122
		return totalAmount;
123
	}
124
	public void setTotalAmount(float totalAmount) {
125
		this.totalAmount = totalAmount;
126
	}
127
	public String getInvoiceNumber() {
128
		return invoiceNumber;
129
	}
130
	public void setInvoiceNumber(String invoiceNumber) {
131
		this.invoiceNumber = invoiceNumber;
132
	}
22859 ashik.ali 133
	public float getCashback() {
134
		return cashback;
135
	}
136
	public void setCashback(float cashback) {
137
		this.cashback = cashback;
138
	}
21984 kshitij.so 139
	public LocalDateTime getCreateTimestamp() {
140
		return createTimestamp;
141
	}
142
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
143
		this.createTimestamp = createTimestamp;
144
	}
22009 ashik.ali 145
 
22243 ashik.ali 146
	public String getFormattedDate(){
24402 amit.gupta 147
    	DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm");
22243 ashik.ali 148
		return this.createTimestamp.format(formatter);
149
    }
22009 ashik.ali 150
 
26817 amit.gupta 151
 
152
 
21924 ashik.ali 153
	@Override
22009 ashik.ali 154
	public int hashCode() {
155
		final int prime = 31;
156
		int result = 1;
26817 amit.gupta 157
		result = prime * result + ((billingTimestamp == null) ? 0 : billingTimestamp.hashCode());
158
		result = prime * result + ((cancelledTimestamp == null) ? 0 : cancelledTimestamp.hashCode());
159
		result = prime * result + Float.floatToIntBits(cashback);
160
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
161
		result = prime * result + customerAddressId;
162
		result = prime * result + ((customerGstNumber == null) ? 0 : customerGstNumber.hashCode());
163
		result = prime * result + customerId;
164
		result = prime * result + ((dateOfBirth == null) ? 0 : dateOfBirth.hashCode());
165
		result = prime * result + fofoId;
22009 ashik.ali 166
		result = prime * result + id;
26817 amit.gupta 167
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
168
		result = prime * result + ((orderItem == null) ? 0 : orderItem.hashCode());
169
		result = prime * result + Float.floatToIntBits(totalAmount);
22009 ashik.ali 170
		return result;
171
	}
22859 ashik.ali 172
 
22009 ashik.ali 173
	@Override
174
	public boolean equals(Object obj) {
175
		if (this == obj)
176
			return true;
177
		if (obj == null)
178
			return false;
179
		if (getClass() != obj.getClass())
180
			return false;
181
		FofoOrder other = (FofoOrder) obj;
26817 amit.gupta 182
		if (billingTimestamp == null) {
183
			if (other.billingTimestamp != null)
184
				return false;
185
		} else if (!billingTimestamp.equals(other.billingTimestamp))
186
			return false;
187
		if (cancelledTimestamp == null) {
188
			if (other.cancelledTimestamp != null)
189
				return false;
190
		} else if (!cancelledTimestamp.equals(other.cancelledTimestamp))
191
			return false;
192
		if (Float.floatToIntBits(cashback) != Float.floatToIntBits(other.cashback))
193
			return false;
194
		if (createTimestamp == null) {
195
			if (other.createTimestamp != null)
196
				return false;
197
		} else if (!createTimestamp.equals(other.createTimestamp))
198
			return false;
199
		if (customerAddressId != other.customerAddressId)
200
			return false;
201
		if (customerGstNumber == null) {
202
			if (other.customerGstNumber != null)
203
				return false;
204
		} else if (!customerGstNumber.equals(other.customerGstNumber))
205
			return false;
206
		if (customerId != other.customerId)
207
			return false;
208
		if (dateOfBirth == null) {
209
			if (other.dateOfBirth != null)
210
				return false;
211
		} else if (!dateOfBirth.equals(other.dateOfBirth))
212
			return false;
213
		if (fofoId != other.fofoId)
214
			return false;
22009 ashik.ali 215
		if (id != other.id)
216
			return false;
26817 amit.gupta 217
		if (invoiceNumber == null) {
218
			if (other.invoiceNumber != null)
219
				return false;
220
		} else if (!invoiceNumber.equals(other.invoiceNumber))
221
			return false;
222
		if (orderItem == null) {
223
			if (other.orderItem != null)
224
				return false;
225
		} else if (!orderItem.equals(other.orderItem))
226
			return false;
227
		if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))
228
			return false;
22009 ashik.ali 229
		return true;
230
	}
22859 ashik.ali 231
 
22009 ashik.ali 232
	@Override
21602 ashik.ali 233
	public String toString() {
21710 ashik.ali 234
		return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="
23369 ashik.ali 235
				+ customerAddressId + ", customerGstNumber=" + customerGstNumber + ", totalAmount=" + totalAmount
236
				+ ", invoiceNumber=" + invoiceNumber + ", cashback=" + cashback + ", createTimestamp=" + createTimestamp
26817 amit.gupta 237
				+ ", cancelledTimestamp=" + cancelledTimestamp + ", billingTimestamp=" + billingTimestamp
238
				+ ", orderItem=" + orderItem + ", dateOfBirth=" + dateOfBirth + "]";
21602 ashik.ali 239
	}
240
 
21596 ashik.ali 241
}