Subversion Repositories SmartDukaan

Rev

Rev 23580 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23418 ashik.ali 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
import java.time.format.DateTimeFormatter;
6
 
7
import javax.persistence.Column;
8
import javax.persistence.Convert;
9
import javax.persistence.Entity;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
13
import javax.persistence.Table;
14
import javax.persistence.UniqueConstraint;
15
 
16
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
17
 
18
@Entity
19
@Table(name="fofo.prebooking_order", schema = "fofo", uniqueConstraints = {@UniqueConstraint(columnNames = {"item_id", "customer_mobile_number"})})
20
public class PrebookingOrder implements Serializable{
21
 
22
	private static final long serialVersionUID = 1L;
23
 
24
	@Id
25
	@Column(name = "id")
26
	@GeneratedValue(strategy = GenerationType.IDENTITY)
27
	private int id;
28
 
29
	@Column(name = "fofo_id")
30
	private int fofoId;
31
 
32
	@Column(name = "customer_name")
33
	private String customerName;
34
 
35
	@Column(name = "customer_mobile_number")
36
	private String customerMobileNumber;
37
 
38
	@Column(name = "customer_email_id")
39
	private String customerEmailId;
40
 
41
	@Column(name = "item_id")
42
	private int itemId;
43
 
44
	@Column(name = "quantity")
45
	private int quantity;
46
 
47
	@Column(name = "available_quantity")
48
	private int availableQuantity;
49
 
50
	@Convert(converter = LocalDateTimeAttributeConverter.class)
51
	@Column(name = "complete_timestamp")
52
	private LocalDateTime completeTimestamp = null;
53
 
54
	@Convert(converter = LocalDateTimeAttributeConverter.class)
55
	@Column(name = "create_timestamp")
56
	private LocalDateTime createTimestamp = LocalDateTime.now();
57
 
58
	public int getId() {
59
		return id;
60
	}
61
 
62
	public void setId(int id) {
63
		this.id = id;
64
	}
65
 
66
	public int getFofoId() {
67
		return fofoId;
68
	}
69
 
70
	public void setFofoId(int fofoId) {
71
		this.fofoId = fofoId;
72
	}
73
 
74
	public String getCustomerName() {
75
		return customerName;
76
	}
77
 
78
	public void setCustomerName(String customerName) {
79
		this.customerName = customerName;
80
	}
81
 
82
	public String getCustomerMobileNumber() {
83
		return customerMobileNumber;
84
	}
85
 
86
	public void setCustomerMobileNumber(String customerMobileNumber) {
87
		this.customerMobileNumber = customerMobileNumber;
88
	}
89
 
90
	public String getCustomerEmailId() {
91
		return customerEmailId;
92
	}
93
 
94
	public void setCustomerEmailId(String customerEmailId) {
95
		this.customerEmailId = customerEmailId;
96
	}
97
 
98
	public int getItemId() {
99
		return itemId;
100
	}
101
 
102
	public void setItemId(int itemId) {
103
		this.itemId = itemId;
104
	}
105
 
106
	public int getQuantity() {
107
		return quantity;
108
	}
109
 
110
	public void setQuantity(int quantity) {
111
		this.quantity = quantity;
112
	}
113
 
114
	public int getAvailableQuantity() {
115
		return availableQuantity;
116
	}
117
 
118
	public void setAvailableQuantity(int availableQuantity) {
119
		this.availableQuantity = availableQuantity;
120
	}
121
 
122
	public LocalDateTime getCompleteTimestamp() {
123
		return completeTimestamp;
124
	}
125
 
126
	public void setCompleteTimestamp(LocalDateTime completeTimestamp) {
127
		this.completeTimestamp = completeTimestamp;
128
	}
129
 
130
	public LocalDateTime getCreateTimestamp() {
131
		return createTimestamp;
132
	}
133
 
134
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
135
		this.createTimestamp = createTimestamp;
136
	}
137
 
138
	public String getFormattedCreateTimestamp(){
139
		if(createTimestamp == null){
140
			return null;
141
		}
142
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd-MM-YYYY HH:mm");
143
		return createTimestamp.format(formatter);
144
    }
145
 
146
	@Override
147
	public int hashCode() {
148
		final int prime = 31;
149
		int result = 1;
150
		result = prime * result + id;
151
		return result;
152
	}
153
 
154
	@Override
155
	public boolean equals(Object obj) {
156
		if (this == obj)
157
			return true;
158
		if (obj == null)
159
			return false;
160
		if (getClass() != obj.getClass())
161
			return false;
162
		PrebookingOrder other = (PrebookingOrder) obj;
163
		if (id != other.id)
164
			return false;
165
		return true;
166
	}
167
 
168
	@Override
169
	public String toString() {
170
		return "PrebookingOrder [id=" + id + ", fofoId=" + fofoId + ", customerName=" + customerName
171
				+ ", customerMobileNumber=" + customerMobileNumber + ", customerEmailId=" + customerEmailId
172
				+ ", itemId=" + itemId + ", quantity=" + quantity + ", availableQuantity=" + availableQuantity
173
				+ ", completeTimestamp=" + completeTimestamp + ", createTimestamp=" + createTimestamp + "]";
174
	}
175
 
176
}