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