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