Subversion Repositories SmartDukaan

Rev

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

Rev 27596 Rev 27618
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, 
256
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId,
-
 
257
			@RequestParam(name = "accesories", required = false, defaultValue = "0") boolean accesories,
-
 
258
 
257
         	@RequestParam(name = "brand", required = false, defaultValue = "") String brand, Model model)
259
			@RequestParam(name = "brand", required = false, defaultValue = "") String brand, Model model)
258
 
260
 
259
			throws ProfitMandiBusinessException {
261
			throws ProfitMandiBusinessException {
260
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
262
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
261
		if (searchTerm == null) {
263
		if (searchTerm == null) {
262
			searchTerm = "";
264
			searchTerm = "";
263
		}
265
		}
264
		
-
 
265
 
266
 
266
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm,
267
		Map<String, Object> map = inventoryService.getCatalog(loginDetails.getFofoId(), offset, limit, searchTerm,
267
				itemId,brand);
268
				itemId, brand, accesories);
268
		model.addAllAttributes(map);
269
		model.addAllAttributes(map);
269
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
270
		model.addAttribute("hasGift", hasGift(loginDetails.getFofoId()));
270
 
271
 
271
		return "catalog";
272
		return "catalog";
272
	}
273
	}
Line 337... Line 338...
337
	public String getCatalogPaginated(HttpServletRequest request,
338
	public String getCatalogPaginated(HttpServletRequest request,
338
			@RequestParam(name = "offset", defaultValue = "0") int offset,
339
			@RequestParam(name = "offset", defaultValue = "0") int offset,
339
			@RequestParam(name = "limit", defaultValue = "20") int limit,
340
			@RequestParam(name = "limit", defaultValue = "20") int limit,
340
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
341
			@RequestParam(name = "searchTerm", required = false, defaultValue = "") String searchTerm,
341
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId,
342
			@RequestParam(name = "itemId", required = false, defaultValue = "0") int itemId,
-
 
343
			@RequestParam(name = "accesories", required = false, defaultValue = "0") boolean accesories,
342
			@RequestParam(name = "brand", required = false, defaultValue = "0") String brand, Model model)
344
			@RequestParam(name = "brand", required = false, defaultValue = "") String brand, Model model)
343
			throws ProfitMandiBusinessException {
345
			throws ProfitMandiBusinessException {
344
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
346
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
345
		if (searchTerm == null) {
347
		if (searchTerm == null) {
346
			searchTerm = "";
348
			searchTerm = "";
347
		}
349
		}
348
		Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit,
350
		Map<String, Object> map = inventoryService.getPaginatedCatalog(loginDetails.getFofoId(), offset, limit,
349
				searchTerm, itemId,brand);
351
				searchTerm, itemId, brand, accesories);
350
		model.addAllAttributes(map);
352
		model.addAllAttributes(map);
351
		return "catalog-paginated";
353
		return "catalog-paginated";
352
	}
354
	}
353
 
355
 
354
	@RequestMapping(value = "/checkItemAvailability")
356
	@RequestMapping(value = "/checkItemAvailability")
Line 1215... Line 1217...
1215
			if (cp.getName() == null) {
1217
			if (cp.getName() == null) {
1216
				cp.setName(itemRepository.selectAllByCatalogItemId(cId.intValue()).get(0).getItemDescriptionNoColor());
1218
				cp.setName(itemRepository.selectAllByCatalogItemId(cId.intValue()).get(0).getItemDescriptionNoColor());
1217
			}
1219
			}
1218
			List<Item> items = itemRepository.selectAllByCatalogItemId(cId.intValue());
1220
			List<Item> items = itemRepository.selectAllByCatalogItemId(cId.intValue());
1219
			LOGGER.info("itemsMop" + items);
1221
			LOGGER.info("itemsMop" + items);
1220
			int i=0;
1222
			int i = 0;
1221
			for(Item item :items) {
1223
			for (Item item : items) {
1222
			TagListing tagListing = tagListingRepository.selectByItemId(items.get(i).getId());
1224
				TagListing tagListing = tagListingRepository.selectByItemId(items.get(i).getId());
1223
			
1225
 
1224
		        	if (tagListing != null) {
1226
				if (tagListing != null) {
1225
				     cp.setPrice(tagListing.getMop());
1227
					cp.setPrice(tagListing.getMop());
1226
				  
1228
 
1227
				     LOGGER.info("tagListingMOP" + tagListing);
1229
					LOGGER.info("tagListingMOP" + tagListing);
1228
				
1230
 
1229
				          break;
1231
					break;
-
 
1232
 
1230
				
1233
				}
1231
		           	}
-
 
1232
			i++;
1234
				i++;
1233
			}
1235
			}
1234
			 cps.add(cp);
1236
			cps.add(cp);
1235
 
1237
 
1236
		}
1238
		}
1237
 
1239
 
1238
		List<Map<String, String>> entityList = new ArrayList<>();
1240
		List<Map<String, String>> entityList = new ArrayList<>();
1239
		for (ContentPojo cp : cps) {
1241
		for (ContentPojo cp : cps) {