Subversion Repositories SmartDukaan

Rev

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

Rev 30806 Rev 30808
Line 890... Line 890...
890
			for (int i = 0; i <= 6; i++) {
890
			for (int i = 0; i <= 6; i++) {
891
 
891
 
892
				Map<Integer, PartnerCollectionPlanModel> collectionMap = partnerCollectionService
892
				Map<Integer, PartnerCollectionPlanModel> collectionMap = partnerCollectionService
893
						.getCollectionMap(fofoIdList, startDate.minusDays(i));
893
						.getCollectionMap(fofoIdList, startDate.minusDays(i));
894
 
894
 
895
				LOGGER.info("dddd {} {}", startDate.minusDays(i), collectionMap);
-
 
896
 
-
 
897
				pcpmMap.put(startDate.minusDays(i).toLocalDate(), collectionMap);
895
				pcpmMap.put(startDate.minusDays(i).toLocalDate(), collectionMap);
898
			}
896
			}
899
 
897
 
900
			Map<Integer, PartnerCollectionPlanModel> todayPcpmMap = pcpmMap.get(startDate.toLocalDate());
898
			Map<Integer, PartnerCollectionPlanModel> todayPcpmMap = pcpmMap.get(startDate.toLocalDate());
901
			model.addAttribute("todayPcpmMap", todayPcpmMap);
899
			model.addAttribute("todayPcpmMap", todayPcpmMap);
902
 
900
 
903
			int totalPartnerTargetCollection = 0;
-
 
904
 
-
 
905
			long totalPartnerAchievement = 0;
-
 
906
 
-
 
907
			for (Entry<Integer, PartnerCollectionPlanModel> todayPcpmMapEntry : todayPcpmMap.entrySet()) {
-
 
908
				PartnerCollectionPlanModel collectionPlan = todayPcpmMapEntry.getValue();
-
 
909
				if (collectionPlan.getTargetPlan() != null && collectionPlan.getCommittedDate() != null) {
-
 
910
					float targetCollection = 0;
-
 
911
 
-
 
912
					if (collectionPlan.getRank() == 2 && collectionPlan.getAchievementPlan() != null) {
-
 
913
						targetCollection = collectionPlan.getTargetPlan() - collectionPlan.getAchievementPlan();
901
			TotalTargetColectionModel totalTargetCollection = partnerCollectionService
914
					} else {
-
 
915
						targetCollection = collectionPlan.getTargetPlan();
902
					.getTotalTargetCollection(todayPcpmMap, startDate);
916
					}
-
 
917
 
-
 
918
					if (!collectionPlan.getCommittedDate().isAfter(startDate)) {
-
 
919
						totalPartnerTargetCollection += targetCollection;
-
 
920
 
-
 
921
					}
-
 
922
 
-
 
923
					if ((collectionPlan.getCommittedDate().toLocalDate().isEqual(startDate.toLocalDate())
-
 
924
							|| collectionPlan.getRank() == 2)
-
 
925
 
-
 
926
							&& collectionPlan.getAchievementPlan() != null) {
-
 
927
						totalPartnerAchievement += collectionPlan.getAchievementPlan();
-
 
928
					}
-
 
929
 
-
 
930
				}
-
 
931
			}
-
 
932
			model.addAttribute("totalPartnerTargetCollection", totalPartnerTargetCollection);
903
			model.addAttribute("totalPartnerTargetCollection", totalTargetCollection.getTotalTarget());
933
 
904
 
934
			model.addAttribute("totalPartnerAchievement", totalPartnerAchievement);
905
			model.addAttribute("totalPartnerAchievement", totalTargetCollection.getTotalAchievement());
935
 
906
 
936
			Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
907
			Map<Integer, CustomRetailer> customRetailerMap = retailerService.getAllFofoRetailers();
937
			Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().distinct()
908
			Map<Integer, CustomRetailer> customRetailers = fofoIdList.stream().distinct()
938
					.map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()).stream()
909
					.map(x -> customRetailerMap.get(x)).filter(x -> x != null).collect(Collectors.toList()).stream()
939
					.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));
910
					.collect(Collectors.toMap(x -> x.getPartnerId(), x -> x));