| Line 608... |
Line 608... |
| 608 |
@RequestParam OrderStatus orderStatus, Model model) throws Exception {
|
608 |
@RequestParam OrderStatus orderStatus, Model model) throws Exception {
|
| 609 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
609 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 610 |
//User userInfo = saholicUserRepository.selectById(loginDetails.getFofoId());
|
610 |
//User userInfo = saholicUserRepository.selectById(loginDetails.getFofoId());
|
| 611 |
LOGGER.info("status" + orderStatus);
|
611 |
LOGGER.info("status" + orderStatus);
|
| 612 |
try {
|
612 |
try {
|
| - |
|
613 |
Order order = orderRepository.selectById(orderId);
|
| 613 |
orderRepository.refundOrder(orderId, loginDetails.getEmailId(), reason, orderStatus);
|
614 |
orderRepository.refundOrder(orderId, loginDetails.getEmailId(), reason, orderStatus);
|
| 614 |
|
615 |
|
| - |
|
616 |
sendCancellationNotificationToPartner(order, reason);
|
| 615 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
617 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 616 |
|
618 |
|
| 617 |
} catch (TransactionServiceException | TException e) {
|
619 |
} catch (TransactionServiceException | TException e) {
|
| 618 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
620 |
model.addAttribute("response", mvcResponseSender.createResponseString(false));
|
| 619 |
|
621 |
|
| 620 |
}
|
622 |
}
|
| 621 |
return "response";
|
623 |
return "response";
|
| 622 |
}
|
624 |
}
|
| 623 |
|
625 |
|
| - |
|
626 |
private void sendCancellationNotificationToPartner(Order order, String reason) throws Exception {
|
| - |
|
627 |
Item item = itemRepository.selectById(order.getLineItem().getItemId());
|
| - |
|
628 |
NotificationCampaigns notification = new NotificationCampaigns();
|
| - |
|
629 |
notification.setName("Order Cancellation");
|
| - |
|
630 |
|
| - |
|
631 |
notification.setTitle(String.format("Order %s %d(Pcs) cancelled", item.getItemDescription(), order.getLineItem().getQuantity()));
|
| - |
|
632 |
|
| - |
|
633 |
notification.setMessage(reason);
|
| - |
|
634 |
notification.setType("url");
|
| - |
|
635 |
notification.setUrl("http://app.profitmandi.com/pages/home/notifications");
|
| - |
|
636 |
|
| - |
|
637 |
notification.setSql("SELECT distinct d1.user_id from devices d1 left join devices d2 on"
|
| - |
|
638 |
+ "(d1.imeinumber = d2.imeinumber and d1.created < d2.created) "
|
| - |
|
639 |
+ " where d2.id is null and d1.user_id = "
|
| - |
|
640 |
+ userAccountRepository.selectUserIdByRetailerId(order.getRetailerId()));
|
| - |
|
641 |
notification.setExpiresat(LocalDateTime.now().plusDays(2).toEpochSecond(ZoneOffset.UTC) * 1000);
|
| - |
|
642 |
notification.setStatus("active");
|
| - |
|
643 |
notification.setSmsprocessed(0);
|
| - |
|
644 |
notification.setNotification_processed(0);
|
| - |
|
645 |
notification.setNotification_type("GENERAL_NOTIFICATION");
|
| - |
|
646 |
mongoClient.persistNotificationCmpInfo(notification);
|
| - |
|
647 |
|
| - |
|
648 |
}
|
| - |
|
649 |
|
| 624 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
650 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
| 625 |
public String getNotifyItemColor(HttpServletRequest request, @RequestParam int catalogItemId,
|
651 |
public String getNotifyItemColor(HttpServletRequest request, @RequestParam int catalogItemId,
|
| 626 |
@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
|
652 |
@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
|
| 627 |
|
653 |
|
| 628 |
List<Item> availableColorItems = itemRepository.selectAllByCatalogItemId(catalogItemId);
|
654 |
List<Item> availableColorItems = itemRepository.selectAllByCatalogItemId(catalogItemId);
|