| Line 279... |
Line 279... |
| 279 |
logger.info(dealResponse);
|
279 |
logger.info(dealResponse);
|
| 280 |
logger.info("log me");
|
280 |
logger.info("log me");
|
| 281 |
return responseSender.ok(dealResponse);
|
281 |
return responseSender.ok(dealResponse);
|
| 282 |
}
|
282 |
}
|
| 283 |
|
283 |
|
| 284 |
@ApiImplicitParams({
|
- |
|
| 285 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
- |
|
| 286 |
@RequestMapping(value = "/partnerStock", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 287 |
public ResponseEntity<?> partnerStock(HttpServletRequest request,
|
- |
|
| 288 |
@RequestParam(value = "categoryId", required = false, defaultValue = "3") String categoryId,
|
- |
|
| 289 |
@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit,
|
- |
|
| 290 |
@RequestParam(value = "sort", required = false) String sort,
|
- |
|
| 291 |
@RequestParam(value = "brand", required = false) String brand,
|
- |
|
| 292 |
@RequestParam(value = "subCategoryId", required = false) int subCategoryId,
|
- |
|
| 293 |
@RequestParam(value = "q", required = false) String queryTerm,
|
- |
|
| 294 |
@RequestParam(value = " ", required = false, defaultValue = "true") boolean partnerStockOnly)
|
- |
|
| 295 |
throws Throwable {
|
- |
|
| 296 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
- |
|
| 297 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
- |
|
| 298 |
UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
|
- |
|
| 299 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
- |
|
| 300 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
- |
|
| 301 |
dealResponse = this.getCatalogResponse(
|
- |
|
| 302 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, false), false,
|
- |
|
| 303 |
userInfo.getRetailerId());
|
- |
|
| 304 |
return responseSender.ok(dealResponse);
|
- |
|
| 305 |
}
|
- |
|
| 306 |
|
- |
|
| 307 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
284 |
@RequestMapping(value = "/online-deals", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 308 |
@ApiImplicitParams({
|
285 |
@ApiImplicitParams({
|
| 309 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
286 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 310 |
@ApiOperation(value = "Get online deals")
|
287 |
@ApiOperation(value = "Get online deals")
|
| 311 |
public ResponseEntity<?> getOnlineDeals(HttpServletRequest request,
|
288 |
public ResponseEntity<?> getOnlineDeals(HttpServletRequest request,
|
| Line 701... |
Line 678... |
| 701 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
678 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
| 702 |
fdi.setItem_id(itemId);
|
679 |
fdi.setItem_id(itemId);
|
| 703 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
680 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
| 704 |
cashBack = cashBack == null ? 0 : cashBack;
|
681 |
cashBack = cashBack == null ? 0 : cashBack;
|
| 705 |
fdi.setCashback(cashBack);
|
682 |
fdi.setCashback(cashBack);
|
| 706 |
fdi.setAvailability(0);
|
- |
|
| 707 |
fdi.setMinBuyQuantity(1);
|
683 |
fdi.setMinBuyQuantity(1);
|
| - |
|
684 |
if (hotDeal) {
|
| 708 |
if (currentAvailability != null) {
|
685 |
if (currentAvailability != null) {
|
| 709 |
fdi.setAvailability(currentAvailability.stream()
|
686 |
fdi.setAvailability(currentAvailability.stream()
|
| 710 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability)));
|
687 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability)));
|
| - |
|
688 |
} else {
|
| - |
|
689 |
fdi.setAvailability(0);
|
| - |
|
690 |
}
|
| - |
|
691 |
} else {
|
| - |
|
692 |
//Lets consider that its out of stock
|
| - |
|
693 |
fdi.setAvailability(100);
|
| - |
|
694 |
Item item = null;
|
| - |
|
695 |
try {
|
| - |
|
696 |
item = itemRepository.selectById(itemId);
|
| - |
|
697 |
} catch(Exception e) {
|
| - |
|
698 |
e.printStackTrace();
|
| - |
|
699 |
continue;
|
| - |
|
700 |
}
|
| - |
|
701 |
// In case its tampered glass moq should be 5
|
| - |
|
702 |
if (item.getCategoryId() == 10020) {
|
| - |
|
703 |
fdi.setMinBuyQuantity(5);
|
| - |
|
704 |
}
|
| 711 |
}
|
705 |
}
|
| 712 |
fdi.setQuantityStep(1);
|
706 |
fdi.setQuantityStep(1);
|
| 713 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
707 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
| 714 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
708 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
| 715 |
}
|
709 |
}
|