Subversion Repositories SmartDukaan

Rev

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

Rev 31733 Rev 31746
Line 3... Line 3...
3
import com.google.common.collect.Lists;
3
import com.google.common.collect.Lists;
4
import com.google.gson.Gson;
4
import com.google.gson.Gson;
5
import com.razorpay.Payment;
5
import com.razorpay.Payment;
6
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
6
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
7
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
7
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
8
import com.spice.profitmandi.common.enumuration.ActivationType;
-
 
9
import com.spice.profitmandi.common.enumuration.MessageType;
8
import com.spice.profitmandi.common.enumuration.*;
10
import com.spice.profitmandi.common.enumuration.RechargeStatus;
-
 
11
import com.spice.profitmandi.common.enumuration.ReporticoProject;
-
 
12
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
9
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
13
import com.spice.profitmandi.common.model.*;
10
import com.spice.profitmandi.common.model.*;
14
import com.spice.profitmandi.common.services.ReporticoService;
11
import com.spice.profitmandi.common.services.ReporticoService;
15
import com.spice.profitmandi.common.services.mandii.AccountStatusResponseOut;
12
import com.spice.profitmandi.common.services.mandii.AccountStatusResponseOut;
16
import com.spice.profitmandi.common.services.mandii.EligibilityStatusEnum;
13
import com.spice.profitmandi.common.services.mandii.EligibilityStatusEnum;
Line 73... Line 70...
73
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
70
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
74
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
71
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
75
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
72
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
76
import com.spice.profitmandi.service.inventory.InventoryService;
73
import com.spice.profitmandi.service.inventory.InventoryService;
77
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
74
import com.spice.profitmandi.service.inventory.SaholicInventoryService;
-
 
75
import com.spice.profitmandi.service.offers.OfferService;
78
import com.spice.profitmandi.service.order.OrderService;
76
import com.spice.profitmandi.service.order.OrderService;
79
import com.spice.profitmandi.service.pricing.PriceDropService;
77
import com.spice.profitmandi.service.pricing.PriceDropService;
80
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
78
import com.spice.profitmandi.service.recharge.provider.OxigenRechargeProviderService;
81
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
79
import com.spice.profitmandi.service.recharge.provider.ThinkWalnutDigitalRechargeProviderService;
82
import com.spice.profitmandi.service.scheme.SchemeService;
80
import com.spice.profitmandi.service.scheme.SchemeService;
Line 998... Line 996...
998
    }
996
    }
999
 
997
 
1000
    @Autowired
998
    @Autowired
1001
    WarehouseInventoryItemRepository warehouseInventoryItemRepository;
999
    WarehouseInventoryItemRepository warehouseInventoryItemRepository;
1002
 
1000
 
-
 
1001
    @Autowired
-
 
1002
    OfferService offerService;
-
 
1003
 
-
 
1004
    @Autowired
-
 
1005
    PurchaseReturnItemRepository purchaseReturnItemRepository;
-
 
1006
 
1003
    public void test() throws Exception {
1007
    public void test() throws Exception {
1004
        //this.sendMailForSamsungRebilling();
1008
        //this.sendMailForSamsungRebilling();
-
 
1009
        List<PurchaseReturnItem> purchaseReturnItems = purchaseReturnItemRepository.selectPurchaseReturnByStatuses(Arrays.asList(PurchaseReturnStatus.DEBIT_NOTE_CREATED));
-
 
1010
        Map<Integer, List<PurchaseReturnItem>> inventoryItemsMap = purchaseReturnItems.stream().collect(Collectors.groupingBy(x -> x.getDebitNoteId()));
-
 
1011
        for (Map.Entry<Integer, List<PurchaseReturnItem>> debitNotePurcahseReturnMap : inventoryItemsMap.entrySet()) {
-
 
1012
            List<InventoryItem> inventoryItems = inventoryItemRepository.selectAllByIds(debitNotePurcahseReturnMap.getValue().stream().map(x -> x.getInventoryItemId()).collect(Collectors.toList()));
1005
        priceDropService.getAllSerialNumbersByAffectedDate(LocalDateTime.now(), 1023170);
1013
            offerService.reverseAdditionalSelloutSchemes(debitNotePurcahseReturnMap.getValue().get(0).getFofoId(), inventoryItems);
-
 
1014
        }
-
 
1015
 
1006
    }
1016
    }
1007
 
1017
 
1008
    public void sendMailForSamsungRebilling() throws Exception {
1018
    public void sendMailForSamsungRebilling() throws Exception {
1009
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1019
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1010
        LOGGER.info("SamsungModels {}", samsungModels);
1020
        LOGGER.info("SamsungModels {}", samsungModels);
Line 2009... Line 2019...
2009
        private int fofoId;
2019
        private int fofoId;
2010
        private String code;
2020
        private String code;
2011
        private ActivationType activationType;
2021
        private ActivationType activationType;
2012
 
2022
 
2013
 
2023
 
2014
 
-
 
2015
        @Override
2024
        @Override
2016
        public boolean equals(Object o) {
2025
        public boolean equals(Object o) {
2017
            if (this == o) return true;
2026
            if (this == o) return true;
2018
            if (o == null || getClass() != o.getClass()) return false;
2027
            if (o == null || getClass() != o.getClass()) return false;
2019
            SaleTargetReportModel that = (SaleTargetReportModel) o;
2028
            SaleTargetReportModel that = (SaleTargetReportModel) o;
Line 2151... Line 2160...
2151
                ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT,
2160
                ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT,
2152
                ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
2161
                ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
2153
 
2162
 
2154
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
2163
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
2155
 
2164
 
2156
		for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
2165
        for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
2157
			String email = storeGuyEntry.getKey();
2166
            String email = storeGuyEntry.getKey();
2158
			Set<Integer> fofoIds = storeGuyEntry.getValue();
2167
            Set<Integer> fofoIds = storeGuyEntry.getValue();
2159
			LOGGER.info("fofoIds {}", fofoIds);
2168
            LOGGER.info("fofoIds {}", fofoIds);
2160
 
2169
 
2161
			if (!fofoIds.isEmpty()) {
2170
            if (!fofoIds.isEmpty()) {
2162
				List<FofoStore> stores = fofoStoreRepository
2171
                List<FofoStore> stores = fofoStoreRepository
2163
						.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds));
2172
                        .selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds));
2164
 
2173
 
2165
                Map<String, List<Integer>> stateMap = stores.stream().collect(groupingBy(
2174
                Map<String, List<Integer>> stateMap = stores.stream().collect(groupingBy(
2166
                        x -> x.getCode().substring(0, 2), mapping(x -> x.getId(), Collectors.toList())));
2175
                        x -> x.getCode().substring(0, 2), mapping(x -> x.getId(), Collectors.toList())));
2167
                List<List<Serializable>> stateWiseSales = new ArrayList<>();
2176
                List<List<Serializable>> stateWiseSales = new ArrayList<>();
2168
                for (Map.Entry<String, List<Integer>> stateMapEntry : stateMap.entrySet()) {
2177
                for (Map.Entry<String, List<Integer>> stateMapEntry : stateMap.entrySet()) {