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