| 37651 |
vikas |
1 |
package com.spice.profitmandi.dao.entity.user;
|
|
|
2 |
|
|
|
3 |
import javax.persistence.Column;
|
|
|
4 |
import javax.persistence.Entity;
|
|
|
5 |
import javax.persistence.GeneratedValue;
|
|
|
6 |
import javax.persistence.GenerationType;
|
|
|
7 |
import javax.persistence.Id;
|
|
|
8 |
import javax.persistence.Table;
|
|
|
9 |
import java.time.LocalDateTime;
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* One upload of a Meta lead-ads export — the batch header for the {@link MetaLead} rows it produced.
|
|
|
13 |
*
|
|
|
14 |
* <p>Nothing in this codebase records what file was uploaded, when, or by whom; bulk imports write
|
|
|
15 |
* their rows and vanish. That is tolerable for a price list and not for paid leads, where "did that
|
|
|
16 |
* file actually go in, and what happened to the 12 rows nobody can find?" is a question someone will
|
|
|
17 |
* ask weeks later. The counts are stored rather than derived so the batch still reads correctly if
|
|
|
18 |
* a lead is later deleted.
|
|
|
19 |
*/
|
|
|
20 |
@Entity
|
|
|
21 |
@Table(name = "user.meta_lead_import")
|
|
|
22 |
public class MetaLeadImport {
|
|
|
23 |
|
|
|
24 |
@Id
|
|
|
25 |
@Column(name = "id", unique = true, updatable = false)
|
|
|
26 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
27 |
private int id;
|
|
|
28 |
|
|
|
29 |
@Column(name = "file_name")
|
|
|
30 |
private String fileName;
|
|
|
31 |
|
|
|
32 |
/** Who uploaded it — {@code auth.auth_user.id}. */
|
|
|
33 |
@Column(name = "auth_id")
|
|
|
34 |
private int authId;
|
|
|
35 |
|
|
|
36 |
@Column(name = "total_rows")
|
|
|
37 |
private int totalRows;
|
|
|
38 |
|
|
|
39 |
@Column(name = "created_count")
|
|
|
40 |
private int createdCount;
|
|
|
41 |
|
|
|
42 |
@Column(name = "duplicate_count")
|
|
|
43 |
private int duplicateCount;
|
|
|
44 |
|
|
|
45 |
@Column(name = "blocked_count")
|
|
|
46 |
private int blockedCount;
|
|
|
47 |
|
|
|
48 |
@Column(name = "rejected_count")
|
|
|
49 |
private int rejectedCount;
|
|
|
50 |
|
|
|
51 |
@Column(name = "created_timestamp")
|
|
|
52 |
private LocalDateTime createdTimestamp;
|
|
|
53 |
|
|
|
54 |
/** Sanity check: every row must land on exactly one outcome. */
|
|
|
55 |
public boolean isBalanced() {
|
|
|
56 |
return totalRows == createdCount + duplicateCount + blockedCount + rejectedCount;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
public int getId() {
|
|
|
60 |
return id;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
public void setId(int id) {
|
|
|
64 |
this.id = id;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
public String getFileName() {
|
|
|
68 |
return fileName;
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
public void setFileName(String fileName) {
|
|
|
72 |
this.fileName = fileName;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
public int getAuthId() {
|
|
|
76 |
return authId;
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public void setAuthId(int authId) {
|
|
|
80 |
this.authId = authId;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public int getTotalRows() {
|
|
|
84 |
return totalRows;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
public void setTotalRows(int totalRows) {
|
|
|
88 |
this.totalRows = totalRows;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public int getCreatedCount() {
|
|
|
92 |
return createdCount;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
public void setCreatedCount(int createdCount) {
|
|
|
96 |
this.createdCount = createdCount;
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
public int getDuplicateCount() {
|
|
|
100 |
return duplicateCount;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public void setDuplicateCount(int duplicateCount) {
|
|
|
104 |
this.duplicateCount = duplicateCount;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public int getBlockedCount() {
|
|
|
108 |
return blockedCount;
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
public void setBlockedCount(int blockedCount) {
|
|
|
112 |
this.blockedCount = blockedCount;
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
public int getRejectedCount() {
|
|
|
116 |
return rejectedCount;
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
public void setRejectedCount(int rejectedCount) {
|
|
|
120 |
this.rejectedCount = rejectedCount;
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
124 |
return createdTimestamp;
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
128 |
this.createdTimestamp = createdTimestamp;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
@Override
|
|
|
132 |
public String toString() {
|
|
|
133 |
return "MetaLeadImport [id=" + id + ", fileName=" + fileName + ", total=" + totalRows
|
|
|
134 |
+ ", created=" + createdCount + ", duplicate=" + duplicateCount
|
|
|
135 |
+ ", blocked=" + blockedCount + ", rejected=" + rejectedCount + "]";
|
|
|
136 |
}
|
|
|
137 |
}
|