Subversion Repositories SmartDukaan

Rev

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

Rev 31625 Rev 31628
Line 264... Line 264...
264
 
264
 
265
	@RequestMapping(value = "/fofo/fovourites", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
265
	@RequestMapping(value = "/fofo/fovourites", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
266
	public ResponseEntity<?> getFavourites(HttpServletRequest request, @RequestParam int fofoId) throws Exception {
266
	public ResponseEntity<?> getFavourites(HttpServletRequest request, @RequestParam int fofoId) throws Exception {
267
 
267
 
268
		Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream()
268
		Set<Integer> catalogIds = catalogFavouriteRepository.selectBypartnerId(fofoId).stream()
269
				.map(x -> x.getCatatlogId()).collect(Collectors.toSet());
269
				.map(x -> x.getCatalogId()).collect(Collectors.toSet());
270
		RestClient rc = new RestClient();
270
		RestClient rc = new RestClient();
271
		Map<String, String> params = new HashMap<>();
271
		Map<String, String> params = new HashMap<>();
272
		List<String> mandatoryQ = new ArrayList<>();
272
		List<String> mandatoryQ = new ArrayList<>();
273
		mandatoryQ.add(
273
		mandatoryQ.add(
274
				String.format("+catalogId_i:(%s) +{!parent which=\"id:catalog*\"}", StringUtils.join(catalogIds, " ")));
274
				String.format("+catalogId_i:(%s) +{!parent which=\"id:catalog*\"}", StringUtils.join(catalogIds, " ")));
Line 304... Line 304...
304
 
304
 
305
		CatalogFavourite catalogFavourite = catalogFavouriteRepository.selectBypartnerAndCatalogId(fofoId, catalogId);
305
		CatalogFavourite catalogFavourite = catalogFavouriteRepository.selectBypartnerAndCatalogId(fofoId, catalogId);
306
 
306
 
307
		if (catalogFavourite == null) {
307
		if (catalogFavourite == null) {
308
			catalogFavourite = new CatalogFavourite();
308
			catalogFavourite = new CatalogFavourite();
309
			catalogFavourite.setCatatlogId(catalogId);
309
			catalogFavourite.setCatalogId(catalogId);
310
			catalogFavourite.setFofoId(fofoId);
310
			catalogFavourite.setFofoId(fofoId);
311
			catalogFavourite.setCreatedTimestamp(LocalDateTime.now());
311
			catalogFavourite.setCreatedTimestamp(LocalDateTime.now());
312
			catalogFavouriteRepository.persist(catalogFavourite);
312
			catalogFavouriteRepository.persist(catalogFavourite);
313
 
313
 
314
		}
314
		}