| Line 397... |
Line 397... |
| 397 |
StringBuffer itemBuffer = new StringBuffer();
|
397 |
StringBuffer itemBuffer = new StringBuffer();
|
| 398 |
List<PendingOrderItem> orderItems = pendingOrderItemRepository.selectByOrderId(pendingOrder.getId());
|
398 |
List<PendingOrderItem> orderItems = pendingOrderItemRepository.selectByOrderId(pendingOrder.getId());
|
| 399 |
int totalItems = 0;
|
399 |
int totalItems = 0;
|
| 400 |
String itemNoColor = null;
|
400 |
String itemNoColor = null;
|
| 401 |
float maxValue = 0;
|
401 |
float maxValue = 0;
|
| 402 |
for(PendingOrderItem orderItem : orderItems) {
|
402 |
for (PendingOrderItem orderItem : orderItems) {
|
| 403 |
if(maxValue < orderItem.getSellingPrice()) {
|
403 |
if (maxValue < orderItem.getSellingPrice()) {
|
| 404 |
maxValue = orderItem.getSellingPrice();
|
404 |
maxValue = orderItem.getSellingPrice();
|
| 405 |
itemNoColor = itemRepository.selectById(orderItem.getItemId()).getItemDescriptionNoColor();
|
405 |
itemNoColor = itemRepository.selectById(orderItem.getItemId()).getItemDescriptionNoColor();
|
| 406 |
}
|
406 |
}
|
| 407 |
totalItems += orderItem.getQuantity();
|
407 |
totalItems += orderItem.getQuantity();
|
| 408 |
}
|
408 |
}
|
| 409 |
if(totalItems > 1) {
|
409 |
if (totalItems > 1) {
|
| 410 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 22));
|
410 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 22));
|
| 411 |
itemBuffer.append(" +").append(totalItems-1).append(" items");
|
411 |
itemBuffer.append(" +").append(totalItems - 1).append(" items");
|
| 412 |
} else {
|
412 |
} else {
|
| 413 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 30));
|
413 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 30));
|
| 414 |
}
|
414 |
}
|
| 415 |
String message = String.format(OtpProcessor.TEMPLATE_ORDER_CREATED, pendingOrder.getId(), itemBuffer.toString(), pendingOrder.getTotalAmount());
|
415 |
String message = String.format(OtpProcessor.TEMPLATE_ORDER_CREATED, pendingOrder.getId(),
|
| - |
|
416 |
itemBuffer.toString(), pendingOrder.getTotalAmount());
|
| 416 |
otpProcessor.sendSms(OtpProcessor.TEMPLATE_ORDER_CREATED_ID, message, customer.getMobileNumber());
|
417 |
otpProcessor.sendSms(OtpProcessor.TEMPLATE_ORDER_CREATED_ID, message, customer.getMobileNumber());
|
| 417 |
|
418 |
|
| 418 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm", emailModel,
|
419 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm", emailModel,
|
| 419 |
customerEmail, null, bccTo.toArray(new String[0]));
|
420 |
customerEmail, null, bccTo.toArray(new String[0]));
|
| 420 |
|
421 |
|
| 421 |
List<String> gmailIds = csService.getAuthUserIdByPartnerId(customRetailer.getPartnerId()).stream()
|
422 |
List<String> gmailIds = csService.getAuthUserIdByPartnerId(customRetailer.getPartnerId()).stream()
|
| 422 |
.map(x -> x.getGmailId()).collect(Collectors.toList());
|
423 |
.map(x -> x.getGmailId()).collect(Collectors.toList());
|
| - |
|
424 |
gmailIds.add("tarunverma09@gmail.com");
|
| 423 |
List<User> user = dtrUserRepository.selectAllByEmailIds(gmailIds);
|
425 |
List<User> user = dtrUserRepository.selectAllByEmailIds(gmailIds);
|
| 424 |
List<Integer> userIds = user.stream().map(x -> x.getId()).collect(Collectors.toList());
|
426 |
List<Integer> userIds = user.stream().map(x -> x.getId()).collect(Collectors.toList());
|
| 425 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
427 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 426 |
sendNotificationModel.setCampaignName("Online Order Alert");
|
428 |
sendNotificationModel.setCampaignName("Online Order Alert");
|
| 427 |
sendNotificationModel.setTitle("Online Order Update");
|
429 |
sendNotificationModel.setTitle("Online Order Update");
|
| 428 |
sendNotificationModel.setMessage(String.format("You have new Online Order. Please check your Dashboard"));
|
430 |
sendNotificationModel.setMessage(String.format(
|
| - |
|
431 |
"You have new Online Order. Please check your Dashboard. In case of an activation scheme pls ensure the handset is activated, payout will be processed as per brand's activation report."));
|
| 429 |
sendNotificationModel.setType("url");
|
432 |
sendNotificationModel.setType("url");
|
| 430 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
433 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| 431 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
434 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 432 |
sendNotificationModel.setMessageType(MessageType.notification);
|
435 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 433 |
int userId = userAccountRepository.selectUserIdByRetailerId(pendingOrder.getFofoId());
|
436 |
int userId = userAccountRepository.selectUserIdByRetailerId(pendingOrder.getFofoId());
|
| Line 443... |
Line 446... |
| 443 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
446 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| 444 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
447 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| 445 |
sendNotificationModel.setMessageType(MessageType.notification);
|
448 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| 446 |
sendNotificationModel.setUserIds(userIds);
|
449 |
sendNotificationModel.setUserIds(userIds);
|
| 447 |
|
450 |
|
| 448 |
|
- |
|
| 449 |
}
|
451 |
}
|
| 450 |
return responseSender.ok(returnMap);
|
452 |
return responseSender.ok(returnMap);
|
| 451 |
|
453 |
|
| 452 |
}
|
454 |
}
|
| 453 |
|
455 |
|
| Line 751... |
Line 753... |
| 751 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
753 |
FofoCatalogResponse ffdr = new FofoCatalogResponse();
|
| 752 |
ffdr.setCatalogId(doc.getInt("catalogId_i"));
|
754 |
ffdr.setCatalogId(doc.getInt("catalogId_i"));
|
| 753 |
ffdr.setImageUrl(doc.getString("imageUrl_s"));
|
755 |
ffdr.setImageUrl(doc.getString("imageUrl_s"));
|
| 754 |
ffdr.setTitle(doc.getString("title_s"));
|
756 |
ffdr.setTitle(doc.getString("title_s"));
|
| 755 |
List<WebOffer> webOffers = webOfferRepository.selectAllActiveOffers().get(ffdr.getCatalogId());
|
757 |
List<WebOffer> webOffers = webOfferRepository.selectAllActiveOffers().get(ffdr.getCatalogId());
|
| 756 |
if(webOffers != null && webOffers.size() > 0) {
|
758 |
if (webOffers != null && webOffers.size() > 0) {
|
| 757 |
ffdr.setOffers(webOffers.stream().map(x->x.getSmallText()).collect(Collectors.toList()));
|
759 |
ffdr.setOffers(webOffers.stream().map(x -> x.getSmallText()).collect(Collectors.toList()));
|
| 758 |
}
|
760 |
}
|
| 759 |
try {
|
761 |
try {
|
| 760 |
ffdr.setFeature(doc.getString("feature_s"));
|
762 |
ffdr.setFeature(doc.getString("feature_s"));
|
| 761 |
} catch (Exception e) {
|
763 |
} catch (Exception e) {
|
| 762 |
ffdr.setFeature(null);
|
764 |
ffdr.setFeature(null);
|
| Line 780... |
Line 782... |
| 780 |
fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
|
782 |
fdi.setColor(childItem.has("color_s") ? childItem.getString("color_s") : "");
|
| 781 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
783 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
| 782 |
fdi.setItem_id(itemId);
|
784 |
fdi.setItem_id(itemId);
|
| 783 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
785 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
| 784 |
cashBack = cashBack == null ? 0 : cashBack;
|
786 |
cashBack = cashBack == null ? 0 : cashBack;
|
| 785 |
//TODO:Dont commit
|
787 |
// TODO:Dont commit
|
| 786 |
//fdi.setCashback(Math.min(100, fdi.getMop()));
|
788 |
// fdi.setCashback(Math.min(100, fdi.getMop()));
|
| 787 |
fdi.setMinBuyQuantity(1);
|
789 |
fdi.setMinBuyQuantity(1);
|
| 788 |
int partnerAvailability = partnerStockAvailabilityMap.get(itemId) == null ? 0
|
790 |
int partnerAvailability = partnerStockAvailabilityMap.get(itemId) == null ? 0
|
| 789 |
: partnerStockAvailabilityMap.get(itemId);
|
791 |
: partnerStockAvailabilityMap.get(itemId);
|
| 790 |
int ourStockAvailability = ourItemAvailabilityMap.get(itemId) == null ? 0
|
792 |
int ourStockAvailability = ourItemAvailabilityMap.get(itemId) == null ? 0
|
| 791 |
: Math.max(0, ourItemAvailabilityMap.get(itemId));
|
793 |
: Math.max(0, ourItemAvailabilityMap.get(itemId));
|