Subversion Repositories SmartDukaan

Rev

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

Rev 34369 Rev 34409
Line 914... Line 914...
914
 
914
 
915
        Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = schemeInOutRepository
915
        Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = schemeInOutRepository
916
                .selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream()
916
                .selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), currentStartMonth, currentDate).stream()
917
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
917
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
918
 
918
 
919
        Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = new HashMap<>();
919
        Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
920
 
-
 
921
        lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
-
 
922
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
920
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
923
 
921
 
924
        Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = lastMonthCreditedIncomeModels.stream()
922
        Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = lastMonthCreditedIncomeModels.stream()
925
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
923
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
926
 
924
 
Line 1021... Line 1019...
1021
 
1019
 
1022
        LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
1020
        LocalDateTime lastMonthStart = LocalDate.now().minusMonths(month).withDayOfMonth(1).atStartOfDay();
1023
        LocalDateTime lastMonthEnd = lastMonthStart.plusMonths(1);
1021
        LocalDateTime lastMonthEnd = lastMonthStart.plusMonths(1);
1024
 
1022
 
1025
        HashSet<String> allImeiSet = new LinkedHashSet<>();
1023
        HashSet<String> allImeiSet = new LinkedHashSet<>();
1026
        HashSet<String> purchaseSet = new LinkedHashSet<>();
-
 
1027
        HashSet<String> saleSet = new LinkedHashSet<>();
-
 
1028
 
1024
 
1029
        List<LastMonthFrontEndImeiModel> lmfi = schemeInOutRepository
1025
        List<LastMonthFrontEndImeiModel> lmfi = schemeInOutRepository
1030
                .selectLastMonthFrontEndImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart, lastMonthEnd);
1026
                .selectLastMonthFrontEndImei(loginDetails.getFofoId(), catalogItemId, lastMonthStart, lastMonthEnd);
1031
        List<LastMonthImeiModel> lmpi = schemeInOutRepository.selectLastMonthPurchaseInImei(loginDetails.getFofoId(),
1027
        List<LastMonthImeiModel> lmpi = schemeInOutRepository.selectLastMonthPurchaseInImei(loginDetails.getFofoId(),
1032
                catalogItemId, lastMonthStart, lastMonthEnd);
1028
                catalogItemId, lastMonthStart, lastMonthEnd);
Line 1092... Line 1088...
1092
        Map<String, Map<String, Double>> lastMonthCreditedMapPairMap = lastMonthCreditedImeis.stream()
1088
        Map<String, Map<String, Double>> lastMonthCreditedMapPairMap = lastMonthCreditedImeis.stream()
1093
                .collect(Collectors.groupingBy(x -> x.getImei(),
1089
                .collect(Collectors.groupingBy(x -> x.getImei(),
1094
                        Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
1090
                        Collectors.groupingBy(x -> x.getDescription(), Collectors.summingDouble(x -> x.getAmount()))));
1095
 
1091
 
1096
        // descriptionSet.add("")
1092
        // descriptionSet.add("")
1097
        purchaseSet.addAll(lastMonthPurchaseInImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
-
 
1098
        saleSet.addAll(lastMonthCreditedImeis.stream().map(x -> x.getDescription()).collect(Collectors.toList()));
-
 
1099
 
1093
 
1100
        List<String> purchaseList = new ArrayList<>(purchaseSet);
1094
        List<String> purchaseList = lastMonthPurchaseInImeis.stream().map(x -> x.getDescription()).distinct().collect(Collectors.toList());
1101
        List<String> saleList = new ArrayList<>(saleSet);
1095
        List<String> saleList = lastMonthCreditedImeis.stream().map(x -> x.getDescription()).distinct().collect(Collectors.toList());
1102
 
1096
 
1103
        Map<String, ImeiWiseIncomePairAndMapModel> imeiWiseIncomeMapOfMap = new HashMap<>();
1097
        Map<String, ImeiWiseIncomePairAndMapModel> imeiWiseIncomeMapOfMap = new HashMap<>();
1104
 
1098
 
1105
        for (Map.Entry<String, Map<String, Double>> entry : lastMonthPurchaseInMapPairMap.entrySet()) {
1099
        for (Map.Entry<String, Map<String, Double>> entry : lastMonthPurchaseInMapPairMap.entrySet()) {
1106
 
1100
 
Line 1298... Line 1292...
1298
        }
1292
        }
1299
 
1293
 
1300
        List<LastMonthCreditedIncomeModel> lastMonthPendingIncomeModels = schemeInOutRepository
1294
        List<LastMonthCreditedIncomeModel> lastMonthPendingIncomeModels = schemeInOutRepository
1301
                .selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
1295
                .selectLastMonthPendingIncomeByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
1302
 
1296
 
1303
        List<LastMonthCreditedIncomeModel> lastMonthCreditedIncomeModels = schemeInOutRepository
-
 
1304
                .selectLastMonthCreditedIncomeByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
-
 
1305
 
-
 
1306
        List<LastMonthCreditedIncomeModel> lastMonthPurchaseInMargins = schemeInOutRepository
1297
        List<LastMonthCreditedIncomeModel> lastMonthPurchaseInMargins = schemeInOutRepository
1307
                .selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
1298
                .selectLastMonthPurchaseInMarginByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
1308
 
1299
 
1309
        List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
1300
        List<LastMonthCreditedIncomeModel> lastMonthFrontEndIncomes = schemeInOutRepository
1310
                .selectFrontIncomeByBrand(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
1301
                .selectFrontIncomeByBrand(loginDetails.getFofoId(), startOfMonth, lastMonthEnd);
Line 1318... Line 1309...
1318
 
1309
 
1319
 
1310
 
1320
        Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
1311
        Map<String, LastMonthCreditedIncomeModel> lastMonthPurchaseInMarginMap = lastMonthPurchaseInMargins.stream()
1321
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1312
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1322
 
1313
 
1323
        Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = lastMonthCreditedIncomeModels.stream()
1314
        Map<String, LastMonthCreditedIncomeModel> lastMonthSaleMarginMap = schemeInOutRepository
-
 
1315
                .selectLastMonthCreditedIncomeByFofoId(loginDetails.getFofoId(), startOfMonth, lastMonthEnd).stream()
1324
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1316
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1325
 
1317
 
1326
 
1318
 
1327
        Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = lastMonthPendingIncomeModels.stream()
1319
        Map<String, LastMonthCreditedIncomeModel> lastMonthPendingIncomeMap = lastMonthPendingIncomeModels.stream()
1328
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));
1320
                .collect(Collectors.toMap(x -> x.getBrand(), x -> x));