| Line 18... |
Line 18... |
| 18 |
import javax.transaction.Transactional;
|
18 |
import javax.transaction.Transactional;
|
| 19 |
|
19 |
|
| 20 |
import org.apache.logging.log4j.LogManager;
|
20 |
import org.apache.logging.log4j.LogManager;
|
| 21 |
import org.apache.logging.log4j.Logger;
|
21 |
import org.apache.logging.log4j.Logger;
|
| 22 |
import org.springframework.beans.factory.annotation.Autowired;
|
22 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
23 |
import org.springframework.cache.annotation.Cacheable;
|
| 23 |
import org.springframework.core.io.InputStreamResource;
|
24 |
import org.springframework.core.io.InputStreamResource;
|
| 24 |
import org.springframework.http.HttpHeaders;
|
25 |
import org.springframework.http.HttpHeaders;
|
| 25 |
import org.springframework.http.HttpStatus;
|
26 |
import org.springframework.http.HttpStatus;
|
| 26 |
import org.springframework.http.ResponseEntity;
|
27 |
import org.springframework.http.ResponseEntity;
|
| 27 |
import org.springframework.stereotype.Controller;
|
28 |
import org.springframework.stereotype.Controller;
|
| Line 33... |
Line 34... |
| 33 |
import org.springframework.web.bind.annotation.RequestPart;
|
34 |
import org.springframework.web.bind.annotation.RequestPart;
|
| 34 |
import org.springframework.web.multipart.MultipartFile;
|
35 |
import org.springframework.web.multipart.MultipartFile;
|
| 35 |
|
36 |
|
| 36 |
import com.google.gson.Gson;
|
37 |
import com.google.gson.Gson;
|
| 37 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
38 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 38 |
import com.spice.profitmandi.common.model.ChartInvestmentModel;
|
- |
|
| 39 |
import com.spice.profitmandi.common.model.Data;
|
- |
|
| 40 |
import com.spice.profitmandi.common.model.DataInvestmentModel;
|
- |
|
| - |
|
39 |
|
| 41 |
import com.spice.profitmandi.common.model.Legend;
|
40 |
import com.spice.profitmandi.common.model.Legend;
|
| 42 |
import com.spice.profitmandi.common.model.OptionModel;
|
41 |
import com.spice.profitmandi.common.model.OptionModel;
|
| 43 |
import com.spice.profitmandi.common.model.PieLables;
|
42 |
import com.spice.profitmandi.common.model.PieLables;
|
| 44 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
43 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 45 |
import com.spice.profitmandi.common.util.FileUtil;
|
44 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 46 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
45 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 47 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
- |
|
| 48 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| - |
|
46 |
|
| 49 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
47 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 50 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
48 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
| 51 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
49 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
| 52 |
import com.spice.profitmandi.dao.model.ChartLeadModel;
|
50 |
import com.spice.profitmandi.dao.model.ChartLeadModel;
|
| 53 |
import com.spice.profitmandi.dao.model.CreateLeacdActivityRequest;
|
51 |
import com.spice.profitmandi.dao.model.CreateLeacdActivityRequest;
|
| 54 |
import com.spice.profitmandi.dao.model.CreateRefferalRequest;
|
52 |
import com.spice.profitmandi.dao.model.CreateRefferalRequest;
|
| 55 |
import com.spice.profitmandi.dao.model.DataLeadModel;
|
53 |
import com.spice.profitmandi.dao.model.DataLeadModel;
|
| 56 |
import com.spice.profitmandi.dao.model.LeadIvoryModel;
|
54 |
import com.spice.profitmandi.dao.model.LeadIvoryModel;
|
| 57 |
import com.spice.profitmandi.dao.model.LeadStatusData;
|
55 |
import com.spice.profitmandi.dao.model.LeadStatusData;
|
| 58 |
import com.spice.profitmandi.dao.model.StateGstRateModel;
|
- |
|
| - |
|
56 |
|
| 59 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
57 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 60 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
58 |
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
|
| 61 |
import com.spice.profitmandi.dao.repository.dtr.LeadActivityRepository;
|
59 |
import com.spice.profitmandi.dao.repository.dtr.LeadActivityRepository;
|
| 62 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
60 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
| 63 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
61 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| Line 101... |
Line 99... |
| 101 |
List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
|
99 |
List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
|
| 102 |
|
100 |
|
| 103 |
@RequestMapping(value = "/getOpenLead", method = RequestMethod.GET)
|
101 |
@RequestMapping(value = "/getOpenLead", method = RequestMethod.GET)
|
| 104 |
public String getOpenLead(HttpServletRequest request,
|
102 |
public String getOpenLead(HttpServletRequest request,
|
| 105 |
@RequestParam(name = "leadStatus", required = false, defaultValue = "All") List<LeadStatus> leadStatus,
|
103 |
@RequestParam(name = "leadStatus", required = false, defaultValue = "All") List<LeadStatus> leadStatus,
|
| 106 |
@RequestParam(name = "color", required = false, defaultValue = "") List<String> color, Model model)
|
104 |
@RequestParam(name = "color", required = false, defaultValue = "") List<String> color,
|
| - |
|
105 |
@RequestParam(name = "leadDate", required = false, defaultValue = "") LocalDate leadDate, Model model)
|
| 107 |
throws Exception {
|
106 |
throws Exception {
|
| 108 |
|
107 |
|
| - |
|
108 |
LocalDateTime localDateTime = null;
|
| - |
|
109 |
|
| - |
|
110 |
LOGGER.info("color" + color);
|
| - |
|
111 |
|
| - |
|
112 |
LOGGER.info("leadDate" + leadDate);
|
| - |
|
113 |
|
| - |
|
114 |
if (leadDate != null) {
|
| - |
|
115 |
localDateTime = leadDate.atStartOfDay();
|
| - |
|
116 |
|
| - |
|
117 |
}
|
| - |
|
118 |
|
| - |
|
119 |
if (color == null) {
|
| - |
|
120 |
color.add("");
|
| - |
|
121 |
}
|
| - |
|
122 |
|
| - |
|
123 |
LOGGER.info("localDateTime" + localDateTime);
|
| - |
|
124 |
|
| 109 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
125 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 110 |
String emailId = loginDetails.getEmailId();
|
126 |
String emailId = loginDetails.getEmailId();
|
| 111 |
AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
|
127 |
AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
|
| 112 |
|
128 |
|
| 113 |
boolean authPositon = positionRepository.hasCategory(authUser.getId(),
|
129 |
boolean authPositon = positionRepository.hasCategory(authUser.getId(),
|
| 114 |
ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
130 |
ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
| 115 |
|
131 |
|
| 116 |
if (leadStatus.contains(LeadStatus.All)) {
|
132 |
if (leadStatus.contains(LeadStatus.All)) {
|
| 117 |
|
133 |
|
| - |
|
134 |
leadStatus.add(LeadStatus.pending);
|
| - |
|
135 |
leadStatus.add(LeadStatus.notInterested);
|
| 118 |
leadStatus.addAll(Arrays.asList(LeadStatus.values()));
|
136 |
leadStatus.add(LeadStatus.finalized);
|
| 119 |
}
|
137 |
}
|
| 120 |
|
138 |
|
| 121 |
List<Lead> leads = null;
|
139 |
List<Lead> leads = null;
|
| - |
|
140 |
|
| - |
|
141 |
model.addAttribute("colors", color);
|
| - |
|
142 |
|
| 122 |
Map<Integer, LeadActivity> leadActivityMap = new HashMap<>();
|
143 |
Map<Integer, LeadActivity> leadActivityMap = new HashMap<>();
|
| 123 |
List<Integer> authUserIds = null;
|
144 |
List<Integer> authUserIds = null;
|
| 124 |
if (!color.isEmpty()) {
|
145 |
if (!color.isEmpty()) {
|
| 125 |
if (color.contains("All")) {
|
146 |
if (color.contains("All")) {
|
| 126 |
color.add("yellow");
|
147 |
color.add("yellow");
|
| 127 |
color.add("green");
|
148 |
color.add("green");
|
| 128 |
}
|
149 |
}
|
| - |
|
150 |
|
| - |
|
151 |
LOGGER.info("color111" + color);
|
| - |
|
152 |
|
| 129 |
if (authPositon) {
|
153 |
if (authPositon) {
|
| 130 |
authUserIds = authService.getAllReportees(authUser.getId());
|
154 |
authUserIds = authService.getAllReportees(authUser.getId());
|
| 131 |
authUserIds.add(authUser.getId());
|
155 |
authUserIds.add(authUser.getId());
|
| 132 |
LOGGER.info("authIds" + authUserIds);
|
156 |
LOGGER.info("authIds" + authUserIds);
|
| 133 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus, authUserIds,
|
- |
|
| 134 |
color, LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
- |
|
| 135 |
|
157 |
|
| - |
|
158 |
if (leadStatus.contains(LeadStatus.All)) {
|
| - |
|
159 |
if (localDateTime == null) {
|
| - |
|
160 |
|
| - |
|
161 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus,
|
| - |
|
162 |
authUserIds, color, LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| - |
|
163 |
|
| - |
|
164 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
165 |
|
| - |
|
166 |
leads.addAll(leadFollowUp);
|
| - |
|
167 |
|
| - |
|
168 |
}
|
| - |
|
169 |
|
| - |
|
170 |
else {
|
| - |
|
171 |
|
| - |
|
172 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus,
|
| - |
|
173 |
authUserIds, color, localDateTime);
|
| - |
|
174 |
|
| - |
|
175 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
176 |
|
| - |
|
177 |
leads.addAll(leadFollowUp);
|
| - |
|
178 |
|
| - |
|
179 |
}
|
| - |
|
180 |
} else
|
| - |
|
181 |
|
| - |
|
182 |
{
|
| - |
|
183 |
if (localDateTime == null) {
|
| - |
|
184 |
|
| - |
|
185 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus,
|
| - |
|
186 |
authUserIds, color, LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| - |
|
187 |
|
| 136 |
} else {
|
188 |
} else {
|
| - |
|
189 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus,
|
| - |
|
190 |
authUserIds, color, localDateTime);
|
| - |
|
191 |
|
| - |
|
192 |
}
|
| - |
|
193 |
|
| - |
|
194 |
}
|
| 137 |
|
195 |
|
| 138 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
- |
|
| 139 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
- |
|
| 140 |
}
|
196 |
}
|
| 141 |
|
197 |
|
| - |
|
198 |
else {
|
| - |
|
199 |
|
| - |
|
200 |
if (leadStatus.contains(LeadStatus.All)) {
|
| - |
|
201 |
|
| - |
|
202 |
if (localDateTime == null) {
|
| - |
|
203 |
|
| - |
|
204 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
| - |
|
205 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| - |
|
206 |
|
| - |
|
207 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
208 |
leads.addAll(leadFollowUp);
|
| - |
|
209 |
LOGGER.info("leadlocalDateTime1" + leads);
|
| - |
|
210 |
|
| - |
|
211 |
} else {
|
| - |
|
212 |
|
| - |
|
213 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
| - |
|
214 |
localDateTime);
|
| - |
|
215 |
|
| - |
|
216 |
LOGGER.info("leadlocalDateTime2" + leads);
|
| - |
|
217 |
|
| - |
|
218 |
}
|
| - |
|
219 |
}
|
| - |
|
220 |
|
| 142 |
} else {
|
221 |
else {
|
| - |
|
222 |
|
| - |
|
223 |
if (localDateTime == null) {
|
| - |
|
224 |
|
| - |
|
225 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
| - |
|
226 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| - |
|
227 |
|
| - |
|
228 |
LOGGER.info("leadlocalDateTime3" + leads);
|
| - |
|
229 |
} else {
|
| - |
|
230 |
|
| - |
|
231 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
| - |
|
232 |
localDateTime);
|
| - |
|
233 |
LOGGER.info("leadlocalDateTime4" + leads);
|
| - |
|
234 |
}
|
| - |
|
235 |
}
|
| - |
|
236 |
}
|
| - |
|
237 |
}
|
| - |
|
238 |
|
| - |
|
239 |
else {
|
| 143 |
|
240 |
|
| 144 |
if (authPositon) {
|
241 |
if (authPositon) {
|
| 145 |
authUserIds = authService.getAllReportees(authUser.getId());
|
242 |
authUserIds = authService.getAllReportees(authUser.getId());
|
| 146 |
authUserIds.add(authUser.getId());
|
243 |
authUserIds.add(authUser.getId());
|
| 147 |
LOGGER.info("authIds" + authUserIds);
|
244 |
LOGGER.info("authIds" + authUserIds);
|
| 148 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
|
245 |
if (leadStatus.contains(LeadStatus.All)) {
|
| 149 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3), authUserIds);
|
246 |
if (localDateTime == null) {
|
| 150 |
|
247 |
|
| - |
|
248 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
|
| - |
|
249 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1), authUserIds);
|
| - |
|
250 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
251 |
leads.addAll(leadFollowUp);
|
| - |
|
252 |
LOGGER.info("leadlocalDateTime1" + leads);
|
| - |
|
253 |
}
|
| - |
|
254 |
|
| 151 |
} else {
|
255 |
else {
|
| - |
|
256 |
|
| - |
|
257 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus, localDateTime,
|
| - |
|
258 |
authUserIds);
|
| - |
|
259 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
260 |
leads.addAll(leadFollowUp);
|
| - |
|
261 |
LOGGER.info("leadlocalDateTime1" + leads);
|
| - |
|
262 |
|
| - |
|
263 |
}
|
| - |
|
264 |
}
|
| - |
|
265 |
|
| - |
|
266 |
else {
|
| - |
|
267 |
|
| - |
|
268 |
if (localDateTime == null) {
|
| 152 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus,
|
269 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
|
| 153 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
270 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1), authUserIds);
|
| - |
|
271 |
}
|
| - |
|
272 |
|
| - |
|
273 |
else {
|
| - |
|
274 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus, localDateTime,
|
| - |
|
275 |
authUserIds);
|
| - |
|
276 |
}
|
| - |
|
277 |
}
|
| 154 |
}
|
278 |
}
|
| - |
|
279 |
|
| - |
|
280 |
else {
|
| - |
|
281 |
|
| - |
|
282 |
if (leadStatus.contains(LeadStatus.All)) {
|
| - |
|
283 |
|
| - |
|
284 |
if (localDateTime == null) {
|
| - |
|
285 |
|
| - |
|
286 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus,
|
| - |
|
287 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| 155 |
// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
|
288 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
289 |
leads.addAll(leadFollowUp);
|
| - |
|
290 |
LOGGER.info("leadlocalDateTime1" + leads);
|
| - |
|
291 |
|
| - |
|
292 |
}
|
| - |
|
293 |
|
| - |
|
294 |
else {
|
| - |
|
295 |
|
| - |
|
296 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus, localDateTime);
|
| - |
|
297 |
List<Lead> leadFollowUp = leadRepository.selectAllByStatus(LeadStatus.followUp);
|
| - |
|
298 |
leads.addAll(leadFollowUp);
|
| - |
|
299 |
LOGGER.info("leadlocalDateTime1" + leads);
|
| - |
|
300 |
}
|
| - |
|
301 |
}
|
| - |
|
302 |
|
| - |
|
303 |
else {
|
| - |
|
304 |
|
| 156 |
if (!leads.isEmpty()) {
|
305 |
if (localDateTime == null) {
|
| - |
|
306 |
|
| 157 |
leads.addAll(leadRepository.selectAllByStatus(LeadStatus.pending));
|
307 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus,
|
| - |
|
308 |
LocalDate.now().atStartOfDay().withDayOfMonth(1).minusMonths(1));
|
| - |
|
309 |
|
| - |
|
310 |
LOGGER.info("manish!233" + leads);
|
| - |
|
311 |
|
| - |
|
312 |
}
|
| - |
|
313 |
|
| - |
|
314 |
else {
|
| - |
|
315 |
|
| - |
|
316 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus, localDateTime);
|
| - |
|
317 |
}
|
| - |
|
318 |
|
| - |
|
319 |
}
|
| - |
|
320 |
|
| 158 |
}
|
321 |
}
|
| - |
|
322 |
// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
|
| 159 |
}
|
323 |
}
|
| 160 |
if (authPositon && authUserIds.size() > 0) {
|
324 |
if (authPositon && authUserIds.size() > 0) {
|
| 161 |
List<String> leadCreators = new ArrayList<>();
|
325 |
List<String> leadCreators = new ArrayList<>();
|
| 162 |
leadCreators.add("daily-sync");
|
326 |
leadCreators.add("daily-sync");
|
| 163 |
leadCreators.addAll(authRepository.selectAllAuthUserByIds(authUserIds).stream().map(x -> x.getFullName())
|
327 |
leadCreators.addAll(authRepository.selectAllAuthUserByIds(authUserIds).stream().map(x -> x.getFullName())
|
| Line 254... |
Line 418... |
| 254 |
weekDates.add(curDate.minusDays(7).toLocalDate());
|
418 |
weekDates.add(curDate.minusDays(7).toLocalDate());
|
| 255 |
LOGGER.info("lastDate" + lastDate);
|
419 |
LOGGER.info("lastDate" + lastDate);
|
| 256 |
|
420 |
|
| 257 |
model.addAttribute("weekDates", weekDates);
|
421 |
model.addAttribute("weekDates", weekDates);
|
| 258 |
|
422 |
|
| - |
|
423 |
model.addAttribute("leadDate", leadDate);
|
| 259 |
model.addAttribute("lastDate", lastDate);
|
424 |
model.addAttribute("lastDate", lastDate);
|
| 260 |
model.addAttribute("stateNames", stateNames);
|
425 |
model.addAttribute("stateNames", stateNames);
|
| 261 |
model.addAttribute("authUsers", authUsers);
|
426 |
model.addAttribute("authUsers", authUsers);
|
| 262 |
model.addAttribute("lead", leads);
|
427 |
model.addAttribute("lead", leads);
|
| 263 |
model.addAttribute("leadStatus", LeadStatus.values());
|
428 |
model.addAttribute("leadStatus", LeadStatus.values());
|
| 264 |
model.addAttribute("leadLasts", leadLasts);
|
429 |
model.addAttribute("leadLasts", leadLasts);
|
| 265 |
model.addAttribute("leadThirds", leadThirds);
|
430 |
model.addAttribute("leadThirds", leadThirds);
|
| 266 |
model.addAttribute("leadSeconds", leadSeconds);
|
431 |
model.addAttribute("leadSeconds", leadSeconds);
|
| 267 |
model.addAttribute("leadFirsts", leadFirsts);
|
432 |
model.addAttribute("leadFirsts", leadFirsts);
|
| 268 |
model.addAttribute("lwDays", lwDays);
|
433 |
model.addAttribute("lwDays", lwDays);
|
| 269 |
model.addAttribute("colors", color);
|
- |
|
| 270 |
|
434 |
|
| 271 |
model.addAttribute("selectedLeadStatus", leadStatus.get(0));
|
435 |
model.addAttribute("selectedLeadStatus", leadStatus.get(0));
|
| 272 |
return "lead";
|
436 |
return "lead";
|
| 273 |
|
437 |
|
| 274 |
}
|
438 |
}
|
| Line 284... |
Line 448... |
| 284 |
LOGGER.info("hotLeadsMap" + hotLeadsMap);
|
448 |
LOGGER.info("hotLeadsMap" + hotLeadsMap);
|
| 285 |
ChartLeadModel cm = new ChartLeadModel();
|
449 |
ChartLeadModel cm = new ChartLeadModel();
|
| 286 |
|
450 |
|
| 287 |
HashSet<LeadStatus> labels = new HashSet<LeadStatus>();
|
451 |
HashSet<LeadStatus> labels = new HashSet<LeadStatus>();
|
| 288 |
labels.addAll(leadStatusMap.keySet());
|
452 |
labels.addAll(leadStatusMap.keySet());
|
| 289 |
|
- |
|
| 290 |
|
453 |
|
| 291 |
HashSet<String> hotLeads = new HashSet<String>();
|
454 |
HashSet<String> hotLeads = new HashSet<String>();
|
| 292 |
hotLeads.addAll(leadStatusMap.keySet().stream().map(x -> x.toString()).collect(Collectors.toSet()));
|
455 |
hotLeads.addAll(leadStatusMap.keySet().stream().map(x -> x.toString()).collect(Collectors.toSet()));
|
| 293 |
hotLeads.add("HotLead");
|
456 |
hotLeads.add("HotLead");
|
| 294 |
|
- |
|
| 295 |
|
457 |
|
| 296 |
HashSet<String> hotLeadKeys = new HashSet<String>();
|
458 |
HashSet<String> hotLeadKeys = new HashSet<String>();
|
| 297 |
|
459 |
|
| 298 |
hotLeadKeys.add("HotLead");
|
460 |
hotLeadKeys.add("HotLead");
|
| 299 |
List<String> hotLeadGreen = new ArrayList<>(hotLeadKeys);
|
461 |
List<String> hotLeadGreen = new ArrayList<>(hotLeadKeys);
|
| 300 |
|
462 |
|
| 301 |
List<LeadStatus> labelList = new ArrayList<>(labels);
|
463 |
List<LeadStatus> labelList = new ArrayList<>(labels);
|
| 302 |
List<String> backgroundColor = new ArrayList<>();
|
464 |
List<String> backgroundColor = new ArrayList<>();
|
| 303 |
LOGGER.info("hotLeadKeys" + hotLeadKeys);
|
465 |
LOGGER.info("hotLeadKeys" + hotLeadKeys);
|
| 304 |
List<Long> values = new ArrayList<>();
|
466 |
List<Long> values = new ArrayList<>();
|
| 305 |
|
467 |
|
| Line 315... |
Line 477... |
| 315 |
if (label.equals(LeadStatus.followUp)) {
|
477 |
if (label.equals(LeadStatus.followUp)) {
|
| 316 |
backgroundColor.add("#9ACD32");
|
478 |
backgroundColor.add("#9ACD32");
|
| 317 |
}
|
479 |
}
|
| 318 |
if (label.equals(LeadStatus.finalized)) {
|
480 |
if (label.equals(LeadStatus.finalized)) {
|
| 319 |
backgroundColor.add("blue");
|
481 |
backgroundColor.add("blue");
|
| 320 |
}
|
482 |
}
|
| 321 |
}
|
483 |
}
|
| 322 |
|
484 |
|
| 323 |
for ( String hotLeadList : hotLeadGreen){
|
485 |
for (String hotLeadList : hotLeadGreen) {
|
| 324 |
|
486 |
|
| 325 |
if(hotLeadList.equals("HotLead"))
|
487 |
if (hotLeadList.equals("HotLead")) {
|
| 326 |
{
|
- |
|
| 327 |
backgroundColor.add("green");
|
488 |
backgroundColor.add("green");
|
| 328 |
values.add(hotLeadsMap.get("Green"));
|
489 |
values.add(hotLeadsMap.get("Green"));
|
| 329 |
|
490 |
|
| 330 |
}
|
491 |
}
|
| 331 |
|
492 |
|
| 332 |
}
|
493 |
}
|
| 333 |
LOGGER.info("labelList" + labelList);
|
494 |
LOGGER.info("labelList" + labelList);
|
| 334 |
|
495 |
|
| 335 |
LOGGER.info("backgroundColor" + backgroundColor);
|
496 |
LOGGER.info("backgroundColor" + backgroundColor);
|
| 336 |
LOGGER.info("labelsChartLead" + labels);
|
497 |
LOGGER.info("labelsChartLead" + labels);
|
| Line 595... |
Line 756... |
| 595 |
|
756 |
|
| 596 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
757 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 597 |
return "response";
|
758 |
return "response";
|
| 598 |
|
759 |
|
| 599 |
}
|
760 |
}
|
| - |
|
761 |
|
| 600 |
@RequestMapping(value = "/downloadIvoryLead", method = RequestMethod.GET)
|
762 |
@RequestMapping(value = "/downloadIvoryLead", method = RequestMethod.GET)
|
| 601 |
public ResponseEntity<?> downloadDelayDayTemplate(HttpServletRequest request) throws Exception {
|
763 |
public ResponseEntity<?> downloadDelayDayTemplate(HttpServletRequest request) throws Exception {
|
| 602 |
List<List<?>> rows = new ArrayList<>();
|
764 |
List<List<?>> rows = new ArrayList<>();
|
| 603 |
|
765 |
|
| 604 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
766 |
org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil
|
| 605 |
.getCSVByteStream(Arrays.asList("created_time", "Name", "email","Mobile","state","city"), rows);
|
767 |
.getCSVByteStream(Arrays.asList("created_time", "Name", "email", "Mobile", "state", "city"), rows);
|
| 606 |
|
768 |
|
| 607 |
final HttpHeaders headers = new HttpHeaders();
|
769 |
final HttpHeaders headers = new HttpHeaders();
|
| 608 |
headers.set("Content-Type", "text/csv");
|
770 |
headers.set("Content-Type", "text/csv");
|
| 609 |
headers.set("Content-disposition", "inline; filename=Ivory.format.csv");
|
771 |
headers.set("Content-disposition", "inline; filename=Ivory.format.csv");
|
| 610 |
headers.setContentLength(baos.toByteArray().length);
|
772 |
headers.setContentLength(baos.toByteArray().length);
|
| Line 612... |
Line 774... |
| 612 |
final InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
|
774 |
final InputStream inputStream = new ByteArrayInputStream(baos.toByteArray());
|
| 613 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
775 |
final InputStreamResource inputStreamResource = new InputStreamResource(inputStream);
|
| 614 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
776 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 615 |
|
777 |
|
| 616 |
}
|
778 |
}
|
| - |
|
779 |
|
| 617 |
@RequestMapping(value = "/csvFileAndSetLead", method = RequestMethod.POST)
|
780 |
@RequestMapping(value = "/csvFileAndSetLead", method = RequestMethod.POST)
|
| 618 |
public String readCsvFileAndSetLead(HttpServletRequest request, Model model, HttpServletResponse response,
|
781 |
public String readCsvFileAndSetLead(HttpServletRequest request, Model model, HttpServletResponse response,
|
| 619 |
@RequestPart MultipartFile file) throws Throwable {
|
782 |
@RequestPart MultipartFile file) throws Throwable {
|
| 620 |
|
783 |
|
| 621 |
LOGGER.info("file" + file.toString());
|
784 |
LOGGER.info("file" + file.toString());
|
| Line 644... |
Line 807... |
| 644 |
lead.setState(leadIvoryModel.getState());
|
807 |
lead.setState(leadIvoryModel.getState());
|
| 645 |
lead.setCity(leadIvoryModel.getCity());
|
808 |
lead.setCity(leadIvoryModel.getCity());
|
| 646 |
lead.setAddress("NOT AVAILABLE");
|
809 |
lead.setAddress("NOT AVAILABLE");
|
| 647 |
|
810 |
|
| 648 |
AuthUser authUser = authRepository.selectById(4);
|
811 |
AuthUser authUser = authRepository.selectById(4);
|
| 649 |
|
812 |
|
| 650 |
if(leadIvoryModel.getCreatedTime() != null) {
|
813 |
if (leadIvoryModel.getCreatedTime() != null) {
|
| 651 |
lead.setCreatedTimestamp(leadIvoryModel.getCreatedTime());
|
814 |
lead.setCreatedTimestamp(leadIvoryModel.getCreatedTime());
|
| 652 |
}
|
- |
|
| 653 |
else
|
815 |
} else {
|
| 654 |
{
|
- |
|
| 655 |
lead.setCreatedTimestamp(LocalDateTime.now());
|
816 |
lead.setCreatedTimestamp(LocalDateTime.now());
|
| 656 |
}
|
817 |
}
|
| 657 |
lead.setUpdatedTimestamp(LocalDateTime.now());
|
818 |
lead.setUpdatedTimestamp(LocalDateTime.now());
|
| 658 |
lead.setStatus(LeadStatus.pending);
|
819 |
lead.setStatus(LeadStatus.pending);
|
| 659 |
lead.setAssignTo(authUser.getId());
|
820 |
lead.setAssignTo(authUser.getId());
|
| 660 |
lead.setSource("IVORY");
|
821 |
lead.setSource("IVORY");
|