Subversion Repositories SmartDukaan

Rev

Rev 26700 | Rev 26702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26700 Rev 26701
Line 127... Line 127...
127
	@Autowired
127
	@Autowired
128
	private TagListingRepository tagListingRepository;
128
	private TagListingRepository tagListingRepository;
129
 
129
 
130
	@Autowired
130
	@Autowired
131
	private ItemRepository itemRepository;
131
	private ItemRepository itemRepository;
132
	
132
 
133
	@Autowired
133
	@Autowired
134
	private SchemeService schemeService;
134
	private SchemeService schemeService;
135
 
135
 
136
	@Autowired
136
	@Autowired
137
	private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
137
	private ItemAvailabilityCacheRepository itemAvailabilityCacheRepository;
Line 146... Line 146...
146
					1003800, 1022322, 1022307, 1022304, 1022004, 1022004, 1021934, 1021897, 1021768));
146
					1003800, 1022322, 1022307, 1022304, 1022004, 1022004, 1021934, 1021897, 1021768));
147
 
147
 
148
	private Set<Integer> latestArrivals = new HashSet<>(Arrays.asList(1022382, 1022335, 1022381, 1022386, 1022380,
148
	private Set<Integer> latestArrivals = new HashSet<>(Arrays.asList(1022382, 1022335, 1022381, 1022386, 1022380,
149
			1022377, 1022376, 1022375, 1022374, 1022373, 1022372, 1022371, 1022370));
149
			1022377, 1022376, 1022375, 1022374, 1022373, 1022372, 1022371, 1022370));
150
 
150
 
-
 
151
	private Set<Integer> topGadgets = new HashSet<>(
-
 
152
			Arrays.asList(1022123, 1022127, 1022128, 1022128, 1022128, 1022128, 1022134, 1022134, 1022134, 1022143,
-
 
153
					1022144, 1022218, 1022218, 1022218, 1022316, 1022318, 1022319, 1022320, 1022320));
-
 
154
 
151
	@ApiImplicitParams({
155
	@ApiImplicitParams({
152
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
156
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
153
	@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
157
	@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
154
	public ResponseEntity<?> getFofo(HttpServletRequest request,
158
	public ResponseEntity<?> getFofo(HttpServletRequest request,
155
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
159
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
Line 216... Line 220...
216
			return responseSender.badRequest(
220
			return responseSender.badRequest(
217
					new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
221
					new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
218
		}
222
		}
219
		return responseSender.ok(dealResponse);
223
		return responseSender.ok(dealResponse);
220
	}
224
	}
221
	
-
 
222
	
225
 
223
	@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
226
	@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
224
	@ApiImplicitParams({
227
	@ApiImplicitParams({
225
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
228
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
226
	@ApiOperation(value = "Get unit deal object")
229
	@ApiOperation(value = "Get unit deal object")
227
	public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
230
	public ResponseEntity<?> getUnitFocoDeal(HttpServletRequest request, @PathVariable(value = "id") long id)
Line 303... Line 306...
303
		Map<String, String> params = new HashMap<>();
306
		Map<String, String> params = new HashMap<>();
304
		List<String> mandatoryQ = new ArrayList<>();
307
		List<String> mandatoryQ = new ArrayList<>();
305
		Set<Integer> catalogIds = this.bestSellers;
308
		Set<Integer> catalogIds = this.bestSellers;
306
		if (tag.equalsIgnoreCase("latestArrivals")) {
309
		if (tag.equalsIgnoreCase("latestArrivals")) {
307
			catalogIds = this.latestArrivals;
310
			catalogIds = this.latestArrivals;
-
 
311
		} else if (tag.equalsIgnoreCase("topGadgets")) {
-
 
312
			catalogIds = this.topGadgets;
308
		}
313
		}
309
		mandatoryQ.add(
314
		mandatoryQ.add(
310
				String.format("+{!parent which=\"catalogId_i:" + StringUtils.join(catalogIds, " ") + "\"} tagId_i:(%s)",
315
				String.format("+{!parent which=\"catalogId_i:" + StringUtils.join(catalogIds, " ") + "\"} tagId_i:(%s)",
311
						StringUtils.join(tagIds, " ")));
316
						StringUtils.join(tagIds, " ")));
312
		params.put("q", StringUtils.join(mandatoryQ, " "));
317
		params.put("q", StringUtils.join(mandatoryQ, " "));
Line 423... Line 428...
423
			cartItemResponseModel.setItemId(cartItem.getItemId());
428
			cartItemResponseModel.setItemId(cartItem.getItemId());
424
			cartItemResponseModel.setMinBuyQuantity(1);
429
			cartItemResponseModel.setMinBuyQuantity(1);
425
			cartItemResponseModel.setQuantity(cartItem.getQuantity());
430
			cartItemResponseModel.setQuantity(cartItem.getQuantity());
426
			cartItemResponseModel.setQuantityStep(1);
431
			cartItemResponseModel.setQuantityStep(1);
427
			Float cashback = schemeService.getItemSchemeCashBack().get(cartItem.getItemId());
432
			Float cashback = schemeService.getItemSchemeCashBack().get(cartItem.getItemId());
428
			cashback = cashback==null? 0 : cashback;
433
			cashback = cashback == null ? 0 : cashback;
429
			cartItemResponseModel.setSellingPrice(tagListing.getMop() - cashback);
434
			cartItemResponseModel.setSellingPrice(tagListing.getMop() - cashback);
430
			cartItemResponseModel.setMaxQuantity(2);
435
			cartItemResponseModel.setMaxQuantity(2);
431
			cartItemResponseModel.setCatalogItemId(item.getCatalogItemId());
436
			cartItemResponseModel.setCatalogItemId(item.getCatalogItemId());
432
			cartItemResponseModel.setImageUrl(contentMap.get(item.getCatalogItemId()).getString("imageUrl_s"));
437
			cartItemResponseModel.setImageUrl(contentMap.get(item.getCatalogItemId()).getString("imageUrl_s"));
433
			cartItemResponseModel.setColor(item.getColor());
438
			cartItemResponseModel.setColor(item.getColor());
Line 500... Line 505...
500
							fofoAvailabilityInfoMap.get(itemId).setSellingPrice(sellingPrice);
505
							fofoAvailabilityInfoMap.get(itemId).setSellingPrice(sellingPrice);
501
							fofoAvailabilityInfoMap.get(itemId).setMop((float) childItem.getDouble("mop_f"));
506
							fofoAvailabilityInfoMap.get(itemId).setMop((float) childItem.getDouble("mop_f"));
502
						}
507
						}
503
					} else {
508
					} else {
504
						FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
509
						FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
505
						fdi.setCashback(itemCashbackMap.get(itemId)==null ? 0 : itemCashbackMap.get(itemId));
510
						fdi.setCashback(itemCashbackMap.get(itemId) == null ? 0 : itemCashbackMap.get(itemId));
506
						fdi.setSellingPrice((float) childItem.getDouble("sellingPrice_f"));
511
						fdi.setSellingPrice((float) childItem.getDouble("sellingPrice_f"));
507
						fdi.setMop((float) childItem.getDouble("mop_f"));
512
						fdi.setMop((float) childItem.getDouble("mop_f"));
508
						fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
513
						fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
509
						fdi.setTagId(childItem.getInt("tagId_i"));
514
						fdi.setTagId(childItem.getInt("tagId_i"));
510
						fdi.setItem_id(itemId);
515
						fdi.setItem_id(itemId);