| Line 4... |
Line 4... |
| 4 |
import java.io.ByteArrayOutputStream;
|
4 |
import java.io.ByteArrayOutputStream;
|
| 5 |
import java.io.IOException;
|
5 |
import java.io.IOException;
|
| 6 |
import java.io.InputStream;
|
6 |
import java.io.InputStream;
|
| 7 |
import java.io.InputStreamReader;
|
7 |
import java.io.InputStreamReader;
|
| 8 |
import java.net.URISyntaxException;
|
8 |
import java.net.URISyntaxException;
|
| - |
|
9 |
import java.text.MessageFormat;
|
| 9 |
import java.time.LocalDate;
|
10 |
import java.time.LocalDate;
|
| 10 |
import java.time.LocalDateTime;
|
11 |
import java.time.LocalDateTime;
|
| 11 |
import java.time.YearMonth;
|
12 |
import java.time.YearMonth;
|
| 12 |
import java.time.format.DateTimeFormatter;
|
13 |
import java.time.format.DateTimeFormatter;
|
| 13 |
import java.time.temporal.ChronoUnit;
|
14 |
import java.time.temporal.ChronoUnit;
|
| Line 75... |
Line 76... |
| 75 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
76 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 76 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
77 |
import com.spice.profitmandi.common.util.ExcelUtils;
|
| 77 |
import com.spice.profitmandi.common.util.PdfUtils;
|
78 |
import com.spice.profitmandi.common.util.PdfUtils;
|
| 78 |
import com.spice.profitmandi.common.util.Utils;
|
79 |
import com.spice.profitmandi.common.util.Utils;
|
| 79 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
80 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| - |
|
81 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| - |
|
82 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModelByPassRequest;
|
| 80 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
83 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 81 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
84 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 82 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
85 |
import com.spice.profitmandi.dao.entity.catalog.TagRanking;
|
| - |
|
86 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 83 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
87 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 84 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
88 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 85 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
89 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 86 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
90 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| - |
|
91 |
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
|
| 87 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
92 |
import com.spice.profitmandi.dao.entity.transaction.NotifyCancel;
|
| 88 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
93 |
import com.spice.profitmandi.dao.entity.transaction.NotifyColorChange;
|
| 89 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
94 |
import com.spice.profitmandi.dao.entity.transaction.NotifyMessage;
|
| 90 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
95 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
| 91 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
96 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| - |
|
97 |
import com.spice.profitmandi.dao.enumuration.catalog.ByPassRequestStatus;
|
| - |
|
98 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| - |
|
99 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
| 92 |
import com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel;
|
100 |
import com.spice.profitmandi.dao.model.BrandItemWiseTertiaryModel;
|
| 93 |
import com.spice.profitmandi.dao.model.BrandRegionModel;
|
101 |
import com.spice.profitmandi.dao.model.BrandRegionModel;
|
| 94 |
import com.spice.profitmandi.dao.model.BrandWiseTertiaryModel;
|
102 |
import com.spice.profitmandi.dao.model.BrandWiseTertiaryModel;
|
| 95 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
103 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
| 96 |
import com.spice.profitmandi.dao.model.OpenPoItemModel;
|
104 |
import com.spice.profitmandi.dao.model.OpenPoItemModel;
|
| Line 101... |
Line 109... |
| 101 |
import com.spice.profitmandi.dao.model.SecondaryOrderBillingModel;
|
109 |
import com.spice.profitmandi.dao.model.SecondaryOrderBillingModel;
|
| 102 |
import com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel;
|
110 |
import com.spice.profitmandi.dao.model.SecondaryOrderItemBillingModel;
|
| 103 |
import com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel;
|
111 |
import com.spice.profitmandi.dao.model.SecondaryWarehouseWiseOrderBilllingModel;
|
| 104 |
import com.spice.profitmandi.dao.model.Specification;
|
112 |
import com.spice.profitmandi.dao.model.Specification;
|
| 105 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
113 |
import com.spice.profitmandi.dao.model.SpecificationGroup;
|
| - |
|
114 |
import com.spice.profitmandi.dao.model.UserCart;
|
| - |
|
115 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| - |
|
116 |
import com.spice.profitmandi.dao.repository.catalog.FocusedModelByPassRepository;
|
| 106 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
117 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
118 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
119 |
import com.spice.profitmandi.dao.repository.catalog.TagRankingRepository;
|
| - |
|
120 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| - |
|
121 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 109 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
122 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 110 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
123 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 111 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
124 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 112 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
125 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
| 113 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
126 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| Line 143... |
Line 156... |
| 143 |
|
156 |
|
| 144 |
private static final List<String> imeis = Arrays.asList("351030944216680", "351030944217183", "351030944217886",
|
157 |
private static final List<String> imeis = Arrays.asList("351030944216680", "351030944217183", "351030944217886",
|
| 145 |
"351030944507286", "351081710231270", "351081710238713", "351081710238796", "351081710241279",
|
158 |
"351030944507286", "351081710231270", "351081710238713", "351081710238796", "351081710241279",
|
| 146 |
"351081710244737", "355777112655976");
|
159 |
"351081710244737", "355777112655976");
|
| 147 |
|
160 |
|
| - |
|
161 |
List<EscalationType> esclationType = Arrays.asList(EscalationType.L3, EscalationType.L4);
|
| - |
|
162 |
|
| - |
|
163 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com");
|
| - |
|
164 |
|
| 148 |
@Autowired
|
165 |
@Autowired
|
| 149 |
private CookiesProcessor cookiesProcessor;
|
166 |
private CookiesProcessor cookiesProcessor;
|
| 150 |
|
167 |
|
| 151 |
@Autowired
|
168 |
@Autowired
|
| 152 |
@Qualifier("fofoInventoryService")
|
169 |
@Qualifier("fofoInventoryService")
|
| Line 230... |
Line 247... |
| 230 |
@Autowired
|
247 |
@Autowired
|
| 231 |
private FofoOrderRepository fofoOrderRepository;
|
248 |
private FofoOrderRepository fofoOrderRepository;
|
| 232 |
@Autowired
|
249 |
@Autowired
|
| 233 |
private Mongo mongoClient;
|
250 |
private Mongo mongoClient;
|
| 234 |
|
251 |
|
| - |
|
252 |
@Autowired
|
| - |
|
253 |
private FocusedModelByPassRepository focusedModelByPassRepository;
|
| - |
|
254 |
|
| - |
|
255 |
@Autowired
|
| - |
|
256 |
private CsService csService;
|
| - |
|
257 |
|
| - |
|
258 |
@Autowired
|
| - |
|
259 |
AuthRepository authRepository;
|
| - |
|
260 |
|
| - |
|
261 |
@Autowired
|
| - |
|
262 |
PositionRepository positionRepository;
|
| - |
|
263 |
|
| 235 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
264 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 236 |
public String getCurrentAvailability(HttpServletRequest request,
|
265 |
public String getCurrentAvailability(HttpServletRequest request,
|
| 237 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
266 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 238 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
267 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 239 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
268 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| Line 559... |
Line 588... |
| 559 |
|
588 |
|
| 560 |
@RequestMapping(value = "/dummy-invoices-bulk")
|
589 |
@RequestMapping(value = "/dummy-invoices-bulk")
|
| 561 |
public ResponseEntity<?> downloadInvoicesBulk(HttpServletRequest request, @RequestParam List<String> serialNumbers,
|
590 |
public ResponseEntity<?> downloadInvoicesBulk(HttpServletRequest request, @RequestParam List<String> serialNumbers,
|
| 562 |
Model model) throws Exception {
|
591 |
Model model) throws Exception {
|
| 563 |
byte[] bytes = null;
|
592 |
byte[] bytes = null;
|
| 564 |
List<Attachment> attachments= new ArrayList<>();
|
593 |
List<Attachment> attachments = new ArrayList<>();
|
| 565 |
for(String serialNumber : serialNumbers) {
|
594 |
for (String serialNumber : serialNumbers) {
|
| 566 |
if (!imeis.contains(serialNumber)) {
|
595 |
if (!imeis.contains(serialNumber)) {
|
| 567 |
PdfModel pdfModel = null;
|
596 |
PdfModel pdfModel = null;
|
| 568 |
try {
|
597 |
try {
|
| 569 |
pdfModel = orderService.getDummyPdfModel(serialNumber);
|
598 |
pdfModel = orderService.getDummyPdfModel(serialNumber);
|
| 570 |
} catch(Exception e) {
|
599 |
} catch (Exception e) {
|
| 571 |
continue;
|
600 |
continue;
|
| 572 |
}
|
601 |
}
|
| 573 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
602 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| 574 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
603 |
PdfUtils.generateAndWrite(Arrays.asList(pdfModel), byteArrayOutputStream);
|
| 575 |
bytes = byteArrayOutputStream.toByteArray();
|
604 |
bytes = byteArrayOutputStream.toByteArray();
|
| Line 1738... |
Line 1767... |
| 1738 |
model.addAttribute("tertiaryItem", tertiaryItem);
|
1767 |
model.addAttribute("tertiaryItem", tertiaryItem);
|
| 1739 |
|
1768 |
|
| 1740 |
return "inventory-item-tertiary-item";
|
1769 |
return "inventory-item-tertiary-item";
|
| 1741 |
|
1770 |
|
| 1742 |
}
|
1771 |
}
|
| - |
|
1772 |
|
| - |
|
1773 |
@RequestMapping(value = "/planogram")
|
| - |
|
1774 |
public String Planogram(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| - |
|
1775 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1776 |
String email = loginDetails.getEmailId();
|
| - |
|
1777 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
| - |
|
1778 |
List<FocusedModelByPassRequest> byPassRequest = null;
|
| - |
|
1779 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1780 |
|
| - |
|
1781 |
Set<Integer> authfofoIds = null;
|
| - |
|
1782 |
|
| - |
|
1783 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId());
|
| - |
|
1784 |
|
| - |
|
1785 |
if (emails.contains(authUser.getEmailId())) {
|
| - |
|
1786 |
authfofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
| - |
|
1787 |
LOGGER.info("fofoIds" + authfofoIds);
|
| - |
|
1788 |
} else {
|
| - |
|
1789 |
|
| - |
|
1790 |
for (Position ps : positions) {
|
| - |
|
1791 |
if (esclationType.contains(ps.getEscalationType())) {
|
| - |
|
1792 |
authfofoIds = storeGuyMap.get(email);
|
| - |
|
1793 |
break;
|
| - |
|
1794 |
}
|
| - |
|
1795 |
|
| - |
|
1796 |
}
|
| - |
|
1797 |
}
|
| - |
|
1798 |
if (authfofoIds != null) {
|
| - |
|
1799 |
byPassRequest = focusedModelByPassRepository.selectByStatusAndFofoIds(new ArrayList<>(authfofoIds),
|
| - |
|
1800 |
ByPassRequestStatus.PENDING);
|
| - |
|
1801 |
}
|
| - |
|
1802 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
|
| - |
|
1803 |
model.addAttribute("customRetailerMap", customRetailerMap);
|
| - |
|
1804 |
model.addAttribute("byPassRequest", byPassRequest);
|
| - |
|
1805 |
return "planogram";
|
| - |
|
1806 |
}
|
| - |
|
1807 |
|
| - |
|
1808 |
@RequestMapping(value = "/byPassRequestAction", method = RequestMethod.PUT)
|
| - |
|
1809 |
public String addAmountToWalletRequestRejected(HttpServletRequest request,
|
| - |
|
1810 |
@RequestParam(name = "id", defaultValue = "0") int id, @RequestParam ByPassRequestStatus status,
|
| - |
|
1811 |
Model model) throws Exception {
|
| - |
|
1812 |
|
| - |
|
1813 |
FocusedModelByPassRequest byPassRequest = focusedModelByPassRepository.selectById(id);
|
| - |
|
1814 |
if (status.equals(ByPassRequestStatus.APPROVED)) {
|
| - |
|
1815 |
byPassRequest.setByPass(true);
|
| - |
|
1816 |
byPassRequest.setStatus(ByPassRequestStatus.APPROVED);
|
| - |
|
1817 |
byPassRequest.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1818 |
} else if (status.equals(ByPassRequestStatus.REJECTED)) {
|
| - |
|
1819 |
byPassRequest.setByPass(false);
|
| - |
|
1820 |
byPassRequest.setStatus(ByPassRequestStatus.REJECTED);
|
| - |
|
1821 |
byPassRequest.setUpdatedTimestamp(LocalDateTime.now());
|
| - |
|
1822 |
}
|
| - |
|
1823 |
|
| - |
|
1824 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| - |
|
1825 |
sendNotificationModel.setCampaignName("By Pass Request");
|
| - |
|
1826 |
sendNotificationModel.setTitle("By Pass Request");
|
| - |
|
1827 |
sendNotificationModel.setMessage(String.format("Your By Pass Request has been" + " " + status));
|
| - |
|
1828 |
sendNotificationModel.setType("url");
|
| - |
|
1829 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| - |
|
1830 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| - |
|
1831 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| - |
|
1832 |
sendNotificationModel
|
| - |
|
1833 |
.setUserIds(Arrays.asList(userAccountRepository.selectUserIdByRetailerId(byPassRequest.getFofoId())));
|
| - |
|
1834 |
|
| - |
|
1835 |
notificationService.sendNotification(sendNotificationModel);
|
| - |
|
1836 |
|
| - |
|
1837 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| - |
|
1838 |
return "response";
|
| - |
|
1839 |
}
|
| - |
|
1840 |
|
| 1743 |
}
|
1841 |
}
|