Subversion Repositories SmartDukaan

Rev

Rev 33319 | 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",
33319 ranu 22
				query = "SELECT DISTINCT u.first_name, u.last_name, u.email, u.mobile_number, u.city, u.pincode, u.state, u.created " +
33305 ranu 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;
37548 ranu 104
 
105
	// Which UI a partner last chose (React 'react' vs classic Angular 'angular').
106
	// Read at login by both apps to redirect the user to their preferred version
107
	// on any browser/device. Null means "no explicit choice yet".
108
	@Column(name = "preferred_app", length = 16)
109
	private String preferredApp;
110
 
22845 amit.gupta 111
	public LocalDateTime getActivationTime() {
112
		return activationTime;
113
	}
114
 
115
	public void setActivationTime(LocalDateTime activationTime) {
116
		this.activationTime = activationTime;
117
	}
118
 
119
	public int getStatus() {
120
		return status;
121
	}
122
 
21545 ashik.ali 123
	private String username;
124
	private String password;
125
	private boolean mobile_verified;
126
	private String referral_url;
127
	private String referrer;
128
 
129
	private int group_id;
130
	@Column(columnDefinition="tinyint(1) default 0")
131
	private int status;
132
	@Column(columnDefinition="tinyint(1) default 0")
133
	private boolean activated;
134
 
23418 ashik.ali 135
	public LocalDateTime getLoginTimestamp() {
136
		return loginTimestamp;
137
	}
138
 
139
	public void setLoginTimestamp(LocalDateTime loginTimestamp) {
140
		this.loginTimestamp = loginTimestamp;
141
	}
142
 
143
	public LocalDateTime getLogoutTimestamp() {
144
		return logoutTimestamp;
145
	}
146
 
147
	public void setLogoutTimestamp(LocalDateTime logoutTimestamp) {
148
		this.logoutTimestamp = logoutTimestamp;
149
	}
150
 
21545 ashik.ali 151
	public int getId() {
152
		return id;
153
	}
154
 
155
	public void setId(int id) {
156
		this.id = id;
157
	}
158
 
159
	public String getFirstName() {
160
		return firstName;
161
	}
162
	public void setFirstName(String firstName) {
163
		this.firstName = firstName;
164
	}
165
	public String getLastName() {
166
		return lastName;
167
	}
168
	public void setLastName(String lastName) {
169
		this.lastName = lastName;
170
	}
171
 
172
	public String getEmailId() {
173
		return emailId;
174
	}
175
	public void setEmailId(String emailId) {
176
		this.emailId = emailId;
177
	}
178
 
23202 ashik.ali 179
	public String getSecondryEmailId() {
180
		return secondryEmailId;
181
	}
182
 
183
	public void setSecondryEmailId(String secondryEmailId) {
184
		this.secondryEmailId = secondryEmailId;
185
	}
21545 ashik.ali 186
 
187
	public String getMobileNumber() {
188
		return mobileNumber;
189
	}
190
 
191
	public void setMobileNumber(String mobileNumber) {
192
		this.mobileNumber = mobileNumber;
193
	}
194
 
195
	public String getCity() {
196
		return city;
197
	}
198
	public void setCity(String city) {
199
		this.city = city;
200
	}
201
	public Integer getPinCode() {
202
		return pinCode;
203
	}
204
	public void setPinCode(Integer pinCode) {
205
		this.pinCode = pinCode;
206
	}
207
 
208
	public LocalDateTime getCreateTimestamp() {
209
		return createTimestamp;
210
	}
211
 
212
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
213
		this.createTimestamp = createTimestamp;
214
	}
215
 
216
	public LocalDateTime getUpdateTimestamp() {
217
		return updateTimestamp;
218
	}
219
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
220
		this.updateTimestamp = updateTimestamp;
221
	}
222
 
223
	public String getUsername() {
224
		return username;
225
	}
226
 
227
	public void setUsername(String username) {
228
		this.username = username;
229
	}
230
 
231
	public String getPassword() {
232
		return password;
233
	}
234
 
235
	public void setPassword(String password) {
236
		this.password = password;
237
	}
238
 
239
	public boolean isMobile_verified() {
240
		return mobile_verified;
241
	}
242
 
243
	public void setMobile_verified(boolean mobile_verified) {
244
		this.mobile_verified = mobile_verified;
245
	}
246
 
247
	public String getReferral_url() {
248
		return referral_url;
249
	}
250
 
251
	public void setReferral_url(String referral_url) {
252
		this.referral_url = referral_url;
253
	}
254
 
255
	public int getGroup_id() {
256
		return group_id;
257
	}
258
 
259
	public void setGroup_id(int group_id) {
260
		this.group_id = group_id;
261
	}
262
 
263
	public String getReferrer() {
264
		return referrer;
265
	}
266
 
267
	public void setReferrer(String referrer) {
268
		this.referrer = referrer;
269
	}
270
 
271
	public int isStatus() {
272
		return status;
273
	}
274
 
275
	public void setStatus(int status) {
276
		this.status = status;
277
	}
278
 
279
	public boolean isActivated() {
280
		return activated;
281
	}
282
 
283
	public void setActivated(boolean activated) {
284
		this.activated = activated;
285
	}
22859 ashik.ali 286
 
287
	public String getState() {
288
		return state;
289
	}
21545 ashik.ali 290
 
22859 ashik.ali 291
	public void setState(String state) {
292
		this.state = state;
293
	}
294
 
37548 ranu 295
	public String getPreferredApp() {
296
		return preferredApp;
297
	}
298
 
299
	public void setPreferredApp(String preferredApp) {
300
		this.preferredApp = preferredApp;
301
	}
302
 
22009 ashik.ali 303
 
21545 ashik.ali 304
	@Override
305
	public int hashCode() {
306
		final int prime = 31;
307
		int result = 1;
22009 ashik.ali 308
		result = prime * result + id;
21545 ashik.ali 309
		return result;
310
	}
311
 
312
	@Override
313
	public boolean equals(Object obj) {
314
		if (this == obj)
315
			return true;
316
		if (obj == null)
317
			return false;
318
		if (getClass() != obj.getClass())
319
			return false;
320
		User other = (User) obj;
321
		if (id != other.id)
322
			return false;
323
		return true;
324
	}
325
 
21924 ashik.ali 326
	@Override
327
	public String toString() {
328
		return "User [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", emailId=" + emailId
23202 ashik.ali 329
				+ ", secondryEmailId=" + secondryEmailId + ", mobileNumber=" + mobileNumber + ", city=" + city
330
				+ ", pinCode=" + pinCode + ", state=" + state + ", createTimestamp=" + createTimestamp
23418 ashik.ali 331
				+ ", updateTimestamp=" + updateTimestamp + ", activationTime=" + activationTime + ", loginTimestamp="
332
				+ loginTimestamp + ", logoutTimestamp=" + logoutTimestamp + ", username=" + username + ", password="
333
				+ password + ", mobile_verified=" + mobile_verified + ", referral_url=" + referral_url + ", referrer="
334
				+ referrer + ", group_id=" + group_id + ", status=" + status + ", activated=" + activated + "]";
21924 ashik.ali 335
	}
21545 ashik.ali 336
 
337
}