| Line 25... |
Line 25... |
| 25 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
25 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 26 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
26 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 27 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
27 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 28 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
28 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
| 29 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
29 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 30 |
import com.spice.profitmandi.dao.repository.fofo.CurrentInventorySnapshotRepository;
|
- |
|
| 31 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
30 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 32 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
- |
|
| 33 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
- |
|
| 34 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
31 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
| 35 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
32 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| 36 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
33 |
import com.spice.profitmandi.dao.repository.warehouse.WarehousePurchaseOrderRepository;
|
| 37 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
34 |
import com.spice.profitmandi.dao.repository.warehouse.WarehouseScanRepository;
|
| 38 |
import com.spice.profitmandi.service.NotificationService;
|
35 |
import com.spice.profitmandi.service.NotificationService;
|
| Line 197... |
Line 194... |
| 197 |
|
194 |
|
| 198 |
@Autowired
|
195 |
@Autowired
|
| 199 |
PositionRepository positionRepository;
|
196 |
PositionRepository positionRepository;
|
| 200 |
|
197 |
|
| 201 |
@Autowired
|
198 |
@Autowired
|
| - |
|
199 |
ActivatedImeiRepository activatedImeiRepository;
|
| - |
|
200 |
|
| - |
|
201 |
@Autowired
|
| 202 |
HighDemandItemsRepository highDemandItemsRepository;
|
202 |
HighDemandItemsRepository highDemandItemsRepository;
|
| 203 |
|
203 |
|
| 204 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
204 |
@RequestMapping(value = "/getCurrentInventorySnapshot")
|
| 205 |
public String getCurrentAvailability(HttpServletRequest request,
|
205 |
public String getCurrentAvailability(HttpServletRequest request,
|
| 206 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
206 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 207 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
207 |
@RequestParam(name = "limit", defaultValue = "10") int limit,
|
| 208 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
208 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm, Model model)
|
| 209 |
throws ProfitMandiBusinessException {
|
209 |
throws ProfitMandiBusinessException {
|
| 210 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
210 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 211 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit,
|
211 |
Map<String, Object> map = inventoryService.getCurrentInventorySnapshot(loginDetails.getFofoId(), offset, limit,
|
| 212 |
searchTerm);
|
212 |
searchTerm);
|
| 213 |
model.addAllAttributes(map);
|
213 |
model.addAllAttributes(map);
|
| Line 277... |
Line 277... |
| 277 |
} catch (ProfitMandiBusinessException e) {
|
277 |
} catch (ProfitMandiBusinessException e) {
|
| 278 |
return false;
|
278 |
return false;
|
| 279 |
}
|
279 |
}
|
| 280 |
}
|
280 |
}
|
| 281 |
|
281 |
|
| 282 |
/*
|
- |
|
| 283 |
* @RequestMapping(value = "/getSimilarItem") public String
|
- |
|
| 284 |
* getCatalog(HttpServletRequest request, @RequestParam(name = "offset",
|
- |
|
| 285 |
* defaultValue = "0") int offset,
|
- |
|
| 286 |
*
|
- |
|
| 287 |
* @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam
|
- |
|
| 288 |
* int catalogItemId,
|
- |
|
| 289 |
*
|
- |
|
| 290 |
* @RequestParam(name = "searchTerm", required = false, defaultValue = "")
|
- |
|
| 291 |
* String searchTerm, Model model) throws ProfitMandiBusinessException
|
- |
|
| 292 |
*
|
- |
|
| 293 |
* { LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
- |
|
| 294 |
*
|
- |
|
| 295 |
* if (catalogItemId != 0) { TagListing tagListing = null; List<Item> items =
|
- |
|
| 296 |
* itemRepository.selectAllByCatalogItemId(catalogItemId); Map<Integer, Float>
|
- |
|
| 297 |
* itemPriceing = new HashMap<>(); List<CustomCurrentInventorySnapshot>
|
- |
|
| 298 |
* inventoryList = new ArrayList<>();
|
- |
|
| 299 |
*
|
- |
|
| 300 |
* for (Item item : items) { tagListing =
|
- |
|
| 301 |
* tagListingRepository.selectByItemId(item.getId());
|
- |
|
| 302 |
* CustomCurrentInventorySnapshot customCurrentInventorySnapshot =
|
- |
|
| 303 |
* inventoryService .checkItemAvailability(item.getId(),
|
- |
|
| 304 |
* loginDetails.getFofoId()); inventoryList.add(customCurrentInventorySnapshot);
|
- |
|
| 305 |
* itemPriceing.put(item.getId(), tagListing.getMop()); } if (tagListing !=
|
- |
|
| 306 |
* null) {
|
- |
|
| 307 |
*
|
- |
|
| 308 |
* float tagStartPrice = tagListing.getMop() - 1000; float tagEndPrice =
|
- |
|
| 309 |
* tagListing.getMop() + 2000; List<TagListing> tagMoplists =
|
- |
|
| 310 |
* tagListingRepository.selectAllBetweenMopPrice(tagStartPrice, tagEndPrice);
|
- |
|
| 311 |
*
|
- |
|
| 312 |
* for (TagListing tagListings : tagMoplists) {
|
- |
|
| 313 |
*
|
- |
|
| 314 |
* int TagListingItemid = tagListings.getItemId();
|
- |
|
| 315 |
*
|
- |
|
| 316 |
* itemPriceing.put(TagListingItemid, tagListings.getMop());
|
- |
|
| 317 |
* CustomCurrentInventorySnapshot customCurrentInventorySnapshotMopPrice =
|
- |
|
| 318 |
* inventoryService .checkItemAvailability(TagListingItemid,
|
- |
|
| 319 |
* loginDetails.getFofoId());
|
- |
|
| 320 |
*
|
- |
|
| 321 |
* inventoryList.add(customCurrentInventorySnapshotMopPrice); }
|
- |
|
| 322 |
*
|
- |
|
| 323 |
* }
|
- |
|
| 324 |
*
|
- |
|
| 325 |
* else { LOGGER.info("tagBrandlist is null"); }
|
- |
|
| 326 |
*
|
- |
|
| 327 |
* model.addAttribute("inventoryLists", inventoryList);
|
- |
|
| 328 |
* model.addAttribute("itemPriceing", itemPriceing);
|
- |
|
| 329 |
*
|
- |
|
| 330 |
* }
|
- |
|
| 331 |
*
|
- |
|
| 332 |
* return "catalog-similar-Id"; }
|
- |
|
| 333 |
*/
|
- |
|
| 334 |
@RequestMapping(value = "/getPaginatedCatalog")
|
282 |
@RequestMapping(value = "/getPaginatedCatalog")
|
| 335 |
public String getCatalogPaginated(HttpServletRequest request,
|
283 |
public String getCatalogPaginated(HttpServletRequest request,
|
| 336 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
284 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 337 |
@RequestParam(name = "limit", defaultValue = "20") int limit,
|
285 |
@RequestParam(name = "limit", defaultValue = "20") int limit,
|
| 338 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
|
286 |
@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
|
| Line 424... |
Line 372... |
| 424 |
final HttpHeaders headers = new HttpHeaders();
|
372 |
final HttpHeaders headers = new HttpHeaders();
|
| 425 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
373 |
headers.setContentType(MediaType.APPLICATION_PDF);
|
| 426 |
headers.set("Content-disposition", "inline; filename=invoices.pdf");
|
374 |
headers.set("Content-disposition", "inline; filename=invoices.pdf");
|
| 427 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
375 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| 428 |
List<InvoicePdfModel> pdfModels = new ArrayList<>();
|
376 |
List<InvoicePdfModel> pdfModels = new ArrayList<>();
|
| 429 |
/*
|
- |
|
| 430 |
* for (FofoOrder fofoOrder : fofoOrders) { try {
|
- |
|
| 431 |
* pdfModels.add(orderService.getInvoicePdfModel(fofoOrder.getId())); } catch
|
- |
|
| 432 |
* (Exception e) {
|
- |
|
| 433 |
* LOGGER.info("could not create invoice for {}, invoice number {}",
|
- |
|
| 434 |
* fofoOrder.getId(), fofoOrder.getInvoiceNumber()); } }
|
- |
|
| 435 |
*/
|
- |
|
| 436 |
PdfUtils.generateAndWrite(pdfModels, byteArrayOutputStream);
|
377 |
PdfUtils.generateAndWrite(pdfModels, byteArrayOutputStream);
|
| 437 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
378 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
| 438 |
final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
379 |
final InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
| 439 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
380 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| 440 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
381 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| Line 492... |
Line 433... |
| 492 |
});
|
433 |
});
|
| 493 |
model.addAttribute("inventoryItems", inventoryItems);
|
434 |
model.addAttribute("inventoryItems", inventoryItems);
|
| 494 |
return "activated-imeis";
|
435 |
return "activated-imeis";
|
| 495 |
}
|
436 |
}
|
| 496 |
|
437 |
|
| - |
|
438 |
@RequestMapping(value = "/activated-imeis-grn-pending")
|
| - |
|
439 |
public String activatedImeisGrnPending(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| - |
|
440 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
441 |
|
| - |
|
442 |
List<Order> openOrders = orderRepository.selectGrnTimestampNull(loginDetails.getFofoId(), Arrays.asList(OrderStatus.SHIPPED_FROM_WH, OrderStatus.DELIVERY_SUCCESS));
|
| - |
|
443 |
List<ImeiActivationTimestampModel> imeiActivationTimestampModels = activatedImeiRepository.selectActivatedImeisByOrders(openOrders.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| - |
|
444 |
Map<Integer, Order> ordersMap = openOrders.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| - |
|
445 |
model.addAttribute("ordersMap", ordersMap);
|
| - |
|
446 |
model.addAttribute("imeiActivationTimestampModels", imeiActivationTimestampModels);
|
| - |
|
447 |
return "activated-imeis-grn-pending";
|
| - |
|
448 |
}
|
| - |
|
449 |
|
| 497 |
@RequestMapping(value = "/view-invoices")
|
450 |
@RequestMapping(value = "/view-invoices")
|
| 498 |
public String viewInvoices(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
451 |
public String viewInvoices(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 499 |
return "view-dummy-invoices";
|
452 |
return "view-dummy-invoices";
|
| 500 |
}
|
453 |
}
|
| 501 |
|
454 |
|
| 502 |
@RequestMapping(value = "/dummy-invoices")
|
455 |
@RequestMapping(value = "/dummy-invoices")
|
| 503 |
public ResponseEntity<?> downloadInvoices(HttpServletRequest request, @RequestParam String serialNumber,
|
456 |
public ResponseEntity<?> downloadInvoices(HttpServletRequest request, @RequestParam String serialNumber,
|
| 504 |
Model model) throws ProfitMandiBusinessException {
|
457 |
Model model) throws ProfitMandiBusinessException {
|
| 505 |
byte[] bytes = null;
|
458 |
byte[] bytes = null;
|
| 506 |
if (!imeis.contains(serialNumber)) {
|
459 |
if (!imeis.contains(serialNumber)) {
|
| 507 |
|
460 |
|
| 508 |
InvoicePdfModel pdfModel = orderService.getDummyPdfModel(serialNumber);
|
461 |
InvoicePdfModel pdfModel = orderService.getDummyPdfModel(serialNumber);
|
| 509 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
462 |
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|