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