Subversion Repositories SmartDukaan

Rev

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

Rev 27583 Rev 27596
Line 251... Line 251...
251
 
251
 
252
	@RequestMapping(value = "/getCatalog")
252
	@RequestMapping(value = "/getCatalog")
253
	public String getCatalog(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
253
	public String getCatalog(HttpServletRequest request, @RequestParam(name = "offset", defaultValue = "0") int offset,
254
			@RequestParam(name = "limit", defaultValue = "20") int limit,
254
			@RequestParam(name = "limit", defaultValue = "20") int limit,
255
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
255
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
256
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId, Model model)
256
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId, 
-
 
257
         	@RequestParam(name = "brand", required = false, defaultValue = "") String brand, Model model)
-
 
258
 
257
			throws ProfitMandiBusinessException {
259
			throws ProfitMandiBusinessException {
258
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
260
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
259
		if (searchTerm == null) {
261
		if (searchTerm == null) {
260
			searchTerm = "";
262
			searchTerm = "";
261
		}
263
		}
-
 
264
		
262
 
265
 
263
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm,
266
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm,
264
				itemId);
267
				itemId,brand);
265
		model.addAllAttributes(map);
268
		model.addAllAttributes(map);
266
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
269
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
267
 
270
 
268
		return "catalog";
271
		return "catalog";
269
	}
272
	}
Line 333... Line 336...
333
	@RequestMapping(value = "/getPaginatedCatalog")
336
	@RequestMapping(value = "/getPaginatedCatalog")
334
	public String getCatalogPaginated(HttpServletRequest request,
337
	public String getCatalogPaginated(HttpServletRequest request,
335
			@RequestParam(name = "offset", defaultValue = "0") int offset,
338
			@RequestParam(name = "offset", defaultValue = "0") int offset,
336
			@RequestParam(name = "limit", defaultValue = "20") int limit,
339
			@RequestParam(name = "limit", defaultValue = "20") int limit,
337
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
340
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
338
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId, Model model)
341
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId,
-
 
342
			@RequestParam(name = "brand", required = false, defaultValue = "0") String brand, Model model)
339
			throws ProfitMandiBusinessException {
343
			throws ProfitMandiBusinessException {
340
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
344
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
341
		if (searchTerm == null) {
345
		if (searchTerm == null) {
342
			searchTerm = "";
346
			searchTerm = "";
343
		}
347
		}
344
		Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit,
348
		Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit,
345
				searchTerm, itemId);
349
				searchTerm, itemId,brand);
346
		model.addAllAttributes(map);
350
		model.addAllAttributes(map);
347
		return "catalog-paginated";
351
		return "catalog-paginated";
348
	}
352
	}
349
 
353
 
350
	@RequestMapping(value = "/checkItemAvailability")
354
	@RequestMapping(value = "/checkItemAvailability")
Line 1203... Line 1207...
1203
	@RequestMapping(value = "/getProductCompareInfo", method = RequestMethod.GET)
1207
	@RequestMapping(value = "/getProductCompareInfo", method = RequestMethod.GET)
1204
	public String getProductCompareInfo(HttpServletRequest request, @RequestParam List<Long> catalogIds, Model model)
1208
	public String getProductCompareInfo(HttpServletRequest request, @RequestParam List<Long> catalogIds, Model model)
1205
			throws Exception {
1209
			throws Exception {
1206
		List<ContentPojo> cps = new ArrayList<>();
1210
		List<ContentPojo> cps = new ArrayList<>();
1207
		Set<Integer> cataogIds = catalogIds.stream().mapToInt(Long::intValue).boxed().collect(Collectors.toSet());
1211
		Set<Integer> cataogIds = catalogIds.stream().mapToInt(Long::intValue).boxed().collect(Collectors.toSet());
1208
 
-
 
-
 
1212
		LOGGER.info("tagListingMOP" + cataogIds);
1209
		for (Long cId : catalogIds) {
1213
		for (Long cId : catalogIds) {
1210
			ContentPojo cp = mongoClient.getEntityById(cId);
1214
			ContentPojo cp = mongoClient.getEntityById(cId);
1211
			if (cp.getName() == null) {
1215
			if (cp.getName() == null) {
1212
				cp.setName(itemRepository.selectAllByCatalogItemId(cId.intValue()).get(0).getItemDescriptionNoColor());
1216
				cp.setName(itemRepository.selectAllByCatalogItemId(cId.intValue()).get(0).getItemDescriptionNoColor());
1213
			}
1217
			}
1214
			List<Item> items = itemRepository.selectAllByCatalogItemId(cId.intValue());
1218
			List<Item> items = itemRepository.selectAllByCatalogItemId(cId.intValue());
-
 
1219
			LOGGER.info("itemsMop" + items);
-
 
1220
			int i=0;
-
 
1221
			for(Item item :items) {
1215
			TagListing tagListing = tagListingRepository.selectByItemId(items.get(0).getId());
1222
			TagListing tagListing = tagListingRepository.selectByItemId(items.get(i).getId());
-
 
1223
			
-
 
1224
		        	if (tagListing != null) {
1216
			cp.setPrice(tagListing.getMop());
1225
				     cp.setPrice(tagListing.getMop());
-
 
1226
				  
-
 
1227
				     LOGGER.info("tagListingMOP" + tagListing);
-
 
1228
				
-
 
1229
				          break;
-
 
1230
				
-
 
1231
		           	}
-
 
1232
			i++;
-
 
1233
			}
1217
			cps.add(cp);
1234
			 cps.add(cp);
1218
 
1235
 
1219
		}
1236
		}
1220
 
1237
 
1221
		List<Map<String, String>> entityList = new ArrayList<>();
1238
		List<Map<String, String>> entityList = new ArrayList<>();
1222
		for (ContentPojo cp : cps) {
1239
		for (ContentPojo cp : cps) {