| Line 27... |
Line 27... |
| 27 |
import com.spice.profitmandi.dao.entity.user.Address;
|
27 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 28 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
28 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 29 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
29 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
| 30 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
30 |
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
|
| 31 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionApprovalStatus;
|
31 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionApprovalStatus;
|
| - |
|
32 |
import com.spice.profitmandi.dao.model.ItemWiseCustomerOfferSummaryModel;
|
| 32 |
import com.spice.profitmandi.dao.model.hdfc.IrnResetOrderModel;
|
33 |
import com.spice.profitmandi.dao.model.hdfc.IrnResetOrderModel;
|
| 33 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
34 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
35 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 35 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
36 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 36 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
37 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| Line 41... |
Line 42... |
| 41 |
import com.spice.profitmandi.dao.repository.user.CartRepository;
|
42 |
import com.spice.profitmandi.dao.repository.user.CartRepository;
|
| 42 |
import com.spice.profitmandi.dao.service.ScratchService;
|
43 |
import com.spice.profitmandi.dao.service.ScratchService;
|
| 43 |
import com.spice.profitmandi.service.EmailService;
|
44 |
import com.spice.profitmandi.service.EmailService;
|
| 44 |
import com.spice.profitmandi.service.NotificationService;
|
45 |
import com.spice.profitmandi.service.NotificationService;
|
| 45 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
46 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| - |
|
47 |
import com.spice.profitmandi.service.integrations.icicilombard.IciciLombardService;
|
| 46 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
48 |
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
|
| 47 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
49 |
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
|
| 48 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
50 |
import com.spice.profitmandi.service.order.BulkOrderService;
|
| 49 |
import com.spice.profitmandi.service.order.OrderService;
|
51 |
import com.spice.profitmandi.service.order.OrderService;
|
| 50 |
import com.spice.profitmandi.service.pricing.PricingService;
|
52 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| Line 210... |
Line 212... |
| 210 |
|
212 |
|
| 211 |
@Autowired
|
213 |
@Autowired
|
| 212 |
SDCreditService sdCreditService;
|
214 |
SDCreditService sdCreditService;
|
| 213 |
|
215 |
|
| 214 |
@Autowired
|
216 |
@Autowired
|
| - |
|
217 |
IciciPolicyTrackerRepository iciciPolicyTrackerRepository;
|
| - |
|
218 |
|
| - |
|
219 |
@Autowired
|
| 215 |
ScratchService scratchService;
|
220 |
ScratchService scratchService;
|
| 216 |
|
221 |
|
| - |
|
222 |
@Autowired
|
| - |
|
223 |
IciciLombardService iciciLombardService;
|
| - |
|
224 |
|
| 217 |
@RequestMapping(value = "/wa-send-invoice", method = RequestMethod.GET)
|
225 |
@RequestMapping(value = "/wa-send-invoice", method = RequestMethod.GET)
|
| 218 |
public String sendWhatsappMessage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) {
|
226 |
public String sendWhatsappMessage(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.ORDER_ID) int orderId, Model model) {
|
| 219 |
try {
|
227 |
try {
|
| 220 |
this.sendWhatsappInvoice(fofoOrderRepository.selectByOrderId(orderId));
|
228 |
this.sendWhatsappInvoice(fofoOrderRepository.selectByOrderId(orderId));
|
| 221 |
} catch (Exception e) {
|
229 |
} catch (Exception e) {
|
| Line 548... |
Line 556... |
| 548 |
}
|
556 |
}
|
| 549 |
|
557 |
|
| 550 |
return "response";
|
558 |
return "response";
|
| 551 |
}
|
559 |
}
|
| 552 |
|
560 |
|
| - |
|
561 |
/* @RequestMapping(value = "/getPlanQuote", method = RequestMethod.GET)
|
| - |
|
562 |
public String getPlanQuote(HttpServletRequest request, Model model,
|
| - |
|
563 |
@RequestParam String planCode, @RequestParam int sumInsured, @RequestParam @DateTimeFormat(pattern = "dd/MM/yyyy") LocalDate manufacturedDate, @RequestParam int itemId) throws ProfitMandiBusinessException {
|
| - |
|
564 |
|
| - |
|
565 |
try {
|
| - |
|
566 |
PlanVariant planVariant = insuranceService.getICICIPremiumByVariantId(planCode);
|
| - |
|
567 |
|
| - |
|
568 |
LOGGER.info("planVariant111 {}",planVariant);
|
| - |
|
569 |
|
| - |
|
570 |
String correlationId = UUID.randomUUID().toString();
|
| - |
|
571 |
IciciPolicyTracker policyTracker = new IciciPolicyTracker();
|
| - |
|
572 |
policyTracker.setCorrelationId(correlationId);
|
| - |
|
573 |
iciciPolicyTrackerRepository.persist(policyTracker);
|
| - |
|
574 |
|
| - |
|
575 |
// Policy validity (1 year from today)
|
| - |
|
576 |
LocalDate today = LocalDate.now();
|
| - |
|
577 |
LocalDate oneYearLater = today.plusYears(1);
|
| - |
|
578 |
|
| - |
|
579 |
String itemBrand = itemRepository.selectById(itemId).getBrand();
|
| - |
|
580 |
|
| - |
|
581 |
AfinityQuoteModel quoteModel = new AfinityQuoteModel();
|
| - |
|
582 |
quoteModel.setPolicyStartDate(today.toString()); // format: yyyy-MM-dd
|
| - |
|
583 |
quoteModel.setPolicyEndDate(oneYearLater.toString());
|
| - |
|
584 |
// quoteModel.setPlanCode(String.valueOf(planVariant.getOurPlanId()));
|
| - |
|
585 |
quoteModel.setPlanCode(String.valueOf(10357));
|
| - |
|
586 |
quoteModel.setSumInsured((int) sumInsured);
|
| - |
|
587 |
quoteModel.setBasisOfValuation("Market_Value");
|
| - |
|
588 |
quoteModel.setPartyStateName("MAHARASHTRA");
|
| - |
|
589 |
quoteModel.setRiskSIComponent("MOBILE");
|
| - |
|
590 |
quoteModel.setMakeManufacturer(itemBrand.toUpperCase());
|
| - |
|
591 |
quoteModel.setYearOfManufacture(manufacturedDate.getYear());
|
| - |
|
592 |
quoteModel.setCoverName("All Risk");
|
| - |
|
593 |
quoteModel.setCorrelationId(correlationId);
|
| - |
|
594 |
|
| - |
|
595 |
String response = mvcResponseSender.createResponseString(iciciLombardService.hitAfinityQuote(quoteModel));
|
| - |
|
596 |
LOGGER.info("response {}",response);
|
| - |
|
597 |
model.addAttribute("response1", response);
|
| - |
|
598 |
} catch (Exception e) {
|
| - |
|
599 |
// TODO Auto-generated catch block
|
| - |
|
600 |
LOGGER.info(e.getMessage(), e);
|
| - |
|
601 |
throw new ProfitMandiBusinessException("Plans", "Plans Quote", "Error qutotation insurance plans");
|
| - |
|
602 |
}
|
| - |
|
603 |
|
| - |
|
604 |
return "response";
|
| - |
|
605 |
}*/
|
| - |
|
606 |
|
| 553 |
private boolean sendWhatsappInvoice(FofoOrder fofoOrder) throws Exception {
|
607 |
private boolean sendWhatsappInvoice(FofoOrder fofoOrder) throws Exception {
|
| 554 |
return this.sendWhatsappInvoice(fofoOrder, "");
|
608 |
return this.sendWhatsappInvoice(fofoOrder, "");
|
| 555 |
}
|
609 |
}
|
| 556 |
|
610 |
|
| 557 |
private boolean sendWhatsappInvoice(FofoOrder fofoOrder, String whatsAppNo) throws Exception {
|
611 |
private boolean sendWhatsappInvoice(FofoOrder fofoOrder, String whatsAppNo) throws Exception {
|
| Line 970... |
Line 1024... |
| 970 |
|
1024 |
|
| 971 |
|
1025 |
|
| 972 |
// get the list of customer item for every item code start here
|
1026 |
// get the list of customer item for every item code start here
|
| 973 |
// ...............................................................
|
1027 |
// ...............................................................
|
| 974 |
|
1028 |
|
| 975 |
List<Map<Integer, List<CustomerOfferItem>>> itemOfferItemMapList = new ArrayList<>();
|
- |
|
| 976 |
|
- |
|
| 977 |
|
- |
|
| 978 |
LocalDateTime todayDate = LocalDateTime.now();
|
1029 |
LocalDateTime todayDate = LocalDateTime.now();
|
| 979 |
LocalDate todayDate2 = LocalDate.now();
|
1030 |
LocalDate todayDate2 = LocalDate.now();
|
| 980 |
|
1031 |
|
| 981 |
Map<Integer, List<CustomerOfferItem>> offerItemMap = new HashMap<>();
|
1032 |
Map<Integer, List<CustomerOfferItem>> offerItemMap = new HashMap<>();
|
| 982 |
Map<Integer, List<WebOffer>> webOfferMap = new HashMap<>();
|
1033 |
Map<Integer, List<WebOffer>> webOfferMap = new HashMap<>();
|
| 983 |
|
1034 |
|
| 984 |
List<CustomerOffer> customerOffers = customerOfferRepository.selectOffersByDate(todayDate);
|
1035 |
List<CustomerOffer> customerOffers = customerOfferRepository.selectOffersByDate(todayDate);
|
| 985 |
List<Integer> customerOfferIds = customerOffers.stream().map(x -> x.getId()).distinct().collect(Collectors.toList());
|
1036 |
List<Integer> customerOfferIds = customerOffers.stream().map(x -> x.getId()).distinct().collect(Collectors.toList());
|
| 986 |
for (CartFofo cartItem : cartItems) {
|
1037 |
/*for (CartFofo cartItem : cartItems) {
|
| 987 |
Item item = itemRepository.selectById(cartItem.getItemId());
|
1038 |
Item item = itemRepository.selectById(cartItem.getItemId());
|
| 988 |
if (customerOfferIds.size() > 0) {
|
1039 |
if (customerOfferIds.size() > 0) {
|
| 989 |
|
1040 |
|
| 990 |
List<CustomerOfferItem> customerOfferItems = customerOfferItemRepository.selectByOfferIds(customerOfferIds, item.getCatalogItemId(), todayDate2);
|
1041 |
List<CustomerOfferItem> customerOfferItems = customerOfferItemRepository.selectByOfferIds(customerOfferIds, item.getCatalogItemId(), todayDate2);
|
| 991 |
|
1042 |
|
| Line 997... |
Line 1048... |
| 997 |
}
|
1048 |
}
|
| 998 |
|
1049 |
|
| 999 |
|
1050 |
|
| 1000 |
List<WebOffer> webOffers = webOfferRepository.selectAllActiveOffers().get(item.getCatalogItemId());
|
1051 |
List<WebOffer> webOffers = webOfferRepository.selectAllActiveOffers().get(item.getCatalogItemId());
|
| 1001 |
webOfferMap.put(item.getId(), webOffers);
|
1052 |
webOfferMap.put(item.getId(), webOffers);
|
| - |
|
1053 |
}*/
|
| - |
|
1054 |
|
| - |
|
1055 |
|
| - |
|
1056 |
Map<Integer, ItemWiseCustomerOfferSummaryModel> offerItemSummaryMap = new HashMap<>();
|
| - |
|
1057 |
|
| - |
|
1058 |
for (CartFofo cartItem : cartItems) {
|
| - |
|
1059 |
Item item = itemRepository.selectById(cartItem.getItemId());
|
| - |
|
1060 |
|
| - |
|
1061 |
List<CustomerOfferItem> customerOfferItems = customerOfferItemRepository
|
| - |
|
1062 |
.selectByOfferIds(customerOfferIds, item.getCatalogItemId(), todayDate2)
|
| - |
|
1063 |
.stream()
|
| - |
|
1064 |
.filter(x -> x.getEndDate() != null && !x.getEndDate().isBefore(todayDate2))
|
| - |
|
1065 |
.collect(Collectors.toList());
|
| - |
|
1066 |
|
| - |
|
1067 |
ItemWiseCustomerOfferSummaryModel summary = new ItemWiseCustomerOfferSummaryModel();
|
| - |
|
1068 |
summary.setItemId(item.getId());
|
| - |
|
1069 |
summary.setCatalogId(item.getCatalogItemId());
|
| - |
|
1070 |
|
| - |
|
1071 |
for (CustomerOfferItem coi : customerOfferItems) {
|
| - |
|
1072 |
String key = coi.getOfferType().name() + "-" + coi.getCustomerOfferId();
|
| - |
|
1073 |
|
| - |
|
1074 |
ItemWiseCustomerOfferSummaryModel.OfferTypeSummary typeSummary =
|
| - |
|
1075 |
summary.getOfferTypeMap().computeIfAbsent(key, k -> {
|
| - |
|
1076 |
ItemWiseCustomerOfferSummaryModel.OfferTypeSummary ts = new ItemWiseCustomerOfferSummaryModel.OfferTypeSummary();
|
| - |
|
1077 |
ts.setOfferType(coi.getOfferType());
|
| - |
|
1078 |
ts.setCustomerOfferId(coi.getCustomerOfferId());
|
| - |
|
1079 |
return ts;
|
| - |
|
1080 |
});
|
| - |
|
1081 |
|
| - |
|
1082 |
typeSummary.setTotalSchemePayout(typeSummary.getTotalSchemePayout() + coi.getSchemePayout());
|
| - |
|
1083 |
typeSummary.setTotalDealerPayout(typeSummary.getTotalDealerPayout() + coi.getDealerPayout());
|
| - |
|
1084 |
typeSummary.getDescriptions().add(coi.getAdditionalInfo());
|
| - |
|
1085 |
typeSummary.getOfferItemIds().add(coi.getId());
|
| - |
|
1086 |
}
|
| - |
|
1087 |
|
| - |
|
1088 |
offerItemSummaryMap.put(item.getId(), summary);
|
| 1002 |
}
|
1089 |
}
|
| 1003 |
|
1090 |
|
| - |
|
1091 |
|
| - |
|
1092 |
|
| 1004 |
// get the list of customer item for every item code end here
|
1093 |
// get the list of customer item for every item code end here
|
| 1005 |
// ...............................................................
|
1094 |
// ...............................................................
|
| 1006 |
|
1095 |
|
| 1007 |
LOGGER.info("itemIdAndPoiMap {}", itemIdAndPoiMap);
|
1096 |
LOGGER.info("itemIdAndPoiMap {}", itemIdAndPoiMap);
|
| 1008 |
LOGGER.info("mopPriceMap {}", mopPriceMap);
|
1097 |
LOGGER.info("mopPriceMap {}", mopPriceMap);
|
| Line 1019... |
Line 1108... |
| 1019 |
model.addAttribute("onlineSellingPrice", onlineSellingPrice);
|
1108 |
model.addAttribute("onlineSellingPrice", onlineSellingPrice);
|
| 1020 |
|
1109 |
|
| 1021 |
model.addAttribute("mopPriceMap", mopPriceMap);
|
1110 |
model.addAttribute("mopPriceMap", mopPriceMap);
|
| 1022 |
model.addAttribute("paymentOptions", paymentOptions);
|
1111 |
model.addAttribute("paymentOptions", paymentOptions);
|
| 1023 |
model.addAttribute("accessoriesDeals", accessoriesDeals);
|
1112 |
model.addAttribute("accessoriesDeals", accessoriesDeals);
|
| 1024 |
model.addAttribute("offerItemMap", offerItemMap);
|
- |
|
| 1025 |
model.addAttribute("webOfferMap", webOfferMap);
|
1113 |
model.addAttribute("webOfferMap", webOfferMap);
|
| - |
|
1114 |
model.addAttribute("offerItemSummaryMap", offerItemSummaryMap);
|
| 1026 |
return "order-index";
|
1115 |
return "order-index";
|
| 1027 |
}
|
1116 |
}
|
| 1028 |
|
1117 |
|
| 1029 |
private Map<String, List<MobileInsurancePlan>> getPlans(float sellingPrice, int itemId, int poiId)
|
1118 |
private Map<String, List<MobileInsurancePlan>> getPlans(float sellingPrice, int itemId, int poiId)
|
| 1030 |
throws ProfitMandiBusinessException {
|
1119 |
throws ProfitMandiBusinessException {
|