Subversion Repositories SmartDukaan

Rev

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

Rev 34114 Rev 34119
Line 998... Line 998...
998
 
998
 
999
        Map<String, Long> rbmBilledCountMapFirstWeek = rbmBilledFofoIdsModelsFirstWeek.stream()
999
        Map<String, Long> rbmBilledCountMapFirstWeek = rbmBilledFofoIdsModelsFirstWeek.stream()
1000
                .filter(x -> x.getStatus().equals("Billed"))
1000
                .filter(x -> x.getStatus().equals("Billed"))
1001
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1001
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1002
 
1002
 
-
 
1003
        long totalFirstWeekCount = rbmBilledCountMapFirstWeek.values().stream()
-
 
1004
                .mapToLong(Long::longValue)
-
 
1005
                .sum();
-
 
1006
 
1003
        Map<String, Long> rbmTargetedFofoIdCountMap = rbmBilledFofoIdsModelsFirstWeek.stream()
1007
        Map<String, Long> rbmTargetedFofoIdCountMap = rbmBilledFofoIdsModelsFirstWeek.stream()
1004
                .collect(Collectors.groupingBy(
1008
                .collect(Collectors.groupingBy(
1005
                        RbmBilledFofoIdsModel::getRbmName, // Group by RBM Name
1009
                        RbmBilledFofoIdsModel::getRbmName, // Group by RBM Name
1006
                        Collectors.counting() // Count all fofoId entries for each RBM
1010
                        Collectors.counting() // Count all fofoId entries for each RBM
1007
                ));
1011
                ));
1008
 
1012
 
1009
 
-
 
1010
 
-
 
-
 
1013
        long totalTargetedCount = rbmTargetedFofoIdCountMap.values().stream().mapToLong(x -> x.longValue()).sum();
1011
 
1014
 
1012
 
1015
 
1013
//        second week count of rbm partner billing
1016
//        second week count of rbm partner billing
1014
 
1017
 
1015
        LocalDate eightOfCurrentMonth = LocalDate.now().withDayOfMonth(8);
1018
        LocalDate eightOfCurrentMonth = LocalDate.now().withDayOfMonth(8);
Line 1019... Line 1022...
1019
 
1022
 
1020
        Map<String, Long> rbmBilledCountMapSecondWeek = rbmBilledFofoIdsModelsSecondWeek.stream()
1023
        Map<String, Long> rbmBilledCountMapSecondWeek = rbmBilledFofoIdsModelsSecondWeek.stream()
1021
                .filter(x -> x.getStatus().equals("Billed"))
1024
                .filter(x -> x.getStatus().equals("Billed"))
1022
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1025
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1023
 
1026
 
-
 
1027
        long totalSecondWeekCount = rbmBilledCountMapSecondWeek.values().stream().mapToLong(Long::longValue).sum();
1024
 
1028
 
1025
//      third week count of rbm partner billing
1029
//      third week count of rbm partner billing
1026
 
1030
 
1027
        LocalDate sixteenOfCurrentMonth = LocalDate.now().withDayOfMonth(16);
1031
        LocalDate sixteenOfCurrentMonth = LocalDate.now().withDayOfMonth(16);
1028
        LocalDate twentySecondOfCurrentMonth = LocalDate.now().withDayOfMonth(22);
1032
        LocalDate twentyFirstOfCurrentMonth = LocalDate.now().withDayOfMonth(21);
1029
 
1033
 
1030
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsThirdWeek = rbmTargetService.getDateWiseBilledFofoIdByRbm(sixteenOfCurrentMonth, twentySecondOfCurrentMonth);
1034
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsThirdWeek = rbmTargetService.getDateWiseBilledFofoIdByRbm(sixteenOfCurrentMonth, twentyFirstOfCurrentMonth);
1031
 
1035
 
1032
        Map<String, Long> rbmBilledCountMapThirdWeek = rbmBilledFofoIdsModelsThirdWeek.stream()
1036
        Map<String, Long> rbmBilledCountMapThirdWeek = rbmBilledFofoIdsModelsThirdWeek.stream()
1033
                .filter(x -> x.getStatus().equals("Billed"))
1037
                .filter(x -> x.getStatus().equals("Billed"))
1034
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1038
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1035
 
1039
 
-
 
1040
        long totalThirdWeekCount = rbmBilledCountMapThirdWeek.values().stream().mapToLong(Long::longValue).sum();
-
 
1041
 
1036
 
1042
 
1037
        //      fourth week count of rbm partner billing
1043
        //      fourth week count of rbm partner billing
1038
 
1044
 
1039
        LocalDate twentyThirdOfCurrentMonth = LocalDate.now().withDayOfMonth(23);
1045
        LocalDate twentySecondOfCurrentMonth = LocalDate.now().withDayOfMonth(22);
1040
        LocalDate lastDayOfCurrentMonth = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
1046
        LocalDate lastDayOfCurrentMonth = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
1041
 
1047
 
1042
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsFourthWeek = rbmTargetService.getDateWiseBilledFofoIdByRbm(twentyThirdOfCurrentMonth, lastDayOfCurrentMonth);
1048
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsFourthWeek = rbmTargetService.getDateWiseBilledFofoIdByRbm(twentySecondOfCurrentMonth, lastDayOfCurrentMonth);
1043
 
1049
 
1044
        Map<String, Long> rbmBilledCountMapFourthWeek = rbmBilledFofoIdsModelsFourthWeek.stream()
1050
        Map<String, Long> rbmBilledCountMapFourthWeek = rbmBilledFofoIdsModelsFourthWeek.stream()
1045
                .filter(x -> x.getStatus().equals("Billed"))
1051
                .filter(x -> x.getStatus().equals("Billed"))
1046
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1052
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1047
 
1053
 
-
 
1054
        long totalFourthWeekCount = rbmBilledCountMapFourthWeek.values().stream().mapToLong(x -> x.longValue()).sum();
-
 
1055
 
1048
 
1056
 
1049
//      mtd rbm partner billing
1057
//      mtd rbm partner billing
1050
 
1058
 
1051
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsMtd = rbmTargetService.getDateWiseBilledFofoIdByRbm(firstOfCurrentMonth, LocalDate.now());
1059
        List<RbmBilledFofoIdsModel> rbmBilledFofoIdsModelsMtd = rbmTargetService.getDateWiseBilledFofoIdByRbm(firstOfCurrentMonth, LocalDate.now());
1052
 
1060
 
1053
        Map<String, Long> rbmBilledCountMapMtd = rbmBilledFofoIdsModelsMtd.stream()
1061
        Map<String, Long> rbmBilledCountMapMtd = rbmBilledFofoIdsModelsMtd.stream()
1054
                .filter(x -> x.getStatus().equals("Billed"))
1062
                .filter(x -> x.getStatus().equals("Billed"))
1055
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1063
                .collect(Collectors.groupingBy(RbmBilledFofoIdsModel::getRbmName, Collectors.counting()));
1056
 
1064
 
-
 
1065
        long totalMtdCount = rbmBilledCountMapMtd.values().stream().mapToLong(Long::longValue).sum();
-
 
1066
 
-
 
1067
        Map<String, Long> zeroBilledCountMap = rbmTargetedFofoIdCountMap.entrySet().stream()
-
 
1068
                .collect(Collectors.toMap(
-
 
1069
                        Map.Entry::getKey,
-
 
1070
                        entry -> entry.getValue() - rbmBilledCountMapMtd.getOrDefault(entry.getKey(), 0L)
-
 
1071
                ));
-
 
1072
 
-
 
1073
        long totalZeroBilledCount = zeroBilledCountMap.values().stream().mapToLong(Long::longValue).sum();
-
 
1074
 
1057
        LOGGER.info("rbmArrViewModels {}", rbmArrViewModels);
1075
        LOGGER.info("rbmArrViewModels {}", rbmArrViewModels);
1058
        model.addAttribute("rbmArrViewModels", rbmArrViewModels);
1076
        model.addAttribute("rbmArrViewModels", rbmArrViewModels);
1059
        model.addAttribute("totalTarget", totalTarget);
1077
        model.addAttribute("totalTarget", totalTarget);
1060
        model.addAttribute("totalAchieved", totalAchieved);
1078
        model.addAttribute("totalAchieved", totalAchieved);
1061
        model.addAttribute("sold15daysOldAgingModels", sold15daysOldAgingModels);
1079
        model.addAttribute("sold15daysOldAgingModels", sold15daysOldAgingModels);
Line 1065... Line 1083...
1065
        model.addAttribute("rbmBilledCountMapFirstWeek", rbmBilledCountMapFirstWeek);
1083
        model.addAttribute("rbmBilledCountMapFirstWeek", rbmBilledCountMapFirstWeek);
1066
        model.addAttribute("rbmBilledCountMapSecondWeek", rbmBilledCountMapSecondWeek);
1084
        model.addAttribute("rbmBilledCountMapSecondWeek", rbmBilledCountMapSecondWeek);
1067
        model.addAttribute("rbmBilledCountMapThirdWeek", rbmBilledCountMapThirdWeek);
1085
        model.addAttribute("rbmBilledCountMapThirdWeek", rbmBilledCountMapThirdWeek);
1068
        model.addAttribute("rbmBilledCountMapFourthWeek", rbmBilledCountMapFourthWeek);
1086
        model.addAttribute("rbmBilledCountMapFourthWeek", rbmBilledCountMapFourthWeek);
1069
        model.addAttribute("rbmBilledCountMapMtd", rbmBilledCountMapMtd);
1087
        model.addAttribute("rbmBilledCountMapMtd", rbmBilledCountMapMtd);
-
 
1088
        model.addAttribute("zeroBilledCountMap", zeroBilledCountMap);
-
 
1089
        model.addAttribute("totalFirstWeekCount", totalFirstWeekCount);
-
 
1090
        model.addAttribute("totalTargetedCount", totalTargetedCount);
-
 
1091
        model.addAttribute("totalSecondWeekCount", totalSecondWeekCount);
-
 
1092
        model.addAttribute("totalThirdWeekCount", totalThirdWeekCount);
-
 
1093
        model.addAttribute("totalFourthWeekCount", totalFourthWeekCount);
-
 
1094
        model.addAttribute("totalMtdCount", totalMtdCount);
-
 
1095
        model.addAttribute("totalZeroBilledCount", totalZeroBilledCount);
1070
 
1096
 
1071
        return "rbm-today-arr";
1097
        return "rbm-today-arr";
1072
    }
1098
    }
1073
 
1099
 
1074
 
1100