| Line 222... |
Line 222... |
| 222 |
return responseSender.ok(bucket);
|
222 |
return responseSender.ok(bucket);
|
| 223 |
}
|
223 |
}
|
| 224 |
|
224 |
|
| 225 |
@RequestMapping(value = "/fofo/suggestedPo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
225 |
@RequestMapping(value = "/fofo/suggestedPo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 226 |
public ResponseEntity<?> getSuggestedPo(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
226 |
public ResponseEntity<?> getSuggestedPo(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
| - |
|
227 |
int userId = (int) request.getAttribute("userId");
|
| - |
|
228 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| - |
|
229 |
int fofoId = uc.getUserId();
|
| - |
|
230 |
SuggestedPo suggestedPo = suggestedPoRepository.selectAllOpenPoByFofoId(fofoId).get(0);
|
| - |
|
231 |
if(suggestedPo == null){
|
| - |
|
232 |
throw new ProfitMandiBusinessException("", "", "Open po is not available in list");
|
| 227 |
|
233 |
}
|
| 228 |
List<SuggestedPoDetail> mpd = suggestedPoDetailRepository.selectByPoId(id);
|
234 |
List<SuggestedPoDetail> mpd = suggestedPoDetailRepository.selectByPoId(suggestedPo.getId());
|
| 229 |
Map<Integer, Integer> itemIdsQtyMap = mpd.stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x.getQuantity()));
|
235 |
Map<Integer, Integer> itemIdsQtyMap = mpd.stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x.getQuantity()));
|
| 230 |
|
236 |
|
| 231 |
Set<Integer> catalogIds = itemRepository.selectByIds(itemIdsQtyMap.keySet()).stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
|
237 |
Set<Integer> catalogIds = itemRepository.selectByIds(itemIdsQtyMap.keySet()).stream().map(x -> x.getCatalogItemId()).collect(Collectors.toSet());
|
| 232 |
RestClient rc = new RestClient();
|
238 |
RestClient rc = new RestClient();
|
| 233 |
Map<String, String> params = new HashMap<>();
|
239 |
Map<String, String> params = new HashMap<>();
|
| Line 251... |
Line 257... |
| 251 |
List<FofoCatalogResponse> dealResponse = getCatalogSingleSkuResponse(docs, itemIdsQtyMap, false);
|
257 |
List<FofoCatalogResponse> dealResponse = getCatalogSingleSkuResponse(docs, itemIdsQtyMap, false);
|
| 252 |
|
258 |
|
| 253 |
return responseSender.ok(dealResponse);
|
259 |
return responseSender.ok(dealResponse);
|
| 254 |
}
|
260 |
}
|
| 255 |
|
261 |
|
| 256 |
@RequestMapping(value = "/suggestedPo/status", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
262 |
@RequestMapping(value = "/suggestedPo/status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 257 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
263 |
@ApiImplicitParams({@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 258 |
@ApiOperation(value = "")
|
264 |
@ApiOperation(value = "")
|
| 259 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
265 |
public ResponseEntity<?> changeSuggestedPoStatus(HttpServletRequest request, @RequestParam int id) throws ProfitMandiBusinessException {
|
| 260 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
266 |
SuggestedPo suggestedPo = suggestedPoRepository.selectById(id);
|
| 261 |
suggestedPo.setStatus("closed");
|
267 |
suggestedPo.setStatus("closed");
|
| Line 614... |
Line 620... |
| 614 |
new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
|
620 |
new ProfitMandiBusinessException("Retailer id", userInfo.getUserId(), "NOT_FOFO_RETAILER"));
|
| 615 |
}
|
621 |
}
|
| 616 |
return responseSender.ok(dealResponse.get(0));
|
622 |
return responseSender.ok(dealResponse.get(0));
|
| 617 |
}
|
623 |
}
|
| 618 |
|
624 |
|
| - |
|
625 |
|
| - |
|
626 |
@RequestMapping(value = "/suggestedPoDeals", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
627 |
public ResponseEntity<?> suggestedPoDeals(HttpServletRequest request,@RequestBody Set<Integer>catalogIds) throws Exception {
|
| - |
|
628 |
|
| - |
|
629 |
int userId = (int) request.getAttribute("userId");
|
| - |
|
630 |
UserCart uc = userAccountRepository.getUserCart(userId);
|
| - |
|
631 |
int fofoId = uc.getUserId();
|
| - |
|
632 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| - |
|
633 |
if (!catalogIds.isEmpty()) {
|
| - |
|
634 |
dealResponse = webSolrService.dealResponse(catalogIds, fofoId);
|
| - |
|
635 |
}
|
| - |
|
636 |
return responseSender.ok(dealResponse);
|
| - |
|
637 |
}
|
| - |
|
638 |
|
| 619 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
639 |
@RequestMapping(value = "/fofo/brands", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 620 |
public ResponseEntity<?> getBrandsToDisplay(HttpServletRequest request,
|
640 |
public ResponseEntity<?> getBrandsToDisplay(HttpServletRequest request,
|
| 621 |
@RequestParam(required = false, defaultValue = "0") int categoryId) throws Exception {
|
641 |
@RequestParam(required = false, defaultValue = "0") int categoryId) throws Exception {
|
| 622 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
642 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 623 |
logger.info("userInfo [{}]", userInfo);
|
643 |
logger.info("userInfo [{}]", userInfo);
|