Subversion Repositories SmartDukaan

Rev

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

Rev 26652 Rev 26654
Line 133... Line 133...
133
	@Autowired
133
	@Autowired
134
	private RoleManager roleManagerService;
134
	private RoleManager roleManagerService;
135
 
135
 
136
	List<String> filterableParams = Arrays.asList("brand");
136
	List<String> filterableParams = Arrays.asList("brand");
137
 
137
 
-
 
138
	private Set<Integer> bestSellers = new HashSet<>(Arrays.asList(1022090, 1022090, 1022090, 1022024, 1022024, 1022024,
-
 
139
			1021868, 1021868, 1022346, 1022346, 1022337, 1022337, 1022355, 1022355, 1022344, 1022344, 1022343, 1022343,
-
 
140
			1022336, 1022336, 1022336, 1021933, 1021933, 1022025, 1022025, 1022025, 1003800, 1003800, 1003800, 1022322,
-
 
141
			1022322, 1022322, 1022307, 1022307, 1022304, 1022304, 1022004, 1022004, 1022004, 1021934, 1021934, 1021897,
-
 
142
			1021897, 1021768, 1021768));
-
 
143
 
-
 
144
	private Set<Integer> latestArrivals = new HashSet<>(Arrays.asList(1022386, 1022386, 1022381, 1022381, 1022381,
-
 
145
			1022380, 1022380, 1022377, 1022377, 1022376, 1022376, 1022375, 1022375, 1022374, 1022374, 1022374, 1022373,
-
 
146
			1022373, 1022372, 1022372, 1022371, 1022371, 1022370, 1022370));
-
 
147
 
138
	@ApiImplicitParams({
148
	@ApiImplicitParams({
139
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
149
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
140
	@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
150
	@RequestMapping(value = "/store/fofo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
141
	public ResponseEntity<?> getFofo(HttpServletRequest request,
151
	public ResponseEntity<?> getFofo(HttpServletRequest request,
142
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
152
			@RequestParam(value = "categoryId", required = false, defaultValue = "(3 OR 6)") String categoryId,
Line 237... Line 247...
237
		}.getType());
247
		}.getType());
238
 
248
 
239
		return responseSender.ok(dealBrandsResponse);
249
		return responseSender.ok(dealBrandsResponse);
240
	}
250
	}
241
 
251
 
-
 
252
	@RequestMapping(value = "/store/tag/{tag}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
253
	public ResponseEntity<?> bestSellers(HttpServletRequest request, String tag) throws Exception {
-
 
254
		List<FofoCatalogResponse> dealResponse = new ArrayList<>();
-
 
255
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
-
 
256
		// UserCart uc = userAccountRepository.getUserCart(userInfo.getUserId());
-
 
257
		List<Integer> tagIds = pricingService.getTagsIdsByRetailerId(userInfo.getRetailerId());
-
 
258
		RestClient rc = new RestClient();
-
 
259
		Map<String, String> params = new HashMap<>();
-
 
260
		List<String> mandatoryQ = new ArrayList<>();
-
 
261
		Set<Integer> catalogIds = this.bestSellers;
-
 
262
		if (tag == "latestArrivals") {
-
 
263
			catalogIds = this.latestArrivals;
-
 
264
		}
-
 
265
		mandatoryQ.add(
-
 
266
				String.format("+{!parent which=\"catalogId_i:" + StringUtils.join(catalogIds, " ") + "\"} tagId_i:(%s)",
-
 
267
						StringUtils.join(tagIds, " ")));
-
 
268
		params.put("q", StringUtils.join(mandatoryQ, " "));
-
 
269
		params.put("fl", "*, [child parentFilter=id:catalog*]");
-
 
270
		// params.put("sort", "create_s desc");
-
 
271
		params.put("start", String.valueOf(0));
-
 
272
		params.put("rows", String.valueOf(30));
-
 
273
		params.put("wt", "json");
-
 
274
		String response = null;
-
 
275
		try {
-
 
276
			response = rc.get(SchemeType.HTTP, "50.116.10.120", 8984, "solr/demo/select", params);
-
 
277
		} catch (HttpHostConnectException e) {
-
 
278
			throw new ProfitMandiBusinessException("", "", "Could not connect to host");
-
 
279
		}
-
 
280
		JSONObject solrResponseJSONObj = new JSONObject(response).getJSONObject("response");
-
 
281
		JSONArray docs = solrResponseJSONObj.getJSONArray("docs");
-
 
282
		dealResponse = getCatalogResponse(docs, false);
-
 
283
		return responseSender.ok(dealResponse);
-
 
284
	}
-
 
285
 
242
	@RequestMapping(value = "/store/otp/generateOTP", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
286
	@RequestMapping(value = "/store/otp/generateOTP", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
243
	public ResponseEntity<?> generateOtp(HttpServletRequest request, @RequestParam String email,
287
	public ResponseEntity<?> generateOtp(HttpServletRequest request, @RequestParam String email,
244
			@RequestParam String phone) throws Exception {
288
			@RequestParam String phone) throws Exception {
245
 
289
 
246
		return responseSender.ok(otpProcessor.generateOtp(email, phone, OtpType.PREBOOKING_ORDER));
290
		return responseSender.ok(otpProcessor.generateOtp(email, phone, OtpType.PREBOOKING_ORDER));
Line 260... Line 304...
260
 
304
 
261
	@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
305
	@RequestMapping(value = "/store/address", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
262
	@ApiImplicitParams({
306
	@ApiImplicitParams({
263
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
307
			@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
264
	@ApiOperation(value = "Get brand list and count for category")
308
	@ApiOperation(value = "Get brand list and count for category")
265
	public ResponseEntity<?> getAddress(HttpServletRequest request)
309
	public ResponseEntity<?> getAddress(HttpServletRequest request) throws Exception {
266
			throws Exception {
-
 
267
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
310
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
268
		Integer storeId = userInfo.getRetailerId();
311
		Integer storeId = userInfo.getRetailerId();
269
		CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
312
		CustomRetailer customRetailer = retailerService.getFofoRetailer(storeId);
270
 
313
 
271
		return responseSender.ok(customRetailer.getAddress());
314
		return responseSender.ok(customRetailer.getAddress());