Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
21720 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
21545 ashik.ali 2
 
33305 ranu 3
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
4
import com.spice.profitmandi.dao.model.VerifiedB2CUsersModel;
5
import org.hibernate.annotations.UpdateTimestamp;
6
 
7
import javax.persistence.*;
21545 ashik.ali 8
import java.io.Serializable;
9
import java.time.LocalDateTime;
10
 
11
 
12
/**
13
 * This is used to store information of end user.
14
 * @author ashikali
15
 *
16
 */
23221 ashik.ali 17
@Entity(name = "dtrUser")
22580 ashik.ali 18
@Table(name="dtr.users", uniqueConstraints = {@UniqueConstraint(columnNames = {"email","mobile_number"})})
33305 ranu 19
@NamedNativeQueries({
20
		@NamedNativeQuery(
21
				name = "User.b2cVerifiedUsersList",
22
				query = "SELECT u.first_name, u.last_name, u.email, u.mobile_number, u.city, u.pincode, u.state, u.created " +
23
						"FROM dtr.`users` u " +
24
						"JOIN dtr.otp o on u.mobile_number = o.mobile " +
33308 ranu 25
						"WHERE o.verified = true " +
33305 ranu 26
						"AND date(u.created) BETWEEN :startDate AND :endDate order by u.id desc",
27
				resultSetMapping = "VerifiedB2CUsersModel"
28
		)
29
})
30
 
31
@SqlResultSetMappings({
32
		@SqlResultSetMapping(name = "VerifiedB2CUsersModel", classes = {@ConstructorResult(targetClass = VerifiedB2CUsersModel.class,
33
				columns = {@ColumnResult(name = "first_name", type = String.class),
34
						@ColumnResult(name = "last_name", type = String.class),
35
						@ColumnResult(name = "email", type = String.class),
36
						@ColumnResult(name = "mobile_number", type = String.class),
37
						@ColumnResult(name = "city", type = String.class),
38
						@ColumnResult(name = "pincode", type = Integer.class),
39
						@ColumnResult(name = "state", type = String.class),
40
						@ColumnResult(name = "created", type = LocalDateTime.class),
41
				})}),
42
 
43
 
44
})
45
 
46
 
21545 ashik.ali 47
public class User implements Serializable{
48
 
49
 
50
	private static final long serialVersionUID = 1L;
51
 
52
	public User(){
53
 
54
	}
55
 
56
	@Id
57
	@Column(name="id",updatable=false, unique=true)
58
	@GeneratedValue(strategy = GenerationType.IDENTITY)
59
	private int id;
60
 
61
	@Column(name = "first_name", length = 64, nullable = false)
62
	private String firstName;
63
 
64
	@Column(name = "last_name", length = 64, nullable = false)
65
	private String lastName;
66
 
67
	@Column(length=25,name="email",unique=true)
68
	private String emailId;
69
 
23202 ashik.ali 70
	@Column(length = 25, name = "secondry_email_id", unique = true)
71
	private String secondryEmailId;
72
 
21545 ashik.ali 73
	@Column(length = 10, name = "mobile_number")
74
	private String mobileNumber;
75
 
76
	@Column(name = "city", length = 128)
77
	private String city;
78
 
79
	@Column(name = "pincode", length = 6)
80
	private Integer pinCode;
81
 
22845 amit.gupta 82
	private String state;
83
 
22009 ashik.ali 84
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 85
	@Column(name="created",updatable=false)
86
	private LocalDateTime createTimestamp;
87
 
22009 ashik.ali 88
	@Convert(converter = LocalDateTimeAttributeConverter.class)
21545 ashik.ali 89
	@Column(name="modified")
22216 ashik.ali 90
	@UpdateTimestamp
21545 ashik.ali 91
	private LocalDateTime updateTimestamp;
92
 
22845 amit.gupta 93
	@Convert(converter = LocalDateTimeAttributeConverter.class)
94
	@Column(name="activation_time")
95
	private LocalDateTime activationTime;
96
 
23418 ashik.ali 97
	@Convert(converter = LocalDateTimeAttributeConverter.class)
98
	@Column(name="login_timestamp")
99
	private LocalDateTime loginTimestamp;
100
 
101
	@Convert(converter = LocalDateTimeAttributeConverter.class)
102
	@Column(name="logout_timestamp")
103
	private LocalDateTime logoutTimestamp;
104
 
22845 amit.gupta 105
	public LocalDateTime getActivationTime() {
106
		return activationTime;
107
	}
108
 
109
	public void setActivationTime(LocalDateTime activationTime) {
110
		this.activationTime = activationTime;
111
	}
112
 
113
	public int getStatus() {
114
		return status;
115
	}
116
 
21545 ashik.ali 117
	private String username;
118
	private String password;
119
	private boolean mobile_verified;
120
	private String referral_url;
121
	private String referrer;
122
 
123
	private int group_id;
124
	@Column(columnDefinition="tinyint(1) default 0")
125
	private int status;
126
	@Column(columnDefinition="tinyint(1) default 0")
127
	private boolean activated;
128
 
23418 ashik.ali 129
	public LocalDateTime getLoginTimestamp() {
130
		return loginTimestamp;
131
	}
132
 
133
	public void setLoginTimestamp(LocalDateTime loginTimestamp) {
134
		this.loginTimestamp = loginTimestamp;
135
	}
136
 
137
	public LocalDateTime getLogoutTimestamp() {
138
		return logoutTimestamp;
139
	}
140
 
141
	public void setLogoutTimestamp(LocalDateTime logoutTimestamp) {
142
		this.logoutTimestamp = logoutTimestamp;
143
	}
144
 
21545 ashik.ali 145
	public int getId() {
146
		return id;
147
	}
148
 
149
	public void setId(int id) {
150
		this.id = id;
151
	}
152
 
153
	public String getFirstName() {
154
		return firstName;
155
	}
156
	public void setFirstName(String firstName) {
157
		this.firstName = firstName;
158
	}
159
	public String getLastName() {
160
		return lastName;
161
	}
162
	public void setLastName(String lastName) {
163
		this.lastName = lastName;
164
	}
165
 
166
	public String getEmailId() {
167
		return emailId;
168
	}
169
	public void setEmailId(String emailId) {
170
		this.emailId = emailId;
171
	}
172
 
23202 ashik.ali 173
	public String getSecondryEmailId() {
174
		return secondryEmailId;
175
	}
176
 
177
	public void setSecondryEmailId(String secondryEmailId) {
178
		this.secondryEmailId = secondryEmailId;
179
	}
21545 ashik.ali 180
 
181
	public String getMobileNumber() {
182
		return mobileNumber;
183
	}
184
 
185
	public void setMobileNumber(String mobileNumber) {
186
		this.mobileNumber = mobileNumber;
187
	}
188
 
189
	public String getCity() {
190
		return city;
191
	}
192
	public void setCity(String city) {
193
		this.city = city;
194
	}
195
	public Integer getPinCode() {
196
		return pinCode;
197
	}
198
	public void setPinCode(Integer pinCode) {
199
		this.pinCode = pinCode;
200
	}
201
 
202
	public LocalDateTime getCreateTimestamp() {
203
		return createTimestamp;
204
	}
205
 
206
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
207
		this.createTimestamp = createTimestamp;
208
	}
209
 
210
	public LocalDateTime getUpdateTimestamp() {
211
		return updateTimestamp;
212
	}
213
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
214
		this.updateTimestamp = updateTimestamp;
215
	}
216
 
217
	public String getUsername() {
218
		return username;
219
	}
220
 
221
	public void setUsername(String username) {
222
		this.username = username;
223
	}
224
 
225
	public String getPassword() {
226
		return password;
227
	}
228
 
229
	public void setPassword(String password) {
230
		this.password = password;
231
	}
232
 
233
	public boolean isMobile_verified() {
234
		return mobile_verified;
235
	}
236
 
237
	public void setMobile_verified(boolean mobile_verified) {
238
		this.mobile_verified = mobile_verified;
239
	}
240
 
241
	public String getReferral_url() {
242
		return referral_url;
243
	}
244
 
245
	public void setReferral_url(String referral_url) {
246
		this.referral_url = referral_url;
247
	}
248
 
249
	public int getGroup_id() {
250
		return group_id;
251
	}
252
 
253
	public void setGroup_id(int group_id) {
254
		this.group_id = group_id;
255
	}
256
 
257
	public String getReferrer() {
258
		return referrer;
259
	}
260
 
261
	public void setReferrer(String referrer) {
262
		this.referrer = referrer;
263
	}
264
 
265
	public int isStatus() {
266
		return status;
267
	}
268
 
269
	public void setStatus(int status) {
270
		this.status = status;
271
	}
272
 
273
	public boolean isActivated() {
274
		return activated;
275
	}
276
 
277
	public void setActivated(boolean activated) {
278
		this.activated = activated;
279
	}
22859 ashik.ali 280
 
281
	public String getState() {
282
		return state;
283
	}
21545 ashik.ali 284
 
22859 ashik.ali 285
	public void setState(String state) {
286
		this.state = state;
287
	}
288
 
22009 ashik.ali 289
 
21545 ashik.ali 290
	@Override
291
	public int hashCode() {
292
		final int prime = 31;
293
		int result = 1;
22009 ashik.ali 294
		result = prime * result + id;
21545 ashik.ali 295
		return result;
296
	}
297
 
298
	@Override
299
	public boolean equals(Object obj) {
300
		if (this == obj)
301
			return true;
302
		if (obj == null)
303
			return false;
304
		if (getClass() != obj.getClass())
305
			return false;
306
		User other = (User) obj;
307
		if (id != other.id)
308
			return false;
309
		return true;
310
	}
311
 
21924 ashik.ali 312
	@Override
313
	public String toString() {
314
		return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId
23202 ashik.ali 315
				+ ", secondryEmailId=" + secondryEmailId + ", mobileNumber=" + mobileNumber + ", city=" + city
316
				+ ", pinCode=" + pinCode + ", state=" + state + ", createTimestamp=" + createTimestamp
23418 ashik.ali 317
				+ ", updateTimestamp=" + updateTimestamp + ", activationTime=" + activationTime + ", loginTimestamp="
318
				+ loginTimestamp + ", logoutTimestamp=" + logoutTimestamp + ", username=" + username + ", password="
319
				+ password + ", mobile_verified=" + mobile_verified + ", referral_url=" + referral_url + ", referrer="
320
				+ referrer + ", group_id=" + group_id + ", status=" + status + ", activated=" + activated + "]";
21924 ashik.ali 321
	}
21545 ashik.ali 322
 
323
}