Subversion Repositories SmartDukaan

Rev

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

Rev 34718 Rev 34798
Line 36... Line 36...
36
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
36
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
37
import com.spice.profitmandi.dao.repository.user.AddressRepository;
37
import com.spice.profitmandi.dao.repository.user.AddressRepository;
38
import com.spice.profitmandi.dao.repository.user.CounterRepository;
38
import com.spice.profitmandi.dao.repository.user.CounterRepository;
39
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
39
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
40
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
40
import com.spice.profitmandi.dao.repository.warehouse.WarehouseInventoryItemRepository;
-
 
41
import com.spice.profitmandi.service.integrations.bharti.model.PlanVariant;
41
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
42
import com.spice.profitmandi.service.integrations.zest.InsuranceService;
42
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
43
import com.spice.profitmandi.service.integrations.zest.MobileInsurancePlan;
43
import com.spice.profitmandi.service.inventory.InventoryService;
44
import com.spice.profitmandi.service.inventory.InventoryService;
44
import com.spice.profitmandi.service.inventory.PurchaseReturnService;
45
import com.spice.profitmandi.service.inventory.PurchaseReturnService;
45
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
46
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
Line 461... Line 462...
461
                        im.setColor(item.getColor());
462
                        im.setColor(item.getColor());
462
                        im.setModelName(item.getModelName() + item.getModelNumber());
463
                        im.setModelName(item.getModelName() + item.getModelNumber());
463
                        im.setInsuranceAmount(serialNumberDetail.getAmount());
464
                        im.setInsuranceAmount(serialNumberDetail.getAmount());
464
                        im.setDeviceSellingPrice(customFofoOrderItem.getSellingPrice());
465
                        im.setDeviceSellingPrice(customFofoOrderItem.getSellingPrice());
465
                        im.setInsuranceUId(serialNumberDetail.getInsurance());
466
                        im.setInsuranceUId(serialNumberDetail.getInsurance());
-
 
467
                        im.setCorrelationId(serialNumberDetail.getCorrelationId());
-
 
468
 
-
 
469
                        PlanVariant oneAssistpremium = insuranceService.getOneAssistPremiumByVariantId(serialNumberDetail.getInsurance());
-
 
470
                        if (oneAssistpremium != null) {
-
 
471
                            im.setInsuranceId(String.valueOf(oneAssistpremium.getId()));
-
 
472
                        } else {
466
                        im.setInsuranceId(String.valueOf(insuranceService.getOneAssistPremiumByVariantId(serialNumberDetail.getInsurance()).getId()));
473
                            im.setInsuranceId(String.valueOf(insuranceService.getICICIPremiumByVariantId(serialNumberDetail.getInsurance()).getId()));
-
 
474
                        }
467
                        im.setSerialNumber(serialNumberDetail.getSerialNumber());
475
                        im.setSerialNumber(serialNumberDetail.getSerialNumber());
468
                        im.setMemory(serialNumberDetail.getMemory());
476
                        im.setMemory(serialNumberDetail.getMemory());
469
                        im.setRam(serialNumberDetail.getRam());
477
                        im.setRam(serialNumberDetail.getRam());
470
                        im.setMfgDate(serialNumberDetail.getMfgDate());
478
                        im.setMfgDate(serialNumberDetail.getMfgDate());
471
                        insuredModels.add(im);
479
                        insuredModels.add(im);
472
                        // Check for free insurance code
480
                        // Check for free insurance code
473
                        try {
481
                        try {
474
                            Map<String, List<MobileInsurancePlan>> mobileInsurancePlanMap = insuranceService.getAllPlans(item.getId(), im.getDeviceSellingPrice(), false);
482
                            Map<String, List<MobileInsurancePlan>> mobileInsurancePlanMap = insuranceService.getAllPlans(item.getId(), im.getDeviceSellingPrice(), false);
475
                            MobileInsurancePlan mobileInsurancePlan = mobileInsurancePlanMap.entrySet().stream().flatMap(x -> x.getValue().stream()).filter(x -> x.getProductId().equals(serialNumberDetail.getInsurance())).findFirst().get();
483
                            MobileInsurancePlan mobileInsurancePlan = mobileInsurancePlanMap.entrySet().stream().flatMap(x -> x.getValue().stream()).filter(x -> x.getProductId().equals(serialNumberDetail.getInsurance())).findFirst().get();
476
//                            if (mobileInsurancePlan.getPlanName().equals("OneAssist Damage Protection Plan")) {
484
/*                            if (mobileInsurancePlan.getPlanName().equals("OneAssist Damage Protection Plan")) {
477
//                                MobileInsurancePlan freePlan = mobileInsurancePlanMap.get("Prolong Extendended Warranty(SmartDukaan Special Price)").get(0);
485
                                MobileInsurancePlan freePlan = mobileInsurancePlanMap.get("Prolong Extendended Warranty(SmartDukaan Special Price)").get(0);
478
//                                InsuranceModel imFree = new InsuranceModel();
486
                                InsuranceModel imFree = new InsuranceModel();
479
//                                imFree.setBrand(item.getBrand());
487
                                imFree.setBrand(item.getBrand());
480
//                                imFree.setColor(item.getColor());
488
                                imFree.setColor(item.getColor());
481
//                                imFree.setModelName(item.getModelName() + item.getModelNumber());
489
                                imFree.setModelName(item.getModelName() + item.getModelNumber());
482
//                                imFree.setInsuranceAmount(0);
490
                                imFree.setInsuranceAmount(0);
483
//                                imFree.setDeviceSellingPrice(customFofoOrderItem.getSellingPrice());
491
                                imFree.setDeviceSellingPrice(customFofoOrderItem.getSellingPrice());
484
//                                LOGGER.info("freePlan.getProductId() {}", freePlan.getProductId());
492
                                LOGGER.info("freePlan.getProductId() {}", freePlan.getProductId());
485
//                                imFree.setInsuranceUId(freePlan.getProductId());
493
                                imFree.setInsuranceUId(freePlan.getProductId());
486
//                                imFree.setInsuranceId(String.valueOf(insuranceService.getOneAssistPremiumByVariantId(freePlan.getProductId()).getId()));
494
                                imFree.setInsuranceId(String.valueOf(insuranceService.getOneAssistPremiumByVariantId(freePlan.getProductId()).getId()));
487
//                                imFree.setSerialNumber(serialNumberDetail.getSerialNumber());
495
                                imFree.setSerialNumber(serialNumberDetail.getSerialNumber());
488
//                                imFree.setMemory(serialNumberDetail.getMemory());
496
                                imFree.setMemory(serialNumberDetail.getMemory());
489
//                                imFree.setRam(serialNumberDetail.getRam());
497
                                imFree.setRam(serialNumberDetail.getRam());
490
//                                imFree.setMfgDate(serialNumberDetail.getMfgDate());
498
                                imFree.setMfgDate(serialNumberDetail.getMfgDate());
491
//                                insuredModels.add(imFree);
499
                                insuredModels.add(imFree);
492
//                            }
500
                            }*/
493
                        } catch (Exception e) {
501
                        } catch (Exception e) {
494
                            LOGGER.error("Exception - {}", e);
502
                            LOGGER.error("Exception - {}", e);
495
                            throw new ProfitMandiBusinessException("problem fetching plans", "problem fetching plans", "problem fetching plans");
503
                            throw new ProfitMandiBusinessException("problem fetching plans", "problem fetching plans", "problem fetching plans");
496
                        }
504
                        }
497
                    }
505
                    }