Subversion Repositories SmartDukaan

Rev

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

Rev 32892 Rev 32893
Line 526... Line 526...
526
            Item item = itemRepository.selectById(fofoOrderItem.getItemId());
526
            Item item = itemRepository.selectById(fofoOrderItem.getItemId());
527
 
527
 
528
            if (item.isSmartPhone()) {
528
            if (item.isSmartPhone()) {
529
                LOGGER.info("fofoItem {}", fofoOrderItem);
529
                LOGGER.info("fofoItem {}", fofoOrderItem);
530
                smartPhone = true;
530
                smartPhone = true;
531
                purchaseAmount = Math.max( fofoOrderItem.getSellingPrice(), purchaseAmount);
531
                purchaseAmount = Math.max(fofoOrderItem.getSellingPrice(), purchaseAmount);
532
 
532
 
533
            }
533
            }
534
        }
534
        }
535
 
535
 
536
        if (!smartPhone) {
536
        if (!smartPhone) {
537
            LOGGER.warn("No smartphones found in fofoItems.");
537
            LOGGER.warn("No smartphones found in fofoItems.");
538
        }
538
        }
539
 
539
 
540
 
540
 
541
 
-
 
542
        if (smartPhone) {
541
        if (smartPhone) {
543
            this.createAndGetHygieneData(fofoOrder.getId(), fofoOrder.getFofoId());
542
            this.createAndGetHygieneData(fofoOrder.getId(), fofoOrder.getFofoId());
544
        }
543
        }
545
        // insurance calculation is insurance flag is enabled
544
        // insurance calculation is insurance flag is enabled
546
        //
545
        //
Line 576... Line 575...
576
                    this.sendAppDownloadBillingOffer(customer.getMobileNumber());
575
                    this.sendAppDownloadBillingOffer(customer.getMobileNumber());
577
                } catch (Exception e) {
576
                } catch (Exception e) {
578
                    // TODO Auto-generated catch block
577
                    // TODO Auto-generated catch block
579
                    e.printStackTrace();
578
                    e.printStackTrace();
580
                }
579
                }
581
                if(specificPriceOffer){
580
                if (specificPriceOffer) {
582
                    this.createSpecificPriceScratchOffer(fofoId, fofoOrder.getInvoiceNumber(), fofoOrder.getCustomerId(),purchaseAmount);
581
                    this.createSpecificPriceScratchOffer(fofoId, fofoOrder.getInvoiceNumber(), fofoOrder.getCustomerId(), purchaseAmount);
583
                }else{
582
                } else {
584
                    this.createScratchOffer(fofoId, fofoOrder.getInvoiceNumber(), fofoOrder.getCustomerId());
583
                    this.createScratchOffer(fofoId, fofoOrder.getInvoiceNumber(), fofoOrder.getCustomerId());
585
                }
584
                }
586
 
585
 
587
            }
586
            }
588
        }
587
        }
Line 665... Line 664...
665
            }
664
            }
666
            scratchOfferRepository.persist(so2);
665
            scratchOfferRepository.persist(so2);
667
        }
666
        }
668
    }
667
    }
669
 
668
 
670
    private void createSpecificPriceScratchOffer(int fofoId, String invoiceNumber, int customerId , float purchaseAmount) {
669
    private void createSpecificPriceScratchOffer(int fofoId, String invoiceNumber, int customerId, float purchaseAmount) {
671
 
670
 
672
        Map<Double, ScratchedGift> giftSeries = new HashMap<>();
671
        Map<Double, ScratchedGift> giftSeries = new HashMap<>();
673
        giftSeries.put(12000.0, ScratchedGift.GIFT_BOWL);
672
        giftSeries.put(12000.0, ScratchedGift.GIFT_BOWL);
674
        giftSeries.put(25000.0, ScratchedGift.NECK_BAND);
673
        giftSeries.put(25000.0, ScratchedGift.NECK_BAND);
675
        giftSeries.put(25001.0, ScratchedGift.BT_SOUNDBAR);
674
        giftSeries.put(25001.0, ScratchedGift.BT_SOUNDBAR);
Line 693... Line 692...
693
    private ScratchedGift getSelectedGift(double purchaseAmount, Map<Double, ScratchedGift> giftSeries) {
692
    private ScratchedGift getSelectedGift(double purchaseAmount, Map<Double, ScratchedGift> giftSeries) {
694
        for (Map.Entry<Double, ScratchedGift> entry : giftSeries.entrySet()) {
693
        for (Map.Entry<Double, ScratchedGift> entry : giftSeries.entrySet()) {
695
            if (purchaseAmount <= entry.getKey()) {
694
            if (purchaseAmount <= entry.getKey()) {
696
                return entry.getValue();
695
                return entry.getValue();
697
            }
696
            }
698
            if(purchaseAmount > 25000){
697
            if (purchaseAmount > 25000) {
699
                return ScratchedGift.BT_SOUNDBAR;
698
                return ScratchedGift.BT_SOUNDBAR;
700
            }
699
            }
701
        }
700
        }
702
        return ScratchedGift.BLNT; // Default gift if no match found
701
        return ScratchedGift.BLNT; // Default gift if no match found
703
    }
702
    }