Subversion Repositories SmartDukaan

Rev

Rev 33680 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
29515 tejbeer 1
package com.spice.profitmandi.dao.entity.dtr;
2
 
33665 ranu 3
import javax.persistence.*;
29515 tejbeer 4
import java.io.Serializable;
5
import java.time.LocalDateTime;
34474 aman.kumar 6
import java.util.Objects;
29515 tejbeer 7
 
8
@Entity
31860 tejbeer 9
@Table(name = "dtr.scratch_offer")
33665 ranu 10
@NamedQueries({@NamedQuery(name = "ScratchOffer.selectAllCountOfOffer",
11
		query = "SELECT so.offerName, COUNT(so) FROM ScratchOffer so " +
33680 ranu 12
				"WHERE so.scratched=true AND so.createdTimestamp BETWEEN :startDate AND :endDate " +
33665 ranu 13
				"GROUP BY so.offerName")
14
})
29515 tejbeer 15
public class ScratchOffer implements Serializable {
16
 
17
	/**
18
	 * 
19
	 */
20
	private static final long serialVersionUID = 1L;
21
 
22
	@Id
23
	@Column(name = "id", unique = true, updatable = false)
24
	@GeneratedValue(strategy = GenerationType.IDENTITY)
25
	private int id;
26
 
27
	@Column(name = "invoice_number")
28
	private String invoiceNumber;
29
 
30
	@Column(name = "customer_id")
31
	private int customerId;
32
 
33
	@Column(name = "offer_name")
34474 aman.kumar 34
	private String offerName;
29515 tejbeer 35
 
36
	@Column(name = "scratched")
37
	private boolean scratched;
38
 
39
	@Column(name = "created_timestamp")
40
	private LocalDateTime createdTimestamp;
41
 
42
	@Column(name = "unlocked_at")
43
	private LocalDateTime unlockedAt;
44
 
45
	@Column(name = "scracthed_at")
46
	private LocalDateTime scracthedAt;
47
 
34474 aman.kumar 48
	@Column(name = "offer_id")
49
	private int offerId;
50
 
51
	@Column(name = "gift_id")
52
	private int giftId;
53
 
29515 tejbeer 54
	public LocalDateTime getScracthedAt() {
55
		return scracthedAt;
56
	}
57
 
58
	public void setScracthedAt(LocalDateTime scracthedAt) {
59
		this.scracthedAt = scracthedAt;
60
	}
61
 
62
	@Transient
63
	private boolean unlocked;
64
 
65
	@Transient
66
	private LocalDateTime expiredTimestamp;
67
 
32671 ranu 68
	@Transient
69
	private boolean expired;
70
 
71
	public boolean isExpired() {
72
		return expired;
73
	}
74
 
75
	public void setExpired(boolean expired) {
76
		this.expired = expired;
77
	}
78
 
29515 tejbeer 79
	public LocalDateTime getExpiredTimestamp() {
80
		return expiredTimestamp;
81
	}
82
 
83
	public void setExpiredTimestamp(LocalDateTime expiredTimestamp) {
84
		this.expiredTimestamp = expiredTimestamp;
85
	}
86
 
87
	public boolean isUnlocked() {
88
		return unlocked;
89
	}
90
 
91
	public void setUnlocked(boolean unlocked) {
92
		this.unlocked = unlocked;
93
	}
94
 
95
	public LocalDateTime getUnlockedAt() {
96
		return unlockedAt;
97
	}
98
 
99
	public void setUnlockedAt(LocalDateTime unlockedAt) {
100
		this.unlockedAt = unlockedAt;
101
	}
102
 
103
	public int getId() {
104
		return id;
105
	}
106
 
107
	public void setId(int id) {
108
		this.id = id;
109
	}
110
 
111
	public int getCustomerId() {
112
		return customerId;
113
	}
114
 
115
	public void setCustomerId(int customerId) {
116
		this.customerId = customerId;
117
	}
118
 
119
	public String getInvoiceNumber() {
120
		return invoiceNumber;
121
	}
122
 
123
	public void setInvoiceNumber(String invoiceNumber) {
124
		this.invoiceNumber = invoiceNumber;
125
	}
126
 
34474 aman.kumar 127
	public String getOfferName() {
29515 tejbeer 128
		return offerName;
129
	}
130
 
34474 aman.kumar 131
	public void setOfferName(String offerName) {
29515 tejbeer 132
		this.offerName = offerName;
133
	}
134
 
135
	public boolean isScratched() {
136
		return scratched;
137
	}
138
 
139
	public void setScratched(boolean scratched) {
140
		this.scratched = scratched;
141
	}
142
 
143
	public LocalDateTime getCreatedTimestamp() {
144
		return createdTimestamp;
145
	}
146
 
147
	public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
148
		this.createdTimestamp = createdTimestamp;
149
	}
150
 
34474 aman.kumar 151
	public int getOfferId() {
152
		return offerId;
153
	}
154
 
155
	public void setOfferId(int offerId) {
156
		this.offerId = offerId;
157
	}
158
 
159
	public int getGiftId() {
160
		return giftId;
161
	}
162
 
163
	public void setGiftId(int giftId) {
164
		this.giftId = giftId;
165
	}
166
 
29515 tejbeer 167
	@Override
168
	public int hashCode() {
169
		final int prime = 31;
170
		int result = 1;
171
		result = prime * result + ((createdTimestamp == null) ? 0 : createdTimestamp.hashCode());
172
		result = prime * result + customerId;
173
		result = prime * result + ((expiredTimestamp == null) ? 0 : expiredTimestamp.hashCode());
174
		result = prime * result + id;
175
		result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());
176
		result = prime * result + ((offerName == null) ? 0 : offerName.hashCode());
177
		result = prime * result + ((scracthedAt == null) ? 0 : scracthedAt.hashCode());
178
		result = prime * result + (scratched ? 1231 : 1237);
179
		result = prime * result + (unlocked ? 1231 : 1237);
180
		result = prime * result + ((unlockedAt == null) ? 0 : unlockedAt.hashCode());
181
		return result;
182
	}
183
 
184
	@Override
185
	public boolean equals(Object obj) {
186
		if (this == obj)
187
			return true;
188
		if (obj == null)
189
			return false;
190
		if (getClass() != obj.getClass())
191
			return false;
192
		ScratchOffer other = (ScratchOffer) obj;
193
		if (createdTimestamp == null) {
194
			if (other.createdTimestamp != null)
195
				return false;
196
		} else if (!createdTimestamp.equals(other.createdTimestamp))
197
			return false;
198
		if (customerId != other.customerId)
199
			return false;
200
		if (expiredTimestamp == null) {
201
			if (other.expiredTimestamp != null)
202
				return false;
203
		} else if (!expiredTimestamp.equals(other.expiredTimestamp))
204
			return false;
205
		if (id != other.id)
206
			return false;
207
		if (invoiceNumber == null) {
208
			if (other.invoiceNumber != null)
209
				return false;
210
		} else if (!invoiceNumber.equals(other.invoiceNumber))
211
			return false;
34474 aman.kumar 212
		if (!Objects.equals(offerName, other.offerName))
29515 tejbeer 213
			return false;
214
		if (scracthedAt == null) {
215
			if (other.scracthedAt != null)
216
				return false;
217
		} else if (!scracthedAt.equals(other.scracthedAt))
218
			return false;
219
		if (scratched != other.scratched)
220
			return false;
221
		if (unlocked != other.unlocked)
222
			return false;
223
		if (unlockedAt == null) {
224
			if (other.unlockedAt != null)
225
				return false;
226
		} else if (!unlockedAt.equals(other.unlockedAt))
227
			return false;
228
		return true;
229
	}
230
 
231
	@Override
232
	public String toString() {
233
		return "ScratchOffer [id=" + id + ", invoiceNumber=" + invoiceNumber + ", customerId=" + customerId
234
				+ ", offerName=" + offerName + ", scratched=" + scratched + ", createdTimestamp=" + createdTimestamp
235
				+ ", unlockedAt=" + unlockedAt + ", scracthedAt=" + scracthedAt + ", unlocked=" + unlocked
34474 aman.kumar 236
				+ ", offerId=" + offerId + ", giftId=" + giftId
29515 tejbeer 237
				+ ", expiredTimestamp=" + expiredTimestamp + "]";
238
	}
239
 
240
}