| 33715 |
ranu |
1 |
package com.spice.profitmandi.dao.entity.fofo;
|
|
|
2 |
|
|
|
3 |
import com.spice.profitmandi.dao.enumuration.transaction.UpSaleCallStatus;
|
| 34111 |
ranu |
4 |
import com.spice.profitmandi.dao.model.UpsellingReportModel;
|
| 33715 |
ranu |
5 |
|
|
|
6 |
import javax.persistence.*;
|
|
|
7 |
import java.io.Serializable;
|
|
|
8 |
import java.time.LocalDateTime;
|
|
|
9 |
import java.util.Objects;
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* @author ranu
|
|
|
13 |
*/
|
|
|
14 |
@Entity
|
|
|
15 |
@Table(name = "fofo.upSaleCall")
|
|
|
16 |
@NamedQueries({
|
|
|
17 |
@NamedQuery(name = "upSaleCall.checkNumberIsExist", query = "SELECT COUNT(u) FROM UpSaleCall u WHERE u.mobile = :mobile AND u.originalOrderId = :orderId"),
|
|
|
18 |
@NamedQuery(name = "upSaleCall.checkOrderIsExist", query = "SELECT COUNT(u) FROM UpSaleCall u WHERE u.originalOrderId = :orderId"),
|
|
|
19 |
})
|
| 34111 |
ranu |
20 |
|
|
|
21 |
|
|
|
22 |
@NamedNativeQueries({
|
|
|
23 |
@NamedNativeQuery(name = "Upsell.UpsellingReport",
|
|
|
24 |
query = "SELECT uc.agentId, ucd.agent_id as agentEmail, uc.originalOrderId as orderId, uc.mobile as customerNumber, ucd.created_timestamp as callingDate," +
|
|
|
25 |
" coalesce(rp.payment_status, 'Not Found') as paymentStatus, (CASE WHEN ac.create_timestamp IS NOT NULL THEN 'Created' ELSE 'Not Created' END) AS insuranceStatus, coalesce(ip.sale_amount,0) as soldAmount, coalesce(ip.invoice_number,'Not Found') as invoiceNumber, coalesce(ip.serial_number,'Not Found') as serialNumber" +
|
|
|
26 |
" FROM fofo.upSaleCall uc" +
|
|
|
27 |
" JOIN fofo.upsell_call_details ucd on uc.id = ucd.upsale_call_id" +
|
|
|
28 |
" LEFT JOIN fofo.upsellRazorpayPaymentStatus rp on rp.order_id = uc.originalOrderId" +
|
|
|
29 |
" LEFT JOIN fofo.upsaleAgentCollection ac on ac.order_id = uc.originalOrderId" +
|
|
|
30 |
" LEFT JOIN dtr.insurance_policy ip on ip.id = ac.product_id" +
|
|
|
31 |
" WHERE uc.create_timestamp >= :startDate and uc.create_timestamp < :endDate",
|
|
|
32 |
resultSetMapping = "UpsellingReport"),
|
|
|
33 |
|
|
|
34 |
})
|
|
|
35 |
|
|
|
36 |
@SqlResultSetMappings({
|
|
|
37 |
|
|
|
38 |
@SqlResultSetMapping(name = "UpsellingReport",
|
|
|
39 |
classes = {@ConstructorResult(targetClass = UpsellingReportModel.class,
|
|
|
40 |
columns = {
|
|
|
41 |
@ColumnResult(name = "agentId", type = Integer.class),
|
|
|
42 |
@ColumnResult(name = "agentEmail", type = String.class),
|
|
|
43 |
@ColumnResult(name = "orderId", type = Integer.class),
|
|
|
44 |
@ColumnResult(name = "customerNumber ", type = String.class),
|
|
|
45 |
@ColumnResult(name = "callingDate ", type = String.class),
|
|
|
46 |
@ColumnResult(name = "paymentStatus ", type = String.class),
|
|
|
47 |
@ColumnResult(name = "insuranceStatus ", type = String.class),
|
|
|
48 |
@ColumnResult(name = "soldAmount ", type = Float.class),
|
|
|
49 |
@ColumnResult(name = "invoiceNumber ", type = String.class),
|
|
|
50 |
@ColumnResult(name = "serialNumber ", type = String.class),
|
|
|
51 |
}
|
|
|
52 |
)}
|
|
|
53 |
)
|
|
|
54 |
|
|
|
55 |
})
|
| 33715 |
ranu |
56 |
public class UpSaleCall implements Serializable {
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
private static final long serialVersionUID = 1L;
|
|
|
60 |
@Id
|
|
|
61 |
@Column(name = "id")
|
|
|
62 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
63 |
private int id;
|
|
|
64 |
|
|
|
65 |
@Column(name = "agentId")
|
|
|
66 |
private int agentId;
|
|
|
67 |
|
|
|
68 |
@Column(name = "originalOrderId")
|
|
|
69 |
private int originalOrderId;
|
|
|
70 |
|
|
|
71 |
@Column(name = "mobile")
|
|
|
72 |
private String mobile;
|
|
|
73 |
|
|
|
74 |
@Column(name = "status")
|
|
|
75 |
@Enumerated(EnumType.STRING)
|
|
|
76 |
private UpSaleCallStatus status;
|
|
|
77 |
|
|
|
78 |
@Column(name = "create_timestamp")
|
|
|
79 |
private LocalDateTime createdTimestamp = LocalDateTime.now();
|
|
|
80 |
|
|
|
81 |
@Column(name = "rescheduled_timestamp")
|
|
|
82 |
private LocalDateTime rescheduledTimestamp;
|
|
|
83 |
|
|
|
84 |
public int getId() {
|
|
|
85 |
return id;
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
public void setId(int id) {
|
|
|
89 |
this.id = id;
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
public int getAgentId() {
|
|
|
93 |
return agentId;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
public void setAgentId(int agentId) {
|
|
|
97 |
this.agentId = agentId;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
public String getMobile() {
|
|
|
101 |
return mobile;
|
|
|
102 |
}
|
|
|
103 |
|
|
|
104 |
public void setMobile(String mobile) {
|
|
|
105 |
this.mobile = mobile;
|
|
|
106 |
}
|
|
|
107 |
|
|
|
108 |
public UpSaleCallStatus getStatus() {
|
|
|
109 |
return status;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
public void setStatus(UpSaleCallStatus status) {
|
|
|
113 |
this.status = status;
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
public LocalDateTime getCreatedTimestamp() {
|
|
|
117 |
return createdTimestamp;
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
public void setCreatedTimestamp(LocalDateTime createdTimestamp) {
|
|
|
121 |
this.createdTimestamp = createdTimestamp;
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
public int getOriginalOrderId() {
|
|
|
125 |
return originalOrderId;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
public void setOriginalOrderId(int originalOrderId) {
|
|
|
129 |
this.originalOrderId = originalOrderId;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
public LocalDateTime getRescheduledTimestamp() {
|
|
|
133 |
return rescheduledTimestamp;
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
public void setRescheduledTimestamp(LocalDateTime rescheduledTimestamp) {
|
|
|
137 |
this.rescheduledTimestamp = rescheduledTimestamp;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
@Override
|
|
|
141 |
public String toString() {
|
|
|
142 |
return "UpSaleCall{" +
|
|
|
143 |
"id=" + id +
|
|
|
144 |
", agentId=" + agentId +
|
|
|
145 |
", originalOrderId=" + originalOrderId +
|
|
|
146 |
", mobile='" + mobile + '\'' +
|
|
|
147 |
", status=" + status +
|
|
|
148 |
", createdTimestamp=" + createdTimestamp +
|
|
|
149 |
", rescheduledTimestamp=" + rescheduledTimestamp +
|
|
|
150 |
'}';
|
|
|
151 |
}
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
@Override
|
|
|
155 |
public boolean equals(Object o) {
|
|
|
156 |
if (this == o) return true;
|
|
|
157 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
158 |
UpSaleCall that = (UpSaleCall) o;
|
|
|
159 |
return id == that.id && agentId == that.agentId && originalOrderId == that.originalOrderId && Objects.equals(mobile, that.mobile) && status == that.status && Objects.equals(createdTimestamp, that.createdTimestamp) && Objects.equals(rescheduledTimestamp, that.rescheduledTimestamp);
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
@Override
|
|
|
163 |
public int hashCode() {
|
|
|
164 |
return Objects.hash(id, agentId, originalOrderId, mobile, status, createdTimestamp, rescheduledTimestamp);
|
|
|
165 |
}
|
|
|
166 |
}
|