| 2674 |
vikas |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
| 3090 |
mandeep.dh |
3 |
import in.shop2020.crm.Activity;
|
| 4142 |
mandeep.dh |
4 |
import in.shop2020.crm.ActivityType;
|
| 3397 |
mandeep.dh |
5 |
import in.shop2020.crm.Agent;
|
| 3390 |
mandeep.dh |
6 |
import in.shop2020.crm.SearchFilter;
|
| 3090 |
mandeep.dh |
7 |
import in.shop2020.crm.Ticket;
|
| 3499 |
mandeep.dh |
8 |
import in.shop2020.crm.TicketCategory;
|
| 3090 |
mandeep.dh |
9 |
import in.shop2020.crm.TicketStatus;
|
| 2724 |
vikas |
10 |
import in.shop2020.model.v1.order.Order;
|
|
|
11 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 6111 |
anupam.sin |
12 |
import in.shop2020.model.v1.order.RechargeOrder;
|
|
|
13 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
| 3090 |
mandeep.dh |
14 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 2724 |
vikas |
15 |
import in.shop2020.model.v1.user.Cart;
|
|
|
16 |
import in.shop2020.model.v1.user.Line;
|
|
|
17 |
import in.shop2020.model.v1.user.User;
|
| 3090 |
mandeep.dh |
18 |
import in.shop2020.model.v1.user.UserCommunication;
|
|
|
19 |
import in.shop2020.model.v1.user.UserCommunicationException;
|
|
|
20 |
import in.shop2020.model.v1.user.UserContextException;
|
| 3390 |
mandeep.dh |
21 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
|
|
22 |
import in.shop2020.thrift.clients.CRMClient;
|
|
|
23 |
import in.shop2020.thrift.clients.TransactionClient;
|
|
|
24 |
import in.shop2020.thrift.clients.UserClient;
|
| 3269 |
mandeep.dh |
25 |
import in.shop2020.util.CRMConstants;
|
| 2674 |
vikas |
26 |
|
| 3546 |
mandeep.dh |
27 |
import java.util.ArrayList;
|
| 3397 |
mandeep.dh |
28 |
import java.util.Calendar;
|
| 3390 |
mandeep.dh |
29 |
import java.util.Collections;
|
| 2724 |
vikas |
30 |
import java.util.Date;
|
|
|
31 |
import java.util.List;
|
|
|
32 |
|
| 2674 |
vikas |
33 |
import org.apache.log4j.Logger;
|
|
|
34 |
import org.apache.struts2.convention.annotation.Action;
|
| 3090 |
mandeep.dh |
35 |
import org.apache.thrift.TException;
|
| 2674 |
vikas |
36 |
|
|
|
37 |
/**
|
|
|
38 |
* @author vikas
|
| 3422 |
mandeep.dh |
39 |
*
|
| 2674 |
vikas |
40 |
*/
|
|
|
41 |
@SuppressWarnings("serial")
|
|
|
42 |
public class HomeController extends BaseController {
|
| 3422 |
mandeep.dh |
43 |
private static final Logger log = Logger.getLogger(HomeController.class);
|
| 3090 |
mandeep.dh |
44 |
|
| 6111 |
anupam.sin |
45 |
private String rechargeOrderId;
|
|
|
46 |
private String deviceNumber;
|
| 3422 |
mandeep.dh |
47 |
private String email;
|
|
|
48 |
private String orderId;
|
|
|
49 |
private String mobileNumber;
|
|
|
50 |
private User user;
|
|
|
51 |
private long orderCount;
|
|
|
52 |
private long completedOrderCount;
|
|
|
53 |
private long openOrderCount;
|
|
|
54 |
private long failedOrderCount;
|
|
|
55 |
private long userCommunicationCount;
|
|
|
56 |
private long ticketCount;
|
|
|
57 |
private long openTicketCount;
|
|
|
58 |
private long closedTicketCount;
|
|
|
59 |
private String ticketId;
|
|
|
60 |
private String lastLogin;
|
|
|
61 |
private double cartItems;
|
|
|
62 |
private String couponCode = "";
|
|
|
63 |
private long agentOpenTicketCount;
|
|
|
64 |
private long unassignedTicketCount;
|
|
|
65 |
private long activityCount;
|
|
|
66 |
private long customerActivityCount;
|
| 3499 |
mandeep.dh |
67 |
private long pendingCodVerificationCount;
|
| 3711 |
mandeep.dh |
68 |
private long agentUnreadActivityCount;
|
| 3578 |
mandeep.dh |
69 |
private long openFailedPaymentsTicketCount;
|
| 4008 |
mandeep.dh |
70 |
private long openDelayedDeliveryTicketCount;
|
| 4267 |
anupam.sin |
71 |
private long openFlaggedPaymentsTicketCount;
|
| 5858 |
amar.kumar |
72 |
private long openStorePickupTicketCount;
|
| 7372 |
kshitij.so |
73 |
private long lowInventoryTicketsCount;
|
| 4490 |
anupam.sin |
74 |
private long DoaRequestCount;
|
| 6111 |
anupam.sin |
75 |
private long failedRechargeCount = 0;
|
|
|
76 |
private long successfulRechargeCount = 0;
|
| 2674 |
vikas |
77 |
|
| 5858 |
amar.kumar |
78 |
private long ReturnRequestCount;
|
| 4490 |
anupam.sin |
79 |
|
| 4751 |
anupam.sin |
80 |
private long orderCancellationCount;
|
| 6111 |
anupam.sin |
81 |
|
|
|
82 |
private long rechargeOrderCount = 0;
|
| 4751 |
anupam.sin |
83 |
|
|
|
84 |
|
| 2674 |
vikas |
85 |
@Action("/")
|
| 2724 |
vikas |
86 |
public String index() throws Exception {
|
| 3137 |
mandeep.dh |
87 |
String returnValue = INPUT;
|
|
|
88 |
|
| 3090 |
mandeep.dh |
89 |
try {
|
| 3106 |
mandeep.dh |
90 |
if (email == null) {
|
| 3390 |
mandeep.dh |
91 |
loadTicketCounts();
|
|
|
92 |
loadCustomerActivities();
|
| 3137 |
mandeep.dh |
93 |
return returnValue;
|
| 3106 |
mandeep.dh |
94 |
}
|
|
|
95 |
|
| 3390 |
mandeep.dh |
96 |
userContextServiceClient = new UserClient().getClient();
|
| 3096 |
mandeep.dh |
97 |
if (email != null && !email.isEmpty()) {
|
|
|
98 |
user = userContextServiceClient.getUserByEmail(email);
|
| 3422 |
mandeep.dh |
99 |
} else if (mobileNumber != null && !mobileNumber.isEmpty()) {
|
|
|
100 |
user = userContextServiceClient.getUserByMobileNumber(Long
|
|
|
101 |
.parseLong(mobileNumber));
|
|
|
102 |
} else if (orderId != null && !orderId.isEmpty()) {
|
| 3390 |
mandeep.dh |
103 |
transactionServiceClient = new TransactionClient().getClient();
|
| 3422 |
mandeep.dh |
104 |
Order order = transactionServiceClient.getOrder(Long
|
|
|
105 |
.parseLong(orderId));
|
|
|
106 |
user = userContextServiceClient.getUserById(order
|
|
|
107 |
.getCustomer_id());
|
| 6111 |
anupam.sin |
108 |
} else if (rechargeOrderId != null && !rechargeOrderId.isEmpty()){
|
|
|
109 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
110 |
RechargeOrder rechargeOrder = transactionServiceClient.getRechargeOrder(Long
|
|
|
111 |
.parseLong(rechargeOrderId));
|
|
|
112 |
user = userContextServiceClient.getUserById(rechargeOrder.getUserId());
|
|
|
113 |
} else if (deviceNumber != null && !deviceNumber.isEmpty()) {
|
|
|
114 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
115 |
List<RechargeOrder> rechargeOrders = transactionServiceClient.getRechargeOrdersForDevice(deviceNumber);
|
|
|
116 |
user = userContextServiceClient.getUserById(rechargeOrders.get(0).getUserId());
|
| 3422 |
mandeep.dh |
117 |
} else if (ticketId != null && !ticketId.isEmpty()) {
|
| 3390 |
mandeep.dh |
118 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
119 |
searchFilter.setTicketId(Long.parseLong(ticketId));
|
| 3422 |
mandeep.dh |
120 |
crmServiceClient = new CRMClient().getClient();
|
|
|
121 |
List<Ticket> tickets = crmServiceClient
|
|
|
122 |
.getTickets(searchFilter);
|
| 3390 |
mandeep.dh |
123 |
if (!tickets.isEmpty()) {
|
|
|
124 |
Ticket ticket = tickets.get(0);
|
|
|
125 |
if (ticket.isSetCustomerId()) {
|
|
|
126 |
user = userContextServiceClient.getUserById(ticket.getCustomerId());
|
|
|
127 |
}
|
|
|
128 |
}
|
| 3422 |
mandeep.dh |
129 |
else {
|
|
|
130 |
// resetting in case on invalid ticket Id
|
|
|
131 |
ticketId = null;
|
|
|
132 |
}
|
| 3096 |
mandeep.dh |
133 |
}
|
| 3090 |
mandeep.dh |
134 |
|
|
|
135 |
if (user == null || user.getUserId() <= 0) {
|
| 3422 |
mandeep.dh |
136 |
if (ticketId == null || ticketId.isEmpty()) {
|
|
|
137 |
addActionError("Invalid input");
|
|
|
138 |
}
|
|
|
139 |
} else {
|
| 3390 |
mandeep.dh |
140 |
loadUserCommunicationDetails();
|
| 6111 |
anupam.sin |
141 |
loadRechargeOrders();
|
| 3390 |
mandeep.dh |
142 |
loadOrderDetails();
|
|
|
143 |
loadCartDetails();
|
|
|
144 |
loadTicketDetails();
|
|
|
145 |
loadActivityDetails();
|
| 3137 |
mandeep.dh |
146 |
returnValue = INDEX;
|
|
|
147 |
}
|
| 3422 |
mandeep.dh |
148 |
} catch (Exception e) {
|
| 3137 |
mandeep.dh |
149 |
addActionError("Invalid input");
|
| 3090 |
mandeep.dh |
150 |
log.error("Error occurred", e);
|
| 2724 |
vikas |
151 |
}
|
| 3137 |
mandeep.dh |
152 |
|
|
|
153 |
if (INPUT.equals(returnValue)) {
|
| 3390 |
mandeep.dh |
154 |
loadTicketCounts();
|
| 3422 |
mandeep.dh |
155 |
loadCustomerActivities();
|
| 3137 |
mandeep.dh |
156 |
}
|
|
|
157 |
|
|
|
158 |
return returnValue;
|
| 3090 |
mandeep.dh |
159 |
}
|
|
|
160 |
|
| 3390 |
mandeep.dh |
161 |
private void loadCustomerActivities() throws TException {
|
|
|
162 |
SearchFilter searchFilter = new SearchFilter();
|
| 3422 |
mandeep.dh |
163 |
searchFilter.setActivityCreatorIds(Collections
|
|
|
164 |
.singletonList(CRMConstants.ADMIN_AGENT_ID));
|
| 3390 |
mandeep.dh |
165 |
searchFilter.setIsActivityRead(false);
|
|
|
166 |
|
| 3711 |
mandeep.dh |
167 |
agentUnreadActivityCount = 0;
|
|
|
168 |
customerActivityCount = 0;
|
|
|
169 |
|
| 3422 |
mandeep.dh |
170 |
crmServiceClient = new CRMClient().getClient();
|
| 3711 |
mandeep.dh |
171 |
List<Activity> activities = crmServiceClient.getActivities(searchFilter);
|
|
|
172 |
|
| 3339 |
mandeep.dh |
173 |
if (activities != null) {
|
| 3711 |
mandeep.dh |
174 |
for (Activity activity : activities) {
|
|
|
175 |
if (CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId() == activity.getTicketAssigneeId()) {
|
|
|
176 |
agentUnreadActivityCount++;
|
|
|
177 |
}
|
|
|
178 |
}
|
|
|
179 |
|
| 3339 |
mandeep.dh |
180 |
customerActivityCount = activities.size();
|
|
|
181 |
}
|
|
|
182 |
}
|
|
|
183 |
|
| 3390 |
mandeep.dh |
184 |
private void loadActivityDetails() throws TException {
|
|
|
185 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
186 |
searchFilter.setCustomerId(user.getUserId());
|
|
|
187 |
|
| 3422 |
mandeep.dh |
188 |
crmServiceClient = new CRMClient().getClient();
|
|
|
189 |
List<Activity> activities = crmServiceClient
|
|
|
190 |
.getActivities(searchFilter);
|
| 3106 |
mandeep.dh |
191 |
if (activities != null) {
|
|
|
192 |
activityCount = activities.size();
|
|
|
193 |
}
|
|
|
194 |
}
|
|
|
195 |
|
| 3390 |
mandeep.dh |
196 |
private void loadTicketCounts() throws TException {
|
|
|
197 |
SearchFilter searchFilter = new SearchFilter();
|
| 3546 |
mandeep.dh |
198 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
199 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
200 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| 3422 |
mandeep.dh |
201 |
searchFilter.setTicketAssigneeIds(Collections
|
| 3499 |
mandeep.dh |
202 |
.singletonList(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId()));
|
| 3390 |
mandeep.dh |
203 |
|
| 3422 |
mandeep.dh |
204 |
crmServiceClient = new CRMClient().getClient();
|
| 3499 |
mandeep.dh |
205 |
agentOpenTicketCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
206 |
unassignedTicketCount = crmServiceClient.getUnassignedTickets().size();
|
| 3390 |
mandeep.dh |
207 |
|
| 3578 |
mandeep.dh |
208 |
if (canVerifyCOD()) {
|
|
|
209 |
searchFilter = new SearchFilter();
|
|
|
210 |
searchFilter.setTicketCategory(TicketCategory.COD_VERIFICATION);
|
|
|
211 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
212 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
213 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| 3546 |
mandeep.dh |
214 |
|
| 3578 |
mandeep.dh |
215 |
crmServiceClient = new CRMClient().getClient();
|
|
|
216 |
pendingCodVerificationCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
217 |
}
|
|
|
218 |
|
|
|
219 |
if (canViewFailedPayments()) {
|
|
|
220 |
searchFilter = new SearchFilter();
|
|
|
221 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
222 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
223 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
224 |
searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
|
|
|
225 |
crmServiceClient = new CRMClient().getClient();
|
|
|
226 |
openFailedPaymentsTicketCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
227 |
}
|
| 4008 |
mandeep.dh |
228 |
|
|
|
229 |
if (canViewDelayedDeliveries()) {
|
|
|
230 |
searchFilter = new SearchFilter();
|
|
|
231 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
232 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
233 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
234 |
searchFilter.setTicketCategory(TicketCategory.DELAYED_DELIVERY);
|
|
|
235 |
crmServiceClient = new CRMClient().getClient();
|
|
|
236 |
openDelayedDeliveryTicketCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
237 |
}
|
| 4267 |
anupam.sin |
238 |
|
|
|
239 |
if (canViewFlaggedPayments()) {
|
|
|
240 |
searchFilter = new SearchFilter();
|
|
|
241 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
242 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
243 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
244 |
searchFilter.setTicketCategory(TicketCategory.PAYMENT_FLAGGED);
|
|
|
245 |
crmServiceClient = new CRMClient().getClient();
|
|
|
246 |
openFlaggedPaymentsTicketCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
247 |
}
|
| 4490 |
anupam.sin |
248 |
|
|
|
249 |
if (canViewDoaRequests()) {
|
|
|
250 |
searchFilter = new SearchFilter();
|
|
|
251 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
252 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
253 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
254 |
searchFilter.setTicketCategory(TicketCategory.DOA_RECEIVED);
|
|
|
255 |
crmServiceClient = new CRMClient().getClient();
|
|
|
256 |
DoaRequestCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
257 |
}
|
|
|
258 |
|
|
|
259 |
if (canViewReturnRequests()) {
|
|
|
260 |
searchFilter = new SearchFilter();
|
|
|
261 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
262 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
263 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
264 |
searchFilter.setTicketCategory(TicketCategory.RETURN_FORM);
|
|
|
265 |
crmServiceClient = new CRMClient().getClient();
|
|
|
266 |
ReturnRequestCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
267 |
}
|
| 4751 |
anupam.sin |
268 |
|
|
|
269 |
if (canViewOrderCancellation()) {
|
|
|
270 |
searchFilter = new SearchFilter();
|
|
|
271 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
272 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
273 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
274 |
searchFilter.setTicketCategory(TicketCategory.ORDER_CANCELLATION);
|
|
|
275 |
crmServiceClient = new CRMClient().getClient();
|
|
|
276 |
orderCancellationCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
277 |
}
|
| 5858 |
amar.kumar |
278 |
|
|
|
279 |
searchFilter = new SearchFilter();
|
|
|
280 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
281 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
282 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
283 |
searchFilter.setTicketCategory(TicketCategory.STORE_PICKUP);
|
|
|
284 |
crmServiceClient = new CRMClient().getClient();
|
|
|
285 |
openStorePickupTicketCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
286 |
|
| 7372 |
kshitij.so |
287 |
if (canViewLowInventoryCancellation()) {
|
|
|
288 |
searchFilter = new SearchFilter();
|
|
|
289 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
290 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
291 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
292 |
searchFilter.setTicketCategory(TicketCategory.LOW_INVENTORY_CANCELLED_ORDERS);
|
|
|
293 |
crmServiceClient = new CRMClient().getClient();
|
|
|
294 |
lowInventoryTicketsCount = crmServiceClient.getTickets(searchFilter).size();
|
|
|
295 |
}
|
|
|
296 |
|
| 3106 |
mandeep.dh |
297 |
}
|
|
|
298 |
|
| 3390 |
mandeep.dh |
299 |
private void loadUserCommunicationDetails()
|
| 3090 |
mandeep.dh |
300 |
throws UserCommunicationException, TException {
|
| 3390 |
mandeep.dh |
301 |
userContextServiceClient = new UserClient().getClient();
|
| 3422 |
mandeep.dh |
302 |
List<UserCommunication> userCommunication = userContextServiceClient
|
|
|
303 |
.getUserCommunicationByUser(user.getUserId());
|
| 3090 |
mandeep.dh |
304 |
userCommunicationCount = userCommunication.size();
|
|
|
305 |
}
|
| 6111 |
anupam.sin |
306 |
|
|
|
307 |
private void loadRechargeOrders() throws TransactionServiceException,
|
|
|
308 |
TException {
|
|
|
309 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
310 |
List<RechargeOrder> allRechargeOrders = transactionServiceClient.getRechargeOrders(user.getUserId());
|
|
|
311 |
rechargeOrderCount = allRechargeOrders.size();
|
| 3090 |
mandeep.dh |
312 |
|
| 6111 |
anupam.sin |
313 |
for (RechargeOrder o : allRechargeOrders) {
|
|
|
314 |
if (o.getStatus() == RechargeOrderStatus.RECHARGE_SUCCESSFUL) {
|
|
|
315 |
successfulRechargeCount++;
|
|
|
316 |
} else if (CRMConstants.failedStatusList.contains(o.getStatus())) {
|
|
|
317 |
failedRechargeCount++;
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
}
|
| 3422 |
mandeep.dh |
321 |
private void loadOrderDetails() throws TransactionServiceException,
|
| 6111 |
anupam.sin |
322 |
TException {
|
| 3390 |
mandeep.dh |
323 |
transactionServiceClient = new TransactionClient().getClient();
|
| 3422 |
mandeep.dh |
324 |
List<Order> allOrders = transactionServiceClient.getOrdersForCustomer(
|
|
|
325 |
user.getUserId(), 0, (new Date()).getTime(), null);
|
| 2724 |
vikas |
326 |
orderCount = allOrders.size();
|
| 3090 |
mandeep.dh |
327 |
|
| 2724 |
vikas |
328 |
for (Order o : allOrders) {
|
|
|
329 |
if (o.getStatus() == OrderStatus.DELIVERY_SUCCESS) {
|
|
|
330 |
completedOrderCount++;
|
| 3422 |
mandeep.dh |
331 |
} else if (CRMConstants.failedStatusList.contains(o.getStatus())) {
|
| 2724 |
vikas |
332 |
failedOrderCount++;
|
| 3422 |
mandeep.dh |
333 |
} else {
|
| 2724 |
vikas |
334 |
openOrderCount++;
|
|
|
335 |
}
|
|
|
336 |
}
|
| 3090 |
mandeep.dh |
337 |
}
|
|
|
338 |
|
| 3422 |
mandeep.dh |
339 |
private void loadCartDetails() throws UserContextException, TException {
|
| 3390 |
mandeep.dh |
340 |
userContextServiceClient = new UserClient().getClient();
|
| 5326 |
rajveer |
341 |
lastLogin = new Date(user.getLastLogin()).toString();
|
| 3090 |
mandeep.dh |
342 |
Cart cart = null;
|
|
|
343 |
|
| 2724 |
vikas |
344 |
try {
|
| 3090 |
mandeep.dh |
345 |
cart = userContextServiceClient.getCurrentCart(user.getUserId());
|
| 2724 |
vikas |
346 |
if (cart.getCouponCode() != null) {
|
|
|
347 |
couponCode = cart.getCouponCode();
|
|
|
348 |
}
|
|
|
349 |
for (Line line : cart.getLines()) {
|
|
|
350 |
cartItems += line.getQuantity();
|
|
|
351 |
}
|
|
|
352 |
} catch (Exception e) {
|
|
|
353 |
log.warn("No cart assigned for this user", e);
|
|
|
354 |
}
|
| 2674 |
vikas |
355 |
}
|
| 2724 |
vikas |
356 |
|
| 3390 |
mandeep.dh |
357 |
private void loadTicketDetails() throws TException {
|
| 3090 |
mandeep.dh |
358 |
// Fetching tickets' info
|
|
|
359 |
ticketCount = 0;
|
|
|
360 |
openTicketCount = 0;
|
|
|
361 |
closedTicketCount = 0;
|
|
|
362 |
|
| 3422 |
mandeep.dh |
363 |
crmServiceClient = new CRMClient().getClient();
|
| 3390 |
mandeep.dh |
364 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
365 |
searchFilter.setCustomerId(user.getUserId());
|
|
|
366 |
|
|
|
367 |
List<Ticket> tickets = crmServiceClient.getTickets(searchFilter);
|
| 3422 |
mandeep.dh |
368 |
if (tickets != null) {
|
| 3090 |
mandeep.dh |
369 |
for (Ticket ticket : tickets) {
|
|
|
370 |
ticketCount++;
|
| 3106 |
mandeep.dh |
371 |
if (!ticket.getStatus().equals(TicketStatus.CLOSED)) {
|
| 3090 |
mandeep.dh |
372 |
openTicketCount++;
|
| 3422 |
mandeep.dh |
373 |
} else {
|
| 3090 |
mandeep.dh |
374 |
closedTicketCount++;
|
|
|
375 |
}
|
|
|
376 |
}
|
|
|
377 |
}
|
|
|
378 |
}
|
|
|
379 |
|
| 3397 |
mandeep.dh |
380 |
public String getToday() {
|
|
|
381 |
return SDF.format(new Date());
|
|
|
382 |
}
|
|
|
383 |
|
|
|
384 |
public String getYesterday() {
|
|
|
385 |
Calendar calendar = Calendar.getInstance();
|
|
|
386 |
calendar.setTime(new Date());
|
|
|
387 |
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
|
|
388 |
return SDF.format(calendar.getTime());
|
|
|
389 |
}
|
|
|
390 |
|
|
|
391 |
public List<Agent> getAllAgents() {
|
|
|
392 |
return CRMAuthorizingRealm.getAgents();
|
|
|
393 |
}
|
|
|
394 |
|
| 4142 |
mandeep.dh |
395 |
public ActivityType[] getActivityTypes() {
|
|
|
396 |
return ActivityType.values();
|
|
|
397 |
}
|
|
|
398 |
|
|
|
399 |
public TicketCategory[] getTicketCategories() {
|
|
|
400 |
return TicketCategory.values();
|
|
|
401 |
}
|
|
|
402 |
|
| 2724 |
vikas |
403 |
public void setEmail(String email) {
|
|
|
404 |
this.email = email;
|
|
|
405 |
}
|
|
|
406 |
|
|
|
407 |
public String getEmail() {
|
|
|
408 |
return email;
|
|
|
409 |
}
|
|
|
410 |
|
|
|
411 |
public void setOrderId(String orderId) {
|
| 3390 |
mandeep.dh |
412 |
this.orderId = orderId;
|
| 2724 |
vikas |
413 |
}
|
|
|
414 |
|
| 3390 |
mandeep.dh |
415 |
public String getOrderId() {
|
| 2724 |
vikas |
416 |
return orderId;
|
|
|
417 |
}
|
| 3422 |
mandeep.dh |
418 |
|
| 2724 |
vikas |
419 |
public User getUser() {
|
|
|
420 |
return user;
|
|
|
421 |
}
|
| 3422 |
mandeep.dh |
422 |
|
| 2724 |
vikas |
423 |
public long getOrderCount() {
|
|
|
424 |
return orderCount;
|
|
|
425 |
}
|
| 3422 |
mandeep.dh |
426 |
|
| 2724 |
vikas |
427 |
public long getCompletedOrderCount() {
|
|
|
428 |
return completedOrderCount;
|
|
|
429 |
}
|
| 3422 |
mandeep.dh |
430 |
|
| 2724 |
vikas |
431 |
public long getOpenOrderCount() {
|
|
|
432 |
return openOrderCount;
|
|
|
433 |
}
|
| 3422 |
mandeep.dh |
434 |
|
| 2724 |
vikas |
435 |
public long getFailedOrderCount() {
|
|
|
436 |
return failedOrderCount;
|
|
|
437 |
}
|
| 3422 |
mandeep.dh |
438 |
|
| 3499 |
mandeep.dh |
439 |
public int getCartItems() {
|
|
|
440 |
return (int)cartItems;
|
| 2724 |
vikas |
441 |
}
|
| 3422 |
mandeep.dh |
442 |
|
| 2724 |
vikas |
443 |
public String getLastLogin() {
|
|
|
444 |
return lastLogin;
|
|
|
445 |
}
|
|
|
446 |
|
|
|
447 |
public String getCouponCode() {
|
|
|
448 |
return couponCode;
|
|
|
449 |
}
|
| 2830 |
vikas |
450 |
|
|
|
451 |
public long getUserCommunicationCount() {
|
|
|
452 |
return userCommunicationCount;
|
|
|
453 |
}
|
| 3090 |
mandeep.dh |
454 |
|
|
|
455 |
public long getTicketCount() {
|
|
|
456 |
return ticketCount;
|
|
|
457 |
}
|
|
|
458 |
|
|
|
459 |
public long getOpenTicketCount() {
|
|
|
460 |
return openTicketCount;
|
|
|
461 |
}
|
|
|
462 |
|
|
|
463 |
public long getClosedTicketCount() {
|
|
|
464 |
return closedTicketCount;
|
|
|
465 |
}
|
|
|
466 |
|
|
|
467 |
public void setMobileNumber(String mobileNumber) {
|
|
|
468 |
this.mobileNumber = mobileNumber;
|
|
|
469 |
}
|
| 3096 |
mandeep.dh |
470 |
|
|
|
471 |
public String getTicketId() {
|
|
|
472 |
return ticketId;
|
|
|
473 |
}
|
|
|
474 |
|
|
|
475 |
public void setTicketId(String ticketId) {
|
|
|
476 |
this.ticketId = ticketId;
|
|
|
477 |
}
|
| 3106 |
mandeep.dh |
478 |
|
|
|
479 |
public long getAgentOpenTicketCount() {
|
|
|
480 |
return agentOpenTicketCount;
|
|
|
481 |
}
|
|
|
482 |
|
|
|
483 |
public long getUnassignedTicketCount() {
|
|
|
484 |
return unassignedTicketCount;
|
|
|
485 |
}
|
|
|
486 |
|
|
|
487 |
public long getActivityCount() {
|
|
|
488 |
return activityCount;
|
|
|
489 |
}
|
|
|
490 |
|
|
|
491 |
public void setActivityCount(long activityCount) {
|
|
|
492 |
this.activityCount = activityCount;
|
|
|
493 |
}
|
| 3339 |
mandeep.dh |
494 |
|
|
|
495 |
public long getCustomerActivityCount() {
|
|
|
496 |
return customerActivityCount;
|
|
|
497 |
}
|
|
|
498 |
|
|
|
499 |
public void setCustomerActivityCount(long customerActivityCount) {
|
|
|
500 |
this.customerActivityCount = customerActivityCount;
|
|
|
501 |
}
|
| 3499 |
mandeep.dh |
502 |
|
|
|
503 |
public long getPendingCodVerificationCount() {
|
|
|
504 |
return pendingCodVerificationCount;
|
|
|
505 |
}
|
|
|
506 |
|
|
|
507 |
public void setPendingCodVerificationCount(long pendingCodVerificationCount) {
|
|
|
508 |
this.pendingCodVerificationCount = pendingCodVerificationCount;
|
|
|
509 |
}
|
| 3578 |
mandeep.dh |
510 |
|
|
|
511 |
public long getOpenFailedPaymentsTicketCount() {
|
|
|
512 |
return openFailedPaymentsTicketCount;
|
|
|
513 |
}
|
|
|
514 |
|
|
|
515 |
public void setOpenFailedPaymentsTicketCount(long openFailedPaymentsTicketCount) {
|
|
|
516 |
this.openFailedPaymentsTicketCount = openFailedPaymentsTicketCount;
|
|
|
517 |
}
|
| 3711 |
mandeep.dh |
518 |
|
|
|
519 |
public long getAgentUnreadActivityCount() {
|
|
|
520 |
return agentUnreadActivityCount;
|
|
|
521 |
}
|
|
|
522 |
|
|
|
523 |
public void setAgentUnreadActivityCount(long agentUnreadActivityCount) {
|
|
|
524 |
this.agentUnreadActivityCount = agentUnreadActivityCount;
|
|
|
525 |
}
|
| 4008 |
mandeep.dh |
526 |
|
|
|
527 |
public long getOpenDelayedDeliveryTicketCount() {
|
|
|
528 |
return openDelayedDeliveryTicketCount;
|
|
|
529 |
}
|
|
|
530 |
|
|
|
531 |
public void setOpenDelayedDeliveryTicketCount(
|
|
|
532 |
long openDelayedDeliveryTicketCount) {
|
|
|
533 |
this.openDelayedDeliveryTicketCount = openDelayedDeliveryTicketCount;
|
|
|
534 |
}
|
| 4267 |
anupam.sin |
535 |
|
|
|
536 |
public long getOpenFlaggedPaymentsTicketCount() {
|
|
|
537 |
return openFlaggedPaymentsTicketCount;
|
|
|
538 |
}
|
|
|
539 |
|
|
|
540 |
public void setOpenFlaggedPaymentsTicketCount(
|
|
|
541 |
long openFlaggedPaymentsTicketCount) {
|
|
|
542 |
this.openFlaggedPaymentsTicketCount = openFlaggedPaymentsTicketCount;
|
|
|
543 |
}
|
| 4490 |
anupam.sin |
544 |
|
|
|
545 |
public long getDoaRequestCount() {
|
|
|
546 |
return DoaRequestCount;
|
|
|
547 |
}
|
|
|
548 |
|
|
|
549 |
public void setDoaRequestCount(long DoaRequestCount) {
|
|
|
550 |
this.DoaRequestCount = DoaRequestCount;
|
|
|
551 |
}
|
|
|
552 |
|
|
|
553 |
public long getReturnRequestCount() {
|
|
|
554 |
return ReturnRequestCount;
|
|
|
555 |
}
|
|
|
556 |
|
|
|
557 |
public void setReturnRequestCount(long returnRequestCount) {
|
|
|
558 |
ReturnRequestCount = returnRequestCount;
|
|
|
559 |
}
|
| 4751 |
anupam.sin |
560 |
|
|
|
561 |
public long getOrderCancellationCount() {
|
|
|
562 |
return orderCancellationCount;
|
|
|
563 |
}
|
|
|
564 |
|
|
|
565 |
public void setOrderCancellationCount(long orderCancellationCount) {
|
|
|
566 |
this.orderCancellationCount = orderCancellationCount;
|
|
|
567 |
}
|
| 5858 |
amar.kumar |
568 |
|
|
|
569 |
|
|
|
570 |
public long getOpenStorePickupTicketCount() {
|
|
|
571 |
return openStorePickupTicketCount;
|
|
|
572 |
}
|
|
|
573 |
|
|
|
574 |
public void setOpenStorePickupTicketCount(long openStorePickupTicketCount) {
|
|
|
575 |
this.openStorePickupTicketCount = openStorePickupTicketCount;
|
|
|
576 |
}
|
| 7372 |
kshitij.so |
577 |
|
|
|
578 |
public long getLowInventoryTicketsCount() {
|
|
|
579 |
return lowInventoryTicketsCount;
|
|
|
580 |
}
|
| 5858 |
amar.kumar |
581 |
|
| 7372 |
kshitij.so |
582 |
public void setLowInventoryTicketsCount(long lowInventoryTicketsCount) {
|
|
|
583 |
this.lowInventoryTicketsCount = lowInventoryTicketsCount;
|
|
|
584 |
}
|
|
|
585 |
|
| 6111 |
anupam.sin |
586 |
public String getDeviceNumber() {
|
|
|
587 |
return deviceNumber;
|
|
|
588 |
}
|
|
|
589 |
|
|
|
590 |
public void setDeviceNumber(String deviceNumber) {
|
|
|
591 |
this.deviceNumber = deviceNumber;
|
|
|
592 |
}
|
|
|
593 |
|
|
|
594 |
public long getFailedRechargeCount() {
|
|
|
595 |
return failedRechargeCount;
|
|
|
596 |
}
|
|
|
597 |
|
|
|
598 |
public void setFailedRechargeCount(long failedRechargeCount) {
|
|
|
599 |
this.failedRechargeCount = failedRechargeCount;
|
|
|
600 |
}
|
|
|
601 |
|
|
|
602 |
public long getSuccessfulRechargeCount() {
|
|
|
603 |
return successfulRechargeCount;
|
|
|
604 |
}
|
|
|
605 |
|
|
|
606 |
public void setSuccessfulRechargeCount(long successfulRechargeCount) {
|
|
|
607 |
this.successfulRechargeCount = successfulRechargeCount;
|
|
|
608 |
}
|
|
|
609 |
|
|
|
610 |
public long getRechargeOrderCount() {
|
|
|
611 |
return rechargeOrderCount;
|
|
|
612 |
}
|
|
|
613 |
|
|
|
614 |
public void setRechargeOrderCount(long rechargeOrderCount) {
|
|
|
615 |
this.rechargeOrderCount = rechargeOrderCount;
|
|
|
616 |
}
|
|
|
617 |
|
|
|
618 |
public String getRechargeOrderId() {
|
|
|
619 |
return rechargeOrderId;
|
|
|
620 |
}
|
|
|
621 |
|
|
|
622 |
public void setRechargeOrderId(String rechargeOrderId) {
|
|
|
623 |
this.rechargeOrderId = rechargeOrderId;
|
|
|
624 |
}
|
|
|
625 |
|
| 2724 |
vikas |
626 |
}
|