| Line 30... |
Line 30... |
| 30 |
import com.spice.profitmandi.common.model.Data;
|
30 |
import com.spice.profitmandi.common.model.Data;
|
| 31 |
import com.spice.profitmandi.common.model.DataInvestmentModel;
|
31 |
import com.spice.profitmandi.common.model.DataInvestmentModel;
|
| 32 |
import com.spice.profitmandi.common.model.Legend;
|
32 |
import com.spice.profitmandi.common.model.Legend;
|
| 33 |
import com.spice.profitmandi.common.model.OptionModel;
|
33 |
import com.spice.profitmandi.common.model.OptionModel;
|
| 34 |
import com.spice.profitmandi.common.model.PieLables;
|
34 |
import com.spice.profitmandi.common.model.PieLables;
|
| - |
|
35 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 35 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
36 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 36 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
37 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 37 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
38 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 38 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
39 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 39 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
40 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
| Line 76... |
Line 77... |
| 76 |
@Autowired
|
77 |
@Autowired
|
| 77 |
private Gson gson;
|
78 |
private Gson gson;
|
| 78 |
|
79 |
|
| 79 |
@Autowired
|
80 |
@Autowired
|
| 80 |
private CookiesProcessor cookiesProcessor;
|
81 |
private CookiesProcessor cookiesProcessor;
|
| - |
|
82 |
|
| - |
|
83 |
@Autowired
|
| - |
|
84 |
PositionRepository positionRepository;
|
| 81 |
|
85 |
|
| 82 |
@Autowired
|
86 |
@Autowired
|
| 83 |
private MVCResponseSender mvcResponseSender;
|
87 |
private MVCResponseSender mvcResponseSender;
|
| 84 |
|
88 |
|
| 85 |
List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
|
89 |
List<LeadStatus> status = Arrays.asList(LeadStatus.notInterested, LeadStatus.finalized);
|
| Line 91... |
Line 95... |
| 91 |
throws Exception {
|
95 |
throws Exception {
|
| 92 |
|
96 |
|
| 93 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
97 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 94 |
String emailId = loginDetails.getEmailId();
|
98 |
String emailId = loginDetails.getEmailId();
|
| 95 |
AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
|
99 |
AuthUser authUser = authRepository.selectByEmailOrMobile(emailId);
|
| - |
|
100 |
|
| 96 |
|
101 |
|
| 97 |
List<Integer> authUserIds = authService.getDirectReportee(authUser.getId());
|
102 |
boolean authPositon = positionRepository.hasCategory(authUser.getId(),ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
| 98 |
LOGGER.info("authIds" + authUserIds);
|
- |
|
| 99 |
|
103 |
|
| 100 |
if (leadStatus.contains(LeadStatus.All)) {
|
104 |
if (leadStatus.contains(LeadStatus.All)) {
|
| 101 |
|
105 |
|
| 102 |
leadStatus.addAll(Arrays.asList(LeadStatus.values()));
|
106 |
leadStatus.addAll(Arrays.asList(LeadStatus.values()));
|
| 103 |
}
|
107 |
}
|
| 104 |
|
108 |
|
| Line 107... |
Line 111... |
| 107 |
if (!color.isEmpty()) {
|
111 |
if (!color.isEmpty()) {
|
| 108 |
if (color.contains("All")) {
|
112 |
if (color.contains("All")) {
|
| 109 |
color.add("yellow");
|
113 |
color.add("yellow");
|
| 110 |
color.add("green");
|
114 |
color.add("green");
|
| 111 |
}
|
115 |
}
|
| - |
|
116 |
if(authPositon)
|
| - |
|
117 |
{
|
| - |
|
118 |
List<Integer> authUserIds = authService.getDirectReportee(authUser.getId());
|
| - |
|
119 |
LOGGER.info("authIds" + authUserIds);
|
| 112 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, authUserIds, color,
|
120 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestampAndAuthIds(leadStatus, authUserIds, color,
|
| 113 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
121 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
| - |
|
122 |
|
| - |
|
123 |
}
|
| - |
|
124 |
else {
|
| - |
|
125 |
|
| - |
|
126 |
leads = leadRepository.selectAllByColorStatusAndUpdatedTimestamp(leadStatus, color,
|
| - |
|
127 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
| - |
|
128 |
}
|
| - |
|
129 |
|
| 114 |
} else {
|
130 |
} else {
|
| 115 |
|
131 |
|
| - |
|
132 |
if(authPositon) {
|
| - |
|
133 |
List<Integer> authUserIds = authService.getDirectReportee(authUser.getId());
|
| - |
|
134 |
LOGGER.info("authIds" + authUserIds);
|
| - |
|
135 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestampAndAuthId(leadStatus,
|
| - |
|
136 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3),authUserIds);
|
| - |
|
137 |
|
| - |
|
138 |
}
|
| - |
|
139 |
else {
|
| 116 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus,
|
140 |
leads = leadRepository.selectAllByStatusAndUpdatedTimestamp(leadStatus,
|
| 117 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3), authUserIds);
|
141 |
LocalDateTime.now().withDayOfMonth(1).minusMonths(3));
|
| - |
|
142 |
}
|
| 118 |
// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
|
143 |
// List<Lead> leads = leadRepository.selectAllBylistStatus(leadStatus);
|
| 119 |
if (!leads.isEmpty()) {
|
144 |
if (!leads.isEmpty()) {
|
| 120 |
leads.addAll(leadRepository.selectAllByStatus(LeadStatus.pending));
|
145 |
leads.addAll(leadRepository.selectAllByStatus(LeadStatus.pending));
|
| 121 |
}
|
146 |
}
|
| 122 |
}
|
147 |
}
|
| Line 154... |
Line 179... |
| 154 |
weekFirst.add(lead);
|
179 |
weekFirst.add(lead);
|
| 155 |
}
|
180 |
}
|
| 156 |
|
181 |
|
| 157 |
}
|
182 |
}
|
| 158 |
}
|
183 |
}
|
| 159 |
|
- |
|
| 160 |
|
- |
|
| 161 |
LOGGER.info("weekLast" + weekLast);
|
184 |
LOGGER.info("weekLast" + weekLast);
|
| 162 |
LOGGER.info("weekThird" + weekThird);
|
185 |
LOGGER.info("weekThird" + weekThird);
|
| 163 |
LOGGER.info("weekSecond" + weekSecond);
|
186 |
LOGGER.info("weekSecond" + weekSecond);
|
| 164 |
Map<String, Long> leadLasts = weekLast.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
|
187 |
Map<String, Long> leadLasts = weekLast.stream().collect(Collectors.groupingBy(x -> x.getCreatedBy(),
|
| 165 |
Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
|
188 |
Collectors.mapping(Lead::getCreatedBy, Collectors.counting())));
|