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