| Line 420... |
Line 420... |
| 420 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
|
420 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
|
| 421 |
|
421 |
|
| 422 |
}
|
422 |
}
|
| 423 |
|
423 |
|
| 424 |
@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
|
424 |
@RequestMapping(value = "/updatePriceDropImeis", method = RequestMethod.POST)
|
| 425 |
public String updatePriceDropImeis(HttpServletRequest request, @RequestBody PriceDropImeisModel priceDropImeisModel,
|
425 |
public String updatePriceDropImeis(@RequestBody PriceDropImeisModel priceDropImeisModel,
|
| 426 |
Model model) throws ProfitMandiBusinessException, Exception {
|
426 |
Model model) throws Exception {
|
| 427 |
final PriceDropImeiStatus status;
|
427 |
final PriceDropImeiStatus status;
|
| 428 |
|
428 |
|
| 429 |
switch (priceDropImeisModel.getUpdatedStatus()) {
|
429 |
switch (priceDropImeisModel.getUpdatedStatus()) {
|
| 430 |
case "approved": {
|
430 |
case "approved": {
|
| 431 |
status = PriceDropImeiStatus.APPROVED;
|
431 |
status = PriceDropImeiStatus.APPROVED;
|
| Line 446... |
Line 446... |
| 446 |
default:
|
446 |
default:
|
| 447 |
throw new IllegalStateException("Unexpected value: " + priceDropImeisModel.getUpdatedStatus());
|
447 |
throw new IllegalStateException("Unexpected value: " + priceDropImeisModel.getUpdatedStatus());
|
| 448 |
}
|
448 |
}
|
| 449 |
|
449 |
|
| 450 |
if (PriceDropImeiStatus.PENDING.equals(status)) {
|
450 |
if (PriceDropImeiStatus.PENDING.equals(status)) {
|
| 451 |
List<PriceDropIMEI> priceDropIMEIsToPending = new ArrayList<>();
|
- |
|
| 452 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByStatuses(Arrays.asList(PriceDropImeiStatus.REJECTED, PriceDropImeiStatus.HOLD),
|
451 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByStatuses(Arrays.asList(PriceDropImeiStatus.REJECTED, PriceDropImeiStatus.HOLD),
|
| 453 |
priceDropImeisModel.getPriceDropId());
|
452 |
priceDropImeisModel.getPriceDropId());
|
| 454 |
LOGGER.info("hello" + priceDropIMEIs);
|
453 |
LOGGER.info("hello" + priceDropIMEIs);
|
| 455 |
for (PriceDropIMEI priceDropIMEI : priceDropIMEIs) {
|
454 |
for (PriceDropIMEI priceDropIMEI : priceDropIMEIs) {
|
| 456 |
if (priceDropIMEI.getStatus().equals(status) || !priceDropImeisModel.getUpdatedImeis().contains(priceDropIMEI.getImei())) {
|
455 |
if (priceDropIMEI.getStatus().equals(status) || !priceDropImeisModel.getUpdatedImeis().contains(priceDropIMEI.getImei())) {
|
| 457 |
continue;
|
456 |
continue;
|
| 458 |
}
|
457 |
}
|
| 459 |
priceDropIMEIsToPending.add(priceDropIMEI);
|
- |
|
| 460 |
priceDropIMEI.setStatus(PriceDropImeiStatus.PENDING);
|
458 |
priceDropIMEI.setStatus(PriceDropImeiStatus.PENDING);
|
| 461 |
}
|
459 |
}
|
| 462 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
460 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 463 |
return "response";
|
461 |
return "response";
|
| 464 |
}
|
462 |
}
|
| Line 546... |
Line 544... |
| 546 |
return false;
|
544 |
return false;
|
| 547 |
}
|
545 |
}
|
| 548 |
|
546 |
|
| 549 |
@Autowired
|
547 |
@Autowired
|
| 550 |
BrandsService brandsService;
|
548 |
BrandsService brandsService;
|
| - |
|
549 |
|
| 551 |
@RequestMapping(value = "/priceCircular")
|
550 |
@RequestMapping(value = "/priceCircular")
|
| 552 |
public String priceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
551 |
public String priceCircular(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 553 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
552 |
int fofoId = Utils.SYSTEM_PARTNER_ID;
|
| 554 |
List<String> brands = brandsService.getBrandsToDisplay(3).stream().map(x -> x.getName()).collect(Collectors.toList());
|
553 |
List<String> brands = brandsService.getBrandsToDisplay(3).stream().map(x -> x.getName()).collect(Collectors.toList());
|
| 555 |
model.addAttribute("brands", brands);
|
554 |
model.addAttribute("brands", brands);
|
| Line 581... |
Line 580... |
| 581 |
}
|
580 |
}
|
| 582 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
581 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoId);
|
| 583 |
|
582 |
|
| 584 |
//.minusDays(2)
|
583 |
//.minusDays(2)
|
| 585 |
PriceCircularModel priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, brand, LocalDate.now());
|
584 |
PriceCircularModel priceCircular = priceCircularService.getPriceCircularByOffer(fofoId, brand, LocalDate.now());
|
| 586 |
return this.getPriceCircularView(priceCircular, model,fs.getCode());
|
585 |
return this.getPriceCircularView(priceCircular, model, fs.getCode());
|
| 587 |
}
|
586 |
}
|
| 588 |
|
587 |
|
| 589 |
public String getPriceCircularView( PriceCircularModel priceCircular, Model model, String partnerCode ) throws ProfitMandiBusinessException {
|
588 |
public String getPriceCircularView(PriceCircularModel priceCircular, Model model, String partnerCode) throws ProfitMandiBusinessException {
|
| 590 |
List<String> schemeHeaders = new ArrayList<>(this.getSchemeHeaders(priceCircular));
|
589 |
List<String> schemeHeaders = new ArrayList<>(this.getSchemeHeaders(priceCircular));
|
| 591 |
List<String> allMargins = ALL_MARGINS.stream().filter(x -> schemeHeaders.contains(x)).collect(Collectors.toList());
|
590 |
List<String> allMargins = ALL_MARGINS.stream().filter(x -> schemeHeaders.contains(x)).collect(Collectors.toList());
|
| 592 |
List<String> sellins = SELLINS.stream().filter(x -> allMargins.contains(x)).collect(Collectors.toList());
|
591 |
List<String> sellins = SELLINS.stream().filter(x -> allMargins.contains(x)).collect(Collectors.toList());
|
| 593 |
List<String> sellouts = SELLOUTS.stream().filter(x -> allMargins.contains(x)).collect(Collectors.toList());
|
592 |
List<String> sellouts = SELLOUTS.stream().filter(x -> allMargins.contains(x)).collect(Collectors.toList());
|
| 594 |
LOGGER.info("Scheme Headers = {}", schemeHeaders);
|
593 |
LOGGER.info("Scheme Headers = {}", schemeHeaders);
|