| Line 194... |
Line 194... |
| 194 |
private WebProductListingRepository webProductListingRepository;
|
194 |
private WebProductListingRepository webProductListingRepository;
|
| 195 |
|
195 |
|
| 196 |
@Autowired
|
196 |
@Autowired
|
| 197 |
private RoleManager roleManagerService;
|
197 |
private RoleManager roleManagerService;
|
| 198 |
|
198 |
|
| 199 |
|
- |
|
| 200 |
@Autowired
|
199 |
@Autowired
|
| 201 |
EmailService emailService;
|
200 |
EmailService emailService;
|
| 202 |
|
- |
|
| 203 |
|
201 |
|
| 204 |
@Autowired
|
202 |
@Autowired
|
| 205 |
CsService csService;
|
203 |
CsService csService;
|
| 206 |
List<String> filterableParams = Arrays.asList("brand");
|
204 |
List<String> filterableParams = Arrays.asList("brand");
|
| 207 |
|
205 |
|
| Line 687... |
Line 685... |
| 687 |
fdi.setItem_id(itemId);
|
685 |
fdi.setItem_id(itemId);
|
| 688 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
686 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
| 689 |
cashBack = cashBack == null ? 0 : cashBack;
|
687 |
cashBack = cashBack == null ? 0 : cashBack;
|
| 690 |
fdi.setCashback(cashBack);
|
688 |
fdi.setCashback(cashBack);
|
| 691 |
fdi.setMinBuyQuantity(1);
|
689 |
fdi.setMinBuyQuantity(1);
|
| 692 |
int ourStockAvailability = ourItemAvailabilityMap.get(itemId) == null ? 0
|
- |
|
| 693 |
: Math.max(0, ourItemAvailabilityMap.get(itemId));
|
- |
|
| 694 |
fdi.setActive(ourStockAvailability > 0);
|
- |
|
| 695 |
int partnerAvailability = partnerStockAvailabilityMap.get(itemId) == null ? 0
|
690 |
int partnerAvailability = partnerStockAvailabilityMap.get(itemId) == null ? 0
|
| 696 |
: partnerStockAvailabilityMap.get(itemId);
|
691 |
: partnerStockAvailabilityMap.get(itemId);
|
| - |
|
692 |
int ourStockAvailability = ourItemAvailabilityMap.get(itemId) == null ? 0
|
| - |
|
693 |
: Math.max(0, ourItemAvailabilityMap.get(itemId));
|
| - |
|
694 |
fdi.setActive(partnerAvailability > 0);
|
| 697 |
fdi.setAvailability(Math.min(5, ourStockAvailability + partnerAvailability));
|
695 |
fdi.setAvailability(Math.min(5, ourStockAvailability + partnerAvailability));
|
| 698 |
fdi.setQuantityStep(1);
|
696 |
fdi.setQuantityStep(1);
|
| 699 |
fdi.setMaxQuantity(fdi.getAvailability());
|
697 |
fdi.setMaxQuantity(fdi.getAvailability());
|
| 700 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
698 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
| 701 |
}
|
699 |
}
|
| 702 |
}
|
700 |
}
|
| 703 |
}
|
701 |
}
|
| 704 |
if (fofoAvailabilityInfoMap.values().size() > 0) {
|
702 |
if (fofoAvailabilityInfoMap.values().size() > 0) {
|
| 705 |
ffdr.setItems(fofoAvailabilityInfoMap.values().stream().sorted()
|
703 |
ffdr.setItems(fofoAvailabilityInfoMap.values().stream()
|
| 706 |
.sorted(
|
- |
|
| 707 |
Comparator.comparing(FofoAvailabilityInfo::isActive).reversed()
|
704 |
.sorted(Comparator.comparing(FofoAvailabilityInfo::isActive, Comparator.reverseOrder())
|
| 708 |
.thenComparingInt(x->x.getAvailability())).collect(Collectors.toList()));
|
705 |
.thenComparingInt(y -> -y.getAvailability()))
|
| - |
|
706 |
.collect(Collectors.toList()));
|
| 709 |
dealResponse.add(ffdr);
|
707 |
dealResponse.add(ffdr);
|
| 710 |
}
|
708 |
}
|
| 711 |
}
|
709 |
}
|
| 712 |
return dealResponse.stream().sorted((x, y) -> {
|
710 |
return dealResponse.stream().sorted((x, y) -> {
|
| 713 |
return Math.min(y.getItems().get(0).getAvailability(), 1)
|
711 |
return Math.min(y.getItems().get(0).getAvailability(), 1)
|
| Line 745... |
Line 743... |
| 745 |
emailModel.put("date", dateTimeFormatter);
|
743 |
emailModel.put("date", dateTimeFormatter);
|
| 746 |
|
744 |
|
| 747 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(pendingOrder.getFofoId());
|
745 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(pendingOrder.getFofoId());
|
| 748 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
746 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
| 749 |
String[] customerEmail = null;
|
747 |
String[] customerEmail = null;
|
| 750 |
if (customer.getEmailId()!= null) {
|
748 |
if (customer.getEmailId() != null) {
|
| 751 |
customerEmail = new String[]{ customer.getEmailId() };
|
749 |
customerEmail = new String[] { customer.getEmailId() };
|
| 752 |
}
|
750 |
}
|
| 753 |
List<String> bccTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
751 |
List<String> bccTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 754 |
"hemant.kaura@smartdukaan.com", "niranjan.kala@smartdukaan.com", "sm@smartdukaan.com",
|
752 |
"hemant.kaura@smartdukaan.com", "niranjan.kala@smartdukaan.com", "sm@smartdukaan.com",
|
| 755 |
"tejbeer.kaur@shop2020.in", customRetailer.getEmail());
|
753 |
"tejbeer.kaur@shop2020.in", customRetailer.getEmail());
|
| 756 |
List<String> authUserEmails = csService.getAuthUserByPartnerId(customRetailer.getPartnerId());
|
754 |
List<String> authUserEmails = csService.getAuthUserByPartnerId(customRetailer.getPartnerId());
|
| 757 |
if(authUserEmails != null) {
|
755 |
if (authUserEmails != null) {
|
| 758 |
authUserEmails = new ArrayList<>();
|
756 |
authUserEmails = new ArrayList<>();
|
| 759 |
}
|
757 |
}
|
| 760 |
logger.info("authUserEmails {}", authUserEmails);
|
758 |
logger.info("authUserEmails {}", authUserEmails);
|
| 761 |
authUserEmails.addAll(bccTo);
|
759 |
authUserEmails.addAll(bccTo);
|
| 762 |
|
760 |
|
| 763 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm",
|
761 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm", emailModel,
|
| 764 |
emailModel, customerEmail, null,
|
- |
|
| 765 |
authUserEmails.toArray(new String[0]));
|
762 |
customerEmail, null, authUserEmails.toArray(new String[0]));
|
| 766 |
return responseSender.ok(pendingOrder);
|
763 |
return responseSender.ok(pendingOrder);
|
| 767 |
}
|
764 |
}
|
| 768 |
|
765 |
|
| 769 |
@RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
|
766 |
@RequestMapping(value = "/store/addresses/{customerId}", method = RequestMethod.GET)
|
| 770 |
public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
|
767 |
public ResponseEntity<?> getAll(HttpServletRequest request, @PathVariable int customerId) throws Throwable {
|
| Line 814... |
Line 811... |
| 814 |
pendingOrder.setStatus(OrderStatus.CLOSED);
|
811 |
pendingOrder.setStatus(OrderStatus.CLOSED);
|
| 815 |
}
|
812 |
}
|
| 816 |
|
813 |
|
| 817 |
pendingOrderItemRepository.persist(pendingOrderItem);
|
814 |
pendingOrderItemRepository.persist(pendingOrderItem);
|
| 818 |
String itemDescription = itemRepository.selectById(pendingOrderItem.getItemId()).getItemDescription();
|
815 |
String itemDescription = itemRepository.selectById(pendingOrderItem.getItemId()).getItemDescription();
|
| 819 |
otpProcessor.sendSms(OtpProcessor.SELF_CANCELLED_TEMPLATE_ID,
|
816 |
otpProcessor.sendSms(OtpProcessor.SELF_CANCELLED_TEMPLATE_ID,
|
| 820 |
String.format(OtpProcessor.SELF_CANCELLED_TEMPLATE, pendingOrder.getId(),
|
817 |
String.format(OtpProcessor.SELF_CANCELLED_TEMPLATE, pendingOrder.getId(),
|
| 821 |
StringUtils.abbreviate(itemDescription, 30),
|
818 |
StringUtils.abbreviate(itemDescription, 30),
|
| 822 |
FormattingUtils.format(pendingOrderItem.getCancelledTimestamp())),
|
819 |
FormattingUtils.format(pendingOrderItem.getCancelledTimestamp())),
|
| 823 |
customer.getMobileNumber());
|
820 |
customer.getMobileNumber());
|
| 824 |
}
|
821 |
}
|
| 825 |
|
822 |
|
| 826 |
return responseSender.ok(true);
|
823 |
return responseSender.ok(true);
|
| 827 |
|
824 |
|