| 3137 |
mandeep.dh |
1 |
/**
|
|
|
2 |
*
|
|
|
3 |
*/
|
|
|
4 |
package in.shop2020.serving.controllers;
|
|
|
5 |
|
| 3339 |
mandeep.dh |
6 |
import in.shop2020.crm.Activity;
|
|
|
7 |
import in.shop2020.crm.ActivityType;
|
| 3137 |
mandeep.dh |
8 |
import in.shop2020.crm.Agent;
|
| 3390 |
mandeep.dh |
9 |
import in.shop2020.crm.SearchFilter;
|
| 3137 |
mandeep.dh |
10 |
import in.shop2020.crm.Ticket;
|
| 3339 |
mandeep.dh |
11 |
import in.shop2020.crm.TicketCategory;
|
|
|
12 |
import in.shop2020.crm.TicketPriority;
|
| 3137 |
mandeep.dh |
13 |
import in.shop2020.crm.TicketStatus;
|
| 5791 |
anupam.sin |
14 |
import in.shop2020.model.v1.order.Attribute;
|
| 3546 |
mandeep.dh |
15 |
import in.shop2020.model.v1.order.LineItem;
|
|
|
16 |
import in.shop2020.model.v1.order.Order;
|
|
|
17 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 4267 |
anupam.sin |
18 |
import in.shop2020.model.v1.order.Transaction;
|
| 3546 |
mandeep.dh |
19 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 4267 |
anupam.sin |
20 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| 3137 |
mandeep.dh |
21 |
import in.shop2020.model.v1.user.User;
|
|
|
22 |
import in.shop2020.model.v1.user.UserContextException;
|
| 3578 |
mandeep.dh |
23 |
import in.shop2020.payments.Payment;
|
|
|
24 |
import in.shop2020.payments.PaymentException;
|
|
|
25 |
import in.shop2020.payments.PaymentStatus;
|
| 3390 |
mandeep.dh |
26 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
|
|
27 |
import in.shop2020.thrift.clients.CRMClient;
|
| 3405 |
mandeep.dh |
28 |
import in.shop2020.thrift.clients.HelperClient;
|
| 3578 |
mandeep.dh |
29 |
import in.shop2020.thrift.clients.PaymentClient;
|
| 3546 |
mandeep.dh |
30 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 3390 |
mandeep.dh |
31 |
import in.shop2020.thrift.clients.UserClient;
|
| 3405 |
mandeep.dh |
32 |
import in.shop2020.util.CRMConstants;
|
| 4020 |
mandeep.dh |
33 |
import in.shop2020.util.CRMConstants.EscalationMatrix;
|
| 16244 |
manish.sha |
34 |
import in.shop2020.util.CRMConstants.PMEscalationMatrix;
|
| 17196 |
manish.sha |
35 |
import in.shop2020.util.SendGrid;
|
| 16642 |
manish.sha |
36 |
import in.shop2020.util.SendGridException;
|
| 17196 |
manish.sha |
37 |
import in.shop2020.utils.GmailUtils;
|
| 3405 |
mandeep.dh |
38 |
import in.shop2020.utils.HelperService.Client;
|
|
|
39 |
import in.shop2020.utils.HelperServiceException;
|
| 3546 |
mandeep.dh |
40 |
import in.shop2020.utils.ModelUtils;
|
| 3137 |
mandeep.dh |
41 |
|
| 17083 |
manish.sha |
42 |
import java.io.File;
|
| 3397 |
mandeep.dh |
43 |
import java.text.ParseException;
|
| 5791 |
anupam.sin |
44 |
import java.text.SimpleDateFormat;
|
| 3137 |
mandeep.dh |
45 |
import java.util.ArrayList;
|
| 5791 |
anupam.sin |
46 |
import java.util.Arrays;
|
| 3578 |
mandeep.dh |
47 |
import java.util.Calendar;
|
| 3390 |
mandeep.dh |
48 |
import java.util.Collections;
|
| 3405 |
mandeep.dh |
49 |
import java.util.Date;
|
| 4490 |
anupam.sin |
50 |
import java.util.HashMap;
|
| 3137 |
mandeep.dh |
51 |
import java.util.List;
|
| 5909 |
amar.kumar |
52 |
import java.util.Map;
|
| 3137 |
mandeep.dh |
53 |
|
| 17083 |
manish.sha |
54 |
import javax.mail.MessagingException;
|
|
|
55 |
|
| 4256 |
mandeep.dh |
56 |
import net.htmlparser.jericho.Source;
|
|
|
57 |
|
| 3405 |
mandeep.dh |
58 |
import org.apache.shiro.SecurityUtils;
|
| 3137 |
mandeep.dh |
59 |
import org.apache.thrift.TException;
|
| 3546 |
mandeep.dh |
60 |
import org.apache.thrift.transport.TTransportException;
|
| 3137 |
mandeep.dh |
61 |
|
|
|
62 |
/**
|
|
|
63 |
* @author mandeep
|
|
|
64 |
*
|
|
|
65 |
*/
|
|
|
66 |
public class TicketsController extends BaseController {
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
*
|
|
|
70 |
*/
|
|
|
71 |
private static final long serialVersionUID = 1L;
|
|
|
72 |
|
|
|
73 |
List<Ticket> tickets = new ArrayList<Ticket>();
|
| 14882 |
manish.sha |
74 |
|
| 3405 |
mandeep.dh |
75 |
private String customerEmailId;
|
| 3339 |
mandeep.dh |
76 |
private String description;
|
|
|
77 |
private String assigneeEmailId;
|
|
|
78 |
private String priority;
|
|
|
79 |
private String category;
|
|
|
80 |
private String orderId;
|
| 3397 |
mandeep.dh |
81 |
private String[] agentIds;
|
|
|
82 |
private String startTimestamp;
|
|
|
83 |
private String endTimestamp;
|
| 3137 |
mandeep.dh |
84 |
|
| 3405 |
mandeep.dh |
85 |
private String userId;
|
|
|
86 |
private String id;
|
|
|
87 |
private String activityDescription;
|
|
|
88 |
private String status;
|
|
|
89 |
private String activityType;
|
|
|
90 |
private Ticket ticket;
|
|
|
91 |
private List<Activity> activities;
|
|
|
92 |
private String subject;
|
|
|
93 |
private String body;
|
|
|
94 |
private String customerName;
|
|
|
95 |
private String customerMobileNumber;
|
| 3546 |
mandeep.dh |
96 |
private User user;
|
|
|
97 |
private String orderStatus;
|
|
|
98 |
private List<Order> orders;
|
| 19072 |
manish.sha |
99 |
private Map<Long, Order> transactions;
|
|
|
100 |
private Map<Long, Long> transactionShipping;
|
|
|
101 |
private Map<Long, Long> transactionTotal;
|
| 4267 |
anupam.sin |
102 |
private List<Payment> payments;
|
| 4020 |
mandeep.dh |
103 |
private String escalate;
|
| 4241 |
anupam.sin |
104 |
private String cancelReason;
|
| 4267 |
anupam.sin |
105 |
private String transactionId;
|
| 5791 |
anupam.sin |
106 |
private String pickupExtension;
|
| 5909 |
amar.kumar |
107 |
private Map<String, Long> ticketCategorycountMap;
|
| 7645 |
anupam.sin |
108 |
private String premises = "";
|
|
|
109 |
private String closureType = "";
|
| 4438 |
anupam.sin |
110 |
private String paymentId;
|
| 19072 |
manish.sha |
111 |
private String quantity;
|
| 4438 |
anupam.sin |
112 |
|
| 4490 |
anupam.sin |
113 |
private HashMap<String, String> allAttachmentsForTicket;
|
|
|
114 |
|
| 3405 |
mandeep.dh |
115 |
public String index() {
|
|
|
116 |
try {
|
|
|
117 |
if (id != null && !id.isEmpty()) {
|
|
|
118 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
119 |
crmServiceClient = new CRMClient().getClient();
|
|
|
120 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
121 |
tickets = crmServiceClient.getTickets(searchFilter);
|
|
|
122 |
}
|
|
|
123 |
} catch (TException e) {
|
|
|
124 |
log.error("Error while getting tickets", e);
|
|
|
125 |
return EXCEPTION;
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
return INDEX;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
public String edit() {
|
|
|
132 |
try {
|
|
|
133 |
long ticketId = Long.parseLong(id);
|
|
|
134 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
135 |
searchFilter.setTicketId(ticketId);
|
|
|
136 |
crmServiceClient = new CRMClient().getClient();
|
|
|
137 |
ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
138 |
activities = crmServiceClient.getActivities(searchFilter);
|
| 4490 |
anupam.sin |
139 |
populateAttachments();
|
| 3405 |
mandeep.dh |
140 |
subject = createSubjectString(ticket);
|
|
|
141 |
|
|
|
142 |
if (ticket.isSetCustomerId()) {
|
|
|
143 |
userId = String.valueOf(ticket.getCustomerId());
|
| 3546 |
mandeep.dh |
144 |
userContextServiceClient = new UserClient().getClient();
|
|
|
145 |
|
|
|
146 |
try {
|
|
|
147 |
user = userContextServiceClient.getUserById(ticket
|
|
|
148 |
.getCustomerId());
|
|
|
149 |
} catch (UserContextException e) {
|
|
|
150 |
log.error("Could not fetch user details", e);
|
|
|
151 |
}
|
| 3405 |
mandeep.dh |
152 |
}
|
|
|
153 |
|
|
|
154 |
customerEmailId = ticket.getCustomerEmailId();
|
| 4689 |
anupam.sin |
155 |
|
| 4277 |
anupam.sin |
156 |
if (TicketCategory.ORDER_CANCELLATION.equals(ticket.getCategory())) {
|
|
|
157 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
158 |
orders = new ArrayList<Order>();
|
|
|
159 |
transactionServiceClient = new TransactionClient().getClient();
|
| 4689 |
anupam.sin |
160 |
for (Order order : transactionServiceClient
|
|
|
161 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
162 |
Collections.singletonList(OrderStatus.CANCEL_REQUEST_RECEIVED))) {
|
|
|
163 |
log.info("Processing Order: " + order.getId());
|
| 4287 |
anupam.sin |
164 |
orders.add(order);
|
|
|
165 |
}
|
| 4277 |
anupam.sin |
166 |
}
|
| 3546 |
mandeep.dh |
167 |
|
|
|
168 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
|
|
169 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
170 |
orders = new ArrayList<Order>();
|
| 18341 |
amit.gupta |
171 |
transactions = new HashMap<Long, Order>();
|
| 18343 |
amit.gupta |
172 |
transactionShipping = new HashMap<Long, Long>();
|
|
|
173 |
transactionTotal = new HashMap<Long, Long>();
|
| 3546 |
mandeep.dh |
174 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
175 |
for (Order order : transactionServiceClient
|
|
|
176 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
| 4663 |
rajveer |
177 |
Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
|
| 3546 |
mandeep.dh |
178 |
log.info("Processing Order: " + order);
|
|
|
179 |
if (order.isCod()) {
|
| 18341 |
amit.gupta |
180 |
transactions.put(order.getTransactionId(), order);
|
| 19072 |
manish.sha |
181 |
if (!transactionShipping.containsKey(order.getTransactionId())){
|
| 18342 |
amit.gupta |
182 |
transactionShipping.put(order.getTransactionId(), (long)order.getShippingCost());
|
| 18341 |
amit.gupta |
183 |
} else {
|
| 18342 |
amit.gupta |
184 |
transactionShipping.put(order.getTransactionId(), transactionShipping.get(order.getTransactionId()).longValue() + (long)order.getShippingCost());
|
| 18341 |
amit.gupta |
185 |
}
|
| 19072 |
manish.sha |
186 |
if (!transactionTotal.containsKey(order.getTransactionId())){
|
| 18342 |
amit.gupta |
187 |
transactionTotal.put(order.getTransactionId(), (long)order.getTotal_amount()-(long)order.getGvAmount());
|
| 18341 |
amit.gupta |
188 |
} else {
|
| 18342 |
amit.gupta |
189 |
transactionTotal.put(order.getTransactionId(), transactionTotal.get(order.getTransactionId()).longValue() + (long)order.getTotal_amount()-(long)order.getGvAmount());
|
| 18341 |
amit.gupta |
190 |
}
|
| 19072 |
manish.sha |
191 |
orders.add(order);
|
| 3546 |
mandeep.dh |
192 |
}
|
|
|
193 |
}
|
| 18341 |
amit.gupta |
194 |
|
| 3546 |
mandeep.dh |
195 |
}
|
| 4689 |
anupam.sin |
196 |
|
| 4490 |
anupam.sin |
197 |
if (TicketCategory.DOA_RECEIVED.equals(ticket.getCategory())) {
|
|
|
198 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
199 |
orders = new ArrayList<Order>();
|
|
|
200 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
201 |
for (Order order : transactionServiceClient
|
|
|
202 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
203 |
Collections.singletonList(OrderStatus.DOA_REQUEST_RECEIVED))) {
|
|
|
204 |
log.info("Processing Order: " + order);
|
|
|
205 |
if (order != null) {
|
|
|
206 |
orders.add(order);
|
|
|
207 |
}
|
|
|
208 |
}
|
|
|
209 |
}
|
| 4689 |
anupam.sin |
210 |
|
| 4490 |
anupam.sin |
211 |
if (TicketCategory.RETURN_FORM.equals(ticket.getCategory())) {
|
|
|
212 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
213 |
orders = new ArrayList<Order>();
|
|
|
214 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
215 |
for (Order order : transactionServiceClient
|
|
|
216 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
217 |
Collections.singletonList(OrderStatus.RET_REQUEST_RECEIVED))) {
|
|
|
218 |
log.info("Processing Order: " + order);
|
|
|
219 |
if (order != null) {
|
|
|
220 |
orders.add(order);
|
|
|
221 |
}
|
|
|
222 |
}
|
|
|
223 |
}
|
| 3578 |
mandeep.dh |
224 |
|
| 4267 |
anupam.sin |
225 |
if (TicketCategory.PAYMENT_FLAGGED.equals(ticket.getCategory())) {
|
|
|
226 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
227 |
payments = new ArrayList<Payment>();
|
|
|
228 |
in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
|
|
|
229 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
230 |
for (Transaction transaction : transactionServiceClient
|
|
|
231 |
.getTransactionsForCustomer(ticket.getCustomerId(), 0, 0, TransactionStatus.FLAGGED)) {
|
|
|
232 |
log.info("Processing Transaction: " + transaction);
|
|
|
233 |
for ( Payment payment : paymentClient.getPaymentForTxnId(transaction.getId())) {
|
|
|
234 |
if( payment.getStatus().equals(PaymentStatus.AUTHORIZED)) {
|
|
|
235 |
payments.add(payment);
|
|
|
236 |
}
|
|
|
237 |
}
|
|
|
238 |
}
|
|
|
239 |
}
|
|
|
240 |
|
| 3578 |
mandeep.dh |
241 |
if (TicketCategory.FAILED_PAYMENTS.equals(ticket.getCategory())) {
|
|
|
242 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
243 |
orders = new ArrayList<Order>();
|
|
|
244 |
in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
|
|
|
245 |
|
|
|
246 |
long failedTransactionId = -1;
|
|
|
247 |
long lastfailedTransactionTimestamp = -1;
|
|
|
248 |
for (Payment payment : paymentClient.getPaymentsForUser(ticket.getCustomerId(), 0, getTomorrow().getTime(), PaymentStatus.FAILED, 0)) {
|
|
|
249 |
if (payment.getErrorTimestamp() > lastfailedTransactionTimestamp) {
|
|
|
250 |
failedTransactionId = payment.getMerchantTxnId();
|
|
|
251 |
}
|
|
|
252 |
}
|
|
|
253 |
|
|
|
254 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
255 |
orders.addAll(transactionServiceClient.getOrdersForTransaction(failedTransactionId, ticket.getCustomerId()));
|
|
|
256 |
}
|
| 4008 |
mandeep.dh |
257 |
|
|
|
258 |
if (TicketCategory.DELAYED_DELIVERY.equals(ticket.getCategory())) {
|
|
|
259 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
260 |
orders = new ArrayList<Order>();
|
|
|
261 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
262 |
|
|
|
263 |
for (Order order : transactionServiceClient.getOrdersForCustomer(ticket.getCustomerId(), 0, 0, null)) {
|
|
|
264 |
if (order.getExpected_delivery_time() > order.getPromised_delivery_time() && order.getExpected_delivery_time() > new Date().getTime()) {
|
|
|
265 |
orders.add(order);
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
}
|
| 5791 |
anupam.sin |
269 |
|
|
|
270 |
if (TicketCategory.STORE_PICKUP.equals(ticket.getCategory())) {
|
|
|
271 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
|
|
272 |
orders = new ArrayList<Order>();
|
|
|
273 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
274 |
for (Order order : transactionServiceClient
|
|
|
275 |
.getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
|
|
|
276 |
Collections.singletonList(OrderStatus.RECEIVED_AT_STORE))) {
|
|
|
277 |
log.info("Processing Order: " + order.getId());
|
|
|
278 |
orders.add(order);
|
|
|
279 |
}
|
|
|
280 |
}
|
|
|
281 |
|
| 3405 |
mandeep.dh |
282 |
} catch (TException e) {
|
| 3546 |
mandeep.dh |
283 |
log.error("Error loading edit page", e);
|
|
|
284 |
} catch (NumberFormatException e) {
|
|
|
285 |
log.error("Error parsing orderId", e);
|
|
|
286 |
} catch (TransactionServiceException e) {
|
|
|
287 |
log.error("Error fetching orders for " + ticket.getCustomerId(), e);
|
| 3578 |
mandeep.dh |
288 |
} catch (PaymentException e) {
|
|
|
289 |
log.error("Error fetching payments for " + ticket.getCustomerId(), e);
|
| 3405 |
mandeep.dh |
290 |
}
|
|
|
291 |
|
|
|
292 |
return EDIT;
|
|
|
293 |
}
|
|
|
294 |
|
| 4490 |
anupam.sin |
295 |
private void populateAttachments() {
|
|
|
296 |
allAttachmentsForTicket = new HashMap<String, String>();
|
|
|
297 |
for (Activity activity : activities) {
|
|
|
298 |
log.info("" + activity.getId());
|
|
|
299 |
String attachment = activity.getAttachments();
|
|
|
300 |
if (attachment != null && !attachment.isEmpty()) {
|
|
|
301 |
log.info("" + attachment);
|
|
|
302 |
String [] attachmentList = attachment.split(";");
|
|
|
303 |
for (String attachmentName : attachmentList) {
|
|
|
304 |
if (attachmentName != null && !attachmentName.isEmpty()) {
|
|
|
305 |
log.info("" + attachmentName);
|
|
|
306 |
allAttachmentsForTicket.put(activity.getId() + "-" + attachmentName, attachmentName);
|
|
|
307 |
}
|
|
|
308 |
}
|
|
|
309 |
}
|
|
|
310 |
}
|
|
|
311 |
}
|
|
|
312 |
|
| 5791 |
anupam.sin |
313 |
public static void main(String[] args) throws TException {
|
|
|
314 |
SearchFilter s = new SearchFilter();
|
|
|
315 |
// s.setTicketId(200l);
|
|
|
316 |
// s.setTicketAssigneeIds(null);
|
|
|
317 |
// s.setTicketAssigneeIds(new ArrayList<Long>());
|
|
|
318 |
// s.setActivityCreatorIds(Collections.singletonList(2l));
|
|
|
319 |
// s.setEndTimestamp(new Date());
|
|
|
320 |
//s.setTicketCategory(TicketCategory.STORE_PICKUP);
|
|
|
321 |
s.setTicketId((long) 51345);
|
|
|
322 |
in.shop2020.crm.CRMService.Client crmServiceClient = new CRMClient().getClient();
|
|
|
323 |
Ticket ticket = crmServiceClient.getTickets(s).get(0);
|
|
|
324 |
System.out.println(ticket.getCategory().name());
|
| 4490 |
anupam.sin |
325 |
}
|
|
|
326 |
|
| 3405 |
mandeep.dh |
327 |
private String createSubjectString(Ticket ticket) {
|
| 14882 |
manish.sha |
328 |
if(!profitMandiTicketCategoryList.contains(ticket.getCategory())){
|
|
|
329 |
return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId()
|
|
|
330 |
+ " " + ticket.getCategory().name();
|
|
|
331 |
}else{
|
|
|
332 |
return CRMConstants.PROFIT_MANDI_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId()
|
|
|
333 |
+ " " + ticket.getCategory().name();
|
|
|
334 |
}
|
| 3405 |
mandeep.dh |
335 |
}
|
|
|
336 |
|
| 3578 |
mandeep.dh |
337 |
private Date getTomorrow() {
|
|
|
338 |
Calendar calendar = Calendar.getInstance();
|
|
|
339 |
calendar.setTime(new Date());
|
|
|
340 |
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
341 |
return calendar.getTime();
|
|
|
342 |
}
|
|
|
343 |
|
| 3339 |
mandeep.dh |
344 |
public String create() {
|
|
|
345 |
try {
|
| 3546 |
mandeep.dh |
346 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
|
|
|
347 |
.getId();
|
| 3339 |
mandeep.dh |
348 |
Ticket ticket = new Ticket();
|
|
|
349 |
ticket.setDescription(description);
|
|
|
350 |
ticket.setCreatorId(creatorId);
|
|
|
351 |
ticket.setStatus(TicketStatus.OPEN);
|
|
|
352 |
ticket.setPriority(TicketPriority.valueOf(priority));
|
|
|
353 |
ticket.setCategory(TicketCategory.valueOf(category));
|
|
|
354 |
|
|
|
355 |
Activity activity = new Activity();
|
|
|
356 |
activity.setDescription("Creating Ticket");
|
|
|
357 |
activity.setType(ActivityType.OTHER);
|
|
|
358 |
activity.setTicketPriority(TicketPriority.valueOf(priority));
|
|
|
359 |
activity.setTicketStatus(TicketStatus.OPEN);
|
|
|
360 |
activity.setCreatorId(creatorId);
|
|
|
361 |
activity.setTicketCategory(TicketCategory.valueOf(category));
|
|
|
362 |
activity.setTicketDescription(description);
|
|
|
363 |
|
|
|
364 |
if (orderId != null && !orderId.isEmpty()) {
|
|
|
365 |
ticket.setOrderId(Long.parseLong(orderId));
|
|
|
366 |
}
|
| 4490 |
anupam.sin |
367 |
|
|
|
368 |
if (TicketCategory.valueOf(category) == TicketCategory.DOA_RECEIVED) {
|
|
|
369 |
transactionServiceClient = new TransactionClient().getClient();
|
| 20091 |
kshitij.so |
370 |
if (!transactionServiceClient.markOrderDoaRequestReceived(Long.parseLong(orderId))) {
|
| 4490 |
anupam.sin |
371 |
throw new Exception("Order cannot be marked as DOA Received");
|
| 20091 |
kshitij.so |
372 |
}
|
| 4490 |
anupam.sin |
373 |
log.info("" + userId);
|
| 19765 |
manish.sha |
374 |
try{
|
|
|
375 |
Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
|
|
|
376 |
log.info("In order table id is : " + order.getCustomer_id());
|
|
|
377 |
if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
|
|
|
378 |
throw new Exception("This order is not associated with this user Id");
|
|
|
379 |
}
|
|
|
380 |
}catch(Exception e){
|
|
|
381 |
throw new Exception("No Order Found for given order id");
|
| 4490 |
anupam.sin |
382 |
}
|
|
|
383 |
}
|
|
|
384 |
|
|
|
385 |
if (TicketCategory.valueOf(category) == TicketCategory.RETURN_FORM) {
|
|
|
386 |
transactionServiceClient = new TransactionClient().getClient();
|
| 20091 |
kshitij.so |
387 |
if (!transactionServiceClient.markOrderReturnRequestReceived(Long.parseLong(orderId))) {
|
| 4490 |
anupam.sin |
388 |
throw new Exception("Order cannot be marked as Return Requested");
|
| 20091 |
kshitij.so |
389 |
}
|
| 4490 |
anupam.sin |
390 |
log.info("" + userId);
|
| 19765 |
manish.sha |
391 |
try{
|
|
|
392 |
Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
|
|
|
393 |
log.info("In order table id is : " + order.getCustomer_id());
|
|
|
394 |
if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
|
|
|
395 |
throw new Exception("This order is not associated with this user Id");
|
|
|
396 |
}
|
|
|
397 |
}catch(Exception e){
|
|
|
398 |
throw new Exception("No Order Found for given order id");
|
| 4490 |
anupam.sin |
399 |
}
|
|
|
400 |
}
|
| 4681 |
amar.kumar |
401 |
if(body!=null && !body.isEmpty()){
|
|
|
402 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
|
|
403 |
ticket.setDescription(description + " : " + plainTextbody);
|
|
|
404 |
}
|
| 4490 |
anupam.sin |
405 |
|
| 3405 |
mandeep.dh |
406 |
if (userId != null && !userId.isEmpty()) {
|
|
|
407 |
ticket.setCustomerId(Long.parseLong(userId));
|
|
|
408 |
activity.setCustomerId(Long.parseLong(userId));
|
| 3546 |
mandeep.dh |
409 |
} else {
|
| 3390 |
mandeep.dh |
410 |
User user = null;
|
|
|
411 |
userContextServiceClient = new UserClient().getClient();
|
|
|
412 |
try {
|
| 3405 |
mandeep.dh |
413 |
if (customerName != null && !customerName.isEmpty()) {
|
|
|
414 |
ticket.setCustomerName(customerName);
|
|
|
415 |
activity.setCustomerName(customerName);
|
|
|
416 |
}
|
|
|
417 |
|
|
|
418 |
if (customerEmailId != null && !customerEmailId.isEmpty()) {
|
|
|
419 |
ticket.setCustomerEmailId(customerEmailId);
|
|
|
420 |
activity.setCustomerEmailId(customerEmailId);
|
| 3546 |
mandeep.dh |
421 |
user = userContextServiceClient
|
|
|
422 |
.getUserByEmail(customerEmailId);
|
| 3405 |
mandeep.dh |
423 |
}
|
|
|
424 |
|
| 3546 |
mandeep.dh |
425 |
if ((user == null || user.getUserId() == -1)
|
|
|
426 |
&& customerMobileNumber != null
|
|
|
427 |
&& !customerMobileNumber.isEmpty()) {
|
| 3405 |
mandeep.dh |
428 |
ticket.setCustomerMobileNumber(customerMobileNumber);
|
|
|
429 |
activity.setCustomerMobileNumber(customerMobileNumber);
|
| 3546 |
mandeep.dh |
430 |
user = userContextServiceClient
|
|
|
431 |
.getUserByMobileNumber(Long
|
|
|
432 |
.parseLong(customerMobileNumber));
|
| 3405 |
mandeep.dh |
433 |
}
|
| 3390 |
mandeep.dh |
434 |
} catch (UserContextException e) {
|
| 3546 |
mandeep.dh |
435 |
log.error("Could not fetch user for: " + customerEmailId
|
|
|
436 |
+ " " + customerMobileNumber + " " + customerName,
|
|
|
437 |
e);
|
| 3390 |
mandeep.dh |
438 |
}
|
| 3546 |
mandeep.dh |
439 |
|
| 3390 |
mandeep.dh |
440 |
if (user != null && user.getUserId() != -1) {
|
|
|
441 |
ticket.setCustomerId(user.getUserId());
|
|
|
442 |
activity.setCustomerId(user.getUserId());
|
|
|
443 |
}
|
| 3339 |
mandeep.dh |
444 |
}
|
|
|
445 |
|
|
|
446 |
// handling null values appropriately
|
|
|
447 |
if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
|
| 3546 |
mandeep.dh |
448 |
long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
|
|
|
449 |
.getId();
|
| 3339 |
mandeep.dh |
450 |
ticket.setAssigneeId(assigneeId);
|
|
|
451 |
activity.setTicketAssigneeId(assigneeId);
|
|
|
452 |
}
|
|
|
453 |
|
| 3546 |
mandeep.dh |
454 |
crmServiceClient = new CRMClient().getClient();
|
|
|
455 |
id = String
|
|
|
456 |
.valueOf(crmServiceClient.insertTicket(ticket, activity));
|
| 3339 |
mandeep.dh |
457 |
} catch (TException e) {
|
|
|
458 |
log.error("Error while creating ticket", e);
|
|
|
459 |
return EXCEPTION;
|
| 4490 |
anupam.sin |
460 |
} catch (NumberFormatException e) {
|
|
|
461 |
log.error("Error while parsing Order Id", e);
|
|
|
462 |
return EXCEPTION;
|
|
|
463 |
} catch (TransactionServiceException e) {
|
|
|
464 |
log.error("Error while updating order status", e);
|
|
|
465 |
return EXCEPTION;
|
|
|
466 |
} catch (Exception e) {
|
|
|
467 |
log.error(e.getMessage());
|
|
|
468 |
return EXCEPTION;
|
| 3339 |
mandeep.dh |
469 |
}
|
|
|
470 |
|
| 3405 |
mandeep.dh |
471 |
return index();
|
| 3339 |
mandeep.dh |
472 |
}
|
|
|
473 |
|
| 3405 |
mandeep.dh |
474 |
public boolean isAssigneeEditable() {
|
| 8847 |
manish.sha |
475 |
return (SecurityUtils.getSubject().hasRole("TeamLead") || SecurityUtils.getSubject().hasRole("Outbound"));
|
| 3405 |
mandeep.dh |
476 |
}
|
|
|
477 |
|
| 3397 |
mandeep.dh |
478 |
public String searchTickets() throws ParseException {
|
| 3137 |
mandeep.dh |
479 |
try {
|
| 3397 |
mandeep.dh |
480 |
SearchFilter searchFilter = new SearchFilter();
|
| 3405 |
mandeep.dh |
481 |
if (userId != null && !userId.isEmpty()) {
|
|
|
482 |
searchFilter.setCustomerId(Long.parseLong(userId));
|
|
|
483 |
}
|
|
|
484 |
|
| 3397 |
mandeep.dh |
485 |
if (agentIds != null && agentIds.length != 0) {
|
|
|
486 |
searchFilter.setTicketAssigneeIds(new ArrayList<Long>());
|
|
|
487 |
for (String agentId : agentIds) {
|
| 3546 |
mandeep.dh |
488 |
searchFilter.getTicketAssigneeIds().add(
|
|
|
489 |
CRMAuthorizingRealm.getAgent(agentId).getId());
|
| 3397 |
mandeep.dh |
490 |
}
|
|
|
491 |
}
|
| 7595 |
kshitij.so |
492 |
|
|
|
493 |
//Start:- Added By Manish Sharma for Searching Tickets/Activities using Mobile No. on 21-Jun-2013
|
|
|
494 |
if(customerMobileNumber!=null && !customerMobileNumber.isEmpty()){
|
|
|
495 |
searchFilter.setCustomerMobileNumber(customerMobileNumber);
|
|
|
496 |
}
|
|
|
497 |
//End:- Added By Manish Sharma for Searching Tickets/Activities using Mobile No. on 21-Jun-2013
|
|
|
498 |
|
| 3397 |
mandeep.dh |
499 |
if (startTimestamp != null && !startTimestamp.isEmpty()) {
|
| 3546 |
mandeep.dh |
500 |
searchFilter.setStartTimestamp(SDF.parse(startTimestamp)
|
|
|
501 |
.getTime());
|
| 3397 |
mandeep.dh |
502 |
}
|
|
|
503 |
|
|
|
504 |
if (endTimestamp != null && !endTimestamp.isEmpty()) {
|
|
|
505 |
searchFilter.setEndTimestamp(SDF.parse(endTimestamp).getTime());
|
|
|
506 |
}
|
|
|
507 |
|
| 3422 |
mandeep.dh |
508 |
if (id != null && !id.isEmpty()) {
|
|
|
509 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
510 |
}
|
|
|
511 |
|
| 3499 |
mandeep.dh |
512 |
if (status != null && !status.isEmpty()) {
|
| 3972 |
mandeep.dh |
513 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
514 |
searchFilter.getTicketStatuses().add(TicketStatus.valueOf(status));
|
|
|
515 |
if (TicketStatus.OPEN.name().equals(status)) {
|
|
|
516 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
517 |
}
|
| 3499 |
mandeep.dh |
518 |
}
|
|
|
519 |
|
|
|
520 |
if (category != null && !category.isEmpty()) {
|
| 3546 |
mandeep.dh |
521 |
searchFilter
|
|
|
522 |
.setTicketCategory(TicketCategory.valueOf(category));
|
| 3499 |
mandeep.dh |
523 |
}
|
|
|
524 |
|
| 3546 |
mandeep.dh |
525 |
crmServiceClient = new CRMClient().getClient();
|
| 3405 |
mandeep.dh |
526 |
tickets = crmServiceClient.getTickets(searchFilter);
|
| 3137 |
mandeep.dh |
527 |
} catch (TException e) {
|
|
|
528 |
String errorString = "Error getting tickets for "
|
|
|
529 |
+ currentAgentEmailId;
|
|
|
530 |
log.error(errorString, e);
|
|
|
531 |
addActionError(errorString);
|
|
|
532 |
}
|
|
|
533 |
|
| 3405 |
mandeep.dh |
534 |
return index();
|
| 3137 |
mandeep.dh |
535 |
}
|
|
|
536 |
|
|
|
537 |
public String getUnassignedTickets() {
|
|
|
538 |
try {
|
| 16244 |
manish.sha |
539 |
tickets = new ArrayList<Ticket>();
|
| 3546 |
mandeep.dh |
540 |
crmServiceClient = new CRMClient().getClient();
|
| 16244 |
manish.sha |
541 |
List<Ticket> unassignedTickets = crmServiceClient.getUnassignedTickets();
|
|
|
542 |
for(Ticket unassignedTicket: unassignedTickets){
|
|
|
543 |
if(isSaholicAndProfitMandiAllowed()){
|
|
|
544 |
tickets.add(unassignedTicket);
|
|
|
545 |
}else if(isProfitMandiAgent()){
|
|
|
546 |
if(profitMandiTicketCategoryList.contains(unassignedTicket.getCategory())){
|
|
|
547 |
tickets.add(unassignedTicket);
|
|
|
548 |
}
|
|
|
549 |
}else{
|
|
|
550 |
if(!profitMandiTicketCategoryList.contains(unassignedTicket.getCategory())){
|
|
|
551 |
tickets.add(unassignedTicket);
|
|
|
552 |
}
|
|
|
553 |
}
|
|
|
554 |
}
|
| 3137 |
mandeep.dh |
555 |
} catch (TException e) {
|
| 3339 |
mandeep.dh |
556 |
String errorString = "Error getting tickets for "
|
|
|
557 |
+ currentAgentEmailId;
|
| 3137 |
mandeep.dh |
558 |
log.error(errorString, e);
|
|
|
559 |
addActionError(errorString);
|
|
|
560 |
}
|
|
|
561 |
|
| 3405 |
mandeep.dh |
562 |
return index();
|
| 3137 |
mandeep.dh |
563 |
}
|
|
|
564 |
|
| 3405 |
mandeep.dh |
565 |
public String update() {
|
| 17083 |
manish.sha |
566 |
String commonDescription ="";
|
|
|
567 |
String addTo[]= new String[]{"amit.sirohi@shop2020.in","rajneesh.arora@saholic.com"};
|
| 3405 |
mandeep.dh |
568 |
try {
|
|
|
569 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
|
|
|
570 |
.getId();
|
|
|
571 |
|
| 3546 |
mandeep.dh |
572 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
573 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
574 |
crmServiceClient = new CRMClient().getClient();
|
|
|
575 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| 3405 |
mandeep.dh |
576 |
ticket.setDescription(description);
|
|
|
577 |
ticket.setPriority(TicketPriority.valueOf(priority));
|
|
|
578 |
|
|
|
579 |
// Update when a ticket is closed!
|
| 3578 |
mandeep.dh |
580 |
if (TicketStatus.CLOSED.name().equals(status) || TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
| 3546 |
mandeep.dh |
581 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())
|
|
|
582 |
&& pendingCODOrders(ticket.getCustomerId())) {
|
|
|
583 |
addActionMessage("Cod orders pending for verification. Ticket can not be closed and its category cannot be changed.");
|
|
|
584 |
} else {
|
|
|
585 |
ticket.setCategory(TicketCategory.valueOf(category));
|
|
|
586 |
ticket.setStatus(TicketStatus.valueOf(status));
|
|
|
587 |
ticket.setCloseDate(new Date().getTime());
|
|
|
588 |
}
|
| 3405 |
mandeep.dh |
589 |
}
|
| 3546 |
mandeep.dh |
590 |
else {
|
|
|
591 |
ticket.setCategory(TicketCategory.valueOf(category));
|
| 3578 |
mandeep.dh |
592 |
ticket.setStatus(TicketStatus.valueOf(status));
|
| 3546 |
mandeep.dh |
593 |
}
|
| 3405 |
mandeep.dh |
594 |
|
|
|
595 |
if (activityDescription == null || activityDescription.isEmpty()) {
|
| 4241 |
anupam.sin |
596 |
activityDescription = "Ticket fields updated";
|
| 3405 |
mandeep.dh |
597 |
}
|
|
|
598 |
|
|
|
599 |
Activity activity = new Activity();
|
|
|
600 |
activity.setDescription(activityDescription);
|
|
|
601 |
activity.setType(ActivityType.valueOf(activityType));
|
| 3546 |
mandeep.dh |
602 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
603 |
activity.setTicketStatus(ticket.getStatus());
|
| 3405 |
mandeep.dh |
604 |
activity.setCreatorId(creatorId);
|
| 3546 |
mandeep.dh |
605 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
606 |
activity.setTicketDescription(ticket.getDescription());
|
| 3405 |
mandeep.dh |
607 |
|
|
|
608 |
if (userId != null && !userId.isEmpty()) {
|
|
|
609 |
activity.setCustomerId(Long.parseLong(userId));
|
|
|
610 |
}
|
|
|
611 |
|
| 4035 |
mandeep.dh |
612 |
// Handling null values appropriately
|
|
|
613 |
if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
|
|
|
614 |
long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
|
|
|
615 |
.getId();
|
|
|
616 |
ticket.setAssigneeId(assigneeId);
|
|
|
617 |
activity.setTicketAssigneeId(assigneeId);
|
|
|
618 |
}
|
|
|
619 |
|
| 3405 |
mandeep.dh |
620 |
if (ActivityType.SEND_EMAIL_TO_CUSTOMER.equals(activity.getType())) {
|
|
|
621 |
log.info("Sending mail");
|
|
|
622 |
Client helperClient = new HelperClient().getClient();
|
| 14882 |
manish.sha |
623 |
if(!profitMandiTicketCategoryList.contains(ticket.getCategory())){
|
|
|
624 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
|
|
625 |
Arrays.asList(customerEmailId), CRMConstants.CRM_EMAIL_SENDOR,
|
|
|
626 |
subject, body, null, CRMConstants.CRM_EMAIL_TYPE, null, null, 1));
|
|
|
627 |
}else{
|
| 16524 |
manish.sha |
628 |
try{
|
| 16642 |
manish.sha |
629 |
sendMailToUser();
|
| 16524 |
manish.sha |
630 |
|
|
|
631 |
} catch(Exception e){
|
| 16644 |
manish.sha |
632 |
log.info("Error while sending mail to user:- "+customerEmailId+" ticket Id:- "+ticket.getId());
|
| 16524 |
manish.sha |
633 |
log.error("Error while sending mail to user:- "+customerEmailId+" ticket Id:- "+ticket.getId(), e);
|
|
|
634 |
}
|
|
|
635 |
|
|
|
636 |
/*activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
| 14882 |
manish.sha |
637 |
Arrays.asList(customerEmailId), CRMConstants.PROFIT_MANDI_EMAIL_SENDER,
|
| 16524 |
manish.sha |
638 |
subject, body, null, CRMConstants.PROFIT_MANDI_EMAIL_TYPE, null, null, 1));*/
|
| 14882 |
manish.sha |
639 |
}
|
| 3405 |
mandeep.dh |
640 |
|
| 4256 |
mandeep.dh |
641 |
String plainTextbody = new Source(body).getTextExtractor().toString();
|
|
|
642 |
|
| 3405 |
mandeep.dh |
643 |
// We change activityType to OTHER when pop up box for email
|
|
|
644 |
// closes
|
|
|
645 |
activity.setDescription("Subject: " + subject + "\n\n"
|
| 4256 |
mandeep.dh |
646 |
+ "Body: " + plainTextbody);
|
| 4206 |
mandeep.dh |
647 |
|
|
|
648 |
String activityDesc = activity.getDescription();
|
|
|
649 |
if (activityDesc.length() > CRMConstants.DESCRIPTION_MAX_WIDTH) {
|
|
|
650 |
activityDesc = activityDesc.substring(0, CRMConstants.DESCRIPTION_MAX_WIDTH);
|
|
|
651 |
activityDesc += "\n\nTHIS TEXT IS TRUNCATED. PLEASE VISIT INBOX TO SEE COMPLETE DETAILS.";
|
|
|
652 |
}
|
|
|
653 |
|
|
|
654 |
activity.setDescription(activityDesc);
|
| 3405 |
mandeep.dh |
655 |
}
|
|
|
656 |
|
| 4020 |
mandeep.dh |
657 |
if (ActivityType.ESCALATE_TICKET.equals(activity.getType())) {
|
|
|
658 |
log.info("Sending escalation mail");
|
| 16244 |
manish.sha |
659 |
if(escalate.startsWith("PM")){
|
|
|
660 |
PMEscalationMatrix escalation = CRMConstants.PMEscalationMatrix.valueOf(escalate);
|
|
|
661 |
List<Integer> escalationReceipients = escalation.getAgentIds();
|
|
|
662 |
|
|
|
663 |
List<String> toMailIds = new ArrayList<String>();
|
|
|
664 |
for (Integer agentId : escalationReceipients) {
|
|
|
665 |
toMailIds.add(CRMAuthorizingRealm.getAgent(agentId).getEmailId());
|
| 4020 |
mandeep.dh |
666 |
|
| 16244 |
manish.sha |
667 |
// Setting last agent as assignee
|
|
|
668 |
ticket.setAssigneeId(agentId);
|
|
|
669 |
activity.setTicketAssigneeId(agentId);
|
|
|
670 |
}
|
| 4034 |
mandeep.dh |
671 |
|
| 16244 |
manish.sha |
672 |
Client helperClient = new HelperClient().getClient();
|
|
|
673 |
String escalationMailSubject = createPMEscalationMailSubject(ticket, escalation);
|
|
|
674 |
String escalationMailBody = createEscalationMailBody(ticket);
|
| 16402 |
manish.sha |
675 |
|
|
|
676 |
if(profitMandiTicketCategoryList.contains(ticket.getCategory())){
|
| 4020 |
mandeep.dh |
677 |
|
| 16402 |
manish.sha |
678 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
|
|
679 |
toMailIds, CRMConstants.PROFIT_MANDI_EMAIL_SENDER,
|
|
|
680 |
escalationMailSubject, escalationMailBody,
|
|
|
681 |
null, CRMConstants.PROFIT_MANDI_EMAIL_TYPE, null, null, 1));
|
|
|
682 |
}else{
|
|
|
683 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
|
|
684 |
Arrays.asList(customerEmailId), CRMConstants.CRM_EMAIL_SENDOR,
|
|
|
685 |
subject, body, null, CRMConstants.CRM_EMAIL_TYPE, null, null, 1));
|
|
|
686 |
}
|
| 4020 |
mandeep.dh |
687 |
|
| 16244 |
manish.sha |
688 |
// We change activityType to OTHER when pop up box for email
|
|
|
689 |
// closes
|
|
|
690 |
activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
|
|
|
691 |
+ "Body: " + escalationMailBody);
|
|
|
692 |
}else{
|
|
|
693 |
EscalationMatrix escalation = CRMConstants.EscalationMatrix.valueOf(escalate);
|
|
|
694 |
List<Integer> escalationReceipients = escalation.getAgentIds();
|
|
|
695 |
|
|
|
696 |
List<String> toMailIds = new ArrayList<String>();
|
|
|
697 |
for (Integer agentId : escalationReceipients) {
|
|
|
698 |
toMailIds.add(CRMAuthorizingRealm.getAgent(agentId).getEmailId());
|
|
|
699 |
|
|
|
700 |
// Setting last agent as assignee
|
|
|
701 |
ticket.setAssigneeId(agentId);
|
|
|
702 |
activity.setTicketAssigneeId(agentId);
|
|
|
703 |
}
|
|
|
704 |
|
|
|
705 |
Client helperClient = new HelperClient().getClient();
|
|
|
706 |
String escalationMailSubject = createEscalationMailSubject(ticket, escalation);
|
|
|
707 |
String escalationMailBody = createEscalationMailBody(ticket);
|
| 4020 |
mandeep.dh |
708 |
|
| 16244 |
manish.sha |
709 |
activity.setUserEmailId(helperClient.saveUserEmailForSending(
|
|
|
710 |
toMailIds, CRMConstants.CRM_EMAIL_SENDOR,
|
|
|
711 |
escalationMailSubject, escalationMailBody,
|
|
|
712 |
null, CRMConstants.CRM_EMAIL_TYPE, null, null, 1));
|
|
|
713 |
|
|
|
714 |
// We change activityType to OTHER when pop up box for email
|
|
|
715 |
// closes
|
|
|
716 |
activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
|
|
|
717 |
+ "Body: " + escalationMailBody);
|
|
|
718 |
}
|
| 4020 |
mandeep.dh |
719 |
}
|
| 17196 |
manish.sha |
720 |
if(isProfitMandiAgent()){
|
|
|
721 |
try{
|
|
|
722 |
if (ActivityType.RECEIVED_CALL_FROM_CUSTOMER.equals(activity.getType())) {
|
|
|
723 |
|
|
|
724 |
commonDescription = "Received Call From Customer || Email Id- ";
|
|
|
725 |
if (customerEmailId != null && !customerEmailId.isEmpty()) {
|
|
|
726 |
commonDescription = commonDescription+customerEmailId;
|
|
|
727 |
}
|
|
|
728 |
if(customerMobileNumber != null
|
|
|
729 |
&& !customerMobileNumber.isEmpty()) {
|
|
|
730 |
commonDescription = commonDescription+" & Mobile No:- "+customerMobileNumber;
|
|
|
731 |
}
|
| 17198 |
manish.sha |
732 |
commonDescription = "PM Ticket: "+ commonDescription;
|
| 17196 |
manish.sha |
733 |
sendMailtoManagersUsingGmailUtils(commonDescription, addTo, description);
|
|
|
734 |
}
|
|
|
735 |
}
|
|
|
736 |
catch(Exception e){
|
|
|
737 |
e.printStackTrace();
|
|
|
738 |
try{
|
|
|
739 |
sendMailToManagers(commonDescription, addTo, description);
|
|
|
740 |
}
|
|
|
741 |
catch(Exception e1){
|
|
|
742 |
e1.printStackTrace();
|
|
|
743 |
}
|
|
|
744 |
}
|
| 17080 |
manish.sha |
745 |
}
|
| 4020 |
mandeep.dh |
746 |
|
| 3405 |
mandeep.dh |
747 |
User user = null;
|
|
|
748 |
userContextServiceClient = new UserClient().getClient();
|
|
|
749 |
try {
|
|
|
750 |
if (customerName != null && !customerName.isEmpty()) {
|
|
|
751 |
ticket.setCustomerName(customerName);
|
|
|
752 |
activity.setCustomerName(customerName);
|
|
|
753 |
}
|
|
|
754 |
|
|
|
755 |
if (customerEmailId != null && !customerEmailId.isEmpty()) {
|
|
|
756 |
ticket.setCustomerEmailId(customerEmailId);
|
|
|
757 |
activity.setCustomerEmailId(customerEmailId);
|
| 3546 |
mandeep.dh |
758 |
user = userContextServiceClient
|
|
|
759 |
.getUserByEmail(customerEmailId);
|
| 3405 |
mandeep.dh |
760 |
}
|
|
|
761 |
|
| 3546 |
mandeep.dh |
762 |
if ((user == null || user.getUserId() == -1)
|
|
|
763 |
&& customerMobileNumber != null
|
|
|
764 |
&& !customerMobileNumber.isEmpty()) {
|
| 3405 |
mandeep.dh |
765 |
ticket.setCustomerMobileNumber(customerMobileNumber);
|
|
|
766 |
activity.setCustomerMobileNumber(customerMobileNumber);
|
| 3546 |
mandeep.dh |
767 |
user = userContextServiceClient.getUserByMobileNumber(Long
|
|
|
768 |
.parseLong(customerMobileNumber));
|
| 3405 |
mandeep.dh |
769 |
}
|
|
|
770 |
} catch (UserContextException e) {
|
|
|
771 |
log.error("Could not fetch user for: " + customerEmailId + " "
|
|
|
772 |
+ customerMobileNumber + " " + customerName, e);
|
|
|
773 |
}
|
| 3546 |
mandeep.dh |
774 |
|
| 3405 |
mandeep.dh |
775 |
if (user != null && user.getUserId() != -1) {
|
|
|
776 |
ticket.setCustomerId(user.getUserId());
|
|
|
777 |
activity.setCustomerId(user.getUserId());
|
|
|
778 |
}
|
|
|
779 |
|
|
|
780 |
crmServiceClient = new CRMClient().getClient();
|
|
|
781 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
782 |
} catch (TException e) {
|
|
|
783 |
log.error("Error while updating ticket", e);
|
|
|
784 |
return EXCEPTION;
|
|
|
785 |
} catch (HelperServiceException hse) {
|
|
|
786 |
log.error("Error while sending mail", hse);
|
|
|
787 |
return EXCEPTION;
|
|
|
788 |
}
|
|
|
789 |
|
| 14882 |
manish.sha |
790 |
return INDEX;
|
| 3405 |
mandeep.dh |
791 |
}
|
|
|
792 |
|
| 16244 |
manish.sha |
793 |
private String createEscalationMailBody(Ticket ticket)
|
| 4020 |
mandeep.dh |
794 |
{
|
|
|
795 |
return body + "<br />Please visit following URL to check ticket details.<br />" +
|
|
|
796 |
"http://cs.shop2020.in:8080/crm?ticketId=" + ticket.getId();
|
|
|
797 |
}
|
|
|
798 |
|
|
|
799 |
private String createEscalationMailSubject(Ticket ticket,
|
|
|
800 |
EscalationMatrix escalation)
|
|
|
801 |
{
|
|
|
802 |
return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId() + " - ESCALATION FROM CRM - Type: " + escalation.name();
|
|
|
803 |
}
|
| 16244 |
manish.sha |
804 |
|
|
|
805 |
private String createPMEscalationMailSubject(Ticket ticket,
|
|
|
806 |
PMEscalationMatrix escalation)
|
|
|
807 |
{
|
|
|
808 |
return CRMConstants.PROFIT_MANDI_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId() + " - ESCALATION FROM CRM - Type: " + escalation.name();
|
|
|
809 |
}
|
| 4020 |
mandeep.dh |
810 |
|
| 3546 |
mandeep.dh |
811 |
private boolean pendingCODOrders(long customerId) {
|
|
|
812 |
try {
|
|
|
813 |
log.info("Trying to fetch orders for " + customerId);
|
|
|
814 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
815 |
for (Order order : transactionServiceClient.getOrdersForCustomer(
|
|
|
816 |
customerId, 0, 0,
|
| 4663 |
rajveer |
817 |
Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
|
| 3546 |
mandeep.dh |
818 |
log.info("Processing order: " + order.getId() + " with COD: " + order.isCod());
|
|
|
819 |
if (order.isCod()) {
|
|
|
820 |
log.info("Returning true from pendingCODOrders() for " + customerId);
|
|
|
821 |
return true;
|
|
|
822 |
}
|
|
|
823 |
}
|
|
|
824 |
} catch (TTransportException e) {
|
|
|
825 |
log.error("Error while creating thrift client", e);
|
|
|
826 |
} catch (TransactionServiceException e) {
|
|
|
827 |
log.error("Error fetching orders", e);
|
|
|
828 |
} catch (TException e) {
|
|
|
829 |
log.error("Error fetching orders", e);
|
|
|
830 |
}
|
|
|
831 |
|
|
|
832 |
log.info("Returning false from pendingCODOrders() for " + customerId);
|
|
|
833 |
return false;
|
|
|
834 |
}
|
| 5791 |
anupam.sin |
835 |
|
|
|
836 |
public String extendExpiry() {
|
|
|
837 |
try {
|
|
|
838 |
log.info("order Id = " + orderId);
|
|
|
839 |
log.info("pickup : " + pickupExtension);
|
|
|
840 |
Attribute newAttribute = new Attribute();
|
|
|
841 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
|
|
842 |
String extendedBy = "0";
|
|
|
843 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
844 |
attributes = transactionServiceClient.getAllAttributesForOrderId(Long.parseLong(orderId));
|
|
|
845 |
for (Attribute attribute : attributes) {
|
|
|
846 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
847 |
extendedBy = attribute.getValue();
|
|
|
848 |
break;
|
|
|
849 |
}
|
|
|
850 |
}
|
|
|
851 |
log.info("ATTR = " + attributes);
|
|
|
852 |
log.info("1");
|
|
|
853 |
if (extendedBy.equals("0")) {
|
|
|
854 |
newAttribute.setName("pickupExtension");
|
|
|
855 |
newAttribute.setValue(pickupExtension);
|
|
|
856 |
attributes.add(newAttribute);
|
|
|
857 |
log.info("2");
|
|
|
858 |
} else {
|
|
|
859 |
Long totalExtension = Long.parseLong(extendedBy) + Long.parseLong(pickupExtension);
|
|
|
860 |
for (Attribute attribute : attributes) {
|
|
|
861 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
862 |
attribute.setValue(totalExtension.toString());
|
|
|
863 |
log.info("3");
|
|
|
864 |
}
|
|
|
865 |
}
|
|
|
866 |
}
|
|
|
867 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
868 |
transactionServiceClient.setOrderAttributes(Long.parseLong(orderId), attributes);
|
| 5919 |
anupam.sin |
869 |
|
|
|
870 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
871 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
872 |
crmServiceClient = new CRMClient().getClient();
|
|
|
873 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
874 |
|
|
|
875 |
// Inserting activity
|
|
|
876 |
Activity activity = new Activity();
|
|
|
877 |
activity.setDescription("Pickup extended by " + pickupExtension
|
|
|
878 |
+ " Days.");
|
|
|
879 |
activity.setType(ActivityType.OTHER);
|
|
|
880 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
881 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
882 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
883 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
884 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
885 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
886 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
887 |
|
|
|
888 |
crmServiceClient = new CRMClient().getClient();
|
|
|
889 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
890 |
|
| 5917 |
anupam.sin |
891 |
//transactionServiceClient = new TransactionClient().getClient();
|
|
|
892 |
//transactionServiceClient.enqueueExpiryExtensionEmail(orderId);
|
| 5791 |
anupam.sin |
893 |
} catch (NumberFormatException e) {
|
|
|
894 |
e.printStackTrace();
|
|
|
895 |
} catch (TException e) {
|
|
|
896 |
e.printStackTrace();
|
|
|
897 |
}
|
| 5917 |
anupam.sin |
898 |
return edit();
|
| 5791 |
anupam.sin |
899 |
}
|
|
|
900 |
|
|
|
901 |
public String getPickupExpiryDate(long id, long deliveryTimestamp) {
|
|
|
902 |
try {
|
|
|
903 |
log.info("orderID" + id);
|
|
|
904 |
log.info("Delivery Time : " + deliveryTimestamp);
|
|
|
905 |
Date deliveryDate = new Date(deliveryTimestamp);
|
|
|
906 |
Calendar cal = Calendar.getInstance();
|
|
|
907 |
cal.setTime(deliveryDate);
|
|
|
908 |
|
|
|
909 |
log.info("Orig Del Date :" + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
910 |
|
|
|
911 |
cal.add(Calendar.DATE, 5);
|
|
|
912 |
|
|
|
913 |
log.info("After adding 5 days" + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
914 |
|
|
|
915 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
916 |
List<Attribute> attributes = new ArrayList<Attribute>();
|
|
|
917 |
String extendedBy = "0";
|
|
|
918 |
attributes = transactionServiceClient.getAllAttributesForOrderId(id);
|
|
|
919 |
for (Attribute attribute : attributes) {
|
|
|
920 |
if (attribute.getName().equals("pickupExtension")) {
|
|
|
921 |
extendedBy = attribute.getValue();
|
|
|
922 |
}
|
|
|
923 |
}
|
|
|
924 |
cal.add(Calendar.DATE, Integer.parseInt(extendedBy));
|
|
|
925 |
|
|
|
926 |
log.info("Extended by" + extendedBy);
|
|
|
927 |
|
|
|
928 |
log.info("Final : " + cal.get(Calendar.DAY_OF_MONTH) + "-" + cal.get(Calendar.MONTH) + "-" + cal.get(Calendar.YEAR));
|
|
|
929 |
|
|
|
930 |
SimpleDateFormat SDF = new SimpleDateFormat("dd MMM, yyyy");
|
|
|
931 |
return SDF.format(cal.getTime());
|
|
|
932 |
|
|
|
933 |
} catch (NumberFormatException e) {
|
|
|
934 |
e.printStackTrace();
|
|
|
935 |
} catch (TException e) {
|
|
|
936 |
e.printStackTrace();
|
|
|
937 |
}
|
|
|
938 |
return "N/A";
|
|
|
939 |
}
|
| 3546 |
mandeep.dh |
940 |
|
| 4277 |
anupam.sin |
941 |
public String updateOrderStatus() {
|
|
|
942 |
long creatorId;
|
|
|
943 |
OrderStatus orderStatusEnum = null;
|
|
|
944 |
try {
|
|
|
945 |
creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
|
|
946 |
|
|
|
947 |
if(orderStatus.equals("DENY_CANCEL_REQUEST")) {
|
|
|
948 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
949 |
transactionServiceClient.markOrderCancellationRequestDenied(Long.parseLong(orderId));
|
|
|
950 |
}
|
| 3546 |
mandeep.dh |
951 |
|
| 4277 |
anupam.sin |
952 |
else {
|
| 3546 |
mandeep.dh |
953 |
|
| 4277 |
anupam.sin |
954 |
orderStatusEnum = OrderStatus.valueOf(orderStatus);
|
|
|
955 |
transactionServiceClient = new TransactionClient().getClient();
|
| 3578 |
mandeep.dh |
956 |
|
| 4277 |
anupam.sin |
957 |
if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
|
|
|
958 |
transactionServiceClient.verifyOrder(Long.parseLong(orderId));
|
| 5348 |
anupam.sin |
959 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
| 4277 |
anupam.sin |
960 |
}
|
| 4682 |
rajveer |
961 |
else if (OrderStatus.COD_VERIFICATION_FAILED.equals(orderStatusEnum)) {
|
| 4277 |
anupam.sin |
962 |
transactionServiceClient.refundOrder(Long.parseLong(orderId), currentAgentEmailId, cancelReason);
|
| 5348 |
anupam.sin |
963 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
| 4277 |
anupam.sin |
964 |
}
|
|
|
965 |
else if (OrderStatus.CANCEL_REQUEST_CONFIRMED.equals(orderStatusEnum)) {
|
|
|
966 |
transactionServiceClient.markOrderCancellationRequestConfirmed(Long.parseLong(orderId));
|
|
|
967 |
}
|
|
|
968 |
else {
|
|
|
969 |
throw new UnsupportedOperationException("Cannot update status of orderId: " + orderId + " to: " + orderStatus);
|
|
|
970 |
}
|
|
|
971 |
}
|
|
|
972 |
|
|
|
973 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
974 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
975 |
crmServiceClient = new CRMClient().getClient();
|
|
|
976 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| 3546 |
mandeep.dh |
977 |
|
| 4277 |
anupam.sin |
978 |
// Inserting activity
|
|
|
979 |
Activity activity = new Activity();
|
|
|
980 |
activity.setDescription("Status updated for Order Id: " + orderId
|
|
|
981 |
+ " to " + orderStatus + ", Reason: " + cancelReason + body);
|
|
|
982 |
activity.setType(ActivityType.OTHER);
|
|
|
983 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
984 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
985 |
activity.setCreatorId(creatorId);
|
|
|
986 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
987 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
988 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
989 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 3546 |
mandeep.dh |
990 |
|
| 4277 |
anupam.sin |
991 |
crmServiceClient = new CRMClient().getClient();
|
|
|
992 |
crmServiceClient.updateTicket(ticket, activity);
|
| 3546 |
mandeep.dh |
993 |
|
| 4277 |
anupam.sin |
994 |
} catch (TException e) {
|
|
|
995 |
log.info("Thrift exception", e);
|
|
|
996 |
} catch (NumberFormatException e) {
|
|
|
997 |
log.info("Could not convert to long", e);
|
|
|
998 |
} catch (TransactionServiceException e) {
|
|
|
999 |
log.info("Transaction client exception", e);
|
|
|
1000 |
}
|
|
|
1001 |
|
| 3546 |
mandeep.dh |
1002 |
return edit();
|
|
|
1003 |
}
|
| 4277 |
anupam.sin |
1004 |
|
| 19072 |
manish.sha |
1005 |
public String updateTxnStatus() {
|
|
|
1006 |
long creatorId;
|
|
|
1007 |
OrderStatus orderStatusEnum = null;
|
|
|
1008 |
try {
|
|
|
1009 |
creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
|
|
1010 |
|
|
|
1011 |
orderStatusEnum = OrderStatus.valueOf(orderStatus);
|
|
|
1012 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1013 |
|
|
|
1014 |
if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
|
|
|
1015 |
transactionServiceClient.verifyOrderForTransaction(Long.parseLong(transactionId));
|
|
|
1016 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
|
|
1017 |
}
|
|
|
1018 |
else if (OrderStatus.COD_VERIFICATION_FAILED.equals(orderStatusEnum)) {
|
|
|
1019 |
transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, cancelReason);
|
|
|
1020 |
transactionServiceClient.updateCODAgent(currentAgentEmailId, Long.parseLong(orderId));
|
|
|
1021 |
}
|
|
|
1022 |
else {
|
|
|
1023 |
throw new UnsupportedOperationException("Cannot update status of transactionId: " + transactionId + " to: " + orderStatus);
|
|
|
1024 |
}
|
|
|
1025 |
|
|
|
1026 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1027 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1028 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1029 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1030 |
|
|
|
1031 |
// Inserting activity
|
|
|
1032 |
Activity activity = new Activity();
|
|
|
1033 |
activity.setDescription("Status updated for Transaction Id: " + transactionId
|
|
|
1034 |
+ " to " + orderStatus + ", Reason: " + cancelReason + body);
|
|
|
1035 |
activity.setType(ActivityType.OTHER);
|
|
|
1036 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1037 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1038 |
activity.setCreatorId(creatorId);
|
|
|
1039 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1040 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1041 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1042 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1043 |
|
|
|
1044 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1045 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1046 |
|
|
|
1047 |
} catch (TException e) {
|
|
|
1048 |
log.info("Thrift exception", e);
|
|
|
1049 |
} catch (NumberFormatException e) {
|
|
|
1050 |
log.info("Could not convert to long", e);
|
|
|
1051 |
} catch (TransactionServiceException e) {
|
|
|
1052 |
log.info("Transaction client exception", e);
|
|
|
1053 |
}
|
|
|
1054 |
|
|
|
1055 |
return edit();
|
|
|
1056 |
}
|
|
|
1057 |
|
| 3137 |
mandeep.dh |
1058 |
public User getUser(Long userId) {
|
|
|
1059 |
User user = null;
|
|
|
1060 |
|
|
|
1061 |
try {
|
| 3390 |
mandeep.dh |
1062 |
userContextServiceClient = new UserClient().getClient();
|
| 3137 |
mandeep.dh |
1063 |
user = userContextServiceClient.getUserById(userId);
|
|
|
1064 |
} catch (UserContextException e) {
|
|
|
1065 |
String errorString = "Could not fetch user for " + userId;
|
|
|
1066 |
log.error(errorString, e);
|
|
|
1067 |
addActionError(errorString);
|
|
|
1068 |
} catch (TException e) {
|
|
|
1069 |
String errorString = "Could not create client";
|
|
|
1070 |
log.error(errorString, e);
|
|
|
1071 |
addActionError(errorString);
|
|
|
1072 |
}
|
|
|
1073 |
|
|
|
1074 |
return user;
|
|
|
1075 |
}
|
| 4267 |
anupam.sin |
1076 |
|
| 4438 |
anupam.sin |
1077 |
public String allowPayment() {
|
|
|
1078 |
try {
|
|
|
1079 |
log.info("Allowing payment for paymentId = " + paymentId);
|
|
|
1080 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1081 |
transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
|
|
|
1082 |
if (id != null && !id.isEmpty()) {
|
|
|
1083 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1084 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1085 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1086 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1087 |
// Inserting activity
|
|
|
1088 |
if(ticket != null) {
|
|
|
1089 |
Activity activity = new Activity();
|
|
|
1090 |
activity.setDescription("Flagged Payment allowed");
|
|
|
1091 |
activity.setType(ActivityType.OTHER);
|
|
|
1092 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1093 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1094 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1095 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1096 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1097 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1098 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1099 |
|
|
|
1100 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1101 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1102 |
}
|
|
|
1103 |
}
|
|
|
1104 |
|
|
|
1105 |
} catch (TException e) {
|
|
|
1106 |
log.error("Error while getting tickets", e);
|
|
|
1107 |
return EXCEPTION;
|
|
|
1108 |
} catch (NumberFormatException e) {
|
|
|
1109 |
log.error("Invalid ticket Id", e);
|
|
|
1110 |
return EXCEPTION;
|
|
|
1111 |
} catch (TransactionServiceException e) {
|
|
|
1112 |
log.error("Error while marking transactions as Flag removed", e);
|
|
|
1113 |
return EXCEPTION;
|
|
|
1114 |
}
|
| 4267 |
anupam.sin |
1115 |
return edit();
|
|
|
1116 |
}
|
|
|
1117 |
|
| 4490 |
anupam.sin |
1118 |
public String blockPayment() {
|
| 4438 |
anupam.sin |
1119 |
try {
|
|
|
1120 |
log.info("Blocking payment for paymentId = " + paymentId);
|
|
|
1121 |
transactionServiceClient = new TransactionClient().getClient();
|
|
|
1122 |
transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
|
|
|
1123 |
if (id != null && !id.isEmpty()) {
|
|
|
1124 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1125 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1126 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1127 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1128 |
// Inserting activity
|
|
|
1129 |
if(ticket != null) {
|
|
|
1130 |
Activity activity = new Activity();
|
|
|
1131 |
activity.setDescription("Flagged Payment allowed");
|
|
|
1132 |
activity.setType(ActivityType.OTHER);
|
|
|
1133 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1134 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1135 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1136 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1137 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1138 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1139 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1140 |
|
|
|
1141 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1142 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1143 |
}
|
|
|
1144 |
}
|
|
|
1145 |
|
|
|
1146 |
} catch (TException e) {
|
|
|
1147 |
log.error("Error while getting tickets", e);
|
|
|
1148 |
return EXCEPTION;
|
|
|
1149 |
} catch (NumberFormatException e) {
|
|
|
1150 |
log.error("Invalid ticket Id", e);
|
|
|
1151 |
return EXCEPTION;
|
|
|
1152 |
} catch (TransactionServiceException e) {
|
|
|
1153 |
log.error("Error while allowing flagged payment", e);
|
|
|
1154 |
return EXCEPTION;
|
|
|
1155 |
}
|
| 4267 |
anupam.sin |
1156 |
return edit();
|
|
|
1157 |
}
|
| 4490 |
anupam.sin |
1158 |
|
|
|
1159 |
public String authorizeReturn() {
|
|
|
1160 |
try {
|
|
|
1161 |
log.info("Authorizing OrderId =" + orderId);
|
| 7645 |
anupam.sin |
1162 |
boolean isReship = false;
|
|
|
1163 |
boolean fromStore = false;
|
| 4490 |
anupam.sin |
1164 |
transactionServiceClient = new TransactionClient().getClient();
|
| 7645 |
anupam.sin |
1165 |
if(premises.equals("store")) {
|
|
|
1166 |
fromStore = true;
|
|
|
1167 |
}
|
|
|
1168 |
|
|
|
1169 |
if(closureType.equals("reship")) {
|
|
|
1170 |
isReship = true;
|
|
|
1171 |
}
|
|
|
1172 |
transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), true, fromStore, isReship);
|
| 4490 |
anupam.sin |
1173 |
if (id != null && !id.isEmpty()) {
|
|
|
1174 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1175 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1176 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1177 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1178 |
// Inserting activity
|
|
|
1179 |
if(ticket != null) {
|
|
|
1180 |
Activity activity = new Activity();
|
|
|
1181 |
activity.setDescription("Return Authorized");
|
|
|
1182 |
activity.setType(ActivityType.OTHER);
|
|
|
1183 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1184 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1185 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1186 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1187 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1188 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1189 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 3137 |
mandeep.dh |
1190 |
|
| 4490 |
anupam.sin |
1191 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1192 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1193 |
}
|
|
|
1194 |
}
|
|
|
1195 |
|
|
|
1196 |
} catch (TException e) {
|
|
|
1197 |
log.error("Error while getting tickets", e);
|
|
|
1198 |
return EXCEPTION;
|
|
|
1199 |
} catch (NumberFormatException e) {
|
|
|
1200 |
log.error("Invalid ticket Id", e);
|
|
|
1201 |
return EXCEPTION;
|
|
|
1202 |
} catch (TransactionServiceException e) {
|
|
|
1203 |
log.error("Error while authorizing Return", e);
|
|
|
1204 |
return EXCEPTION;
|
|
|
1205 |
}
|
|
|
1206 |
return edit();
|
|
|
1207 |
}
|
|
|
1208 |
|
|
|
1209 |
public String denyReturn() {
|
|
|
1210 |
try {
|
|
|
1211 |
log.info("Denying OrderId =" + orderId);
|
|
|
1212 |
transactionServiceClient = new TransactionClient().getClient();
|
| 7645 |
anupam.sin |
1213 |
transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), false, false, false);
|
| 4490 |
anupam.sin |
1214 |
if (id != null && !id.isEmpty()) {
|
|
|
1215 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1216 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1217 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1218 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1219 |
// Inserting activity
|
|
|
1220 |
if(ticket != null) {
|
|
|
1221 |
Activity activity = new Activity();
|
|
|
1222 |
activity.setDescription("Return Denied");
|
|
|
1223 |
activity.setType(ActivityType.OTHER);
|
|
|
1224 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1225 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1226 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1227 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1228 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1229 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1230 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1231 |
|
|
|
1232 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1233 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1234 |
}
|
|
|
1235 |
}
|
|
|
1236 |
|
|
|
1237 |
} catch (TException e) {
|
|
|
1238 |
log.error("Error while getting tickets", e);
|
|
|
1239 |
return EXCEPTION;
|
|
|
1240 |
} catch (NumberFormatException e) {
|
|
|
1241 |
log.error("Invalid ticket Id", e);
|
|
|
1242 |
return EXCEPTION;
|
|
|
1243 |
} catch (TransactionServiceException e) {
|
|
|
1244 |
log.error("Error while denying Return", e);
|
|
|
1245 |
return EXCEPTION;
|
|
|
1246 |
}
|
|
|
1247 |
return edit();
|
|
|
1248 |
}
|
|
|
1249 |
|
|
|
1250 |
public String authorizeDOA() {
|
|
|
1251 |
try {
|
|
|
1252 |
log.info("Authorizing OrderId =" + orderId);
|
| 7645 |
anupam.sin |
1253 |
boolean isReship = false;
|
|
|
1254 |
boolean fromStore = false;
|
| 4490 |
anupam.sin |
1255 |
transactionServiceClient = new TransactionClient().getClient();
|
| 7645 |
anupam.sin |
1256 |
if(premises.equals("store")) {
|
|
|
1257 |
fromStore = true;
|
|
|
1258 |
}
|
|
|
1259 |
|
|
|
1260 |
if(closureType.equals("reship")) {
|
|
|
1261 |
isReship = true;
|
|
|
1262 |
}
|
|
|
1263 |
transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), true, fromStore, isReship);
|
| 4490 |
anupam.sin |
1264 |
if (id != null && !id.isEmpty()) {
|
|
|
1265 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1266 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1267 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1268 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1269 |
// Inserting activity
|
|
|
1270 |
if(ticket != null) {
|
|
|
1271 |
Activity activity = new Activity();
|
|
|
1272 |
activity.setDescription("DOA Authorized");
|
|
|
1273 |
activity.setType(ActivityType.OTHER);
|
|
|
1274 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1275 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1276 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1277 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1278 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1279 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1280 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1281 |
|
|
|
1282 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1283 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1284 |
}
|
|
|
1285 |
}
|
|
|
1286 |
|
|
|
1287 |
} catch (TException e) {
|
|
|
1288 |
log.error("Error while getting tickets", e);
|
|
|
1289 |
return EXCEPTION;
|
|
|
1290 |
} catch (NumberFormatException e) {
|
|
|
1291 |
log.error("Invalid ticket Id", e);
|
|
|
1292 |
return EXCEPTION;
|
|
|
1293 |
} catch (TransactionServiceException e) {
|
|
|
1294 |
log.error("Error while authorizing DOA", e);
|
|
|
1295 |
return EXCEPTION;
|
|
|
1296 |
}
|
|
|
1297 |
return edit();
|
|
|
1298 |
}
|
|
|
1299 |
|
|
|
1300 |
public String denyDOA() {
|
|
|
1301 |
try {
|
|
|
1302 |
log.info("Denying OrderId =" + orderId);
|
|
|
1303 |
transactionServiceClient = new TransactionClient().getClient();
|
| 7645 |
anupam.sin |
1304 |
transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), false, false, false);
|
| 4490 |
anupam.sin |
1305 |
if (id != null && !id.isEmpty()) {
|
|
|
1306 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1307 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1308 |
searchFilter.setTicketId(Long.parseLong(id));
|
|
|
1309 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
|
|
1310 |
// Inserting activity
|
|
|
1311 |
if(ticket != null) {
|
|
|
1312 |
Activity activity = new Activity();
|
|
|
1313 |
activity.setDescription("DOA Denied");
|
|
|
1314 |
activity.setType(ActivityType.OTHER);
|
|
|
1315 |
activity.setTicketPriority(ticket.getPriority());
|
|
|
1316 |
activity.setTicketStatus(ticket.getStatus());
|
|
|
1317 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
|
|
1318 |
activity.setTicketCategory(ticket.getCategory());
|
|
|
1319 |
activity.setTicketDescription(ticket.getDescription());
|
|
|
1320 |
activity.setCustomerId(ticket.getCustomerId());
|
|
|
1321 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
|
|
1322 |
|
|
|
1323 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1324 |
crmServiceClient.updateTicket(ticket, activity);
|
|
|
1325 |
}
|
|
|
1326 |
}
|
|
|
1327 |
|
|
|
1328 |
} catch (TException e) {
|
|
|
1329 |
log.error("Error while getting tickets", e);
|
|
|
1330 |
return EXCEPTION;
|
|
|
1331 |
} catch (NumberFormatException e) {
|
|
|
1332 |
log.error("Invalid ticket Id", e);
|
|
|
1333 |
return EXCEPTION;
|
|
|
1334 |
} catch (TransactionServiceException e) {
|
|
|
1335 |
log.error("Error while denying DOA", e);
|
|
|
1336 |
return EXCEPTION;
|
|
|
1337 |
}
|
|
|
1338 |
return edit();
|
|
|
1339 |
}
|
| 5407 |
amar.kumar |
1340 |
|
| 14882 |
manish.sha |
1341 |
public String loadProfitMandiTickets() throws ParseException {
|
|
|
1342 |
try {
|
|
|
1343 |
SearchFilter searchFilter = new SearchFilter();
|
|
|
1344 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
|
|
1345 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
|
|
1346 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
|
|
1347 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1348 |
tickets = new ArrayList<Ticket>();
|
| 16244 |
manish.sha |
1349 |
searchFilter.setTicketCategoryList(profitMandiTicketCategoryList);
|
| 14882 |
manish.sha |
1350 |
tickets.addAll(crmServiceClient.getTickets(searchFilter));
|
|
|
1351 |
} catch (TException e) {
|
|
|
1352 |
String errorString = "Error getting tickets for "
|
|
|
1353 |
+ currentAgentEmailId;
|
|
|
1354 |
log.error(errorString, e);
|
|
|
1355 |
addActionError(errorString);
|
|
|
1356 |
}
|
|
|
1357 |
return index();
|
|
|
1358 |
}
|
|
|
1359 |
|
| 5909 |
amar.kumar |
1360 |
public String getAllOpenTickets() {
|
|
|
1361 |
try {
|
|
|
1362 |
ticketCategorycountMap= new HashMap<String, Long>();
|
|
|
1363 |
crmServiceClient = new CRMClient().getClient();
|
|
|
1364 |
ticketCategorycountMap = crmServiceClient.getOpenTicketsMap();
|
|
|
1365 |
} catch (TException e) {
|
|
|
1366 |
String errorString = "Error getting tickets for "
|
|
|
1367 |
+ currentAgentEmailId;
|
|
|
1368 |
log.error(errorString, e);
|
|
|
1369 |
addActionError(errorString);
|
|
|
1370 |
}
|
|
|
1371 |
return OPEN;
|
|
|
1372 |
}
|
|
|
1373 |
|
| 5407 |
amar.kumar |
1374 |
public double getCustomerTrustLevel(long userId) {
|
|
|
1375 |
try {
|
|
|
1376 |
userContextServiceClient = new UserClient().getClient();
|
|
|
1377 |
return userContextServiceClient.getTrustLevel(userId);
|
|
|
1378 |
} catch (TException e) {
|
|
|
1379 |
log.info("Exception while getting trustLevel for " +
|
|
|
1380 |
"userId " + userId);
|
|
|
1381 |
}
|
|
|
1382 |
return 0;
|
|
|
1383 |
}
|
| 4490 |
anupam.sin |
1384 |
|
| 4020 |
mandeep.dh |
1385 |
public EscalationMatrix[] getEscalationMatrix () {
|
|
|
1386 |
return CRMConstants.EscalationMatrix.values();
|
|
|
1387 |
}
|
| 16244 |
manish.sha |
1388 |
|
|
|
1389 |
public PMEscalationMatrix[] getPMEscalationMatrix () {
|
|
|
1390 |
return CRMConstants.PMEscalationMatrix.values();
|
|
|
1391 |
}
|
| 4020 |
mandeep.dh |
1392 |
|
| 3546 |
mandeep.dh |
1393 |
public String getAddress(Order order) {
|
|
|
1394 |
return ModelUtils.extractAddressFromOrder(order);
|
|
|
1395 |
}
|
|
|
1396 |
|
|
|
1397 |
public String getProductName(LineItem lineItem) {
|
| 4008 |
mandeep.dh |
1398 |
return ModelUtils.extractProductNameFromLineItem(lineItem) + " " + lineItem.getColor();
|
| 3546 |
mandeep.dh |
1399 |
}
|
|
|
1400 |
|
| 3405 |
mandeep.dh |
1401 |
public ActivityType[] getActivityTypes() {
|
|
|
1402 |
return ActivityType.values();
|
|
|
1403 |
}
|
|
|
1404 |
|
|
|
1405 |
public TicketStatus[] getTicketStatuses() {
|
|
|
1406 |
return TicketStatus.values();
|
|
|
1407 |
}
|
|
|
1408 |
|
| 3390 |
mandeep.dh |
1409 |
public Agent getAgent(long agentId) throws TException {
|
|
|
1410 |
return CRMAuthorizingRealm.getAgent(agentId);
|
| 3137 |
mandeep.dh |
1411 |
}
|
|
|
1412 |
|
| 3339 |
mandeep.dh |
1413 |
public List<Agent> getAllAgents() {
|
| 16244 |
manish.sha |
1414 |
List<Agent> allagents = CRMAuthorizingRealm.getAgents();
|
|
|
1415 |
List<Agent> requiredAgents = new ArrayList<Agent>();
|
|
|
1416 |
if(isSaholicAndProfitMandiAllowed()){
|
|
|
1417 |
return allagents;
|
|
|
1418 |
} else if(isProfitMandiAgent()){
|
|
|
1419 |
for(Agent agent: allagents){
|
|
|
1420 |
if(agent.isIs_pmCrmUser()){
|
|
|
1421 |
requiredAgents.add(agent);
|
|
|
1422 |
}
|
|
|
1423 |
}
|
|
|
1424 |
return requiredAgents;
|
|
|
1425 |
} else{
|
|
|
1426 |
for(Agent agent: allagents){
|
|
|
1427 |
if(!agent.isIs_pmCrmUser()||agent.isIs_allAssignable()){
|
|
|
1428 |
requiredAgents.add(agent);
|
|
|
1429 |
}
|
|
|
1430 |
}
|
|
|
1431 |
return requiredAgents;
|
|
|
1432 |
}
|
| 3339 |
mandeep.dh |
1433 |
}
|
|
|
1434 |
|
| 16248 |
manish.sha |
1435 |
public List<TicketCategory> getTicketCategories() {
|
|
|
1436 |
List<TicketCategory> allCategories = Arrays.asList(TicketCategory.values());
|
|
|
1437 |
List<TicketCategory> requiredCategories = new ArrayList<TicketCategory>();
|
|
|
1438 |
if(isSaholicAndProfitMandiAllowed()){
|
|
|
1439 |
return allCategories;
|
|
|
1440 |
}else if(isProfitMandiAgent()){
|
|
|
1441 |
for(TicketCategory tkCategory: allCategories){
|
|
|
1442 |
if(profitMandiTicketCategoryList.contains(tkCategory)){
|
|
|
1443 |
requiredCategories.add(tkCategory);
|
|
|
1444 |
}
|
|
|
1445 |
}
|
|
|
1446 |
return requiredCategories;
|
|
|
1447 |
}else{
|
|
|
1448 |
for(TicketCategory tkCategory: allCategories){
|
|
|
1449 |
if(!profitMandiTicketCategoryList.contains(tkCategory)){
|
|
|
1450 |
requiredCategories.add(tkCategory);
|
|
|
1451 |
}
|
|
|
1452 |
}
|
|
|
1453 |
return requiredCategories;
|
|
|
1454 |
}
|
| 3339 |
mandeep.dh |
1455 |
}
|
| 16642 |
manish.sha |
1456 |
|
|
|
1457 |
private void sendMailToUser() throws SendGridException{
|
| 16645 |
manish.sha |
1458 |
log.info("Sending mail to user:- "+customerEmailId);
|
| 16642 |
manish.sha |
1459 |
SendGrid sendgrid = new SendGrid("profitmandi", "pma20aug");
|
|
|
1460 |
SendGrid.Email email = new SendGrid.Email();
|
|
|
1461 |
email.setFrom(CRMConstants.PROFIT_MANDI_EMAIL_SENDER);
|
|
|
1462 |
email.setFromName("ProfitMandi");
|
|
|
1463 |
email.addTo(customerEmailId);
|
|
|
1464 |
email.addBcc("backup@saholic.com");
|
|
|
1465 |
email.setSubject(subject);
|
| 16655 |
manish.sha |
1466 |
email.setHtml(body);
|
| 16649 |
manish.sha |
1467 |
log.info("Mail Body:- "+body);
|
| 16650 |
manish.sha |
1468 |
sendgrid.send(email);
|
|
|
1469 |
log.info("Mail sent to user:- "+customerEmailId);
|
| 16642 |
manish.sha |
1470 |
}
|
| 17080 |
manish.sha |
1471 |
|
|
|
1472 |
private void sendMailToManagers(String subject, String[] addTo, String body) throws SendGridException{
|
|
|
1473 |
SendGrid sendgrid = new SendGrid("profitmandi", "pma20aug");
|
|
|
1474 |
SendGrid.Email email = new SendGrid.Email();
|
|
|
1475 |
email.setFrom(CRMConstants.PROFIT_MANDI_EMAIL_SENDER);
|
|
|
1476 |
email.setFromName("ProfitMandi");
|
|
|
1477 |
email.addTo(addTo);
|
|
|
1478 |
email.addBcc("backup@saholic.com");
|
|
|
1479 |
email.setSubject(subject);
|
|
|
1480 |
email.setHtml(body);
|
|
|
1481 |
log.info("Mail Body:- "+body);
|
|
|
1482 |
sendgrid.send(email);
|
|
|
1483 |
log.info("Mail sent to user:- "+addTo);
|
|
|
1484 |
}
|
| 17083 |
manish.sha |
1485 |
|
|
|
1486 |
public void sendMailtoManagersUsingGmailUtils(String subject, String[] addTo, String body) throws MessagingException{
|
|
|
1487 |
GmailUtils mailer = new GmailUtils();
|
|
|
1488 |
mailer.sendSSLMessage(addTo, subject, body, "build-staging@shop2020.in", "shop2020", new ArrayList<File>());
|
|
|
1489 |
}
|
| 3339 |
mandeep.dh |
1490 |
|
|
|
1491 |
public TicketPriority[] getTicketPriorities() {
|
|
|
1492 |
return TicketPriority.values();
|
|
|
1493 |
}
|
|
|
1494 |
|
| 3137 |
mandeep.dh |
1495 |
public List<Ticket> getTickets() {
|
|
|
1496 |
return tickets;
|
|
|
1497 |
}
|
|
|
1498 |
|
|
|
1499 |
public void setTickets(List<Ticket> tickets) {
|
|
|
1500 |
this.tickets = tickets;
|
|
|
1501 |
}
|
| 3339 |
mandeep.dh |
1502 |
|
| 3405 |
mandeep.dh |
1503 |
public String getCustomerEmailId() {
|
|
|
1504 |
return customerEmailId;
|
| 3339 |
mandeep.dh |
1505 |
}
|
|
|
1506 |
|
| 3405 |
mandeep.dh |
1507 |
public void setCustomerEmailId(String customerEmailId) {
|
|
|
1508 |
this.customerEmailId = customerEmailId;
|
| 3339 |
mandeep.dh |
1509 |
}
|
|
|
1510 |
|
|
|
1511 |
public String getDescription() {
|
|
|
1512 |
return description;
|
|
|
1513 |
}
|
|
|
1514 |
|
|
|
1515 |
public void setDescription(String description) {
|
|
|
1516 |
this.description = description;
|
|
|
1517 |
}
|
|
|
1518 |
|
|
|
1519 |
public String getAssigneeEmailId() {
|
|
|
1520 |
return assigneeEmailId;
|
|
|
1521 |
}
|
|
|
1522 |
|
|
|
1523 |
public void setAssigneeEmailId(String assigneeEmailId) {
|
|
|
1524 |
this.assigneeEmailId = assigneeEmailId;
|
|
|
1525 |
}
|
|
|
1526 |
|
|
|
1527 |
public String getPriority() {
|
|
|
1528 |
return priority;
|
|
|
1529 |
}
|
|
|
1530 |
|
|
|
1531 |
public void setPriority(String priority) {
|
|
|
1532 |
this.priority = priority;
|
|
|
1533 |
}
|
|
|
1534 |
|
|
|
1535 |
public String getCategory() {
|
|
|
1536 |
return category;
|
|
|
1537 |
}
|
|
|
1538 |
|
|
|
1539 |
public void setCategory(String category) {
|
|
|
1540 |
this.category = category;
|
|
|
1541 |
}
|
|
|
1542 |
|
|
|
1543 |
public String getOrderId() {
|
|
|
1544 |
return orderId;
|
|
|
1545 |
}
|
|
|
1546 |
|
|
|
1547 |
public void setOrderId(String orderId) {
|
|
|
1548 |
this.orderId = orderId;
|
|
|
1549 |
}
|
| 3397 |
mandeep.dh |
1550 |
|
|
|
1551 |
public String[] getAgentIds() {
|
|
|
1552 |
return agentIds;
|
|
|
1553 |
}
|
|
|
1554 |
|
|
|
1555 |
public void setAgentIds(String[] agentIds) {
|
|
|
1556 |
this.agentIds = agentIds;
|
|
|
1557 |
}
|
|
|
1558 |
|
|
|
1559 |
public String getStartTimestamp() {
|
|
|
1560 |
return startTimestamp;
|
|
|
1561 |
}
|
|
|
1562 |
|
|
|
1563 |
public void setStartTimestamp(String startTimestamp) {
|
|
|
1564 |
this.startTimestamp = startTimestamp;
|
|
|
1565 |
}
|
|
|
1566 |
|
|
|
1567 |
public String getEndTimestamp() {
|
|
|
1568 |
return endTimestamp;
|
|
|
1569 |
}
|
|
|
1570 |
|
|
|
1571 |
public void setEndTimestamp(String endTimestamp) {
|
|
|
1572 |
this.endTimestamp = endTimestamp;
|
|
|
1573 |
}
|
| 3405 |
mandeep.dh |
1574 |
|
|
|
1575 |
public String getUserId() {
|
|
|
1576 |
return userId;
|
|
|
1577 |
}
|
|
|
1578 |
|
|
|
1579 |
public void setUserId(String userId) {
|
|
|
1580 |
this.userId = userId;
|
|
|
1581 |
}
|
|
|
1582 |
|
|
|
1583 |
public String getId() {
|
|
|
1584 |
return id;
|
|
|
1585 |
}
|
|
|
1586 |
|
|
|
1587 |
public void setId(String id) {
|
|
|
1588 |
this.id = id;
|
|
|
1589 |
}
|
|
|
1590 |
|
|
|
1591 |
public String getActivityDescription() {
|
|
|
1592 |
return activityDescription;
|
|
|
1593 |
}
|
|
|
1594 |
|
|
|
1595 |
public void setActivityDescription(String activityDescription) {
|
|
|
1596 |
this.activityDescription = activityDescription;
|
|
|
1597 |
}
|
|
|
1598 |
|
|
|
1599 |
public String getStatus() {
|
|
|
1600 |
return status;
|
|
|
1601 |
}
|
|
|
1602 |
|
|
|
1603 |
public void setStatus(String status) {
|
|
|
1604 |
this.status = status;
|
|
|
1605 |
}
|
|
|
1606 |
|
|
|
1607 |
public String getActivityType() {
|
|
|
1608 |
return activityType;
|
|
|
1609 |
}
|
|
|
1610 |
|
|
|
1611 |
public void setActivityType(String activityType) {
|
|
|
1612 |
this.activityType = activityType;
|
|
|
1613 |
}
|
|
|
1614 |
|
|
|
1615 |
public Ticket getTicket() {
|
|
|
1616 |
return ticket;
|
|
|
1617 |
}
|
|
|
1618 |
|
|
|
1619 |
public void setTicket(Ticket ticket) {
|
|
|
1620 |
this.ticket = ticket;
|
|
|
1621 |
}
|
|
|
1622 |
|
|
|
1623 |
public List<Activity> getActivities() {
|
|
|
1624 |
return activities;
|
|
|
1625 |
}
|
|
|
1626 |
|
|
|
1627 |
public void setActivities(List<Activity> activities) {
|
|
|
1628 |
this.activities = activities;
|
|
|
1629 |
}
|
|
|
1630 |
|
|
|
1631 |
public String getSubject() {
|
|
|
1632 |
return subject;
|
|
|
1633 |
}
|
|
|
1634 |
|
|
|
1635 |
public void setSubject(String subject) {
|
|
|
1636 |
this.subject = subject;
|
|
|
1637 |
}
|
|
|
1638 |
|
|
|
1639 |
public String getBody() {
|
|
|
1640 |
return body;
|
|
|
1641 |
}
|
|
|
1642 |
|
|
|
1643 |
public void setBody(String body) {
|
|
|
1644 |
this.body = body;
|
|
|
1645 |
}
|
|
|
1646 |
|
|
|
1647 |
public String getCustomerName() {
|
|
|
1648 |
return customerName;
|
|
|
1649 |
}
|
|
|
1650 |
|
|
|
1651 |
public void setCustomerName(String customerName) {
|
|
|
1652 |
this.customerName = customerName;
|
|
|
1653 |
}
|
|
|
1654 |
|
|
|
1655 |
public String getCustomerMobileNumber() {
|
|
|
1656 |
return customerMobileNumber;
|
|
|
1657 |
}
|
|
|
1658 |
|
|
|
1659 |
public void setCustomerMobileNumber(String customerMobileNumber) {
|
|
|
1660 |
this.customerMobileNumber = customerMobileNumber;
|
|
|
1661 |
}
|
| 3546 |
mandeep.dh |
1662 |
|
|
|
1663 |
public User getUser() {
|
|
|
1664 |
return user;
|
|
|
1665 |
}
|
|
|
1666 |
|
|
|
1667 |
public void setUser(User user) {
|
|
|
1668 |
this.user = user;
|
|
|
1669 |
}
|
|
|
1670 |
|
|
|
1671 |
public String getOrderStatus() {
|
|
|
1672 |
return orderStatus;
|
|
|
1673 |
}
|
|
|
1674 |
|
|
|
1675 |
public void setOrderStatus(String orderStatus) {
|
|
|
1676 |
this.orderStatus = orderStatus;
|
|
|
1677 |
}
|
|
|
1678 |
|
|
|
1679 |
public List<Order> getOrders() {
|
|
|
1680 |
return orders;
|
|
|
1681 |
}
|
|
|
1682 |
|
|
|
1683 |
public void setOrders(List<Order> orders) {
|
|
|
1684 |
this.orders = orders;
|
|
|
1685 |
}
|
| 4020 |
mandeep.dh |
1686 |
|
|
|
1687 |
public String getEscalate() {
|
|
|
1688 |
return escalate;
|
|
|
1689 |
}
|
|
|
1690 |
|
|
|
1691 |
public void setEscalate(String escalate) {
|
|
|
1692 |
this.escalate = escalate;
|
|
|
1693 |
}
|
| 4241 |
anupam.sin |
1694 |
|
|
|
1695 |
public String getCancelReason() {
|
|
|
1696 |
return cancelReason;
|
|
|
1697 |
}
|
|
|
1698 |
|
|
|
1699 |
public void setCancelReason(String cancelReason) {
|
|
|
1700 |
this.cancelReason = cancelReason;
|
|
|
1701 |
}
|
| 4267 |
anupam.sin |
1702 |
|
|
|
1703 |
public List<Payment> getPayments() {
|
|
|
1704 |
return payments;
|
|
|
1705 |
}
|
|
|
1706 |
|
|
|
1707 |
public void setPayments(List<Payment> payments) {
|
|
|
1708 |
this.payments = payments;
|
|
|
1709 |
}
|
|
|
1710 |
|
|
|
1711 |
public String getTransactionId() {
|
|
|
1712 |
return transactionId;
|
|
|
1713 |
}
|
|
|
1714 |
|
|
|
1715 |
public void setTransactionId(String transactionId) {
|
|
|
1716 |
this.transactionId = transactionId;
|
|
|
1717 |
}
|
| 4438 |
anupam.sin |
1718 |
|
|
|
1719 |
public String getPaymentId() {
|
|
|
1720 |
return paymentId;
|
|
|
1721 |
}
|
|
|
1722 |
|
|
|
1723 |
public void setPaymentId(String paymentId) {
|
|
|
1724 |
this.paymentId = paymentId;
|
|
|
1725 |
}
|
| 4490 |
anupam.sin |
1726 |
|
|
|
1727 |
public HashMap<String, String> getAllAttachmentsForTicket() {
|
|
|
1728 |
return allAttachmentsForTicket;
|
|
|
1729 |
}
|
|
|
1730 |
|
|
|
1731 |
public void setAllAttachmentsForTicket(HashMap<String, String> allAttachmentsForTicket) {
|
|
|
1732 |
this.allAttachmentsForTicket = allAttachmentsForTicket;
|
|
|
1733 |
}
|
| 5791 |
anupam.sin |
1734 |
|
|
|
1735 |
public String getPickupExtension() {
|
|
|
1736 |
return pickupExtension;
|
|
|
1737 |
}
|
|
|
1738 |
|
|
|
1739 |
public void setPickupExtension(String pickupExtension) {
|
|
|
1740 |
this.pickupExtension = pickupExtension;
|
|
|
1741 |
}
|
| 5909 |
amar.kumar |
1742 |
|
|
|
1743 |
public Map<String, Long> getTicketCategorycountMap() {
|
|
|
1744 |
return ticketCategorycountMap;
|
|
|
1745 |
}
|
|
|
1746 |
|
|
|
1747 |
public void setTicketCategorycountMap(
|
|
|
1748 |
Map<String, Long> ticketCategorycountMap) {
|
|
|
1749 |
this.ticketCategorycountMap = ticketCategorycountMap;
|
|
|
1750 |
}
|
| 7645 |
anupam.sin |
1751 |
|
|
|
1752 |
public String getPremises() {
|
|
|
1753 |
return premises;
|
|
|
1754 |
}
|
|
|
1755 |
|
|
|
1756 |
public void setPremises(String premises) {
|
|
|
1757 |
this.premises = premises;
|
|
|
1758 |
}
|
|
|
1759 |
|
|
|
1760 |
public String getClosureType() {
|
|
|
1761 |
return closureType;
|
|
|
1762 |
}
|
|
|
1763 |
|
|
|
1764 |
public void setClosureType(String closureType) {
|
|
|
1765 |
this.closureType = closureType;
|
|
|
1766 |
}
|
| 19072 |
manish.sha |
1767 |
|
|
|
1768 |
|
|
|
1769 |
public String getQuantity() {
|
|
|
1770 |
return quantity;
|
|
|
1771 |
}
|
|
|
1772 |
|
|
|
1773 |
public void setQuantity(String quantity) {
|
|
|
1774 |
this.quantity = quantity;
|
|
|
1775 |
}
|
|
|
1776 |
|
| 18341 |
amit.gupta |
1777 |
|
|
|
1778 |
public Map<Long, Order> getTransactions() {
|
|
|
1779 |
return transactions;
|
|
|
1780 |
}
|
|
|
1781 |
|
|
|
1782 |
public void setTransactions(Map<Long, Order> transactions) {
|
|
|
1783 |
this.transactions = transactions;
|
|
|
1784 |
}
|
|
|
1785 |
|
| 18342 |
amit.gupta |
1786 |
public Map<Long, Long> getTransactionShipping() {
|
| 18341 |
amit.gupta |
1787 |
return transactionShipping;
|
|
|
1788 |
}
|
|
|
1789 |
|
| 18342 |
amit.gupta |
1790 |
public void setTransactionShipping(Map<Long, Long> transactionShipping) {
|
| 18341 |
amit.gupta |
1791 |
this.transactionShipping = transactionShipping;
|
|
|
1792 |
}
|
|
|
1793 |
|
| 18342 |
amit.gupta |
1794 |
public Map<Long, Long> getTransactionTotal() {
|
| 18341 |
amit.gupta |
1795 |
return transactionTotal;
|
|
|
1796 |
}
|
|
|
1797 |
|
| 18342 |
amit.gupta |
1798 |
public void setTransactionTotal(Map<Long, Long> transactionTotal) {
|
| 18341 |
amit.gupta |
1799 |
this.transactionTotal = transactionTotal;
|
|
|
1800 |
}
|
| 3137 |
mandeep.dh |
1801 |
}
|