| Line 868... |
Line 868... |
| 868 |
.collect(Collectors.counting());
|
868 |
.collect(Collectors.counting());
|
| 869 |
|
869 |
|
| 870 |
}
|
870 |
}
|
| 871 |
|
871 |
|
| 872 |
}
|
872 |
}
|
| - |
|
873 |
ChartLeadModel cm = new ChartLeadModel();
|
| 873 |
|
874 |
|
| 874 |
ChartLeadModel cm = this
|
875 |
if (!foundCollectionMap.isEmpty()) {
|
| 875 |
.getCollectionCount(foundCollectionMap.values().stream().collect(Collectors.toList()));
|
876 |
cm = this.getCollectionCount(foundCollectionMap.values().stream().collect(Collectors.toList()));
|
| - |
|
877 |
|
| - |
|
878 |
}
|
| 876 |
model.addAttribute("chartPartnerHealth", gson.toJson(cm));
|
879 |
model.addAttribute("chartPartnerHealth", gson.toJson(cm));
|
| 877 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
880 |
Map<Integer, PartnerDailyInvestment> partnerDailyInvestmentMap = new HashMap<>();
|
| 878 |
|
881 |
|
| 879 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
882 |
List<PartnerDailyInvestment> partnerDailyInvestments = partnerDailyInvestmentRepository
|
| 880 |
.selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
|
883 |
.selectAll(fofoIdList, startDate.toLocalDate().minusDays(1));
|
| Line 1145... |
Line 1148... |
| 1145 |
|
1148 |
|
| 1146 |
}
|
1149 |
}
|
| 1147 |
|
1150 |
|
| 1148 |
@RequestMapping(value = "/indent/today_target", method = RequestMethod.GET)
|
1151 |
@RequestMapping(value = "/indent/today_target", method = RequestMethod.GET)
|
| 1149 |
public String todayTarget(HttpServletRequest request, Model model) throws Exception {
|
1152 |
public String todayTarget(HttpServletRequest request, Model model) throws Exception {
|
| 1150 |
//model.addAttribute("warehouseCollectionMap", warehouseCollectionMap);
|
1153 |
// model.addAttribute("warehouseCollectionMap", warehouseCollectionMap);
|
| 1151 |
List<RBMPerformanceSummaryModel> summaryModels = new ArrayList<>();
|
1154 |
List<RBMPerformanceSummaryModel> summaryModels = new ArrayList<>();
|
| 1152 |
List<Integer> rbmPositionsAuthIds = positionRepository
|
1155 |
List<Integer> rbmPositionsAuthIds = positionRepository
|
| - |
|
1156 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM).stream()
|
| 1153 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_RBM).stream().filter(x -> Arrays.asList(EscalationType.L1, EscalationType.L2).contains(x.getEscalationType()))
|
1157 |
.filter(x -> Arrays.asList(EscalationType.L1, EscalationType.L2).contains(x.getEscalationType()))
|
| 1154 |
.map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
|
1158 |
.map(x -> x.getAuthUserId()).distinct().collect(Collectors.toList());
|
| 1155 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
1159 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| 1156 |
List<TeamCommitmentModel> teamCommitmentModels = partnerCollectionPlanRepository.selectTeamCommitmentByDate(LocalDate.now());
|
1160 |
List<TeamCommitmentModel> teamCommitmentModels = partnerCollectionPlanRepository
|
| - |
|
1161 |
.selectTeamCommitmentByDate(LocalDate.now());
|
| - |
|
1162 |
Map<Integer, Double> rbmSecondaryTargetMap = teamCommitmentModels.stream()
|
| - |
|
1163 |
.filter(x -> rbmPositionsAuthIds.contains(x.getAuthId()))
|
| - |
|
1164 |
.collect(Collectors.groupingBy(x -> x.getAuthId(),
|
| 1157 |
Map<Integer, Double> rbmSecondaryTargetMap = teamCommitmentModels.stream().filter(x -> rbmPositionsAuthIds.contains(x.getAuthId())).collect(Collectors.groupingBy(x -> x.getAuthId(), Collectors.summingDouble(x -> x.getTotalTarget() == null ? 0 : x.getTotalTarget())));
|
1165 |
Collectors.summingDouble(x -> x.getTotalTarget() == null ? 0 : x.getTotalTarget())));
|
| - |
|
1166 |
Map<Integer, Double> rbmSecondaryMap = teamCommitmentModels.stream()
|
| - |
|
1167 |
.filter(x -> rbmPositionsAuthIds.contains(x.getAuthId()))
|
| - |
|
1168 |
.collect(Collectors.groupingBy(x -> x.getAuthId(),
|
| 1158 |
Map<Integer, Double> rbmSecondaryMap = teamCommitmentModels.stream().filter(x -> rbmPositionsAuthIds.contains(x.getAuthId())).collect(Collectors.groupingBy(x -> x.getAuthId(), Collectors.summingDouble(x -> x.getTotalAchievement() == null ? 0 : x.getTotalAchievement())));
|
1169 |
Collectors.summingDouble(x -> x.getTotalAchievement() == null ? 0 : x.getTotalAchievement())));
|
| 1159 |
LocalDateTime startDate = LocalDate.now().atStartOfDay();
|
1170 |
LocalDateTime startDate = LocalDate.now().atStartOfDay();
|
| 1160 |
for (int rbmAuthId : rbmPositionsAuthIds) {
|
1171 |
for (int rbmAuthId : rbmPositionsAuthIds) {
|
| 1161 |
RBMPerformanceSummaryModel rbmPerformanceSummaryModel = new RBMPerformanceSummaryModel();
|
1172 |
RBMPerformanceSummaryModel rbmPerformanceSummaryModel = new RBMPerformanceSummaryModel();
|
| 1162 |
rbmPerformanceSummaryModel.setAuthId(rbmAuthId);
|
1173 |
rbmPerformanceSummaryModel.setAuthId(rbmAuthId);
|
| 1163 |
AuthUser authUser = authRepository.selectById(rbmAuthId);
|
1174 |
AuthUser authUser = authRepository.selectById(rbmAuthId);
|
| 1164 |
rbmPerformanceSummaryModel.setAuthName(authUser.getFullName());
|
1175 |
rbmPerformanceSummaryModel.setAuthName(authUser.getFullName());
|
| 1165 |
List<Integer> fofoIds = new ArrayList<>(storeGuyMap.get(authUser.getEmailId()));
|
1176 |
List<Integer> fofoIds = new ArrayList<>(storeGuyMap.get(authUser.getEmailId()));
|
| 1166 |
|
1177 |
|
| 1167 |
if (fofoIds.size() > 0) {
|
1178 |
if (fofoIds.size() > 0) {
|
| 1168 |
fofoIds = fofoStoreRepository.selectByRetailerIds(fofoIds).stream()
|
1179 |
fofoIds = fofoStoreRepository.selectByRetailerIds(fofoIds).stream().filter(x -> !x.isInternal())
|
| 1169 |
.filter(x -> !x.isInternal()).map(x -> x.getId()).collect(Collectors.toList());
|
1180 |
.map(x -> x.getId()).collect(Collectors.toList());
|
| 1170 |
|
1181 |
|
| - |
|
1182 |
/*
|
| 1171 |
/*Map<Integer, PartnerCollectionPlanModel> foundCollectionMap = partnerCollectionService
|
1183 |
* Map<Integer, PartnerCollectionPlanModel> foundCollectionMap =
|
| 1172 |
.getCollectionMap(fofoIds, startDate);*/
|
1184 |
* partnerCollectionService .getCollectionMap(fofoIds, startDate);
|
| - |
|
1185 |
*/
|
| 1173 |
|
1186 |
|
| 1174 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIds);
|
1187 |
List<Integer> remarkIds = partnerCollectionRemarkRepository.selectMaxRemarkId(fofoIds);
|
| 1175 |
|
1188 |
|
| 1176 |
LOGGER.info("remarkIds {}", remarkIds);
|
1189 |
LOGGER.info("remarkIds {}", remarkIds);
|
| 1177 |
|
1190 |
|
| Line 1187... |
Line 1200... |
| 1187 |
.getCollectionMap(fofoIds, startDate);
|
1200 |
.getCollectionMap(fofoIds, startDate);
|
| 1188 |
|
1201 |
|
| 1189 |
ChartLeadModel cm = this
|
1202 |
ChartLeadModel cm = this
|
| 1190 |
.getCollectionCount(collectionMap.values().stream().collect(Collectors.toList()));
|
1203 |
.getCollectionCount(collectionMap.values().stream().collect(Collectors.toList()));
|
| 1191 |
|
1204 |
|
| 1192 |
long collectionTarget = collectionMap.values().stream().filter(x -> x.getTargetPlan() != null).collect(Collectors.summingLong(x -> x.getTargetPlan()));
|
1205 |
long collectionTarget = collectionMap.values().stream().filter(x -> x.getTargetPlan() != null)
|
| - |
|
1206 |
.collect(Collectors.summingLong(x -> x.getTargetPlan()));
|
| - |
|
1207 |
long collection = collectionMap.values().stream().filter(
|
| 1193 |
long collection = collectionMap.values().stream().filter(x -> x.getTargetPlan() != null && x.getTargetPlan() != 0 && x.getAchievementPlan() != null).collect(Collectors.summingLong(x -> x.getAchievementPlan()));
|
1208 |
x -> x.getTargetPlan() != null && x.getTargetPlan() != 0 && x.getAchievementPlan() != null)
|
| - |
|
1209 |
.collect(Collectors.summingLong(x -> x.getAchievementPlan()));
|
| 1194 |
rbmPerformanceSummaryModel.setChartLeadModel(cm);
|
1210 |
rbmPerformanceSummaryModel.setChartLeadModel(cm);
|
| 1195 |
rbmPerformanceSummaryModel.setPartnersCommunicated(todayOverallCall);
|
1211 |
rbmPerformanceSummaryModel.setPartnersCommunicated(todayOverallCall);
|
| 1196 |
rbmPerformanceSummaryModel.setCollectionTarget(collectionTarget);
|
1212 |
rbmPerformanceSummaryModel.setCollectionTarget(collectionTarget);
|
| 1197 |
rbmPerformanceSummaryModel.setCollection(collection);
|
1213 |
rbmPerformanceSummaryModel.setCollection(collection);
|
| 1198 |
rbmPerformanceSummaryModel.setSecondaryTarget(rbmSecondaryTargetMap.get(rbmAuthId) == null ? 0 : rbmSecondaryTargetMap.get(rbmAuthId).floatValue());
|
1214 |
rbmPerformanceSummaryModel.setSecondaryTarget(rbmSecondaryTargetMap.get(rbmAuthId) == null ? 0
|
| - |
|
1215 |
: rbmSecondaryTargetMap.get(rbmAuthId).floatValue());
|
| - |
|
1216 |
rbmPerformanceSummaryModel.setSecondary(
|
| 1199 |
rbmPerformanceSummaryModel.setSecondary(rbmSecondaryMap.get(rbmAuthId) == null ? 0 : rbmSecondaryMap.get(rbmAuthId).floatValue());
|
1217 |
rbmSecondaryMap.get(rbmAuthId) == null ? 0 : rbmSecondaryMap.get(rbmAuthId).floatValue());
|
| 1200 |
summaryModels.add(rbmPerformanceSummaryModel);
|
1218 |
summaryModels.add(rbmPerformanceSummaryModel);
|
| 1201 |
//cm.getData().getDatasets().get(0).getData().;
|
1219 |
// cm.getData().getDatasets().get(0).getData().;
|
| 1202 |
//cm.getData().getDatasets().get(0).getBackgroundColor();
|
1220 |
// cm.getData().getDatasets().get(0).getBackgroundColor();
|
| 1203 |
//cm.getData().getLabels()
|
1221 |
// cm.getData().getLabels()
|
| 1204 |
|
1222 |
|
| 1205 |
}
|
1223 |
}
|
| 1206 |
}
|
1224 |
}
|
| 1207 |
model.addAttribute("summaryModels", summaryModels);
|
1225 |
model.addAttribute("summaryModels", summaryModels);
|
| 1208 |
return "today_target";
|
1226 |
return "today_target";
|