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