Subversion Repositories SmartDukaan

Rev

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

Rev 22952 Rev 22988
Line 101... Line 101...
101
			@RequestParam(value = "direction", required = false) String direction,
101
			@RequestParam(value = "direction", required = false) String direction,
102
			@RequestParam(value = "filterData", required = false) String filterData) throws ProfitMandiBusinessException {
102
			@RequestParam(value = "filterData", required = false) String filterData) throws ProfitMandiBusinessException {
103
		logger.info("Request " + request.getParameterMap());
103
		logger.info("Request " + request.getParameterMap());
104
		String response = null;
104
		String response = null;
105
		int userId = (int) request.getAttribute("userId");
105
		int userId = (int) request.getAttribute("userId");
-
 
106
		
-
 
107
		//If pincode belongs to Specific warehouse marked
-
 
108
		//availability should be fetched for that warehouse only
-
 
109
		//show only skus belonging to that specific
-
 
110
		//else use normal flow
106
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
111
		UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
107
		// TODO: move to properties
112
		// TODO: move to properties
108
		String uri = "/deals/" + userId;
113
		String uri = "/deals/" + userId;
109
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
114
		RestClient rc = new RestClient(SchemeType.HTTP, host, port);
110
		Map<String, String> params = new HashMap<>();
115
		Map<String, String> params = new HashMap<>();
Line 204... Line 209...
204
							fdi.setItem_id(itemId);
209
							fdi.setItem_id(itemId);
205
							fdi.setAvailability(inventoryService.getCachedAvailabilityByItemIdWarehouseIds(itemId, warehouseIds));
210
							fdi.setAvailability(inventoryService.getCachedAvailabilityByItemIdWarehouseIds(itemId, warehouseIds));
206
							fdi.setQuantityStep(1);
211
							fdi.setQuantityStep(1);
207
							fdi.setMinBuyQuantity(1);
212
							fdi.setMinBuyQuantity(1);
208
							fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
213
							fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
-
 
214
							if(fdi.getMaxQuantity() > 0) {
209
							fofoAvailabilityInfoMap.put(itemId, fdi);
215
								fofoAvailabilityInfoMap.put(itemId, fdi);
-
 
216
							}
210
					}
217
					}
211
				}
218
				}
-
 
219
				if(fofoAvailabilityInfoMap.values().size() > 0) {
212
				ffdr.setItems(new ArrayList<FofoAvailabilityInfo>(fofoAvailabilityInfoMap.values()));
220
					ffdr.setItems(new ArrayList<FofoAvailabilityInfo>(fofoAvailabilityInfoMap.values()));
213
				dealResponse.add(ffdr);
221
					dealResponse.add(ffdr);
-
 
222
				}
214
			}
223
			}
215
			
224
			
216
		} else {
225
		} else {
217
			return responseSender.badRequest(new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
226
			return responseSender.badRequest(new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
218
		}
227
		}
Line 378... Line 387...
378
				responseObject.add(innerObject);
387
				responseObject.add(innerObject);
379
			}
388
			}
380
		}
389
		}
381
		return responseSender.ok(responseObject);
390
		return responseSender.ok(responseObject);
382
	}
391
	}
-
 
392
	
-
 
393
	/*@RequestMapping(value = "/deals/pincode/{pincode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
-
 
394
	public ResponseEntity<?> getDealsByPinCode (@PathVariable String pincode, 
-
 
395
			@RequestParam(value = "offset") String offset, @RequestParam(value = "limit") String limit) throws ProfitMandiBusinessException{
-
 
396
			
-
 
397
			return responseSender.ok("");
-
 
398
	}*/
383
 
399
 
384
}
400
}