| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.service.warehouse.BillingWarehouseService;
|
- |
|
| 4 |
|
- |
|
| 5 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
3 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 6 |
import com.google.gson.Gson;
|
4 |
import com.google.gson.Gson;
|
| 7 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
5 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 8 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 9 |
import com.spice.profitmandi.common.model.*;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| Line 49... |
Line 47... |
| 49 |
import com.spice.profitmandi.service.inventory.MappedComboModel;
|
47 |
import com.spice.profitmandi.service.inventory.MappedComboModel;
|
| 50 |
import com.spice.profitmandi.service.mail.MailOutboxService;
|
48 |
import com.spice.profitmandi.service.mail.MailOutboxService;
|
| 51 |
import com.spice.profitmandi.service.order.OrderService;
|
49 |
import com.spice.profitmandi.service.order.OrderService;
|
| 52 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
50 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 53 |
import com.spice.profitmandi.service.user.RetailerService;
|
51 |
import com.spice.profitmandi.service.user.RetailerService;
|
| - |
|
52 |
import com.spice.profitmandi.service.warehouse.BillingWarehouseService;
|
| 54 |
import com.spice.profitmandi.web.model.LoginDetails;
|
53 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| - |
|
54 |
import com.spice.profitmandi.web.service.EmiOfferFileCacheService;
|
| 55 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
55 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 56 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
56 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 57 |
import in.shop2020.model.v1.order.OrderStatus;
|
57 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 58 |
import org.apache.commons.csv.CSVFormat;
|
58 |
import org.apache.commons.csv.CSVFormat;
|
| 59 |
import org.apache.commons.csv.CSVParser;
|
59 |
import org.apache.commons.csv.CSVParser;
|
| Line 260... |
Line 260... |
| 260 |
private CatalogRepository catalogRepository;
|
260 |
private CatalogRepository catalogRepository;
|
| 261 |
|
261 |
|
| 262 |
@Autowired
|
262 |
@Autowired
|
| 263 |
private CustomerOfferItemRepository customerOfferItemRepository;
|
263 |
private CustomerOfferItemRepository customerOfferItemRepository;
|
| 264 |
|
264 |
|
| - |
|
265 |
/**
|
| - |
|
266 |
* File-cache of daily scraped EMI offers. Used to drive the 'View EMI' column
|
| - |
|
267 |
* on the catalog listing without an extra DB round-trip per row.
|
| - |
|
268 |
*/
|
| - |
|
269 |
@Autowired
|
| - |
|
270 |
private EmiOfferFileCacheService emiOfferFileCache;
|
| - |
|
271 |
|
| 265 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
272 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 266 |
public String getCurrentAvailability(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model) throws ProfitMandiBusinessException {
|
273 |
public String getCurrentAvailability(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model) throws ProfitMandiBusinessException {
|
| 267 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
274 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 268 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
275 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit, searchTerm);
|
| 269 |
model.addAllAttributes(map);
|
276 |
model.addAllAttributes(map);
|
| Line 302... |
Line 309... |
| 302 |
|
309 |
|
| 303 |
Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm, itemId, brand, accesories);
|
310 |
Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm, itemId, brand, accesories);
|
| 304 |
model.addAllAttributes(map);
|
311 |
model.addAllAttributes(map);
|
| 305 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
312 |
model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
|
| 306 |
|
313 |
|
| - |
|
314 |
// Populate emiProductMap so catalog.vm's "View EMI" link appears for rows
|
| - |
|
315 |
// whose catalog_id has EMI data. Values are Boolean.TRUE sentinels — the
|
| - |
|
316 |
// template only does an existence check via $emiProductMap.get(catalogId).
|
| - |
|
317 |
java.util.Set<Integer> emiCatalogIds = emiOfferFileCache.availableCatalogIds();
|
| - |
|
318 |
if (!emiCatalogIds.isEmpty()) {
|
| - |
|
319 |
java.util.Map<Integer, Boolean> emiProductMap = new java.util.HashMap<>(emiCatalogIds.size() * 2);
|
| - |
|
320 |
for (Integer cid : emiCatalogIds) emiProductMap.put(cid, Boolean.TRUE);
|
| - |
|
321 |
model.addAttribute("emiProductMap", emiProductMap);
|
| - |
|
322 |
}
|
| - |
|
323 |
|
| 307 |
return "catalog";
|
324 |
return "catalog";
|
| 308 |
}
|
325 |
}
|
| 309 |
|
326 |
|
| 310 |
@RequestMapping(value = "/getCategorisedCatalog", method = RequestMethod.GET)
|
327 |
@RequestMapping(value = "/getCategorisedCatalog", method = RequestMethod.GET)
|
| 311 |
public String getCategorisedCatalog(HttpServletRequest request, Model model) throws Exception {
|
328 |
public String getCategorisedCatalog(HttpServletRequest request, Model model) throws Exception {
|