| Line 604... |
Line 604... |
| 604 |
retailerIds.add(order.getRetailerId());
|
604 |
retailerIds.add(order.getRetailerId());
|
| 605 |
orderIds.add(order.getId());
|
605 |
orderIds.add(order.getId());
|
| 606 |
|
606 |
|
| 607 |
}
|
607 |
}
|
| 608 |
|
608 |
|
| 609 |
List<NotifyOrder> notify = notifyOrderRespository.selectByorderIds(orderIds);
|
609 |
/*List<NotifyOrder> notify = notifyOrderRespository.selectByorderIds(orderIds);
|
| 610 |
for (NotifyOrder notifyOrder : notify) {
|
610 |
for (NotifyOrder notifyOrder : notify) {
|
| 611 |
List<NotifyItem> notifyItems = notifyItemRepository.selectByNotifyId(notifyOrder.getNotifyId());
|
611 |
List<NotifyItem> notifyItems = notifyItemRepository.selectByNotifyId(notifyOrder.getNotifyId());
|
| 612 |
Iterator<NotifyItem> notifyItemsIterator = notifyItems.iterator();
|
612 |
Iterator<NotifyItem> notifyItemsIterator = notifyItems.iterator();
|
| 613 |
|
613 |
|
| 614 |
while (notifyItemsIterator.hasNext()) {
|
614 |
while (notifyItemsIterator.hasNext()) {
|
| Line 621... |
Line 621... |
| 621 |
if (NotifyStatus.pending == notifyOrder.getStatus()) {
|
621 |
if (NotifyStatus.pending == notifyOrder.getStatus()) {
|
| 622 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
622 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
| 623 |
}
|
623 |
}
|
| 624 |
}
|
624 |
}
|
| 625 |
|
625 |
|
| 626 |
}
|
626 |
}*/
|
| 627 |
|
627 |
|
| 628 |
Map<Integer, Optional<NotifyOrder>> notifyOrders = notifyOrderRespository.selectByorderIds(orderIds)
|
628 |
Map<Integer, Optional<NotifyOrder>> notifyOrders = notifyOrderRespository.selectByorderIds(orderIds)
|
| 629 |
.stream().collect(Collectors.groupingBy(NotifyOrder::getOrderId,
|
629 |
.stream().collect(Collectors.groupingBy(NotifyOrder::getOrderId,
|
| 630 |
Collectors.maxBy((x1, x2) -> x1.getId() - x2.getId())));
|
630 |
Collectors.maxBy((x1, x2) -> x1.getId() - x2.getId())));
|
| 631 |
|
631 |
|
| Line 823... |
Line 823... |
| 823 |
|
823 |
|
| 824 |
NotifyMessage message = notifyMessageRepository.selectByNotifyId(notifytimestamp.getId());
|
824 |
NotifyMessage message = notifyMessageRepository.selectByNotifyId(notifytimestamp.getId());
|
| 825 |
|
825 |
|
| 826 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
826 |
SimpleCampaignParams scp = new SimpleCampaignParams();
|
| 827 |
scp.setMessage(message.getNotifyMessages());
|
827 |
scp.setMessage(message.getNotifyMessages());
|
| 828 |
scp.setTitle("Notify Partner");
|
828 |
scp.setTitle("Alert");
|
| 829 |
scp.setType("url");
|
829 |
scp.setType("url");
|
| 830 |
scp.setUrl("http://app.profitmandi.com/pages/home/notifyOrder");
|
830 |
scp.setUrl("http://app.profitmandi.com/pages/home/notifyOrder");
|
| 831 |
scp.setExpireTimestamp(LocalDateTime.now().plusDays(2));
|
831 |
scp.setExpireTimestamp(LocalDateTime.now().plusDays(2));
|
| 832 |
SimpleCampaign sc = new SimpleCampaign(scp);
|
832 |
SimpleCampaign sc = new SimpleCampaign(scp);
|
| 833 |
sc.setSimpleCampaignParams(scp);
|
833 |
sc.setSimpleCampaignParams(scp);
|
| Line 926... |
Line 926... |
| 926 |
Set<Integer> oldItemIds = new HashSet<>();
|
926 |
Set<Integer> oldItemIds = new HashSet<>();
|
| 927 |
List<Integer> fofoIds = new ArrayList<>();
|
927 |
List<Integer> fofoIds = new ArrayList<>();
|
| 928 |
List<Integer> notifyIds = new ArrayList<>();
|
928 |
List<Integer> notifyIds = new ArrayList<>();
|
| 929 |
if (!notifyOrders.isEmpty()) {
|
929 |
if (!notifyOrders.isEmpty()) {
|
| 930 |
for (NotifyOrder notifyOrder : notifyOrders) {
|
930 |
for (NotifyOrder notifyOrder : notifyOrders) {
|
| 931 |
List<NotifyItem> notifyItems = notifyItemRepository.selectByNotifyId(notifyOrder.getNotifyId());
|
- |
|
| 932 |
Iterator<NotifyItem> notifyItemsIterator = notifyItems.iterator();
|
- |
|
| 933 |
|
- |
|
| 934 |
while (notifyItemsIterator.hasNext()) {
|
- |
|
| 935 |
NotifyItem notifyItem = notifyItemsIterator.next();
|
- |
|
| 936 |
if (LocalDateTime.now().isAfter(notifyItem.getResponseTime())) {
|
- |
|
| 937 |
notifyItemsIterator.remove();
|
- |
|
| 938 |
}
|
- |
|
| 939 |
}
|
- |
|
| 940 |
if (notifyItems.size() == 0) {
|
- |
|
| 941 |
if (NotifyStatus.pending == notifyOrder.getStatus()) {
|
- |
|
| 942 |
notifyOrder.setStatus(NotifyStatus.rejected);
|
- |
|
| 943 |
LOGGER.info("existingOrder" + notifyOrder);
|
- |
|
| 944 |
}
|
- |
|
| 945 |
}
|
- |
|
| 946 |
oldItemIds.add(notifyOrder.getItemId());
|
931 |
oldItemIds.add(notifyOrder.getItemId());
|
| 947 |
fofoIds.add(notifyOrder.getFofoId());
|
932 |
fofoIds.add(notifyOrder.getFofoId());
|
| 948 |
notifyIds.add(notifyOrder.getNotifyId());
|
933 |
notifyIds.add(notifyOrder.getNotifyId());
|
| 949 |
}
|
934 |
}
|
| 950 |
|
935 |
|