| Line 40... |
Line 40... |
| 40 |
|
40 |
|
| 41 |
import com.eclipsesource.json.JsonObject;
|
41 |
import com.eclipsesource.json.JsonObject;
|
| 42 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
42 |
import com.fasterxml.jackson.annotation.JsonProperty;
|
| 43 |
import com.google.gson.Gson;
|
43 |
import com.google.gson.Gson;
|
| 44 |
import com.google.gson.reflect.TypeToken;
|
44 |
import com.google.gson.reflect.TypeToken;
|
| - |
|
45 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 45 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
46 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 46 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
47 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 47 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
48 |
import com.spice.profitmandi.common.model.CreatePendingOrderItem;
|
| 48 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
49 |
import com.spice.profitmandi.common.model.CreatePendingOrderRequest;
|
| 49 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
50 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 50 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
51 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
52 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 51 |
import com.spice.profitmandi.common.model.UserInfo;
|
53 |
import com.spice.profitmandi.common.model.UserInfo;
|
| 52 |
import com.spice.profitmandi.common.solr.SolrService;
|
54 |
import com.spice.profitmandi.common.solr.SolrService;
|
| 53 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
55 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 54 |
import com.spice.profitmandi.common.web.client.RestClient;
|
56 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 55 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
57 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 56 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
58 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 57 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
59 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| - |
|
60 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 58 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
61 |
import com.spice.profitmandi.dao.entity.dtr.WebListing;
|
| 59 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
62 |
import com.spice.profitmandi.dao.entity.dtr.WebOffer;
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.Customer;
|
| 61 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;
|
| 62 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 63 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrder;
|
| 64 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.PendingOrderItem;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.PincodePartner;
|
| - |
|
69 |
import com.spice.profitmandi.dao.entity.fofo.RazorPay;
|
| 66 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
70 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| 67 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
71 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 68 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
72 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
| 69 |
import com.spice.profitmandi.dao.model.CartItem;
|
73 |
import com.spice.profitmandi.dao.model.CartItem;
|
| 70 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
74 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
| Line 83... |
Line 87... |
| 83 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
87 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
88 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderItemRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
89 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
90 |
import com.spice.profitmandi.dao.repository.fofo.PendingOrderService;
|
| 87 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
91 |
import com.spice.profitmandi.dao.repository.fofo.PincodePartnerRepository;
|
| - |
|
92 |
import com.spice.profitmandi.dao.repository.fofo.RazorPayRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
93 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 89 |
import com.spice.profitmandi.service.CustomerService;
|
94 |
import com.spice.profitmandi.service.CustomerService;
|
| - |
|
95 |
import com.spice.profitmandi.service.EmailService;
|
| - |
|
96 |
import com.spice.profitmandi.service.NotificationService;
|
| 90 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
97 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 91 |
import com.spice.profitmandi.service.inventory.AvailabilityModel;
|
98 |
import com.spice.profitmandi.service.inventory.AvailabilityModel;
|
| 92 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
99 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
| 93 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
100 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
| 94 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
101 |
import com.spice.profitmandi.service.inventory.InventoryService;
|
| Line 98... |
Line 105... |
| 98 |
import com.spice.profitmandi.web.processor.OtpProcessor;
|
105 |
import com.spice.profitmandi.web.processor.OtpProcessor;
|
| 99 |
import com.spice.profitmandi.web.res.DealBrands;
|
106 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 100 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
107 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 101 |
import com.spice.profitmandi.web.res.DealsResponse;
|
108 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 102 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
109 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| 103 |
import com.spice.profitmandi.web.services.EmailService;
|
- |
|
| 104 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
110 |
import com.spice.profitmandi.web.services.PartnerIndexService;
|
| 105 |
|
111 |
|
| 106 |
import io.swagger.annotations.ApiImplicitParam;
|
112 |
import io.swagger.annotations.ApiImplicitParam;
|
| 107 |
import io.swagger.annotations.ApiImplicitParams;
|
113 |
import io.swagger.annotations.ApiImplicitParams;
|
| 108 |
import io.swagger.annotations.ApiOperation;
|
114 |
import io.swagger.annotations.ApiOperation;
|
| Line 205... |
Line 211... |
| 205 |
EmailService emailService;
|
211 |
EmailService emailService;
|
| 206 |
|
212 |
|
| 207 |
@Autowired
|
213 |
@Autowired
|
| 208 |
CsService csService;
|
214 |
CsService csService;
|
| 209 |
|
215 |
|
| - |
|
216 |
@Autowired
|
| - |
|
217 |
private NotificationService notificationService;
|
| - |
|
218 |
|
| - |
|
219 |
@Autowired
|
| - |
|
220 |
private com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
|
| - |
|
221 |
|
| 210 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
222 |
private static final List<String> offlineOrders = Arrays.asList("EMIOD", "POD");
|
| 211 |
|
223 |
|
| 212 |
List<String> filterableParams = Arrays.asList("brand");
|
224 |
List<String> filterableParams = Arrays.asList("brand");
|
| 213 |
|
225 |
|
| 214 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
226 |
@RequestMapping(value = "/store/entity/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
| Line 369... |
Line 381... |
| 369 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
381 |
Customer customer = customerRepository.selectById(pendingOrder.getCustomerId());
|
| 370 |
String[] customerEmail = null;
|
382 |
String[] customerEmail = null;
|
| 371 |
if (customer.getEmailId() != null) {
|
383 |
if (customer.getEmailId() != null) {
|
| 372 |
customerEmail = new String[] { customer.getEmailId() };
|
384 |
customerEmail = new String[] { customer.getEmailId() };
|
| 373 |
}
|
385 |
}
|
| - |
|
386 |
|
| 374 |
List<String> bccTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
387 |
List<String> bccTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 375 |
"hemant.kaura@smartdukaan.com", "niranjan.kala@smartdukaan.com", "sm@smartdukaan.com",
|
388 |
"hemant.kaura@smartdukaan.com", "niranjan.kala@smartdukaan.com", "sm@smartdukaan.com",
|
| 376 |
"tejbeer.kaur@shop2020.in", customRetailer.getEmail());
|
389 |
"tejbeer.kaur@shop2020.in", customRetailer.getEmail());
|
| - |
|
390 |
|
| 377 |
List<String> authUserEmails = csService.getAuthUserByPartnerId(customRetailer.getPartnerId());
|
391 |
List<String> authUserEmails = csService.getAuthUserByPartnerId(customRetailer.getPartnerId());
|
| 378 |
if (authUserEmails != null) {
|
392 |
if (authUserEmails != null) {
|
| 379 |
authUserEmails = new ArrayList<>();
|
393 |
authUserEmails = new ArrayList<>();
|
| 380 |
}
|
394 |
}
|
| 381 |
logger.info("authUserEmails {}", authUserEmails);
|
395 |
logger.info("authUserEmails {}", authUserEmails);
|
| Line 398... |
Line 412... |
| 398 |
} else {
|
412 |
} else {
|
| 399 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 30));
|
413 |
itemBuffer.append(StringUtils.abbreviate(itemNoColor, 30));
|
| 400 |
}
|
414 |
}
|
| 401 |
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(), itemBuffer.toString(), pendingOrder.getTotalAmount());
|
| 402 |
otpProcessor.sendSms(OtpProcessor.TEMPLATE_ORDER_CREATED_ID, message, customer.getMobileNumber());
|
416 |
otpProcessor.sendSms(OtpProcessor.TEMPLATE_ORDER_CREATED_ID, message, customer.getMobileNumber());
|
| - |
|
417 |
|
| 403 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm", emailModel,
|
418 |
emailService.sendMailWithAttachments("Order Created with SmartDukaan", "order-confirm.vm", emailModel,
|
| 404 |
customerEmail, null, authUserEmails.toArray(new String[0]));
|
419 |
customerEmail, null, bccTo.toArray(new String[0]));
|
| - |
|
420 |
|
| - |
|
421 |
List<String> gmailIds = csService.getAuthUserIdByPartnerId(customRetailer.getPartnerId()).stream()
|
| - |
|
422 |
.map(x -> x.getGmailId()).collect(Collectors.toList());
|
| - |
|
423 |
List<User> user = dtrUserRepository.selectAllByEmailIds(gmailIds);
|
| - |
|
424 |
List<Integer> userIds = user.stream().map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
425 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| - |
|
426 |
sendNotificationModel.setCampaignName("Online Order Alert");
|
| - |
|
427 |
sendNotificationModel.setTitle("Online Order Update");
|
| - |
|
428 |
sendNotificationModel.setMessage(String.format("You have new Online Order. Please check your Dashboard"));
|
| - |
|
429 |
sendNotificationModel.setType("url");
|
| - |
|
430 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| - |
|
431 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| - |
|
432 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| - |
|
433 |
int userId = userAccountRepository.selectUserIdByRetailerId(pendingOrder.getFofoId());
|
| - |
|
434 |
sendNotificationModel.setUserIds(Arrays.asList(userId));
|
| - |
|
435 |
notificationService.sendNotification(sendNotificationModel);
|
| - |
|
436 |
|
| - |
|
437 |
sendNotificationModel = new SendNotificationModel();
|
| - |
|
438 |
sendNotificationModel.setCampaignName("Online Order Alert");
|
| - |
|
439 |
sendNotificationModel.setTitle("Online Order Update");
|
| - |
|
440 |
sendNotificationModel.setMessage(String.format("Your Partner " + customRetailer.getBusinessName()
|
| - |
|
441 |
+ " have new Online Order. Please inform your partner"));
|
| - |
|
442 |
sendNotificationModel.setType("url");
|
| - |
|
443 |
sendNotificationModel.setUrl("https://app.smartdukaan.com/pages/home/notifications");
|
| - |
|
444 |
sendNotificationModel.setExpiresat(LocalDateTime.now().plusDays(1));
|
| - |
|
445 |
sendNotificationModel.setMessageType(MessageType.notification);
|
| - |
|
446 |
sendNotificationModel.setUserIds(userIds);
|
| - |
|
447 |
|
| - |
|
448 |
|
| 405 |
}
|
449 |
}
|
| 406 |
return responseSender.ok(returnMap);
|
450 |
return responseSender.ok(returnMap);
|
| 407 |
|
451 |
|
| 408 |
}
|
452 |
}
|
| 409 |
|
453 |
|