| 25899 |
tejbeer |
1 |
package com.spice.profitmandi.dao.entity.user;
|
|
|
2 |
|
| 32349 |
amit.gupta |
3 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
|
|
4 |
import com.spice.profitmandi.dao.enumuration.dtr.VisitStatus;
|
|
|
5 |
|
|
|
6 |
import javax.persistence.*;
|
| 25899 |
tejbeer |
7 |
import java.time.LocalDateTime;
|
| 29317 |
tejbeer |
8 |
import java.util.List;
|
| 25899 |
tejbeer |
9 |
|
|
|
10 |
@Entity
|
| 31860 |
tejbeer |
11 |
@Table(name = "user.lead")
|
| 25899 |
tejbeer |
12 |
public class Lead {
|
|
|
13 |
@Id
|
|
|
14 |
@Column(name = "id", unique = true, updatable = false)
|
|
|
15 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
16 |
private int id;
|
|
|
17 |
|
|
|
18 |
@Column(name = "first_name")
|
|
|
19 |
private String firstName;
|
|
|
20 |
|
| 25979 |
tejbeer |
21 |
@Column(name = "source")
|
|
|
22 |
private String source;
|
|
|
23 |
|
| 26244 |
tejbeer |
24 |
@Column(name = "color")
|
|
|
25 |
private String color;
|
|
|
26 |
|
| 29317 |
tejbeer |
27 |
@Transient
|
|
|
28 |
private List<LeadActivity> leadActivities;
|
|
|
29 |
|
| 31249 |
tejbeer |
30 |
@Transient
|
|
|
31 |
private VisitStatus visitStatus;
|
|
|
32 |
|
| 34391 |
tejus.loha |
33 |
@Column(name = "outlet_name")
|
| 31370 |
tejbeer |
34 |
private String outLetName;
|
|
|
35 |
|
| 34394 |
tejus.loha |
36 |
@Column(name = "potential")
|
|
|
37 |
private double potential;
|
|
|
38 |
|
|
|
39 |
public double getPotential() {
|
|
|
40 |
return potential;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
public void setPotential(double potential) {
|
|
|
44 |
this.potential = potential;
|
|
|
45 |
}
|
|
|
46 |
|
| 31370 |
tejbeer |
47 |
public String getOutLetName() {
|
|
|
48 |
return outLetName;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
public void setOutLetName(String outLetName) {
|
|
|
52 |
this.outLetName = outLetName;
|
|
|
53 |
}
|
|
|
54 |
|
| 29317 |
tejbeer |
55 |
public List<LeadActivity> getLeadActivities() {
|
|
|
56 |
return leadActivities;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public void setLeadActivities(List<LeadActivity> leadActivities) {
|
|
|
60 |
this.leadActivities = leadActivities;
|
|
|
61 |
}
|
|
|
62 |
|
| 28200 |
tejbeer |
63 |
@Column(name = "notinterested_reason")
|
|
|
64 |
public String notinterestedReason;
|
|
|
65 |
|
|
|
66 |
public String getNotinterestedReason() {
|
|
|
67 |
return notinterestedReason;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public void setNotinterestedReason(String notinterestedReason) {
|
|
|
71 |
this.notinterestedReason = notinterestedReason;
|
|
|
72 |
}
|
|
|
73 |
|
| 26244 |
tejbeer |
74 |
public String getColor() {
|
|
|
75 |
return color;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void setColor(String color) {
|
|
|
79 |
this.color = color;
|
|
|
80 |
}
|
|
|
81 |
|
| 25979 |
tejbeer |
82 |
public String getSource() {
|
|
|
83 |
return source;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void setSource(String source) {
|
|
|
87 |
this.source = source;
|
|
|
88 |
}
|
|
|
89 |
|
| 25899 |
tejbeer |
90 |
public String getFirstName() {
|
|
|
91 |
return firstName;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setFirstName(String firstName) {
|
|
|
95 |
this.firstName = firstName;
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public String getLastName() {
|
|
|
99 |
return lastName;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public void setLastName(String lastName) {
|
|
|
103 |
this.lastName = lastName;
|
|
|
104 |
}
|
|
|
105 |
|
| 32349 |
amit.gupta |
106 |
public String getFullName() {
|
|
|
107 |
return String.join(", ", firstName, lastName);
|
|
|
108 |
}
|
|
|
109 |
|
| 25899 |
tejbeer |
110 |
@Column(name = "last_name")
|
|
|
111 |
private String lastName;
|
|
|
112 |
|
|
|
113 |
@Column(length = 10, name = "mobile")
|
|
|
114 |
private String leadMobile;
|
|
|
115 |
|
|
|
116 |
@Column(name = "created_by")
|
|
|
117 |
private String createdBy;
|
|
|
118 |
|
|
|
119 |
@Column(name = "auth_id")
|
|
|
120 |
private int authId;
|
|
|
121 |
|
|
|
122 |
public int getAuthId() {
|
|
|
123 |
return authId;
|
|
|
124 |
}
|
|
|
125 |
|
| 25916 |
amit.gupta |
126 |
@Transient
|
|
|
127 |
private LeadActivity leadActivity;
|
| 26244 |
tejbeer |
128 |
|
| 27788 |
amit.gupta |
129 |
@Transient
|
|
|
130 |
private LocalDateTime scheduledTimestamp;
|
| 28200 |
tejbeer |
131 |
|
| 25916 |
amit.gupta |
132 |
public LeadActivity getLeadActivity() {
|
|
|
133 |
return leadActivity;
|
|
|
134 |
}
|
|
|
135 |
|
| 31249 |
tejbeer |
136 |
public VisitStatus getVisitStatus() {
|
|
|
137 |
return visitStatus;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
public void setVisitStatus(VisitStatus visitStatus) {
|
|
|
141 |
this.visitStatus = visitStatus;
|
|
|
142 |
}
|
|
|
143 |
|
| 27788 |
amit.gupta |
144 |
@Override
|
|
|
145 |
public int hashCode() {
|
|
|
146 |
final int prime = 31;
|
|
|
147 |
int result = 1;
|
|
|
148 |
result = prime * result + id;
|
|
|
149 |
return result;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
@Override
|
|
|
153 |
public boolean equals(Object obj) {
|
|
|
154 |
if (this == obj)
|
|
|
155 |
return true;
|
|
|
156 |
if (obj == null)
|
|
|
157 |
return false;
|
|
|
158 |
if (getClass() != obj.getClass())
|
|
|
159 |
return false;
|
|
|
160 |
Lead other = (Lead) obj;
|
|
|
161 |
if (id != other.id)
|
|
|
162 |
return false;
|
|
|
163 |
return true;
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
public LocalDateTime getScheduledTimestamp() {
|
|
|
167 |
return scheduledTimestamp;
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
public void setScheduledTimestamp(LocalDateTime scheduledTimestamp) {
|
|
|
171 |
this.scheduledTimestamp = scheduledTimestamp;
|
|
|
172 |
}
|
|
|
173 |
|
| 25916 |
amit.gupta |
174 |
public void setLeadActivity(LeadActivity leadActivity) {
|
|
|
175 |
this.leadActivity = leadActivity;
|
|
|
176 |
}
|
|
|
177 |
|
| 25899 |
tejbeer |
178 |
public void setAuthId(int authId) {
|
|
|
179 |
this.authId = authId;
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
@Column(name = "address")
|
|
|
183 |
private String address;
|
|
|
184 |
|
|
|
185 |
@Column(name = "city")
|
|
|
186 |
private String city;
|
|
|
187 |
|
|
|
188 |
@Column(name = "state")
|
|
|
189 |
private String state;
|
|
|
190 |
|
| 37027 |
aman |
191 |
@Column(name = "recording_url")
|
|
|
192 |
private String recordingUrl;
|
|
|
193 |
|
|
|
194 |
public String getRecordingUrl() {
|
|
|
195 |
return recordingUrl;
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
public void setRecordingUrl(String recordingUrl) {
|
|
|
199 |
this.recordingUrl = recordingUrl;
|
|
|
200 |
}
|
|
|
201 |
|
| 25899 |
tejbeer |
202 |
@Column(name = "status")
|
|
|
203 |
@Enumerated(EnumType.STRING)
|
|
|
204 |
private LeadStatus status;
|
|
|
205 |
|
| 25979 |
tejbeer |
206 |
@Column(name = "assign_to")
|
|
|
207 |
private int assignTo;
|
|
|
208 |
|
| 27025 |
tejbeer |
209 |
@Column(name = "closure_timestamp")
|
|
|
210 |
private LocalDateTime closureTimestamp;
|
|
|
211 |
|
|
|
212 |
public LocalDateTime getClosureTimestamp() {
|
|
|
213 |
return closureTimestamp;
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
public void setClosureTimestamp(LocalDateTime closureTimestamp) {
|
|
|
217 |
this.closureTimestamp = closureTimestamp;
|
|
|
218 |
}
|
|
|
219 |
|
| 25899 |
tejbeer |
220 |
@Column(name = "created_timestamp")
|
|
|
221 |
private LocalDateTime createdTimestamp;
|
|
|
222 |
|
|
|
223 |
@Column(name = "updated_timestamp")
|
|
|
224 |
private LocalDateTime updatedTimestamp;
|
|
|
225 |
|
| 37120 |
vikas |
226 |
// ---- LMS operating-core columns (additive; see migration_lms_operating_core.sql) ----
|
|
|
227 |
// Legacy `status` above is kept in sync with `stage` (LeadStage.toLegacyStatus) on every mutation.
|
|
|
228 |
|
|
|
229 |
/** Immutable formatted LMS id, e.g. LMS-UPW-26-000123. Generated on create; null for legacy rows. */
|
|
|
230 |
@Column(name = "lms_code")
|
|
|
231 |
private String lmsCode;
|
|
|
232 |
|
|
|
233 |
/** Richer lifecycle stage (SOP §8). Null for legacy rows → derive via LeadStage.fromLegacy on read. */
|
|
|
234 |
@Column(name = "stage")
|
|
|
235 |
@Enumerated(EnumType.STRING)
|
|
|
236 |
private com.spice.profitmandi.dao.enumuration.dtr.LeadStage stage;
|
|
|
237 |
|
|
|
238 |
/** Last call disposition (SOP §12.2). */
|
|
|
239 |
@Column(name = "disposition")
|
|
|
240 |
@Enumerated(EnumType.STRING)
|
|
|
241 |
private com.spice.profitmandi.dao.enumuration.dtr.LeadDisposition disposition;
|
|
|
242 |
|
|
|
243 |
/** Sub-reason for NOT_INTERESTED (Price / Terms / Already partnered / Category mismatch / Other). */
|
|
|
244 |
@Column(name = "disposition_sub_reason")
|
|
|
245 |
private String dispositionSubReason;
|
|
|
246 |
|
|
|
247 |
/** Creation path: 'A' = BGC outbound, 'B' = field encounter (geo mandatory). */
|
|
|
248 |
@Column(name = "creation_path")
|
|
|
249 |
private String creationPath;
|
|
|
250 |
|
|
|
251 |
/** Resolved region (FK to cs.region) driving auto-assignment. */
|
|
|
252 |
@Column(name = "region_id")
|
|
|
253 |
private Integer regionId;
|
|
|
254 |
|
|
|
255 |
/** Region short code (UPW/UPE/RJ/PB/HR/UK/DL) — denormalised for display + LMS id. */
|
|
|
256 |
@Column(name = "region_code")
|
|
|
257 |
private String regionCode;
|
|
|
258 |
|
|
|
259 |
/** Auto-resolved owning BM/RSM auth id (distinct from assignTo, which is the working owner/ASM). */
|
|
|
260 |
@Column(name = "owner_bm_id")
|
|
|
261 |
private Integer ownerBmId;
|
|
|
262 |
|
|
|
263 |
/** ASSIGNED / HOLD / FALLBACK (SOP §10.2). HOLD = no active BM/RSM for the region. */
|
|
|
264 |
@Column(name = "assignment_status")
|
|
|
265 |
private String assignmentStatus;
|
|
|
266 |
|
|
|
267 |
/** First-contact SLA deadline = created + 5h (SOP §11). */
|
|
|
268 |
@Column(name = "first_contact_due")
|
|
|
269 |
private LocalDateTime firstContactDue;
|
|
|
270 |
|
|
|
271 |
/** When first contact (call/visit with disposition) actually happened. Stamped once. */
|
|
|
272 |
@Column(name = "first_contacted_at")
|
|
|
273 |
private LocalDateTime firstContactedAt;
|
|
|
274 |
|
|
|
275 |
/** Count of NOT_REACHABLE attempts; lead auto-flags DROPPED after N (SOP §8). */
|
|
|
276 |
@Column(name = "unreachable_count")
|
|
|
277 |
private Integer unreachableCount;
|
|
|
278 |
|
|
|
279 |
public String getLmsCode() {
|
|
|
280 |
return lmsCode;
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
public void setLmsCode(String lmsCode) {
|
|
|
284 |
this.lmsCode = lmsCode;
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
public com.spice.profitmandi.dao.enumuration.dtr.LeadStage getStage() {
|
|
|
288 |
return stage;
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
public void setStage(com.spice.profitmandi.dao.enumuration.dtr.LeadStage stage) {
|
|
|
292 |
this.stage = stage;
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
public com.spice.profitmandi.dao.enumuration.dtr.LeadDisposition getDisposition() {
|
|
|
296 |
return disposition;
|
|
|
297 |
}
|
|
|
298 |
|
|
|
299 |
public void setDisposition(com.spice.profitmandi.dao.enumuration.dtr.LeadDisposition disposition) {
|
|
|
300 |
this.disposition = disposition;
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
public String getDispositionSubReason() {
|
|
|
304 |
return dispositionSubReason;
|
|
|
305 |
}
|
|
|
306 |
|
|
|
307 |
public void setDispositionSubReason(String dispositionSubReason) {
|
|
|
308 |
this.dispositionSubReason = dispositionSubReason;
|
|
|
309 |
}
|
|
|
310 |
|
|
|
311 |
public String getCreationPath() {
|
|
|
312 |
return creationPath;
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
public void setCreationPath(String creationPath) {
|
|
|
316 |
this.creationPath = creationPath;
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
public Integer getRegionId() {
|
|
|
320 |
return regionId;
|
|
|
321 |
}
|
|
|
322 |
|
|
|
323 |
public void setRegionId(Integer regionId) {
|
|
|
324 |
this.regionId = regionId;
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
public String getRegionCode() {
|
|
|
328 |
return regionCode;
|
|
|
329 |
}
|
|
|
330 |
|
|
|
331 |
public void setRegionCode(String regionCode) {
|
|
|
332 |
this.regionCode = regionCode;
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
public Integer getOwnerBmId() {
|
|
|
336 |
return ownerBmId;
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
public void setOwnerBmId(Integer ownerBmId) {
|
|
|
340 |
this.ownerBmId = ownerBmId;
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
public String getAssignmentStatus() {
|
|
|
344 |
return assignmentStatus;
|
|
|
345 |
}
|
|
|
346 |
|
|
|
347 |
public void setAssignmentStatus(String assignmentStatus) {
|
|
|
348 |
this.assignmentStatus = assignmentStatus;
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
public LocalDateTime getFirstContactDue() {
|
|
|
352 |
return firstContactDue;
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
public void setFirstContactDue(LocalDateTime firstContactDue) {
|
|
|
356 |
this.firstContactDue = firstContactDue;
|
|
|
357 |
}
|
|
|
358 |
|
|
|
359 |
public LocalDateTime getFirstContactedAt() {
|
|
|
360 |
return firstContactedAt;
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
public void setFirstContactedAt(LocalDateTime firstContactedAt) {
|
|
|
364 |
this.firstContactedAt = firstContactedAt;
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
public Integer getUnreachableCount() {
|
|
|
368 |
return unreachableCount;
|
|
|
369 |
}
|
|
|
370 |
|
|
|
371 |
public void setUnreachableCount(Integer unreachableCount) {
|
|
|
372 |
this.unreachableCount = unreachableCount;
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
/** Effective stage for display: stored stage, or derived from legacy status for pre-LMS rows. */
|
|
|
376 |
@Transient
|
|
|
377 |
public com.spice.profitmandi.dao.enumuration.dtr.LeadStage getEffectiveStage() {
|
|
|
378 |
return stage != null
|
|
|
379 |
? stage
|
|
|
380 |
: com.spice.profitmandi.dao.enumuration.dtr.LeadStage.fromLegacy(status, color);
|
|
|
381 |
}
|
|
|
382 |
|
| 25979 |
tejbeer |
383 |
public int getAssignTo() {
|
|
|
384 |
return assignTo;
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
public void setAssignTo(int assignTo) {
|
|
|
388 |
this.assignTo = assignTo;
|
|
|
389 |
}
|
|
|
390 |
|
| 25899 |
tejbeer |
391 |
public int getId() {
|
|
|
392 |
return id;
|
|
|
393 |
}
|
|
|
394 |
|
|
|
395 |
public void setId(int id) {
|
|
|
396 |
this.id = id;
|
|
|
397 |
}
|
|
|
398 |
|
|
|
399 |
public String getLeadMobile() {
|
|
|
400 |
return leadMobile;
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
public void setLeadMobile(String leadMobile) {
|
|
|
404 |
this.leadMobile = leadMobile;
|
|
|
405 |
}
|
|
|
406 |
|
|
|
407 |
public String getCreatedBy() {
|
|
|
408 |
return createdBy;
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
public void setCreatedBy(String createdBy) {
|
|
|
412 |
this.createdBy = createdBy;
|
|
|
413 |
}
|
|
|
414 |
|
|
|
415 |
public String getAddress() {
|
|
|
416 |
return address;
|
|
|
417 |
}
|
|
|
418 |
|
|
|
419 |
public void setAddress(String address) {
|
|
|
420 |
this.address = address;
|
|
|
421 |
}
|
|
|
422 |
|
|
|
423 |
public String getCity() {
|
|
|
424 |
return city;
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
public void setCity(String city) {
|
|
|
428 |
this.city = city;
|
|
|
429 |
}
|
|
|
430 |
|
|
|
431 |
public String getState() {
|
|
|
432 |
return state;
|
|
|
433 |
}
|
|
|
434 |
|
|
|
435 |
public void setState(String state) {
|
|
|
436 |
this.state = state;
|
|
|
437 |
}
|
|
|
438 |
|
|
|
439 |
public LeadStatus getStatus() {
|
|
|
440 |
return status;
|
|
|
441 |
}
|
|
|
442 |
|
|
|
443 |
public void setStatus(LeadStatus status) {
|
|
|
444 |
this.status = status;
|
|
|
445 |
}
|
|
|
446 |
|
|
|
447 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
448 |
return createdTimestamp;
|
|
|
449 |
}
|
|
|
450 |
|
|
|
451 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
452 |
this.createdTimestamp = createdTimestamp;
|
|
|
453 |
}
|
|
|
454 |
|
|
|
455 |
public LocalDateTime getUpdatedTimestamp() {
|
|
|
456 |
return updatedTimestamp;
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
public void setUpdatedTimestamp(LocalDateTime updatedTimestamp) {
|
|
|
460 |
this.updatedTimestamp = updatedTimestamp;
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
@Override
|
|
|
464 |
public String toString() {
|
| 31249 |
tejbeer |
465 |
return "Lead [id=" + id + ", firstName=" + firstName + ", source=" + source + ", color=" + color
|
| 31370 |
tejbeer |
466 |
+ ", leadActivities=" + leadActivities + ", visitStatus=" + visitStatus + ", outLetName=" + outLetName
|
|
|
467 |
+ ", notinterestedReason=" + notinterestedReason + ", lastName=" + lastName + ", leadMobile="
|
|
|
468 |
+ leadMobile + ", createdBy=" + createdBy + ", authId=" + authId + ", leadActivity=" + leadActivity
|
|
|
469 |
+ ", scheduledTimestamp=" + scheduledTimestamp + ", address=" + address + ", city=" + city + ", state="
|
|
|
470 |
+ state + ", status=" + status + ", assignTo=" + assignTo + ", closureTimestamp=" + closureTimestamp
|
|
|
471 |
+ ", createdTimestamp=" + createdTimestamp + ", updatedTimestamp=" + updatedTimestamp + "]";
|
| 25899 |
tejbeer |
472 |
}
|
|
|
473 |
|
|
|
474 |
}
|