Subversion Repositories SmartDukaan

Rev

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

Rev 29284 Rev 29287
Line 106... Line 106...
106
			leadStatus.addAll(Arrays.asList(LeadStatus.values()));
106
			leadStatus.addAll(Arrays.asList(LeadStatus.values()));
107
		}
107
		}
108
 
108
 
109
		List<Lead> leads = null;
109
		List<Lead> leads = null;
110
		Map<Integer, LeadActivity> leadActivityMap = new HashMap<>();
110
		Map<Integer, LeadActivity> leadActivityMap = new HashMap<>();
-
 
111
		List<Integer> authUserIds = null;
111
		if (!color.isEmpty()) {
112
		if (!color.isEmpty()) {
112
			if (color.contains("All")) {
113
			if (color.contains("All")) {
113
				color.add("yellow");
114
				color.add("yellow");
114
				color.add("green");
115
				color.add("green");
115
			}
116
			}
116
			if(authPositon)
117
			if(authPositon)
117
			{
118
			{
118
				List<Integer> authUserIds = authService.getAllReportees(authUser.getId());
119
				authUserIds = authService.getAllReportees(authUser.getId());
119
				authUserIds.add(authUser.getId());
120
				authUserIds.add(authUser.getId());
120
				LOGGER.info("authIds" + authUserIds);
121
				LOGGER.info("authIds" + authUserIds);
121
			leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus, authUserIds, color,
122
			leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus, authUserIds, color,
122
					LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
123
					LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
123
			
124
			
Line 129... Line 130...
129
			}
130
			}
130
			
131
			
131
		} else {
132
		} else {
132
 
133
 
133
			if(authPositon) {
134
			if(authPositon) {
134
				List<Integer> authUserIds = authService.getAllReportees(authUser.getId());
135
				authUserIds = authService.getAllReportees(authUser.getId());
135
				authUserIds.add(authUser.getId());
136
				authUserIds.add(authUser.getId());
136
				LOGGER.info("authIds" + authUserIds);
137
				LOGGER.info("authIds" + authUserIds);
137
				leads =	leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
138
				leads =	leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
138
						LocalDateTime.now().withDayOfMonth(1).minusMonths(3),authUserIds);
139
						LocalDateTime.now().withDayOfMonth(1).minusMonths(3),authUserIds);
139
			
140
			
Line 145... Line 146...
145
			// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
146
			// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
146
			if (!leads.isEmpty()) {
147
			if (!leads.isEmpty()) {
147
				leads.addAll(leadRepository.selectAllByStatus(LeadStatus.pending));
148
				leads.addAll(leadRepository.selectAllByStatus(LeadStatus.pending));
148
			}
149
			}
149
		}
150
		}
-
 
151
		if(authPositon && authUserIds.size() > 0) {
-
 
152
			List<String> leadCreators = new ArrayList<>();
-
 
153
			leadCreators.add("daily-sync");
-
 
154
			model.addAttribute("leadCreators", leadCreators.addAll(authRepository.selectAllAuthUserByIds(authUserIds).stream().map(x->x.getFullName()).collect(Collectors.toList())));
-
 
155
		}
150
		List<Lead> weekLast = new ArrayList<>();
156
		List<Lead> weekLast = new ArrayList<>();
151
		List<Lead> weekThird = new ArrayList<>();
157
		List<Lead> weekThird = new ArrayList<>();
152
		List<Lead> weekSecond = new ArrayList<>();
158
		List<Lead> weekSecond = new ArrayList<>();
153
		List<Lead> weekFirst = new ArrayList<>();
159
		List<Lead> weekFirst = new ArrayList<>();
154
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
160
		LocalDateTime curDate = LocalDate.now().atStartOfDay();
Line 184... Line 190...
184
		}
190
		}
185
	}
191
	}
186
		LOGGER.info("weekLast" + weekLast);
192
		LOGGER.info("weekLast" + weekLast);
187
		LOGGER.info("weekThird" + weekThird);
193
		LOGGER.info("weekThird" + weekThird);
188
		LOGGER.info("weekSecond" + weekSecond);
194
		LOGGER.info("weekSecond" + weekSecond);
189
		Map<String, Long> leadLasts = weekLast.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
195
		Map<String, Long> leadLasts = weekLast.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(), Collectors.counting()));
190
				Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
-
 
191
		Map<String, Long> leadThirds = weekThird.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
196
		Map<String, Long> leadThirds = weekThird.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(), Collectors.counting()));
192
				Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
-
 
193
		Map<String, Long> leadSeconds = weekSecond.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
197
		Map<String, Long> leadSeconds = weekSecond.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
194
				Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
198
				Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
195
 
199
 
196
		Map<String, Map<LocalDate, Long>> leadFirsts = weekFirst.stream()
200
		Map<String, Map<LocalDate, Long>> leadFirsts = weekFirst.stream()
197
				.collect(Collectors.groupingBy(x -> x.getCreatedBy(),
201
				.collect(Collectors.groupingBy(x -> x.getCreatedBy(),