| Line 3... |
Line 3... |
| 3 |
import java.io.ByteArrayInputStream;
|
3 |
import java.io.ByteArrayInputStream;
|
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.InputStream;
|
5 |
import java.io.InputStream;
|
| 6 |
import java.time.LocalDateTime;
|
6 |
import java.time.LocalDateTime;
|
| 7 |
import java.util.ArrayList;
|
7 |
import java.util.ArrayList;
|
| - |
|
8 |
import java.util.Arrays;
|
| 8 |
import java.util.HashMap;
|
9 |
import java.util.HashMap;
|
| 9 |
import java.util.HashSet;
|
10 |
import java.util.HashSet;
|
| 10 |
import java.util.Iterator;
|
11 |
import java.util.Iterator;
|
| 11 |
import java.util.List;
|
12 |
import java.util.List;
|
| 12 |
import java.util.Map;
|
13 |
import java.util.Map;
|
| Line 55... |
Line 56... |
| 55 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
56 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 56 |
import com.spice.profitmandi.common.util.PdfUtils;
|
57 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 57 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
58 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 58 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
59 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 59 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
60 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
| 60 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
- |
|
| 61 |
import com.spice.profitmandi.dao.entity.dtr.PushNotifications;
|
- |
|
| 62 |
import com.spice.profitmandi.dao.entity.dtr.UserCampaign;
|
- |
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 67 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
65 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
| 68 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
66 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
| 69 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
67 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
| 70 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
68 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 71 |
import com.spice.profitmandi.dao.entity.user.Device;
|
- |
|
| 72 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
- |
|
| 73 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
- |
|
| 74 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
69 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
| 75 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
70 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 76 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
71 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 77 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
72 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
| 78 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
73 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| Line 170... |
Line 165... |
| 170 |
private String webapp;
|
165 |
private String webapp;
|
| 171 |
|
166 |
|
| 172 |
@Autowired
|
167 |
@Autowired
|
| 173 |
JavaMailSender mailSender;
|
168 |
JavaMailSender mailSender;
|
| 174 |
|
169 |
|
| 175 |
@Autowired
|
- |
|
| 176 |
private NotificationCampaignRepository notificationCampaignRepository;
|
- |
|
| 177 |
|
- |
|
| 178 |
@Autowired
|
- |
|
| 179 |
private DeviceRepository deviceRepository;
|
- |
|
| 180 |
|
- |
|
| 181 |
@Autowired
|
- |
|
| 182 |
private PushNotificationRepository pushNotificationRepository;
|
- |
|
| 183 |
|
- |
|
| 184 |
@Autowired
|
- |
|
| 185 |
private UserCampaignRepository userCampaignRepository;
|
- |
|
| 186 |
|
- |
|
| 187 |
@Autowired
|
- |
|
| 188 |
private Gson gson;
|
- |
|
| 189 |
|
- |
|
| 190 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
170 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 191 |
public String getCurrentAvailability(HttpServletRequest request,
|
171 |
public String getCurrentAvailability(HttpServletRequest request,
|
| 192 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
172 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 193 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
173 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 194 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
174 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| Line 696... |
Line 676... |
| 696 |
sendNotificationModel.setMessage(reason);
|
676 |
sendNotificationModel.setMessage(reason);
|
| 697 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/orderDetails");
|
677 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/orderDetails");
|
| 698 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
678 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 699 |
sendNotificationModel.setMessageType(MessageType.notification);
|
679 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 700 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
680 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
| 701 |
List<Integer> userIds = new ArrayList<>();
|
- |
|
| 702 |
userIds.add(userId);
|
- |
|
| 703 |
sendNotificationModel.setUserIds(userIds);
|
681 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 704 |
notificationService.sendNotification(sendNotificationModel);
|
682 |
notificationService.sendNotification(sendNotificationModel);
|
| 705 |
|
683 |
|
| 706 |
}
|
684 |
}
|
| 707 |
|
685 |
|
| 708 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
686 |
@RequestMapping(value = "/getNotifyItemColor", method = RequestMethod.GET)
|
| Line 807... |
Line 785... |
| 807 |
sendNotificationModel.setTitle("Alert");
|
785 |
sendNotificationModel.setTitle("Alert");
|
| 808 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/notifyOrder");
|
786 |
sendNotificationModel.setUrl("http://app.smartdukaan.com/pages/home/notifyOrder");
|
| 809 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
787 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(2));
|
| 810 |
sendNotificationModel.setMessageType(MessageType.notification);
|
788 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 811 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
789 |
int userId = userAccountRepository.selectUserIdByRetailerId(order.getRetailerId());
|
| 812 |
List<Integer> userIds = new ArrayList<>();
|
- |
|
| 813 |
userIds.add(userId);
|
- |
|
| - |
|
790 |
|
| 814 |
sendNotificationModel.setUserIds(userIds);
|
791 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| 815 |
notificationService.sendNotification(sendNotificationModel);
|
792 |
notificationService.sendNotification(sendNotificationModel);
|
| 816 |
|
793 |
|
| 817 |
}
|
794 |
}
|
| 818 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
795 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 819 |
return "response";
|
796 |
return "response";
|
| 820 |
}
|
797 |
}
|
| 821 |
|
798 |
|
| 822 |
public void pushNotification(int cid, List<Device> devices) {
|
- |
|
| 823 |
for (Device device : devices) {
|
- |
|
| 824 |
PushNotifications pn = new PushNotifications();
|
- |
|
| 825 |
pn.setNotificationCampaignid(cid);
|
- |
|
| 826 |
pn.setDeviceId(device.getId());
|
- |
|
| 827 |
pn.setUserId(device.getUser_id());
|
- |
|
| 828 |
pushNotificationRepository.persist(pn);
|
- |
|
| 829 |
}
|
- |
|
| 830 |
|
- |
|
| 831 |
}
|
- |
|
| 832 |
|
- |
|
| 833 |
@RequestMapping(value = "/getAllNotifyOrder", method = RequestMethod.GET)
|
799 |
@RequestMapping(value = "/getAllNotifyOrder", method = RequestMethod.GET)
|
| 834 |
public String getAllNotifyOrder(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
800 |
public String getAllNotifyOrder(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 835 |
List<NotifyOrder> notifyOrders = null;
|
801 |
List<NotifyOrder> notifyOrders = null;
|
| 836 |
List<com.spice.profitmandi.dao.entity.transaction.Order> inProcessorder = orderRepository
|
802 |
List<com.spice.profitmandi.dao.entity.transaction.Order> inProcessorder = orderRepository
|
| 837 |
.selectAllOrder(OrderStatus.SUBMITTED_FOR_PROCESSING);
|
803 |
.selectAllOrder(OrderStatus.SUBMITTED_FOR_PROCESSING);
|