Subversion Repositories SmartDukaan

Rev

Rev 33667 | Rev 33675 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33667 Rev 33674
Line 233... Line 233...
233
 
233
 
234
    @Autowired
234
    @Autowired
235
    private ScratchOfferRepository scratchOfferRepository;
235
    private ScratchOfferRepository scratchOfferRepository;
236
 
236
 
237
    @Autowired
237
    @Autowired
-
 
238
    private UpSaleOrderRepository upSaleOrderRepository;
-
 
239
 
-
 
240
    @Autowired
238
    RestClient restClient;
241
    RestClient restClient;
239
 
242
 
240
    @Value("${prod}")
243
    @Value("${prod}")
241
    private boolean prodEnv;
244
    private boolean prodEnv;
242
 
245
 
Line 581... Line 584...
581
 
584
 
582
        }
585
        }
583
        //Process scratch
586
        //Process scratch
584
        this.processScratchOffer(fofoOrder);
587
        this.processScratchOffer(fofoOrder);
585
 
588
 
-
 
589
        //unable it fo upsell call
-
 
590
//        if (fofoOrder.getId() > 0) {
-
 
591
//            List<InsurancePolicy> insurancePolicies = insurancePolicyRepository
-
 
592
//                    .selectByRetailerIdInvoiceNumber(fofoOrder.getInvoiceNumber());
-
 
593
//            if (insurancePolicies.isEmpty()) {
-
 
594
//                List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
-
 
595
//                for (FofoOrderItem fofoOrderItem : fofoOrderItems) {
-
 
596
//                    Item item = itemRepository.selectById(fofoOrderItem.getItemId());
-
 
597
//                    if (item.isSmartPhone()) {
-
 
598
//                        UpSaleOrder upSaleOrder = new UpSaleOrder();
-
 
599
//                        upSaleOrder.setCreatedTimestamp(LocalDateTime.now());
-
 
600
//                        upSaleOrder.setOrderId(fofoOrder.getId());
-
 
601
//                        upSaleOrderRepository.persist(upSaleOrder);
-
 
602
//                        break; // Exit the loop after persisting the UpSaleOrder for the first smartphone
-
 
603
//                    }
-
 
604
//                }
-
 
605
//            }
-
 
606
//        }
-
 
607
 
586
        return fofoOrder.getId();
608
        return fofoOrder.getId();
587
    }
609
    }
588
 
610
 
589
    static Map<Double, List<ScratchedGift>> GIFT_SERIES = new TreeMap<>(Comparator.reverseOrder());
611
    static Map<Double, List<ScratchedGift>> GIFT_SERIES = new TreeMap<>(Comparator.reverseOrder());
590
 
612
 
Line 741... Line 763...
741
        Map<ScratchedGift, Long> scratchOfferCountMap = scratchOfferRepository.countOffersByDateRange(ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
763
        Map<ScratchedGift, Long> scratchOfferCountMap = scratchOfferRepository.countOffersByDateRange(ProfitMandiConstants.SCRATCH_OFFER_START_DATE, ProfitMandiConstants.SCRATCH_OFFER_END_DATE);
742
 
764
 
743
        RandomCollection<ScratchedGift> giftRandomCollection = createDynamicGiftSeries(scratchOfferCountMap, purchaseAmount);
765
        RandomCollection<ScratchedGift> giftRandomCollection = createDynamicGiftSeries(scratchOfferCountMap, purchaseAmount);
744
        if (giftRandomCollection.size() > 0) {
766
        if (giftRandomCollection.size() > 0) {
745
            return giftRandomCollection.next();
767
            return giftRandomCollection.next();
746
        } else {
768
        } else if (purchaseAmount > 35000) {
747
            // Default gift if no match found
769
            // Default gift if no match found
748
            return ScratchedGift.EW;
770
            return ScratchedGift.EW;
-
 
771
        } else {
-
 
772
            return ScratchedGift.BLNT;
749
        }
773
        }
750
    }
774
    }
751
 
775
 
752
    public RandomCollection<ScratchedGift> createDynamicGiftSeries(Map<ScratchedGift, Long> soldGiftContMap, Double sellingPrice) {
776
    public RandomCollection<ScratchedGift> createDynamicGiftSeries(Map<ScratchedGift, Long> soldGiftContMap, Double sellingPrice) {
753
        int index = 0;
777
        int index = 0;