| Line 12... |
Line 12... |
| 12 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
12 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 13 |
import com.spice.profitmandi.dao.model.*;
|
13 |
import com.spice.profitmandi.dao.model.*;
|
| 14 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
14 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 15 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
15 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 16 |
import com.spice.profitmandi.service.EmailService;
|
16 |
import com.spice.profitmandi.service.EmailService;
|
| - |
|
17 |
import com.spice.profitmandi.service.mail.MailOutboxService;
|
| 17 |
import com.spice.profitmandi.service.user.RetailerService;
|
18 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 18 |
import org.apache.commons.collections4.map.HashedMap;
|
19 |
import org.apache.commons.collections4.map.HashedMap;
|
| 19 |
import org.apache.commons.lang.RandomStringUtils;
|
20 |
import org.apache.commons.lang.RandomStringUtils;
|
| 20 |
import org.apache.commons.lang.StringUtils;
|
21 |
import org.apache.commons.lang.StringUtils;
|
| 21 |
import org.apache.logging.log4j.LogManager;
|
22 |
import org.apache.logging.log4j.LogManager;
|
| Line 49... |
Line 50... |
| 49 |
|
50 |
|
| 50 |
@Autowired
|
51 |
@Autowired
|
| 51 |
JavaMailSender mailSender;
|
52 |
JavaMailSender mailSender;
|
| 52 |
|
53 |
|
| 53 |
@Autowired
|
54 |
@Autowired
|
| - |
|
55 |
MailOutboxService mailOutboxService;
|
| - |
|
56 |
|
| - |
|
57 |
@Autowired
|
| 54 |
TicketCategoryRepository ticketCategoryRepository;
|
58 |
TicketCategoryRepository ticketCategoryRepository;
|
| 55 |
|
59 |
|
| 56 |
@Autowired
|
60 |
@Autowired
|
| 57 |
TicketSubCategoryRepository ticketSubCategoryRepository;
|
61 |
TicketSubCategoryRepository ticketSubCategoryRepository;
|
| 58 |
|
62 |
|
| Line 313... |
Line 317... |
| 313 |
List<Integer> oldAssignedAuthUserIds = oldTicketAssignedList.stream().map(x -> x.getAssineeId()).collect(Collectors.toList());
|
317 |
List<Integer> oldAssignedAuthUserIds = oldTicketAssignedList.stream().map(x -> x.getAssineeId()).collect(Collectors.toList());
|
| 314 |
List<String> oldAssignedEmailIds = authRepository.selectByIds(oldAssignedAuthUserIds).stream().map(x -> x.getEmailId()).collect(Collectors.toList());
|
318 |
List<String> oldAssignedEmailIds = authRepository.selectByIds(oldAssignedAuthUserIds).stream().map(x -> x.getEmailId()).collect(Collectors.toList());
|
| 315 |
String mailTo = oldAssignedEmailIds.remove(0);
|
319 |
String mailTo = oldAssignedEmailIds.remove(0);
|
| 316 |
String message = String.format(CATEGORY_CHANGED_TICKET, ticket.getId(), storeName, ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName());
|
320 |
String message = String.format(CATEGORY_CHANGED_TICKET, ticket.getId(), storeName, ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName());
|
| 317 |
try {
|
321 |
try {
|
| 318 |
Utils.sendMailWithAttachments(mailSender, mailTo, oldAssignedEmailIds.toArray(new String[0]), "Ticket Category/Subcategory Changed", message, null);
|
322 |
mailOutboxService.queueMail(mailTo, oldAssignedEmailIds.toArray(new String[0]), "Ticket Category/Subcategory Changed", message, "CsServiceImpl.updateTicket");
|
| 319 |
} catch (Exception e) {
|
323 |
} catch (Exception e) {
|
| 320 |
LOGGER.info("Could not send mail for ticket {}", ticket.toString());
|
324 |
LOGGER.info("Could not send mail for ticket {}", ticket.toString());
|
| 321 |
}
|
325 |
}
|
| 322 |
|
326 |
|
| 323 |
Activity categoryChangedActivity = this.createActivity(ActivityType.CATEGORY_CHANGED, "Category changed to " + ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName(), 0);
|
327 |
Activity categoryChangedActivity = this.createActivity(ActivityType.CATEGORY_CHANGED, "Category changed to " + ticketSubCategory.getTicketCategory().getName() + " - " + ticketSubCategory.getName(), 0);
|
| Line 660... |
Line 664... |
| 660 |
messageFormat = ESCALATED_TICKET;
|
664 |
messageFormat = ESCALATED_TICKET;
|
| 661 |
} else {
|
665 |
} else {
|
| 662 |
messageFormat = ASSIGNED_TICKET;
|
666 |
messageFormat = ASSIGNED_TICKET;
|
| 663 |
}
|
667 |
}
|
| 664 |
String message = String.format(messageFormat, authUserTo.getName(), ticket.getId(), activities.get(0).getMessage(), retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName());
|
668 |
String message = String.format(messageFormat, authUserTo.getName(), ticket.getId(), activities.get(0).getMessage(), retailerService.getFofoRetailer(ticket.getFofoId()).getBusinessName());
|
| 665 |
Utils.sendMailWithAttachments(mailSender, authUserTo.getEmailId(), ccTo, ASSINMENT_SUBJECT, message, null);
|
669 |
mailOutboxService.queueMail(authUserTo.getEmailId(), ccTo, ASSINMENT_SUBJECT, message, "CsServiceImpl.sendAssignedTicketMail");
|
| 666 |
} catch (Exception e) {
|
670 |
} catch (Exception e) {
|
| 667 |
e.printStackTrace();
|
671 |
e.printStackTrace();
|
| 668 |
throw new ProfitMandiBusinessException("Ticket Assingment", authUserTo.getEmailId(), "Could not send ticket assignment mail");
|
672 |
throw new ProfitMandiBusinessException("Ticket Assingment", authUserTo.getEmailId(), "Could not send ticket assignment mail");
|
| 669 |
}
|
673 |
}
|
| 670 |
}
|
674 |
}
|