| Line 16... |
Line 16... |
| 16 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
16 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 17 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
17 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 18 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
18 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 19 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
19 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 20 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
20 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| - |
|
21 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 21 |
import com.spice.profitmandi.dao.enumuration.catalog.ByPassRequestStatus;
|
22 |
import com.spice.profitmandi.dao.enumuration.catalog.ByPassRequestStatus;
|
| 22 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
23 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 23 |
import com.spice.profitmandi.dao.model.*;
|
24 |
import com.spice.profitmandi.dao.model.*;
|
| 24 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
25 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 25 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
26 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| Line 30... |
Line 31... |
| 30 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
32 |
import com.spice.profitmandi.dao.repository.dtr.WebOfferRepository;
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
33 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 33 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
34 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
| 34 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
35 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| - |
|
36 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| - |
|
37 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
38 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
39 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
| 37 |
import com.spice.profitmandi.service.NotificationService;
|
40 |
import com.spice.profitmandi.service.NotificationService;
|
| 38 |
import com.spice.profitmandi.service.inventory.Combo;
|
41 |
import com.spice.profitmandi.service.inventory.Combo;
|
| 39 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
42 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| Line 212... |
Line 215... |
| 212 |
ComboModelRepository comboModelRepository;
|
215 |
ComboModelRepository comboModelRepository;
|
| 213 |
|
216 |
|
| 214 |
@Autowired
|
217 |
@Autowired
|
| 215 |
ComboMappedModelRepository comboMappedModelRepository;
|
218 |
ComboMappedModelRepository comboMappedModelRepository;
|
| 216 |
|
219 |
|
| - |
|
220 |
@Autowired
|
| - |
|
221 |
private UserRepository userUserRepository;
|
| - |
|
222 |
|
| - |
|
223 |
@Autowired
|
| - |
|
224 |
private AddressRepository addressRepository;
|
| - |
|
225 |
|
| 217 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
226 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 218 |
public String getCurrentAvailability(HttpServletRequest request,
|
227 |
public String getCurrentAvailability(HttpServletRequest request,
|
| 219 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
228 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 220 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
229 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 221 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
230 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| Line 893... |
Line 902... |
| 893 |
}
|
902 |
}
|
| 894 |
|
903 |
|
| 895 |
private void sendCancellationNotificationToPartner(Order order, String reason) throws Exception {
|
904 |
private void sendCancellationNotificationToPartner(Order order, String reason) throws Exception {
|
| 896 |
Item item = itemRepository.selectById(order.getLineItem().getItemId());
|
905 |
Item item = itemRepository.selectById(order.getLineItem().getItemId());
|
| 897 |
|
906 |
|
| - |
|
907 |
String title = "Order Cancellation";
|
| - |
|
908 |
String message = String.format("Order %s %d(Pcs) has been cancelled", item.getItemDescription(),
|
| - |
|
909 |
order.getLineItem().getQuantity());
|
| - |
|
910 |
|
| - |
|
911 |
com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(order.getRetailerId());
|
| - |
|
912 |
|
| - |
|
913 |
Address address = addressRepository.selectById(user.getAddressId());
|
| - |
|
914 |
|
| 898 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
915 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 899 |
sendNotificationModel.setCampaignName("Order Cancellation");
|
916 |
sendNotificationModel.setCampaignName(title);
|
| 900 |
sendNotificationModel.setTitle(String.format("Order %s %d(Pcs) cancelled", item.getItemDescription(),
|
- |
|
| 901 |
order.getLineItem().getQuantity()));
|
917 |
sendNotificationModel.setTitle(message);
|
| 902 |
sendNotificationModel.setType("url");
|
918 |
sendNotificationModel.setType("url");
|
| 903 |
sendNotificationModel.setMessage(reason);
|
919 |
sendNotificationModel.setMessage(reason);
|
| 904 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/orderDetails");
|
920 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/orderDetails");
|
| 905 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
921 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 906 |
sendNotificationModel.setMessageType(MessageType.notification);
|
922 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 907 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
923 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
| 908 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
924 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 909 |
notificationService.sendNotification(sendNotificationModel);
|
925 |
notificationService.sendNotification(sendNotificationModel);
|
| 910 |
|
926 |
|
| - |
|
927 |
notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
|
| - |
|
928 |
|
| 911 |
}
|
929 |
}
|
| 912 |
|
930 |
|
| 913 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
931 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
| 914 |
public String getNotifyItemColor(HttpServletRequest request, @RequestParam int catalogItemId,
|
932 |
public String getNotifyItemColor(HttpServletRequest request, @RequestParam int catalogItemId,
|
| 915 |
@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
|
933 |
@RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
|
| Line 1002... |
Line 1020... |
| 1002 |
LOGGER.info("orderIds" + orderIds);
|
1020 |
LOGGER.info("orderIds" + orderIds);
|
| 1003 |
List<Order> orders = orderRepository.selectByOrderIds(orderIds);
|
1021 |
List<Order> orders = orderRepository.selectByOrderIds(orderIds);
|
| 1004 |
for (Order order : orders) {
|
1022 |
for (Order order : orders) {
|
| 1005 |
LOGGER.info("order" + order.getId());
|
1023 |
LOGGER.info("order" + order.getId());
|
| 1006 |
|
1024 |
|
| - |
|
1025 |
String title = "Alert!";
|
| - |
|
1026 |
|
| 1007 |
NotifyMessage message = notifyMessageRepository.selectByNotifyId(notifytimestamp.getId());
|
1027 |
NotifyMessage message = notifyMessageRepository.selectByNotifyId(notifytimestamp.getId());
|
| 1008 |
|
1028 |
|
| - |
|
1029 |
com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(order.getRetailerId());
|
| - |
|
1030 |
|
| - |
|
1031 |
Address address = addressRepository.selectById(user.getAddressId());
|
| - |
|
1032 |
|
| 1009 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
1033 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 1010 |
sendNotificationModel.setCampaignName("Notify Partner");
|
1034 |
sendNotificationModel.setCampaignName("Notify Partner");
|
| 1011 |
sendNotificationModel.setMessage(message.getNotifyMessages());
|
1035 |
sendNotificationModel.setMessage(message.getNotifyMessages());
|
| 1012 |
sendNotificationModel.setType("url");
|
1036 |
sendNotificationModel.setType("url");
|
| 1013 |
sendNotificationModel.setTitle("Alert");
|
1037 |
sendNotificationModel.setTitle("Alert");
|
| Line 1017... |
Line 1041... |
| 1017 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
1041 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
| 1018 |
|
1042 |
|
| 1019 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
1043 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 1020 |
notificationService.sendNotification(sendNotificationModel);
|
1044 |
notificationService.sendNotification(sendNotificationModel);
|
| 1021 |
|
1045 |
|
| - |
|
1046 |
//notificationService.sendWhatsappMessage(message.getNotifyMessages(), title, address.getPhoneNumber());
|
| - |
|
1047 |
|
| 1022 |
}
|
1048 |
}
|
| 1023 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1049 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1024 |
return "response";
|
1050 |
return "response";
|
| 1025 |
}
|
1051 |
}
|
| 1026 |
|
1052 |
|
| Line 1752... |
Line 1778... |
| 1752 |
byPassRequest.setStatus(ByPassRequestStatus.REJECTED);
|
1778 |
byPassRequest.setStatus(ByPassRequestStatus.REJECTED);
|
| 1753 |
byPassRequest.setUpdatedTimestamp(LocalDateTime.now());
|
1779 |
byPassRequest.setUpdatedTimestamp(LocalDateTime.now());
|
| 1754 |
byPassRequest.setReason(reason);
|
1780 |
byPassRequest.setReason(reason);
|
| 1755 |
}
|
1781 |
}
|
| 1756 |
|
1782 |
|
| - |
|
1783 |
com.spice.profitmandi.dao.entity.user.User user = userUserRepository.selectById(byPassRequest.getFofoId());
|
| - |
|
1784 |
|
| - |
|
1785 |
Address address = addressRepository.selectById(user.getAddressId());
|
| - |
|
1786 |
|
| - |
|
1787 |
String title = "Billing Request";
|
| - |
|
1788 |
|
| - |
|
1789 |
String message = String.format("Your Billing Request is " + status
|
| - |
|
1790 |
+ ". Please ensure to order the missing focus models as soon as possible.");
|
| - |
|
1791 |
|
| 1757 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
1792 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 1758 |
sendNotificationModel.setCampaignName("Billing Request");
|
1793 |
sendNotificationModel.setCampaignName("Billing Request");
|
| 1759 |
sendNotificationModel.setTitle("Billing Request");
|
1794 |
sendNotificationModel.setTitle(title);
|
| 1760 |
sendNotificationModel.setMessage(String.format("Your Billing Request is " + " " + status
|
1795 |
sendNotificationModel.setMessage(message);
|
| 1761 |
+ "Please ensure to order the missing focus models as soon as possible"));
|
- |
|
| 1762 |
sendNotificationModel.setType("url");
|
1796 |
sendNotificationModel.setType("url");
|
| 1763 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
1797 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| 1764 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
1798 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 1765 |
sendNotificationModel.setMessageType(MessageType.notification);
|
1799 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 1766 |
sendNotificationModel
|
1800 |
sendNotificationModel
|
| 1767 |
.setUserIds(Arrays.asList(userAccountRepository.selectUserIdByRetailerId(byPassRequest.getFofoId())));
|
1801 |
.setUserIds(Arrays.asList(userAccountRepository.selectUserIdByRetailerId(byPassRequest.getFofoId())));
|
| 1768 |
|
1802 |
|
| 1769 |
notificationService.sendNotification(sendNotificationModel);
|
1803 |
notificationService.sendNotification(sendNotificationModel);
|
| 1770 |
|
1804 |
|
| - |
|
1805 |
notificationService.sendWhatsappMessage(message, title, address.getPhoneNumber());
|
| - |
|
1806 |
|
| 1771 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1807 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1772 |
return "response";
|
1808 |
return "response";
|
| 1773 |
}
|
1809 |
}
|
| 1774 |
|
1810 |
|
| 1775 |
@RequestMapping(value = "/highDemandItem", method = RequestMethod.GET)
|
1811 |
@RequestMapping(value = "/highDemandItem", method = RequestMethod.GET)
|